@extends('layouts.page') @section('title') Log Delivery Challans New Delivery Challan @endsection @section('navs') @endsection @section('content')
{!! Form::open(['url' => route('log_dc.mof_dc_save', [$mof->id, $mof_record->id,$log_dc->id]), 'files' => true]) !!} {!! EasyForm::setErrors($errors) !!} {!! EasyForm::setNoRows() !!} {!! EasyForm::setColSizes(2, 4) !!}
{!! EasyForm::select('consignor', $log_dc->label('consignor'). ' *', old('consignor', $log_dc->consignor), AppHelper::options('consignor')) !!} {!! EasyForm::input('receipt_id', $log_dc->label('receipt_id'), old('receipt_id', $log_dc->receipt_id)) !!} {!! EasyForm::date('receipt_date', $log_dc->label('receipt_date'), old('receipt_date', date('Y-m-d')?? $log_dc->receipt_date)) !!} {!! EasyForm::select('dispatch_to', $log_dc->label('dispatch_to'), old('dispatch_to', 'MOF'), AppHelper::options('log_dispatch_to')) !!} {!! EasyForm::select('department', $log_dc->label('department'), old('department', $mof->department), AppHelper::options('departments')) !!} {!! EasyForm::input('name', $log_dc->label('name'), old('name', $mof_record->name), ['id' => 'name']) !!} {!! EasyForm::input('address', $log_dc->label('address'), old('address', $mof_record->address), ['id' => 'address']) !!} {!! EasyForm::select('state', $log_dc->label('state'), old('state', $mof_record->state), AppHelper::options('states')) !!} {!! EasyForm::dependent('district', $log_dc->label('district'), old('district', $mof_record->district), AppHelper::options('districts'), 'state')!!} {!! EasyForm::input('destination', $log_dc->label('destination'). ' *', old('destination', $log_dc->destination)) !!} {!! EasyForm::input('mobile', $log_dc->label('mobile'), old('mobile', $mof_record->mobile), ['id' => 'mobile']) !!} {!! EasyForm::select('dispatch_through', $log_dc->label('dispatch_through'). ' *', old('dispatch_through', $log_dc->dispatch_through), AppHelper::options('dispatch_through')) !!} {!! EasyForm::input('delivery_note', $log_dc->label('delivery_note'). ' *', old('delivery_note', $log_dc->delivery_note)) !!} {!! EasyForm::select('terms', $log_dc->label('terms'), old('terms', ''),AppHelper::options('terms_of_delivery')) !!} {!! EasyForm::select('terms_of_payment', $log_dc->label('terms_of_payment'), old('terms_of_payment', ''),AppHelper::options('terms_of_payment')) !!}
@php $i = 1; @endphp @if($log_dc->records && $log_dc->records->count()) {{-- Edit mode: load existing LogDcRecord items --}} @foreach($log_dc->records as $record) @endforeach @else {{-- Create mode: load from mof_breakups --}} @php $bookLangTotals = []; foreach ($mof->mof_breakups as $breakup) { $bookNames = explode(',', $breakup->name); $languages = explode(',', $breakup->language); foreach ($bookNames as $index => $bookName) { $lang = $languages[$index] ?? 'Unknown'; $key = trim($bookName) . '|' . trim(ucfirst($lang)); if (!isset($bookLangTotals[$key])) { $bookLangTotals[$key] = 0; } $bookLangTotals[$key] += $breakup->quantity; } } @endphp @foreach ($bookLangTotals as $key => $quantity) @php [$bookName, $lang] = explode('|', $key); @endphp @endforeach @endif
S.No Item Quantity
{{ $i++ }}
{{ $i++ }}
{!! Form::close() !!}
@endsection