@include('includes.sidebar')
| ID |
Request Code |
Voucher Type |
Total Vouchers |
Grand Total |
Valid Until |
Created by |
Status |
Approvers |
Notes |
Add vouchers to Request |
@if(is_array($voucher_request) || is_object($voucher_request))
@forelse($voucher_request as $list)
| {{ $list->id }} |
{{ $list->rv_code }} |
{{ ($list->type == 1) ? "Gramasi" : "Nominal" }} |
@php
$users = App\Models\Users_model::where('id', $list->created_by)->first();
$total_vouchers = App\Models\Voucher_request_detail_model::where('id_voucher_request', $list->id)->sum('qty');
$voucher_request_detail = App\Models\Voucher_request_detail_model::where('id_voucher_request', $list->id)->get();
$total = 0;
foreach($voucher_request_detail as $detail) {
$detail_total = $detail->qty * $detail->amount;
$total += $detail_total;
}
$campaign = App\Models\Campaign_model::where("id", $list->id_campaign)->first();
if(!empty($list->needed_approval_by)) {
$approvers = explode(",", $list->needed_approval_by);
$approvers_name = [];
foreach($approvers as $id) {
$user_approver = App\Models\Users_model::where('id', $id)->first();
array_push($approvers_name, $user_approver->name);
// $final_name = implode(", ", $approvers_name);
}
}
// if($total == 0) {
// $final_name = "-";
// }
@endphp
{{ $total_vouchers }} pcs |
@if($list->type == 1)
{{ number_format($total, 4) }} gram |
@elseif($list->type == 2)
Rp. {{ number_format($total, 2) }} |
@endif
@if($campaign)
{{ $campaign->berlaku_sampai }} |
@else
- |
@endif
{{ $users ? $users->name : 'LAKUSHOP' }} |
@php
if($list->status == 0) {
$status = "Pending";
}
if($list->status == 1) {
$status = "Approved";
}
if($list->status == -1) {
$status = "Reject";
}
@endphp
{{ $status }} |
{{-- @if ($final_name)
{{ $final_name }}
@else --}}
-
{{-- @endif --}}
|
{{ $list->notes }} |
|
@empty
| No Data |
@endforelse
@endif
@if($voucher_request)
{{ $voucher_request->appends($_GET)->links("pagination::bootstrap-4") }}
@endif
@include('includes.footer')