CasperSecurity
<div class="row">
<div class="card z-auto p-[25px]" style="min-height:690px;">
<div class="card-header">
<div class="flex justify-between items-center mb-2">
<h1 class="heading text-[1.8rem] font-medium uppercase">Voucher Management</h1>
</div>
</div>
<div class="card-body">
<div class="p-[1.563rem]">
<div class="p-4 overflow-y-auto overflow-x-hidden dz-scroll">
@if($modelid)
<div class="flex justify-end mt-3 items-center">
<div class="xl:w-1/2 mb-4 flex justify-between">
<label for="exampleFormControlInputfirst"
class="form-label mt-4">Status</label>
<div class="row">
<div class="flex justify-end w-full px-2 py-2">
<select name="orderAsc" wire:model="status"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full">
<option value="1">Active</option>
<option value="0">Inactive</option>
</select>
</div>
</div>
</div>
</div>
@endif
<div class="xl:w-full border mb-2"style="border-color: lightgrey">
<div class="row flex justify-center items-center p-2">
<div class="xl:w-1/2">
<div class="row">
<div class="xl:w-1/2">
<select name="type" wire:model="type" @if(sizeof($this->add_payments_data)>0) disabled @endif
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full mb-2">
<option value=" ">Select Type</option>
<option value="payment">Payment</option>
<option value="receive">Receive</option>
<option value="journal">Journal</option>
</select>
@error('type') <span class="error text-danger">{{ $message }}</span> @enderror
</div>
@if($type == 'payment' || $type == 'receive')
<div class="xl:w-1/2">
<select name="voucher_type" wire:model.defer="voucher_type"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full mb-2">
<option value=" ">Select Mode</option>
<option value="Bank">Bank</option>
<option value="Cash">Cash</option>
</select>
@error('voucher_type') <span class="error text-danger">{{ $message }}</span> @enderror
</div>
@endif
</div>
<input type="date" name="voucher_date" pattern="[A-Za-z\s]+" wire:model.defer="voucher_date" class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full" id="exampleFormControlInputfirst" placeholder="Enter Date" >
@error('voucher_date') <span class="w-full mt-1 text-xs text-danger">{{ $message }}</span> @enderror
</div>
<div class="xl:w-1/2 ">
<textarea
class="relative text-[13px] h-auto min-h-auto border border-b-color block rounded-md p-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full resize-y "
rows="4" id="voucher_particulars" wire:model.defer="voucher_particulars" placeholder="Enter Particular*">
</textarea>
@error('voucher_particulars') <span class="w-full mt-1 text-xs text-danger">{{ $message }}</span> @enderror
</div>
</div>
</div>
@if($type == 'payment' || $type == 'receive')
<div class="xl:w-full border mb-2"style="border-color: lightgrey">
<div class="row p-2">
<div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label"> @if($type == 'payment') Paid To @elseif($type == 'receive') Receive From @endif<span class="text-danger">*</span></label>
<input type="text" name="paid_to_received_from" pattern="[A-Za-z\s]+" wire:model.defer="paid_to_received_from" class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full" placeholder="Enter Paid To">
@error('paid_to_received_from') <span class="w-full mt-1 text-xs text-danger">{{ $message }}</span> @enderror
</div>
<div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Reference No<span class="text-danger">*</span></label>
<input type="text" name="reference_no" pattern="[A-Za-z\s]+" wire:model.defer="reference_no" class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full" placeholder="Enter Reference No">
@error('reference_no') <span class="w-full mt-1 text-xs text-danger">{{ $message }}</span> @enderror
</div>
<!-- <div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Select Ledger Type<span class="text-danger">*</span></label>
<select name="ledger_type" wire:model.debounce.500ms="ledger_type"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full">
<option value="">Select</option>
@if(sizeof($ledger_head_type)>0)
@foreach($ledger_head_type as $head_type)
<option value="{{$head_type['id']}}">{{$head_type['ledger_type']}}</option>
@endforeach
@endif
</select>
@error('ledger_type') <span class="error text-danger">{{ $message }}</span> @enderror
</div> -->
<!-- @if($ledger_type == 1)
<div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Vendor Name</label>
<select name="vendor_id" wire:model.defer="vendor_id"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full"
placeholder="Enter Vendor">
<option value="">Select</option>
@if(sizeof($vendors)>0)
@foreach($vendors as $vendor)
<option value="{{$vendor->id}}">{{$vendor->vendor_name}}</option>
@endforeach
@endif
</select>
@error('vendor_id') <span class="error text-danger">{{ $message }}</span> @enderror
</div>
@elseif($ledger_type == 3)
<div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Employee Name</label>
<select name="employee_id" wire:model.defer="employee_id"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full"
placeholder="Enter Employee">
<option value="">Select</option>
@if(sizeof($emps)>0)
@foreach($emps as $emp)
<option value="{{$emp['id']}}">{{$emp['name']}}</option>
@endforeach
@endif
</select>
@error('employee_id') <span class="error text-danger">{{ $message }}</span> @enderror
</div>
@elseif($ledger_type == 2)
<div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Client Name</label>
<select name="client_id" wire:model.defer="client_id"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full"
placeholder="Enter Employee">
<option value="">Select</option>
@if(sizeof($clients)>0)
@foreach($clients as $client)
<option value="{{$client['id']}}">{{$client['client_name']}}</option>
@endforeach
@endif
</select>
@error('client_id') <span class="error text-danger">{{ $message }}</span> @enderror
</div>
@endif -->
<div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Select Ledger Type<span class="text-danger">*</span></label>
<select name="ledger_type" wire:model.debounce.500ms="ledger_type"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full">
<option value="">Select</option>
@foreach($ledger_head_type as $head_type)
<option value="{{ $head_type->id }}">{{ $head_type->ledger_type }}</option>
@endforeach
</select>
@error('ledger_type')
<span class="error text-danger">{{ $message }}</span>
@enderror
</div>
<div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Ledger Head<span class="text-danger">*</span></label>
<select name="ledger_head_id" wire:model.defer="ledger_head_id"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full">
<option value="">Select</option>
@foreach($ledger_head as $ledger)
<option value="{{ $ledger->id }}">{{ $ledger->ledger_head_name }}</option>
@endforeach
</select>
@error('ledger_head_id')
<span class="error text-danger">{{ $message }}</span>
@enderror
</div>
<div class="xl:w-1/4 justify-between">
<label class="form-label">Amount<span class="text-danger">*</span></label>
<input type="number" name="amount" wire:model="amount" class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full" placeholder="Enter Amount">
@error('amount') <span class="w-full mt-1 text-xs text-danger">{{ $message }}</span> @enderror
</div>
</div>
<div class="flex justify-end">
{{-- @if($upperid)--}}
{{-- <button class="btn btn-primary xl:py-[0.719rem] py-2.5 xl:px-[1.563rem] px-4 duration-300 xl:text-[15px] text-[13px] font-medium rounded text-white bg-primary leading-5 inline-block border border-primary hover:bg-hover-primary" wire:click="updatesub">Add new</button>--}}
{{-- @else--}}
<button class="btn btn-primary xl:py-[0.719rem] py-2.5 xl:px-[1.563rem] px-4 duration-300 xl:text-[15px] text-[13px] font-medium rounded text-white bg-primary leading-5 inline-block border border-primary hover:bg-hover-primary" wire:click="add_payments">Add</button>
{{-- @endif--}}
</div>
</div>
</div>
@elseif($type == 'journal')
<div class="xl:w-full border mb-2"style="border-color: lightgrey">
<div class="row p-2">
<div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Select Ledger Type<span class="text-danger">*</span></label>
<select name="ledger_type" wire:model.debounce.500ms="ledger_type"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full">
<option value="">Select</option>
@foreach($ledger_head_type as $head_type)
<option value="{{ $head_type->id }}">{{ $head_type->ledger_type }}</option>
@endforeach
</select>
@error('ledger_type')
<span class="error text-danger">{{ $message }}</span>
@enderror
</div>
<div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Ledger Head<span class="text-danger">*</span></label>
<select name="ledger_head_id" wire:model.defer="ledger_head_id"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full">
<option value="">Select</option>
@foreach($ledger_head as $ledger)
<option value="{{ $ledger->id }}">{{ $ledger->ledger_head_name }}</option>
@endforeach
</select>
@error('ledger_head_id')
<span class="error text-danger">{{ $message }}</span>
@enderror
</div>
<!-- @if($ledger_type == 1)
<div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Vendor Name</label>
<select name="vendor_id" wire:model.defer="vendor_id"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full"
placeholder="Enter Vendor">
<option value="">Select</option>
@if(sizeof($vendors)>0)
@foreach($vendors as $vendor)
<option value="{{$vendor->id}}">{{$vendor->vendor_name}}</option>
@endforeach
@endif
</select>
@error('vendor_id') <span class="error text-danger">{{ $message }}</span> @enderror
</div>
@elseif($ledger_type == 3)
<div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Employee Name</label>
<select name="employee_id" wire:model.defer="employee_id"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full"
placeholder="Enter Employee">
<option value="">Select</option>
@if(sizeof($emps)>0)
@foreach($emps as $emp)
<option value="{{$emp['id']}}">{{$emp['name']}}</option>
@endforeach
@endif
</select>
@error('employee_id') <span class="error text-danger">{{ $message }}</span> @enderror
</div>
@elseif($ledger_type == 2)
<div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Client Name</label>
<select name="client_id" wire:model.defer="client_id"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full"
placeholder="Enter Employee">
<option value="">Select</option>
@if(sizeof($clients)>0)
@foreach($clients as $client)
<option value="{{$client['id']}}">{{$client['client_name']}}</option>
@endforeach
@endif
</select>
@error('client_id') <span class="error text-danger">{{ $message }}</span> @enderror
</div>
@endif -->
<div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Select Amount Type<span class="text-danger">*</span></label>
<select name="amount_type" wire:model="amount_type"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full">
<option value="">Select</option>
<option value="Debit">Debit</option>
<option value="Credit">Credit</option>
</select>
@error('amount_type') <span class="error text-danger">{{ $message }}</span> @enderror
</div>
<!-- <div class="xl:w-1/4 mb-2 justify-between">
<label class="form-label">Ledger Head<span class="text-danger">*</span></label>
<select name="ledger_head_id" wire:model="ledger_head_id"
class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full">
<option value="">Select</option>
@foreach($ledgerhead as $ledger)
<option value="{{$ledger->id}}">{{$ledger->ledger_head_name}}</option>
@endforeach
</select>
@error('ledger_head_id') <span class="error text-danger">{{ $message }}</span> @enderror
</div> -->
<div class="xl:w-1/4 justify-end">
<label class="form-label">Amount<span class="text-danger">*</span></label>
<input type="number" name="amount" wire:model="amount" class="form-control relative text-[13px] text-body-color h-[2.813rem] border border-b-color block rounded-md py-1.5 px-3 duration-500 focus:border-primary dark:hover:border-b-color outline-none w-full" placeholder="Enter Amount">
@error('amount') <span class="w-full mt-1 text-xs text-danger">{{ $message }}</span> @enderror
</div>
<div class="flex justify-end">
{{-- @if($upperid)--}}
{{-- <button class="btn btn-primary xl:py-[0.719rem] py-2.5 xl:px-[1.563rem] px-4 duration-300 xl:text-[15px] text-[13px] font-medium rounded text-white bg-primary leading-5 inline-block border border-primary hover:bg-hover-primary" wire:click="updatesub">Add new</button>--}}
{{-- @else--}}
<button class="btn btn-primary xl:py-[0.719rem] py-2.5 xl:px-[1.563rem] px-4 duration-300 xl:text-[15px] text-[13px] font-medium rounded text-white bg-primary leading-5 inline-block border border-primary hover:bg-hover-primary" wire:click="add_journal">Add</button>
{{-- @endif--}}
</div>
</div>
</div>
@endif
</div>
@if($type == 'journal')
<div class="xl:w-full light-border mb-1 p-4">
<div class="overflow-x-auto table-scroll">
<table class="display table w-full" >
<thead>
<tr class="bg-transparent">
<th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">Ledger Head</th>
<th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">Ledger Head Name</th>
<!-- <th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">Sub Ledger Name</th> -->
<th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">Credit</th>
<th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">Debit</th>
</tr>
</thead>
<tbody>
@if(sizeof($journal_data)>0)
@foreach($journal_data as $key => $jr_data)
<tr class="bg-transparent">
<td class="text-black border-2 border-solid border-[#E6E6E6] dark:border-[#444444] bg-transparent xl:py-2 py-2 xl:px-[0.9375rem] px-[0.9375rem] capitalize whitespace-nowrap text-xs font-normal text-center">{{$jr_data['ledger_head_code']}}</td>
<td class="text-black border-2 border-solid border-[#E6E6E6] dark:border-[#444444] bg-transparent xl:py-2 py-2 xl:px-[0.9375rem] px-[0.9375rem] capitalize whitespace-nowrap text-xs font-normal text-center">{{$jr_data['ledger_head']}}</td>
<!-- <td class="text-black border-2 border-solid border-[#E6E6E6] dark:border-[#444444] bg-transparent xl:py-2 py-2 xl:px-[0.9375rem] px-[0.9375rem] capitalize whitespace-nowrap text-xs font-normal text-center">{{$jr_data['vendor_name'] != null?$jr_data['vendor_name']:$jr_data['employee_name']}}</td> -->
<td class="text-black border-2 border-solid border-[#E6E6E6] dark:border-[#444444] bg-transparent xl:py-2 py-2 xl:px-[0.9375rem] px-[0.9375rem] capitalize whitespace-nowrap text-xs font-normal text-center">{{$jr_data['credit']}}</td>
<td class="text-black border-2 border-solid border-[#E6E6E6] dark:border-[#444444] bg-transparent xl:py-2 py-2 xl:px-[0.9375rem] px-[0.9375rem] capitalize whitespace-nowrap text-xs font-normal text-center">{{$jr_data['debit']}}</td>
</tr>
@endforeach
@else
<tr class="bg-transparent">
<td colspan="7" class="text-danger border-2 border-solid border-[#E6E6E6] dark:border-[#444444] bg-transparent xl:py-2 py-2 xl:px-[0.9375rem] px-[0.9375rem] capitalize whitespace-nowrap xl:text-[15px] text-[15px] font-bold text-center mb-2">No Data Available</td>
</tr>
@endif
</tbody>
@if(sizeof($journal_data)>0)
<tfoot>
<tr class="bg-transparent">
<td colspan="3" class="bg-transparent border-2 border-solid border-[#E6E6E6] dark:border-[#444444] py-2 px-[0.9375rem] capitalize whitespace-nowrap text-[15px] font-normal text-end">
Total Amount
</td>
<td class="bg-transparent border-2 border-solid border-[#E6E6E6] dark:border-[#444444] py-2 px-[0.9375rem] capitalize whitespace-nowrap text-[15px] font-normal text-center">
{{$total_credit_amount>0?$total_credit_amount:0}}
</td>
<td class="bg-transparent border-2 border-solid border-[#E6E6E6] dark:border-[#444444] py-2 px-[0.9375rem] capitalize whitespace-nowrap text-[15px] font-normal text-center">
{{$total_debit_amount>0?$total_debit_amount:0}}
</td>
</tr>
</tfoot>
@endif
</table>
{{--@if()--}}
@if(sizeof($journal_data)>0)
<div class="flex items-center justify-center mb-2 mt-4">
<button class="btn btn-primary xl:py-[0.719rem] py-2.5 xl:px-[1.563rem] px-4 duration-300 xl:text-[15px] text-[13px] font-medium rounded text-white bg-primary leading-5 inline-block border border-primary hover:bg-hover-primary" wire:click="save_journal">Save</button>
{{-- <a class="btn btn-primary duration-500 hover:bg-hover-primary py-[5px] px-3 text-[13px] rounded text-white bg-primary leading-[18px] inline-block border border-primary ml-2 offcanvas-toggle cursor-pointer" wire:click="showmodalclick">Preview</a>--}}
</div>
@endif
</div>
</div>
@elseif($type == 'payment' || $type == 'receive')
<div class="xl:w-full light-border mb-1 p-4">
<div class="overflow-x-auto table-scroll">
<table class="display table w-full" >
<thead>
<tr class="bg-transparent">
<th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">ACTION</th>
<th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">Received From</th>
<th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">Reference Number</th>
<th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">Ledger Head</th>
<th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">Amount</th>
</tr>
</thead>
<tbody>
@if(sizeof($add_payments_data)>0)
@foreach($add_payments_data as $key => $data)
<tr class="bg-transparent">
<td class="bg-transparent border-2 border-solid border-[#E6E6E6] dark:border-[#444444] py-2 px-[0.9375rem] capitalize whitespace-nowrap text-[15px] font-normal text-center">
<div class="flex justify-center">
<a href="javascript:void(0);" class="btn w-[1.625rem] h-[1.625rem] leading-[1.625rem] rounded-md text-center text-white bg-danger hover:bg-danger-hover duration-300" wire:click="delete_transaction({{$key}})"><i class="fa fa-trash text-[0.875em]"></i></a>
</div>
</td>
<td class="text-black border-2 border-solid border-[#E6E6E6] dark:border-[#444444] bg-transparent xl:py-2 py-2 xl:px-[0.9375rem] px-[0.9375rem] capitalize whitespace-nowrap text-xs font-normal text-center">{{$data['paid_to_received_from']}}</td>
<td class="text-black border-2 border-solid border-[#E6E6E6] dark:border-[#444444] bg-transparent xl:py-2 py-2 xl:px-[0.9375rem] px-[0.9375rem] capitalize whitespace-nowrap text-xs font-normal text-center">{{$data['reference_no']}}</td>
<td class="text-black border-2 border-solid border-[#E6E6E6] dark:border-[#444444] bg-transparent xl:py-2 py-2 xl:px-[0.9375rem] px-[0.9375rem] capitalize whitespace-nowrap text-xs font-normal text-center">{{$data['ledger_head_name']}}</td>
<td class="text-black border-2 border-solid border-[#E6E6E6] dark:border-[#444444] bg-transparent xl:py-2 py-2 xl:px-[0.9375rem] px-[0.9375rem] capitalize whitespace-nowrap text-xs font-normal text-center">{{$data['amount']}}</td>
</tr>
@endforeach
@else
<tr class="bg-transparent">
<td colspan="7" class="text-danger border-2 border-solid border-[#E6E6E6] dark:border-[#444444] bg-transparent xl:py-2 py-2 xl:px-[0.9375rem] px-[0.9375rem] capitalize whitespace-nowrap xl:text-[15px] text-[15px] font-bold text-center mb-2">No Data Available</td>
</tr>
@endif
</tbody>
<tfoot>
<tr class="bg-transparent">
<td colspan="4" class="bg-transparent border-2 border-solid border-[#E6E6E6] dark:border-[#444444] py-2 px-[0.9375rem] capitalize whitespace-nowrap text-[15px] font-normal text-end">
Total Amount
</td>
<td class="bg-transparent border-2 border-solid border-[#E6E6E6] dark:border-[#444444] py-2 px-[0.9375rem] capitalize whitespace-nowrap text-[15px] font-normal text-center">
{{$total_amount>0?$total_amount:0}}
</td>
</tr>
</tfoot>
</table>
{{--@if()--}}
@if(sizeof($add_payments_data)>0)
<div class="flex items-center justify-center mb-2 mt-4">
<button class="btn btn-primary xl:py-[0.719rem] py-2.5 xl:px-[1.563rem] px-4 duration-300 xl:text-[15px] text-[13px] font-medium rounded text-white bg-primary leading-5 inline-block border border-primary hover:bg-hover-primary" wire:click="save">Save</button>
{{-- <a class="btn btn-primary duration-500 hover:bg-hover-primary py-[5px] px-3 text-[13px] rounded text-white bg-primary leading-[18px] inline-block border border-primary ml-2 offcanvas-toggle cursor-pointer" wire:click="showmodalclick">Preview</a>--}}
</div>
@endif
</div>
</div>
@endif
</div>
</div>
@if(!$showmodal)
<div wire:ignore.self>
<x-notify::notify/>
</div>
@endif
</div>
<div wire:ignore.self>
<div class="fixed top-0 right-0 flex flex-col w-1/2 h-[100vh] z-[1045] bg-white dark:bg-[#1E1E1E] text-body-color duration-500 ease-in-out offcanvas @if($showmodal) @else is-closed @endif" id="offcanvasExample">
<div class="card-header">
<div class="flex justify-between items-center mb-2">
<h4 class="heading text-[1.8rem] font-medium uppercase">Other Payment</h4>
</div>
</div>
<div class="card-border">
<table>
<div>
<label for="voucher_type">Mode:</label>
<span class="disabled-span">
@foreach($othertable as $other)
{{ $other['voucher_type'] }}<br>
@endforeach
</span>
</div>
<div>
<label for="voucher_particulars">Particulars:</label>
<span class="disabled-span">
@foreach($othertable as $other)
{{ $other['voucher_particulars'] }}<br>
@endforeach
</span>
</div>
</table>
<div class="xl:w-full border mb-2">
<div class="overflow-x-auto table-scroll">
<table id="dept_datatable" class="display table w-full">
<thead>
<tr class="bg-transparent">
<th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">Paid To</th>
<th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">Reference Number</th>
<th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">Ledger Head</th>
<th class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">Amount</th>
</tr>
</thead>
<tbody>
<tbody>
@if(sizeof($datatable) > 0)
@php
$totalamount = 0;
@endphp
@foreach($datatable as $data)
<tr class="bg-transparent">
<td class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">
{{$data['paid_to_received_from']}}
</td>
<td class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">
{{$data['reference_no']}}
</td>
<td class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">
{{$data['ledger_head_name']}}
</td>
<td class="text-black py-2 px-[0.9375rem] border-2 border-solid border-[#E6E6E6] dark:border-[#444444] capitalize whitespace-nowrap text-xs font-medium text-center">
{{$data['amount']}}
@php
$totalamount += $data['amount']; // Accumulate total amount
@endphp
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
<div class="flex justify-between border-t-2 border-[#E6E6E6] dark:border-[#444444] mt-4 py-2 px-4 bg-gray-100 dark:bg-gray-800">
<div class="text-xs font-medium">Total Amount</div>
<div class="text-xs font-medium">{{ number_format($totalamount, 2) }}</div>
</div>
</div>
<div class="flex justify-between">
<div class="justify-start">
<button class="btn xl:py-[0.719rem] mr-4 py-2.5 xl:px-[1.563rem] px-4 duration-300 xl:text-[15px] text-[13px] font-medium rounded text-danger bg-danger-light leading-5 inline-block border border-danger-light btn-danger light hover:text-white hover:bg-danger offcanvas-close" wire:click="closemodalclick">Close</button>
</div>
<div class="justify-start">
<button class="btn btn-primary xl:py-[0.719rem] py-2.5 xl:px-[1.563rem] px-4 duration-300 xl:text-[15px] text-[13px] font-medium rounded text-white bg-primary leading-5 inline-block border border-primary hover:bg-hover-primary" wire:click="">Submit</button>
</div>
</div>
</div>
</div>
@if($showmodal)
<x-notify::notify />
@endif
</div>
</div>
</div>
@section('externaljs')
<script>
window.addEventListener('send_to_voucher_print', event => {
window.open('/voucher_print', '_blank');
});
</script>
@endsection