mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-24 23:13:59 +00:00
update list all customer transactions
This commit is contained in:
+5
-2
@@ -6,6 +6,7 @@ namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Http\Resources\PaymentTransactionResource;
|
||||
use App\Models\Booking;
|
||||
@@ -21,8 +22,8 @@ class FetchCompanyTransactionStatementLogic extends AbstractControllerLogic
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Retrieved Company Balance Account',
|
||||
'message' => 'You have successfully retrieved company balance account'
|
||||
'title' => 'Retrieved Company Transaction Statement',
|
||||
'message' => 'You have successfully retrieved company transaction statement'
|
||||
];
|
||||
}
|
||||
|
||||
@@ -41,6 +42,7 @@ class FetchCompanyTransactionStatementLogic extends AbstractControllerLogic
|
||||
$query
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->where('owner_type', Booking::class)
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->whereHas('booking', function ($query) use ($companyId) {
|
||||
$query->where('company_id', $companyId);
|
||||
});
|
||||
@@ -53,6 +55,7 @@ class FetchCompanyTransactionStatementLogic extends AbstractControllerLogic
|
||||
->where('owner_type', Wallet::class)
|
||||
->where('type', '!=', TransactionType::PAYMENT);
|
||||
})
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->orderBy('created_at', 'desc')
|
||||
->get();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Http\Resources;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Booking;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Wallet;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PaymentTransactionResource extends JsonResource
|
||||
@@ -20,9 +21,19 @@ class PaymentTransactionResource extends JsonResource
|
||||
|
||||
$booking = in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND])? $this->owner->owner : $this->owner;
|
||||
|
||||
$booking_marking = '';
|
||||
switch ($this->owner_type) {
|
||||
case Booking::class:
|
||||
$booking_marking = $booking->marking;
|
||||
break;
|
||||
case Wallet::class:
|
||||
$booking_marking = $this->booking->marking;
|
||||
break;
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'booking_marking' => $booking->marking,
|
||||
'booking_marking' => $booking_marking,
|
||||
'type' => (int) $this->type,
|
||||
'bill_no' => $this->bill_no,
|
||||
'payment_reference' => $this->payment_reference,
|
||||
|
||||
+3
-3
@@ -14,7 +14,7 @@
|
||||
<div class="row padding-10">
|
||||
<div class="col-2 fs-10">Date</div>
|
||||
<div class="col-3 fs-10">Description</div>
|
||||
<div class="col fs-10">Type</div>
|
||||
<div class="col fs-10">Marking</div>
|
||||
<div class="col-2 fs-10 text-center">Incoming</div>
|
||||
<div class="col-2 fs-10 text-center">Outgoing</div>
|
||||
<div class="col-2 fs-10 text-right">Balance</div>
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
<div class="row bg-white padding-10 m-b-10 rounded" v-for="(item, index) in transaction" v-bind:key="item.id" :data="item">
|
||||
<div class="col-2 fs-12">{{item.created_at}}</div>
|
||||
<div class="col-3 fs-12">{{ item.payment_reference ? item.payment_reference + ' - ' : '' }} {{convertPaymentMethod(item.payment_method)}} - <a :href="route('booking.details', item.booking_marking)">{{item.booking_marking}}</a></div>
|
||||
<div class="col fs-12">{{ convertTransactionType(item.type) }}</div>
|
||||
<div class="col-3 fs-12">{{ convertTransactionType(item.type) }} {{ item.payment_reference ? ' - ' + item.payment_reference : '' }}</div>
|
||||
<div class="col fs-12"><a :href="route('booking.details', item.booking_marking)">{{item.booking_marking}}</a></div>
|
||||
<div class="col-2 text-success text-center">{{[5, 9].includes(parseFloat(item.type)) ? (Math.round((parseFloat(item.amount) + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : ''}}</div>
|
||||
<div class="col-2 text-danger text-center">{{[1, 11].includes(parseFloat(item.type)) ? '- ' + (Math.round((parseFloat(item.amount) + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : ''}}</div>
|
||||
<div class="col-2 text-right">{{remainingBalance(index)}}</div>
|
||||
|
||||
Reference in New Issue
Block a user