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/market_symbols/market_symbolsSlice'
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";


const Market_symbolsView = () => {
    const router = useRouter()
    const dispatch = useAppDispatch()
    const { market_symbols } = useAppSelector((state) => state.market_symbols)
    

    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 market_symbols')}</title>
          </Head>
          <SectionMain>
            <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title={removeLastCharacter('View market_symbols')} main>
                <BaseButton
                  color='info'
                  label='Edit'
                  href={`/market_symbols/market_symbols-edit/?id=${id}`}
                />
            </SectionTitleLineWithButton>
            <CardBox>
            

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Symbol</p>
                    <p>{market_symbols?.symbol}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Name</p>
                    <p>{market_symbols?.name}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>AssetClass</p>
                    <p>{market_symbols?.asset_class ?? 'No data'}</p>
                </div>
              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Exchange</p>
                    <p>{market_symbols?.exchange}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Currency</p>
                    <p>{market_symbols?.currency}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Country</p>
                    <p>{market_symbols?.country}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Sector</p>
                    <p>{market_symbols?.sector}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Industry</p>
                    <p>{market_symbols?.industry}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

              
                <FormField label='Active'>
                    <SwitchField
                      field={{name: 'active', value: market_symbols?.active}}
                      form={{setFieldValue: () => null}}
                      disabled
                    />
                </FormField>
              

              

              

              

              
              

              

              

              

              

              

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

              

              

              

              

              

              

              
              

                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Symbol_fundamentals MarketSymbol</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>P/ERatio</th>
                                
                                
                                
                                <th>EPS</th>
                                
                                
                                
                                <th>MarketCap</th>
                                
                                
                                
                                <th>Revenue</th>
                                
                                
                                
                                <th>DividendYield</th>
                                
                                
                                
                                <th>Beta</th>
                                
                                
                                
                                <th>SharesOutstanding</th>
                                
                                
                                
                                <th>AsOfAt</th>
                                
                                
                                
                                <th>Source</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {market_symbols.symbol_fundamentals_market_symbol && Array.isArray(market_symbols.symbol_fundamentals_market_symbol) &&
                              market_symbols.symbol_fundamentals_market_symbol.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/symbol_fundamentals/symbol_fundamentals-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="pe_ratio">
                                        { item.pe_ratio }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="eps">
                                        { item.eps }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="market_cap">
                                        { item.market_cap }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="revenue">
                                        { item.revenue }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="dividend_yield">
                                        { item.dividend_yield }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="beta">
                                        { item.beta }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shares_outstanding">
                                        { item.shares_outstanding }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="as_of_at">
                                        { dataFormatter.dateTimeFormatter(item.as_of_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="source">
                                        { item.source }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!market_symbols?.symbol_fundamentals_market_symbol?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Price_quotes MarketSymbol</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>QuotedAt</th>
                                
                                
                                
                                <th>Price</th>
                                
                                
                                
                                <th>Open</th>
                                
                                
                                
                                <th>High</th>
                                
                                
                                
                                <th>Low</th>
                                
                                
                                
                                <th>PreviousClose</th>
                                
                                
                                
                                <th>ChangeAmount</th>
                                
                                
                                
                                <th>ChangePercent</th>
                                
                                
                                
                                <th>Volume</th>
                                
                                
                                
                                <th>Timeframe</th>
                                
                                
                                
                                <th>Source</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {market_symbols.price_quotes_market_symbol && Array.isArray(market_symbols.price_quotes_market_symbol) &&
                              market_symbols.price_quotes_market_symbol.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/price_quotes/price_quotes-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="quoted_at">
                                        { dataFormatter.dateTimeFormatter(item.quoted_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="price">
                                        { item.price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="open">
                                        { item.open }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="high">
                                        { item.high }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="low">
                                        { item.low }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="previous_close">
                                        { item.previous_close }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="change_amount">
                                        { item.change_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="change_percent">
                                        { item.change_percent }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="volume">
                                        { item.volume }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="timeframe">
                                        { item.timeframe }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="source">
                                        { item.source }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!market_symbols?.price_quotes_market_symbol?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Technical_indicators MarketSymbol</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>CalculatedAt</th>
                                
                                
                                
                                <th>IndicatorType</th>
                                
                                
                                
                                <th>Timeframe</th>
                                
                                
                                
                                <th>Period</th>
                                
                                
                                
                                <th>Value</th>
                                
                                
                                
                                <th>Signal</th>
                                
                                
                                
                                <th>Histogram</th>
                                
                                
                                
                                <th>UpperBand</th>
                                
                                
                                
                                <th>MiddleBand</th>
                                
                                
                                
                                <th>LowerBand</th>
                                
                                
                                
                                <th>Source</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {market_symbols.technical_indicators_market_symbol && Array.isArray(market_symbols.technical_indicators_market_symbol) &&
                              market_symbols.technical_indicators_market_symbol.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/technical_indicators/technical_indicators-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="calculated_at">
                                        { dataFormatter.dateTimeFormatter(item.calculated_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="indicator_type">
                                        { item.indicator_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="timeframe">
                                        { item.timeframe }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="period">
                                        { item.period }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="value">
                                        { item.value }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="signal">
                                        { item.signal }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="histogram">
                                        { item.histogram }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="upper_band">
                                        { item.upper_band }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="middle_band">
                                        { item.middle_band }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="lower_band">
                                        { item.lower_band }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="source">
                                        { item.source }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!market_symbols?.technical_indicators_market_symbol?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Analyst_ratings MarketSymbol</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>FirmName</th>
                                
                                
                                
                                <th>Rating</th>
                                
                                
                                
                                <th>PriceTarget</th>
                                
                                
                                
                                <th>RatingAt</th>
                                
                                
                                
                                <th>Summary</th>
                                
                                
                                
                                <th>SourceURL</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {market_symbols.analyst_ratings_market_symbol && Array.isArray(market_symbols.analyst_ratings_market_symbol) &&
                              market_symbols.analyst_ratings_market_symbol.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/analyst_ratings/analyst_ratings-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="firm_name">
                                        { item.firm_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rating">
                                        { item.rating }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="price_target">
                                        { item.price_target }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rating_at">
                                        { dataFormatter.dateTimeFormatter(item.rating_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="summary">
                                        { item.summary }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="source_url">
                                        { item.source_url }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!market_symbols?.analyst_ratings_market_symbol?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Earnings_reports MarketSymbol</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>PeriodEndAt</th>
                                
                                
                                
                                <th>ReportedAt</th>
                                
                                
                                
                                <th>ReportedEPS</th>
                                
                                
                                
                                <th>EstimatedEPS</th>
                                
                                
                                
                                <th>Surprise</th>
                                
                                
                                
                                <th>SurprisePercent</th>
                                
                                
                                
                                <th>ReportedRevenue</th>
                                
                                
                                
                                <th>EstimatedRevenue</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {market_symbols.earnings_reports_market_symbol && Array.isArray(market_symbols.earnings_reports_market_symbol) &&
                              market_symbols.earnings_reports_market_symbol.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/earnings_reports/earnings_reports-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="period_end_at">
                                        { dataFormatter.dateTimeFormatter(item.period_end_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reported_at">
                                        { dataFormatter.dateTimeFormatter(item.reported_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reported_eps">
                                        { item.reported_eps }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="estimated_eps">
                                        { item.estimated_eps }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="surprise">
                                        { item.surprise }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="surprise_percent">
                                        { item.surprise_percent }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reported_revenue">
                                        { item.reported_revenue }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="estimated_revenue">
                                        { item.estimated_revenue }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!market_symbols?.earnings_reports_market_symbol?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>News_article_symbols MarketSymbol</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Relevance</th>
                                
                                
                                
                                <th>SentimentScore</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {market_symbols.news_article_symbols_market_symbol && Array.isArray(market_symbols.news_article_symbols_market_symbol) &&
                              market_symbols.news_article_symbols_market_symbol.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/news_article_symbols/news_article_symbols-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="relevance">
                                        { item.relevance }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sentiment_score">
                                        { item.sentiment_score }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!market_symbols?.news_article_symbols_market_symbol?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Watchlist_items MarketSymbol</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>AddedAt</th>
                                
                                
                                
                                <th>AlertAbovePrice</th>
                                
                                
                                
                                <th>AlertBelowPrice</th>
                                
                                
                                
                                <th>AlertsEnabled</th>
                                
                                
                                
                                <th>Note</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {market_symbols.watchlist_items_market_symbol && Array.isArray(market_symbols.watchlist_items_market_symbol) &&
                              market_symbols.watchlist_items_market_symbol.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/watchlist_items/watchlist_items-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="added_at">
                                        { dataFormatter.dateTimeFormatter(item.added_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="alert_above_price">
                                        { item.alert_above_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="alert_below_price">
                                        { item.alert_below_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="alerts_enabled">
                                        { dataFormatter.booleanFormatter(item.alerts_enabled) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="note">
                                        { item.note }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!market_symbols?.watchlist_items_market_symbol?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Paper_orders MarketSymbol</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>PlacedAt</th>
                                
                                
                                
                                <th>FilledAt</th>
                                
                                
                                
                                <th>Side</th>
                                
                                
                                
                                <th>OrderType</th>
                                
                                
                                
                                <th>Quantity</th>
                                
                                
                                
                                <th>LimitPrice</th>
                                
                                
                                
                                <th>StopPrice</th>
                                
                                
                                
                                <th>FilledQuantity</th>
                                
                                
                                
                                <th>AverageFillPrice</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>RejectionReason</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {market_symbols.paper_orders_market_symbol && Array.isArray(market_symbols.paper_orders_market_symbol) &&
                              market_symbols.paper_orders_market_symbol.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/paper_orders/paper_orders-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="placed_at">
                                        { dataFormatter.dateTimeFormatter(item.placed_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="filled_at">
                                        { dataFormatter.dateTimeFormatter(item.filled_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="side">
                                        { item.side }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="order_type">
                                        { item.order_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity">
                                        { item.quantity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="limit_price">
                                        { item.limit_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="stop_price">
                                        { item.stop_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="filled_quantity">
                                        { item.filled_quantity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="average_fill_price">
                                        { item.average_fill_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rejection_reason">
                                        { item.rejection_reason }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!market_symbols?.paper_orders_market_symbol?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Paper_positions MarketSymbol</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Quantity</th>
                                
                                
                                
                                <th>AverageCost</th>
                                
                                
                                
                                <th>MarketValue</th>
                                
                                
                                
                                <th>UnrealizedP&L</th>
                                
                                
                                
                                <th>RealizedP&L</th>
                                
                                
                                
                                <th>DayP&L</th>
                                
                                
                                
                                <th>LastPricedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {market_symbols.paper_positions_market_symbol && Array.isArray(market_symbols.paper_positions_market_symbol) &&
                              market_symbols.paper_positions_market_symbol.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/paper_positions/paper_positions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="quantity">
                                        { item.quantity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="average_cost">
                                        { item.average_cost }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="market_value">
                                        { item.market_value }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="unrealized_pl">
                                        { item.unrealized_pl }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="realized_pl">
                                        { item.realized_pl }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="day_pl">
                                        { item.day_pl }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_priced_at">
                                        { dataFormatter.dateTimeFormatter(item.last_priced_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!market_symbols?.paper_positions_market_symbol?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Screener_results MarketSymbol</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>LastPrice</th>
                                
                                
                                
                                <th>MarketCap</th>
                                
                                
                                
                                <th>P/ERatio</th>
                                
                                
                                
                                <th>Volume</th>
                                
                                
                                
                                <th>52-WeekPerformance</th>
                                
                                
                                
                                <th>Sector</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {market_symbols.screener_results_market_symbol && Array.isArray(market_symbols.screener_results_market_symbol) &&
                              market_symbols.screener_results_market_symbol.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/screener_results/screener_results-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="last_price">
                                        { item.last_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="market_cap">
                                        { item.market_cap }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="pe_ratio">
                                        { item.pe_ratio }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="volume">
                                        { item.volume }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="performance_52w">
                                        { item.performance_52w }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sector">
                                        { item.sector }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!market_symbols?.screener_results_market_symbol?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Ir_companies MarketSymbol</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>Name</th>
                                
                                
                                
                                
                                
                                <th>Website</th>
                                
                                
                                
                                
                                
                                <th>HQLocation</th>
                                
                                
                                
                                <th>LastUpdatedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {market_symbols.ir_companies_market_symbol && Array.isArray(market_symbols.ir_companies_market_symbol) &&
                              market_symbols.ir_companies_market_symbol.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/ir_companies/ir_companies-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="website">
                                        { item.website }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="hq_location">
                                        { item.hq_location }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_updated_at">
                                        { dataFormatter.dateTimeFormatter(item.last_updated_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!market_symbols?.ir_companies_market_symbol?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                
                
                

                <BaseDivider />

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

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

export default Market_symbolsView;