-
-
![]()
-
-
-
+
+
+
+
+
Original Photo
+
![]()
+
+
Generated Media
+
+
+
+
+
+
+
Full Entry Metadata
+
+
+
+
+ | Field |
+ Value |
+
+
+
+
+
+
+
+
+
Lyrics
+
+
+
-
-
-
@@ -146,11 +158,14 @@
$(document).ready(function() {
const API_BASE_URL = '';
const API_ENDPOINT = `/back/api/admin/data`;
+ const MEDIA_BASE_URL = 'https://storage.googleapis.com/vday2026/';
// Helper to convert container paths to web URLs
function fixStoragePath(path) {
if (!path) return '';
- return path.replace(/^\/app\/storage\//, '/storage/');
+ // let relative_path = path.replace(/^\/app\/storage\//, '/storage/');
+ const isRelative = path.startsWith('uploads/') || path.startsWith('audio/') || path.startsWith('video/');
+ return isRelative ? MEDIA_BASE_URL + path : path;
}
// Fetch and display Sonauto credits
@@ -274,39 +289,67 @@
const rowData = table.row($(this).closest('tr')).data();
// 2. Populate the Modal fields
- $('#modalUserName').text(rowData.owner_name + ' - Profile');
+ $('.modal-title').text(`Session: ${rowData.session_id}`);
$('#modalImage').attr('src', fixStoragePath(rowData.photo_path) || "https://placehold.co/500x500/fbba0e/e11d48/jpg?text=No\nImage");
- $('#modalPetName').text(rowData.pet_name || 'N/A');
- $('#modalPetType').text(rowData.pet_type || 'N/A');
- $('#modalVibe').text(rowData.music_vibe || 'N/A');
- $('#modalSession').text(rowData.session_id);
- // 3. Handle Lyrics
- if (rowData.lyrics) {
- $('#modalLyrics').text(rowData.lyrics);
- } else {
- $('#modalLyrics').text('No lyrics available yet...');
- }
+
+ // 3. Dynamic Table Generation for all 20+ columns
+ const tableBody = $('#modalDetailsTableBody');
+ tableBody.empty();
+ // List of keys we want to display or skip
+ Object.entries(rowData).forEach(([key, value]) => {
+ // Skip keys that are handled visually (media/lyrics)
+ if (['photo_path', 'generated_video_path', 'generated_song_path', 'lyrics'].includes(key))
+ return;
+
+ let displayValue = value ?? '
null';
+ // Surgical Link Detection: Only link if it has a known file extension
+ const isFile = typeof value === 'string' && /\.(jpg|jpeg|png|mp3|mp4|wav)$/i.test(value);
+ if (isFile) {
+ const fullUrl = fixStoragePath(value);
+ displayValue = `
${value} 🔗`;
+ }
+ tableBody.append(`
+
+ | ${key.replace(/_/g, ' ')} |
+ ${displayValue} |
+
+ `);
+ });
+
+ $('#modalLyrics').text(rowData.lyrics || 'No lyrics generated.');
+
// 4. Handle Media (Song or Video)
const mediaContainer = $('#modalMediaContainer');
- mediaContainer.empty(); // Clear previous content
+
+ console.group(`--- Media Debug: Session ${rowData.session_id} ---`);
+ const videoUrl = fixStoragePath(rowData.generated_video_path);
+ const audioUrl = fixStoragePath(rowData.generated_song_path);
+ console.log('Video URL:', videoUrl);
+ console.log('Audio URL:', audioUrl);
+ console.groupEnd();
+
+ // Reset container state
+ mediaContainer.empty().removeClass('ratio ratio-9x16 d-flex align-items-center p-3');
- if (rowData.generated_video_path) {
+ if (videoUrl && rowData.generated_video_path) {
+ console.log('Injecting Video...');
+ mediaContainer.addClass('ratio ratio-9x16');
mediaContainer.html(`
-