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/releases/releasesSlice'
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 ReleasesView = () => {
    const router = useRouter()
    const dispatch = useAppDispatch()
    const { releases } = useAppSelector((state) => state.releases)
    
    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 releases')}</title>
          </Head>
          <SectionMain>
            <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title={removeLastCharacter('View releases')} main>
                <BaseButton
                  color='info'
                  label='Edit'
                  href={`/releases/releases-edit/?id=${id}`}
                />
            </SectionTitleLineWithButton>
            <CardBox>
            

              

              

              

              

              

              

              

              

              

              
              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Artistprofile</p>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                        <p>{releases?.artist_profile?.artist_name ?? 'No data'}</p>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                </div>
                 
              

              

              

              
              

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

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Releasetype</p>
                    <p>{releases?.release_type ?? 'No data'}</p>
                </div>
              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

              

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

              

              

              
              

              

              

              

              

              

              

              

              

              

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

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Language</p>
                    <p>{releases?.language}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

              

              

              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Coverart</p>
                    {releases?.cover_art?.length
                      ? (
                        <ImageField
                          name={'cover_art'}
                          image={releases?.cover_art}
                          className='w-20 h-20'
                        />
                      ) : <p>No Coverart</p>
                    }
                </div>
              

              
              

              

              

              

              

              

              

              

              

              

              

              

              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Bookletfiles</p>
                    {releases?.booklet_files?.length
                      ? dataFormatter.filesFormatter(releases.booklet_files).map(link => (
                        <button
                          key={link.publicUrl}
                          onClick={(e) => saveFile(e, link.publicUrl, link.name)}
                        >
                            {link.name}
                        </button>
                      )) : <p>No Bookletfiles</p>
                    }
                </div>
              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Labelname</p>
                    <p>{releases?.label_name}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Copyrightnotice</p>
                    <p>{releases?.copyright_notice}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Productionnotice</p>
                    <p>{releases?.production_notice}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>UPC/EANcode</p>
                    <p>{releases?.upc_code}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>UPCsource</p>
                    <p>{releases?.upc_source ?? 'No data'}</p>
                </div>
              

              

              

              

              

              
              

              

              

              

              

              

              
                <FormField label='Releasedate'>
                    {releases.release_date ? <DatePicker
                      dateFormat="yyyy-MM-dd hh:mm"
                      showTimeSelect
                      selected={releases.release_date ?
                        new Date(
                          dayjs(releases.release_date).format('YYYY-MM-DD hh:mm'),
                        ) : null
                      }
                      disabled
                    /> : <p>No Releasedate</p>}
                </FormField>
              

              

              

              

              

              

              

              
              

              

              

              

              

              

              
                <FormField label='Originalreleasedate'>
                    {releases.original_release_date ? <DatePicker
                      dateFormat="yyyy-MM-dd hh:mm"
                      showTimeSelect
                      selected={releases.original_release_date ?
                        new Date(
                          dayjs(releases.original_release_date).format('YYYY-MM-DD hh:mm'),
                        ) : null
                      }
                      disabled
                    /> : <p>No Originalreleasedate</p>}
                </FormField>
              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Moderationstatus</p>
                    <p>{releases?.moderation_status ?? 'No data'}</p>
                </div>
              

              

              

              

              

              
              

              

              
                <FormField label='Multi Text' hasTextareaHeight>
                  <textarea className={'w-full'} disabled value={releases?.moderation_notes} />
                </FormField>
              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

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

              

              

              

              
              

              

              

              

              

              

              

              

              

              
                <FormField label='Licenseaccepted'>
                    <SwitchField
                      field={{name: 'license_accepted', value: releases?.license_accepted}}
                      form={{setFieldValue: () => null}}
                      disabled
                    />
                </FormField>
              

              

              

              

              
              

              

              

              

              

              

              

              

              

              
                <FormField label='ContentIDenabled'>
                    <SwitchField
                      field={{name: 'content_id_enabled', value: releases?.content_id_enabled}}
                      form={{setFieldValue: () => null}}
                      disabled
                    />
                </FormField>
              

              

              

              

              
              

              

              

              

              

              

              

              

              

              
                <FormField label='Contentmatchenabled'>
                    <SwitchField
                      field={{name: 'content_match_enabled', value: releases?.content_match_enabled}}
                      form={{setFieldValue: () => null}}
                      disabled
                    />
                </FormField>
              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Internalcatalogcode</p>
                    <p>{releases?.internal_catalog_code}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

              

              

              
                <>
                    <p className={'block font-bold mb-2'}>Selectedplatforms</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                    <th>Platformname</th>
                                
                                
                                
                                    <th>Category</th>
                                
                                
                                
                                    <th>WebsiteURL</th>
                                
                                
                                
                                
                                
                                    <th>Isactive</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {releases.selected_platforms && Array.isArray(releases.selected_platforms) &&
                              releases.selected_platforms.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/distribution_platforms/distribution_platforms-view/?id=${item.id}`)}>
                                  
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                  
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="category">
                                        { item.category }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="website_url">
                                        { item.website_url }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!releases?.selected_platforms?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
              

              

              
              

              

              

              

              

              

              

              

              

              

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

              

              

              
              

                
                
                
                
                
                
                
                
                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Tracks Release</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Tracktitle</th>
                                
                                
                                
                                <th>Tracknumber</th>
                                
                                
                                
                                <th>Version</th>
                                
                                
                                
                                
                                
                                <th>ISRCcode</th>
                                
                                
                                
                                <th>ISRCsource</th>
                                
                                
                                
                                
                                
                                <th>Durationseconds</th>
                                
                                
                                
                                <th>SamplerateHz</th>
                                
                                
                                
                                <th>Bitratekbps</th>
                                
                                
                                
                                <th>Audioformat</th>
                                
                                
                                
                                <th>Explicitcontent</th>
                                
                                
                                
                                <th>Lyrics</th>
                                
                                
                                
                                <th>Audiofingerprint</th>
                                
                                
                                
                                <th>Qualitystatus</th>
                                
                                
                                
                                <th>Qualitynotes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {releases.tracks_release && Array.isArray(releases.tracks_release) &&
                              releases.tracks_release.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/tracks/tracks-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="track_number">
                                        { item.track_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="version">
                                        { item.version }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="isrc_code">
                                        { item.isrc_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="isrc_source">
                                        { item.isrc_source }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="duration_seconds">
                                        { item.duration_seconds }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sample_rate_hz">
                                        { item.sample_rate_hz }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="bitrate_kbps">
                                        { item.bitrate_kbps }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="audio_format">
                                        { item.audio_format }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="explicit_content">
                                        { dataFormatter.booleanFormatter(item.explicit_content) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="lyrics">
                                        { item.lyrics }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="audio_fingerprint">
                                        { item.audio_fingerprint }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quality_status">
                                        { item.quality_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quality_notes">
                                        { item.quality_notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!releases?.tracks_release?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Release_deliveries Release</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Deliverystatus</th>
                                
                                
                                
                                <th>Requestedat</th>
                                
                                
                                
                                <th>Sentat</th>
                                
                                
                                
                                <th>Deliveredat</th>
                                
                                
                                
                                <th>PlatformreleaseURL</th>
                                
                                
                                
                                <th>Externalreference</th>
                                
                                
                                
                                <th>Errormessage</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {releases.release_deliveries_release && Array.isArray(releases.release_deliveries_release) &&
                              releases.release_deliveries_release.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/release_deliveries/release_deliveries-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="delivery_status">
                                        { item.delivery_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="requested_at">
                                        { dataFormatter.dateTimeFormatter(item.requested_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sent_at">
                                        { dataFormatter.dateTimeFormatter(item.sent_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="delivered_at">
                                        { dataFormatter.dateTimeFormatter(item.delivered_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="platform_release_url">
                                        { item.platform_release_url }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="external_reference">
                                        { item.external_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="error_message">
                                        { item.error_message }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!releases?.release_deliveries_release?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Smart_links Release</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Slug</th>
                                
                                
                                
                                <th>Pagetitle</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Themecolor</th>
                                
                                
                                
                                <th>Ispublic</th>
                                
                                
                                
                                <th>Publishedat</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {releases.smart_links_release && Array.isArray(releases.smart_links_release) &&
                              releases.smart_links_release.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/smart_links/smart_links-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="slug">
                                        { item.slug }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="page_title">
                                        { item.page_title }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="theme_color">
                                        { item.theme_color }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_public">
                                        { dataFormatter.booleanFormatter(item.is_public) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="published_at">
                                        { dataFormatter.dateTimeFormatter(item.published_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!releases?.smart_links_release?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Royalty_lines Release</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Territory</th>
                                
                                
                                
                                <th>Storename</th>
                                
                                
                                
                                <th>Quantity</th>
                                
                                
                                
                                <th>Unitrate</th>
                                
                                
                                
                                <th>Grossamount</th>
                                
                                
                                
                                <th>Netamount</th>
                                
                                
                                
                                <th>Currency</th>
                                
                                
                                
                                <th>Eventat</th>
                                
                                
                                
                                <th>Usagetype</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {releases.royalty_lines_release && Array.isArray(releases.royalty_lines_release) &&
                              releases.royalty_lines_release.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/royalty_lines/royalty_lines-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="territory">
                                        { item.territory }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="store_name">
                                        { item.store_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity">
                                        { item.quantity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="unit_rate">
                                        { item.unit_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="gross_amount">
                                        { item.gross_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="net_amount">
                                        { item.net_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="currency">
                                        { item.currency }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="event_at">
                                        { dataFormatter.dateTimeFormatter(item.event_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="usage_type">
                                        { item.usage_type }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!releases?.royalty_lines_release?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Analytics_daily Release</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Metricdate</th>
                                
                                
                                
                                <th>Streams</th>
                                
                                
                                
                                <th>Uniquelisteners</th>
                                
                                
                                
                                <th>Saves</th>
                                
                                
                                
                                <th>Likes</th>
                                
                                
                                
                                <th>Shares</th>
                                
                                
                                
                                <th>Country</th>
                                
                                
                                
                                <th>City</th>
                                
                                
                                
                                <th>Trafficsource</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {releases.analytics_daily_release && Array.isArray(releases.analytics_daily_release) &&
                              releases.analytics_daily_release.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/analytics_daily/analytics_daily-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="metric_date">
                                        { dataFormatter.dateTimeFormatter(item.metric_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="streams">
                                        { item.streams }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="unique_listeners">
                                        { item.unique_listeners }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="saves">
                                        { item.saves }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="likes">
                                        { item.likes }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shares">
                                        { item.shares }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="country">
                                        { item.country }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="city">
                                        { item.city }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="traffic_source">
                                        { item.traffic_source }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!releases?.analytics_daily_release?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                
                
                
                
                
                
                
                

                <BaseDivider />

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

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

export default ReleasesView;