company wallet transaction pagination

This commit is contained in:
JiaSheng
2023-09-19 00:09:09 +08:00
parent 6542710ba9
commit cc1229a27f
8 changed files with 107 additions and 36 deletions
@@ -20,12 +20,15 @@ class WalletTransactionResource extends JsonResource
public function toArray($request)
{
$description = '';
$current_running_balance = $request['running_balance'];
switch((int) $this->type){
case 5:
$description = (double) $this->amount.' Credit Top up';
$request['running_balance'] = bcsub($request['running_balance'], $this->amount, 5);
break;
case 9:
$description = 'Credit Voucher for '.$this->payment_reference;
$request['running_balance'] = bcsub($request['running_balance'], $this->amount, 5);
break;
case 1:
$booking = Transaction::where('payment_reference', $this->bill_no)->first()->owner;
@@ -35,11 +38,13 @@ class WalletTransactionResource extends JsonResource
break;
}
$request['running_balance'] = bcadd($request['running_balance'], $this->amount, 5);
$marking = $booking->marking;
$description = 'Payment For booking refs.'.'<a href="'.route('booking.details', $marking).'">'.$marking.'</a>';
break;
case 11:
$description = 'Debit Voucher for '.$this->payment_reference;
$request['running_balance'] = bcadd($request['running_balance'], $this->amount, 5);
break;
}
@@ -53,6 +58,7 @@ class WalletTransactionResource extends JsonResource
'payment_method' => (float) $this->payment_method,
'issuer_name' => $this->issuerCompany->name,
'amount' => (double) $this->amount,
'running_balance' => (double) $current_running_balance,
'service_charge' => (double) $this->service_charge,
'tax' => (double) $this->tax,
'status' => (int) $this->status,