@extends('layouts.app')

@section('content')
    <section class="page-header row">
        <h2> {{ $pageTitle }} <small> {{ $pageNote }} </small></h2>
        <ol class="breadcrumb">
            <li><a href="{{ url('') }}"> Dashboard </a></li>
            <li><a href="{{ url($pageModule) }}"> {{ $pageTitle }} </a></li>
            <li class="active"> View </li>
        </ol>
    </section>

    <div class="page-content row">
        <div class="page-content-wrapper no-margin">
            <div class="sbox">
                <div class="sbox-title clearfix">
                    <div class="sbox-tools pull-left">
                        <a href="{{ ($prevnext['prev'] != '' ? url('manage/missingcashbackclaims/'.$prevnext['prev'].'?return='.$return ) : '#') }}"
                           class="tips btn btn-sm"><i class="fa fa-arrow-left"></i> </a>
                        <a href="{{ ($prevnext['next'] != '' ? url('manage/missingcashbackclaims/'.$prevnext['next'].'?return='.$return ) : '#') }}"
                           class="tips btn btn-sm "> <i class="fa fa-arrow-right"></i> </a>
                    </div>

                    <div class="sbox-tools">
                        @if($access['is_add'] ==1)
                            <a href="{{ url('manage/missingcashbackclaims/'.$id.'/edit?return='.$return) }}"
                               class="tips btn btn-sm  " title="{{ __('core.btn_edit') }}"><i class="fa  fa-pencil"></i></a>
                        @endif
                        <a href="{{ url('manage/missingcashbackclaims?return='.$return) }}" class="tips btn btn-sm  "
                           title="{{ __('core.btn_back') }}"><i class="fa  fa-times"></i></a>
                    </div>
                </div>
                <div class="sbox-content">
                    <!-- Nav tabs -->
                    <ul class="nav nav-tabs" role="tablist">
                        <li role="presentation" class="active">
							<a href="#home" aria-controls="home" role="tab" data-toggle="tab"><b>{{ $pageTitle }} : </b> View Detail </a>
						</li>
                        @foreach($subgrid as $sub)
                            <li role="presentation">
								<a href="#{{ str_replace(" ","_",$sub['title']) }}" aria-controls="profile" role="tab" data-toggle="tab"><b>{{ $pageTitle }}</b> : {{ $sub['title'] }}</a>
							</li>
                        @endforeach
                    </ul>

                    <!-- Tab panes -->
                    <div class="tab-content m-t">
                        <div role="tabpanel" class="tab-pane active" id="home">
                            <table class="table table-striped table-bordered">
                                <tbody>
                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('ID', (isset($fields['id']['language'])? $fields['id']['language'] : array())) }}</td>
                                    <td>{{ $row['id']}} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
										class='label-view text-right'>{{ SiteHelpers::activeLang('User', (isset($fields['user_id']['language'])? $fields['user_id']['language'] : array())) }}</td>
                                    <td>{{ SiteHelpers::formatLookUp($row['user_id'],'user_id','1:users:user_id:first_name|last_name|email') }} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Click Id', (isset($fields['click_id']['language'])? $fields['click_id']['language'] : array())) }}</td>
                                    <td>{{ SiteHelpers::formatLookUp($row['click_id'],'click_id','1:clicks:id:id') }} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Store', (isset($fields['store_id']['language'])? $fields['store_id']['language'] : array())) }}</td>
                                    <td>{{ SiteHelpers::formatLookUp($row['store_id'],'store_id','1:stores:id:slug') }} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Network', (isset($fields['network_id']['language'])? $fields['network_id']['language'] : array())) }}</td>
                                    <td>{{ SiteHelpers::formatLookUp($row['network_id'],'network_id','1:networks:id:name') }} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Click Time', (isset($fields['click_time']['language'])? $fields['click_time']['language'] : array())) }}</td>
                                    <td>{{ $row['click_time']}} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Order Id', (isset($fields['order_id']['language'])? $fields['order_id']['language'] : array())) }}</td>
                                    <td>{{ $row['order_id']}} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Currency Iso', (isset($fields['currency_iso']['language'])? $fields['currency_iso']['language'] : array())) }}</td>
                                    <td>{{ SiteHelpers::formatLookUp($row['currency_iso'],'currency_iso','1:currencies:iso_code:symbol') }} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Order Amount', (isset($fields['order_amount']['language'])? $fields['order_amount']['language'] : array())) }}</td>
                                    <td>{{ $row['order_amount']}} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Transaction Date', (isset($fields['transaction_date']['language'])? $fields['transaction_date']['language'] : array())) }}</td>
                                    <td>{{ $row['transaction_date']}} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Platform', (isset($fields['platform']['language'])? $fields['platform']['language'] : array())) }}</td>
                                    <td>{{ $row['platform']}} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Message', (isset($fields['message']['language'])? $fields['message']['language'] : array())) }}</td>
                                    <td>{{ $row['message']}} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Note', (isset($fields['note']['language'])? $fields['note']['language'] : array())) }}</td>
                                    <td>{{ $row['note']}} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Status', (isset($fields['status']['language'])? $fields['status']['language'] : array())) }}</td>
                                    <td>{{ $row['status']}} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Closed By', (isset($fields['closed_by']['language'])? $fields['closed_by']['language'] : array())) }}</td>
                                    <td>{{ $row['closed_by']}} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Created At', (isset($fields['created_at']['language'])? $fields['created_at']['language'] : array())) }}</td>
                                    <td>{{ $row['created_at']}} </td>
                                </tr>

                                <tr>
                                    <td width='30%'
                                        class='label-view text-right'>{{ SiteHelpers::activeLang('Updated At', (isset($fields['updated_at']['language'])? $fields['updated_at']['language'] : array())) }}</td>
                                    <td>{{ $row['updated_at']}} </td>
                                </tr>

                                <tr>
                                    <td width='30%' class='label-view text-right'>Attachments</td>
                                    <td>
                                        @if ($row['attachments'])
                                            @foreach($row['attachments'] as $attachment)
                                                <a href="{{ $attachment }}" target="_blank" class="d-inline-block mx-2">
                                                    <img src="{{ $attachment }}" alt="" class="img-thumbnail" width="100" height="100">
                                                </a>
                                            @endforeach
                                        @endif
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>

                        @foreach($subgrid as $sub)
                            <div role="tabpanel" class="tab-pane" id="{{ str_replace(" ","_",$sub['title']) }}">
                                <table class="table table-striped " style="width: 100vw;">
                                    <thead>
                                    <tr>
                                        <th>Comment</th>
                                        <th>Commented By</th>
                                        <th>Created At</th>
                                        <th>Attachments</th>
                                    </tr>
                                    </thead>

                                    <tbody>
                                    @foreach ($subform['rowData'] as $row)
                                        <tr>
                                            <td>{{ $row['comment'] }}</td>
                                            <td>{{ $row['commented_by'] }}</td>
                                            <td>{{ $row['created_at'] }}</td>
                                            <td>
                                                @if ($row['attachments'])
                                                    @foreach($row['attachments'] as $attachment)
                                                        <a href="{{ $attachment }}" target="_blank" class="d-inline-block mx-2">
                                                            <img src="{{ $attachment }}" alt="" class="img-thumbnail" width="100" height="100">
                                                        </a>
                                                    @endforeach
                                                @endif
                                            </td>
                                        </tr>
                                    @endforeach
                                    </tbody>
                                </table>
                            </div>
                        @endforeach
                    </div>
                </div>
            </div>
        </div>
        <script type="text/javascript">
            $(function () {
                <?php for($i = 0 ; $i < count($subgrid); $i++)  :?>
                $('#{{ str_replace(" ","_",$subgrid[$i]['title']) }}').load('{{ url("missingcashbackclaims/lookup?param=".implode("-",$subgrid["$i"])."-".$id)}}')
                <?php endfor;?>
            })
        </script>
@stop