import React, { ReactElement, useEffect } from 'react';
import Head from 'next/head'
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
import dayjs from "dayjs";
import {useAppDispatch, useAppSelector} from "../../stores/hooks";
import {useRouter} from "next/router";
import { fetch } from '../../stores/songs/songsSlice'
import {saveFile} from "../../helpers/fileSaver";
import dataFormatter from '../../helpers/dataFormatter';
import ImageField from "../../components/ImageField";
import LayoutAuthenticated from "../../layouts/Authenticated";
import {getPageTitle} from "../../config";
import SectionTitleLineWithButton from "../../components/SectionTitleLineWithButton";
import SectionMain from "../../components/SectionMain";
import CardBox from "../../components/CardBox";
import BaseButton from "../../components/BaseButton";
import BaseDivider from "../../components/BaseDivider";
import {mdiChartTimelineVariant} from "@mdi/js";
import {SwitchField} from "../../components/SwitchField";
import FormField from "../../components/FormField";

import {hasPermission} from "../../helpers/userPermissions";


const SongsView = () => {
    const router = useRouter()
    const dispatch = useAppDispatch()
    const { songs } = useAppSelector((state) => state.songs)
    
    const { currentUser } = useAppSelector((state) => state.auth);
    

    const { id } = router.query;
    
    function removeLastCharacter(str) {
      console.log(str,`str`)
      return str.slice(0, -1);
    }

    useEffect(() => {
        dispatch(fetch({ id }));
    }, [dispatch, id]);


    return (
      <>
          <Head>
              <title>{getPageTitle('View songs')}</title>
          </Head>
          <SectionMain>
            <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title={removeLastCharacter('View songs')} main>
                <BaseButton
                  color='info'
                  label='Edit'
                  href={`/songs/songs-edit/?id=${id}`}
                />
            </SectionTitleLineWithButton>
            <CardBox>
            

              

              

              

              

              

              

              

              

              

              
              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Project</p>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                        <p>{songs?.project?.name ?? 'No data'}</p>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                </div>
                 
              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>SongTitle</p>
                    <p>{songs?.title}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>ArtistDisplay</p>
                    <p>{songs?.artist_display}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

              

              
              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Genre</p>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                        <p>{songs?.genre?.name ?? 'No data'}</p>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                </div>
                 
              

              

              

              
              

              

              

              

              
                <div className={'mb-4'}>
                  <p className={'block font-bold mb-2'}>BPM</p>
                  <p>{songs?.bpm || 'No data'}</p>
                </div>
              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>KeySignature</p>
                    <p>{songs?.key_signature}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Mood</p>
                    <p>{songs?.mood ?? 'No data'}</p>
                </div>
              

              

              

              

              

              
              

              

              

              

              
                <div className={'mb-4'}>
                  <p className={'block font-bold mb-2'}>DurationSeconds</p>
                  <p>{songs?.duration_seconds || 'No data'}</p>
                </div>
              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

              

              
              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>VocalLanguage</p>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                        <p>{songs?.vocal_language?.name ?? 'No data'}</p>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                </div>
                 
              

              

              

              
              

              

              

              

              

              

              

              

              

              
                <FormField label='ExplicitContent'>
                    <SwitchField
                      field={{name: 'explicit_content', value: songs?.explicit_content}}
                      form={{setFieldValue: () => null}}
                      disabled
                    />
                </FormField>
              

              

              

              

              
              

              

              

              
                <div className={'mb-4'}>
                  <p className={'block font-bold mb-2'}>Lyrics</p>
                  {songs.lyrics
                    ? <p dangerouslySetInnerHTML={{__html: songs.lyrics}}/>
                    : <p>No data</p>
                  }
                </div>
              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

              

              
              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>organizations</p>
                    
                    
                    
                    
                    
                    
                    
                    
                        <p>{songs?.organizations?.name ?? 'No data'}</p>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                </div>
                 
              

              

              

              
              

                
                
                
                
                
                
                
                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Song_metadata Song</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>ISRC</th>
                                
                                
                                
                                <th>UPC</th>
                                
                                
                                
                                <th>ReleaseTitle</th>
                                
                                
                                
                                <th>ReleaseDate</th>
                                
                                
                                
                                <th>LabelName</th>
                                
                                
                                
                                <th>Publisher</th>
                                
                                
                                
                                <th>CopyrightNotice</th>
                                
                                
                                
                                <th>DistributionStatus</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {songs.song_metadata_song && Array.isArray(songs.song_metadata_song) &&
                              songs.song_metadata_song.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/song_metadata/song_metadata-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="isrc">
                                        { item.isrc }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="upc">
                                        { item.upc }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="release_title">
                                        { item.release_title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="release_date">
                                        { dataFormatter.dateTimeFormatter(item.release_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="label_name">
                                        { item.label_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="publisher">
                                        { item.publisher }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="copyright_notice">
                                        { item.copyright_notice }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="distribution_status">
                                        { item.distribution_status }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!songs?.song_metadata_song?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Assets Song</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>AssetType</th>
                                
                                
                                
                                <th>AudioRole</th>
                                
                                
                                
                                <th>AssetName</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>DurationSeconds</th>
                                
                                
                                
                                <th>SampleRateHz</th>
                                
                                
                                
                                <th>BitDepth</th>
                                
                                
                                
                                <th>IsStereo</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {songs.assets_song && Array.isArray(songs.assets_song) &&
                              songs.assets_song.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/assets/assets-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="asset_type">
                                        { item.asset_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="audio_role">
                                        { item.audio_role }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="duration_seconds">
                                        { item.duration_seconds }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sample_rate_hz">
                                        { item.sample_rate_hz }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="bit_depth">
                                        { item.bit_depth }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_stereo">
                                        { dataFormatter.booleanFormatter(item.is_stereo) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!songs?.assets_song?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Recording_sessions Song</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>StartedAt</th>
                                
                                
                                
                                <th>EndedAt</th>
                                
                                
                                
                                <th>InputChannels</th>
                                
                                
                                
                                <th>SampleRateHz</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {songs.recording_sessions_song && Array.isArray(songs.recording_sessions_song) &&
                              songs.recording_sessions_song.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/recording_sessions/recording_sessions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="started_at">
                                        { dataFormatter.dateTimeFormatter(item.started_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ended_at">
                                        { dataFormatter.dateTimeFormatter(item.ended_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="input_channels">
                                        { item.input_channels }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sample_rate_hz">
                                        { item.sample_rate_hz }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!songs?.recording_sessions_song?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Tracks Song</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>TrackName</th>
                                
                                
                                
                                <th>TrackType</th>
                                
                                
                                
                                <th>Instrument</th>
                                
                                
                                
                                <th>Volume(dB)</th>
                                
                                
                                
                                <th>Pan</th>
                                
                                
                                
                                <th>Mute</th>
                                
                                
                                
                                <th>Solo</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {songs.tracks_song && Array.isArray(songs.tracks_song) &&
                              songs.tracks_song.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/tracks/tracks-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="track_type">
                                        { item.track_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="instrument">
                                        { item.instrument }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="volume_db">
                                        { item.volume_db }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="pan">
                                        { item.pan }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="mute">
                                        { dataFormatter.booleanFormatter(item.mute) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="solo">
                                        { dataFormatter.booleanFormatter(item.solo) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!songs?.tracks_song?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Arrangement_sections Song</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>SectionType</th>
                                
                                
                                
                                <th>Label</th>
                                
                                
                                
                                <th>StartBar</th>
                                
                                
                                
                                <th>BarLength</th>
                                
                                
                                
                                <th>OrderIndex</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {songs.arrangement_sections_song && Array.isArray(songs.arrangement_sections_song) &&
                              songs.arrangement_sections_song.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/arrangement_sections/arrangement_sections-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="section_type">
                                        { item.section_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="label">
                                        { item.label }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="start_bar">
                                        { item.start_bar }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="bar_length">
                                        { item.bar_length }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="order_index">
                                        { item.order_index }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!songs?.arrangement_sections_song?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Generation_requests Song</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>RequestType</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>TargetBPM</th>
                                
                                
                                
                                <th>TargetKey</th>
                                
                                
                                
                                <th>Mood</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>QueuedAt</th>
                                
                                
                                
                                <th>StartedAt</th>
                                
                                
                                
                                <th>FinishedAt</th>
                                
                                
                                
                                <th>ErrorMessage</th>
                                
                                
                                
                                <th>ComputeSeconds</th>
                                
                                
                                
                                <th>EstimatedCost</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {songs.generation_requests_song && Array.isArray(songs.generation_requests_song) &&
                              songs.generation_requests_song.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/generation_requests/generation_requests-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="request_type">
                                        { item.request_type }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="target_bpm">
                                        { item.target_bpm }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="target_key">
                                        { item.target_key }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="mood">
                                        { item.mood }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="queued_at">
                                        { dataFormatter.dateTimeFormatter(item.queued_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="started_at">
                                        { dataFormatter.dateTimeFormatter(item.started_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="finished_at">
                                        { dataFormatter.dateTimeFormatter(item.finished_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="error_message">
                                        { item.error_message }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="compute_seconds">
                                        { item.compute_seconds }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="estimated_cost">
                                        { item.estimated_cost }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!songs?.generation_requests_song?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Mix_sessions Song</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>MixType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>StereoWideningAmount</th>
                                
                                
                                
                                <th>CompressionAmount</th>
                                
                                
                                
                                <th>EQAmount</th>
                                
                                
                                
                                
                                
                                <th>StartedAt</th>
                                
                                
                                
                                <th>FinishedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {songs.mix_sessions_song && Array.isArray(songs.mix_sessions_song) &&
                              songs.mix_sessions_song.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/mix_sessions/mix_sessions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="mix_type">
                                        { item.mix_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="stereo_widening_amount">
                                        { item.stereo_widening_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="compression_amount">
                                        { item.compression_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="eq_amount">
                                        { item.eq_amount }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="started_at">
                                        { dataFormatter.dateTimeFormatter(item.started_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="finished_at">
                                        { dataFormatter.dateTimeFormatter(item.finished_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!songs?.mix_sessions_song?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Mastering_sessions Song</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>LUFSMeasured</th>
                                
                                
                                
                                <th>TruePeakMeasured(dB)</th>
                                
                                
                                
                                <th>StartedAt</th>
                                
                                
                                
                                <th>FinishedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {songs.mastering_sessions_song && Array.isArray(songs.mastering_sessions_song) &&
                              songs.mastering_sessions_song.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/mastering_sessions/mastering_sessions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="lufs_measured">
                                        { item.lufs_measured }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="true_peak_measured_db">
                                        { item.true_peak_measured_db }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="started_at">
                                        { dataFormatter.dateTimeFormatter(item.started_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="finished_at">
                                        { dataFormatter.dateTimeFormatter(item.finished_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!songs?.mastering_sessions_song?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Exports Song</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Format</th>
                                
                                
                                
                                <th>Quality</th>
                                
                                
                                
                                <th>IncludeStems</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                <th>RequestedAt</th>
                                
                                
                                
                                <th>CompletedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {songs.exports_song && Array.isArray(songs.exports_song) &&
                              songs.exports_song.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/exports/exports-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="format">
                                        { item.format }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quality">
                                        { item.quality }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="include_stems">
                                        { dataFormatter.booleanFormatter(item.include_stems) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="requested_at">
                                        { dataFormatter.dateTimeFormatter(item.requested_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="completed_at">
                                        { dataFormatter.dateTimeFormatter(item.completed_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!songs?.exports_song?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Cover_artworks Song</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Status</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {songs.cover_artworks_song && Array.isArray(songs.cover_artworks_song) &&
                              songs.cover_artworks_song.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/cover_artworks/cover_artworks-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!songs?.cover_artworks_song?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                

                <BaseDivider />

                <BaseButton
                    color='info'
                    label='Back'
                    onClick={() => router.push('/songs/songs-list')}
                />
              </CardBox>
          </SectionMain>
      </>
    );
};

SongsView.getLayout = function getLayout(page: ReactElement) {
    return (
      <LayoutAuthenticated
        
        permission={'READ_SONGS'}
        
      >
          {page}
      </LayoutAuthenticated>
    )
}

export default SongsView;