ultimatepos/Modules/Accounting/Resources/views/holding/partials/cheque_actions.blade.php

36 lines
1.5 KiB
PHP

@php
$chequeService = app(\Modules\Accounting\Services\ChequeService::class);
$transitions = $chequeService->allowedTransitions($row->status);
$labels = [
'deposited' => __('accounting::lang.deposited'),
'cleared' => __('accounting::lang.clear'),
'bounced' => __('accounting::lang.bounced'),
'cancelled' => __('accounting::lang.cancelled'),
'endorsed' => __('accounting::lang.endorsed'),
'pending' => __('accounting::lang.re_present'),
];
$btnClass = [
'deposited' => 'btn-info',
'cleared' => 'btn-success',
'bounced' => 'btn-danger',
'cancelled' => 'btn-default',
'endorsed' => 'btn-primary',
'pending' => 'btn-warning',
];
@endphp
@if(empty($transitions))
<span class="text-muted">-</span>
@else
@foreach($transitions as $status)
<form action="{{ route('accounting.transitionCheque', $row->id) }}" method="POST" class="form-inline" style="display:inline-block;margin:2px 0;">
@csrf
<input type="hidden" name="status" value="{{ $status }}">
@if($chequeService->transitionRequiresCounterAccount($status))
{!! Form::select('counter_account_id', $accounts, null, ['class'=>'form-control input-sm','required','placeholder'=>__('accounting::lang.counter_account'),'style'=>'max-width:140px']) !!}
@endif
<button class="btn btn-xs {{ $btnClass[$status] ?? 'btn-default' }}">{{ $labels[$status] ?? $status }}</button>
</form>
@endforeach
@endif