NTG TNA Dashboard

@php $buyerList = DB::table('t_n_a_s')->where('order_close', 1)->select('buyer')->distinct()->get(); @endphp
@foreach ($buyerList as $buyer) @endforeach
@php $sl = 1; @endphp @forelse ($tnas as $tna) @foreach (['lab_dip_submission', 'fabric_booking', 'fit_sample_submission', 'print_strike_off_submission', 'bulk_accessories_booking', 'fit_comments', 'bulk_yarn_inhouse', 'bulk_accessories_inhouse', 'pp_sample_submission', 'bulk_fabric_knitting', 'pp_comments_receive', 'bulk_fabric_dyeing', 'bulk_fabric_delivery', 'pp_meeting','cutting', 'etd'] as $task) @foreach (['plan', 'actual'] as $type) @php $date = $tna->{$task . '_' . $type}; $cellClass = ''; $explanation = ''; // Default explanation to empty if ($date && $date != 'N/A') { $today = \Carbon\Carbon::now(); $cellDate = \Carbon\Carbon::parse($date); $diffDays = $today->diffInDays($cellDate, false); // if actual date is empty and plane date have value then if plan date is today or past then bg color red else plan date before 2 days then bg color yellow else bg color light example: if plan date is 10-10-2021 and actual date is empty and today date is 10-10-2021 then bg color red if plan date is 8-10-2021 and actual date is empty then bg color yellow if plan date is 9-10-2021 and actual date is empty then bg color light if ($type === 'plan' && empty($tna->{$task . '_actual'})) { if ($cellDate->isToday() || $cellDate->lt($today)) { $cellClass = 'bg-red'; } elseif ($diffDays <= 2) { $cellClass = 'bg-yellow'; } else { $cellClass = 'bg-light'; } } //if actual date and plan date both have value then check if actual date is same or date over then plan date then bg color red expample: if plan date is 10-10-2021 and actual date is 10-10-2021 or 12-10-2021 then bg color red // if ($type === 'actual' && $tna->{$task . '_plan'}) { // $planDate = \Carbon\Carbon::parse($tna->{$task . '_plan'}); // if ($cellDate->isToday() || $cellDate->gt($planDate)) { // $cellClass = 'bg-red'; // } // } //if actual date and plan date both have value then check if actual date is date over then plan date then text front red and blod expample: if plan date is 10-10-2021 and actual date is 12-10-2021 then text front red and blod if ($type === 'actual' && $tna->{$task . '_plan'}) { $planDate = \Carbon\Carbon::parse($tna->{$task . '_plan'}); $actualDate = \Carbon\Carbon::parse($date); if ($cellDate->gt($planDate)) { $cellClass = 'text-danger font-weight-bold'; } if ($cellDate->gt($actualDate)) { $cellClass = 'bg-light'; } } //explanation show from tna_explanations table if plan date is over from the actual date then show explanation in bootstrap tooltip // Retrieve explanation for the actual date } elseif ($date == 'N/A') { $date = 'N/A'; } @endphp @if ($type === 'actual' && empty($date)) @else @php $explanation = DB::table('tna_explanations') ->where('perticulars', $task . '_' . $type) ->where('tna_id', $tna->id) ->first()->explanation ?? ''; // dd($tna->id); @endphp @endif @endforeach @endforeach {{-- @dd($explanation); --}} @empty @endforelse
SL Buyer Style PO Item Qty (pcs) PO Receive Date Shipment/ETD Total Lead Time Order Free Time Lab Dip Submission Fabric Booking Fit Sample Submission Print Strike Off Submission Bulk Accessories Booking Fit Comments Bulk Yarn Inhouse Bulk Accessories Inhouse PP Sample Submission Bulk Fabric Knitting PP Comments Receive Bulk Fabric Dyeing Bulk Fabric Delivery PP Meeting Cutting ETD
Plan Actual Plan Actual Plan Actual Plan Actual Plan Actual Plan Actual Plan Actual Plan Actual Plan Actual Plan Actual Plan Actual Plan Actual Plan Actual Plan Actual Plan Actual Plan Actual
@if (auth()->user()->role_id == 1)
@csrf @method('DELETE')
@else {{ $sl++ }} @endif
{{ $tna->buyer }} {{ $tna->style }} {{ $tna->po }} {{ $tna->item }} {{ $tna->qty_pcs }} {{ \Carbon\Carbon::parse($tna->po_receive_date)->format('d-M-y') ?? '' }} {{ \Carbon\Carbon::parse($tna->shipment_etd)->format('d-M-y') ?? '' }} {{ $tna->total_lead_time }} @if ($tna->pp_meeting_actual == null) @php $today = \Carbon\Carbon::parse($tna->pp_meeting_plan); $shipment_etd = \Carbon\Carbon::parse($tna->shipment_etd); $diffDays = $today->diffInDays($shipment_etd, false); if ($diffDays > 0) { echo $diffDays; } else { echo '0'; } @endphp @else @php $today = \Carbon\Carbon::parse($tna->pp_meeting_plan); $shipment_etd = \Carbon\Carbon::parse($tna->pp_meeting_actual); $diffDays = $today->diffInDays($shipment_etd, false); if ($diffDays > 0) { echo $diffDays; } else { echo '0'; } @endphp @endif {{ $date == 'N/A' ? 'N/A' : ($date ? \Carbon\Carbon::parse($date)->format('d-M-y') : '') }}
No TNA Found
Cancel