Merge branch 'dillon/34.8-jenkins-vapor' into vapor/production

This commit is contained in:
Dillon Ngo
2024-11-07 03:35:49 +08:00
4 changed files with 36 additions and 6 deletions
@@ -0,0 +1,22 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class DoesNotHaveGroup implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereDoesntHave('transactions', function ($transaction) use ($value) {
$transaction->whereHas('groupTransaction');
});
}
}
@@ -10,6 +10,7 @@ use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Http\Resources\GroupResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class DeleteGroupLogic extends AbstractControllerLogic
{
@@ -61,13 +62,17 @@ class DeleteGroupLogic extends AbstractControllerLogic
$bill = $item;
$payment = $bill->owner;
$group->transactions()->detach($bill->id);
$this->updatesTransactionStatus->execute($payment, ApprovalStatus::APPROVED);
$trns = $payment->transactions()->with('groupTransaction')->get();
if(count($trns) <= 1){
$this->updatesTransactionStatus->execute($payment, ApprovalStatus::APPROVED);
}
$this->deletesTransaction->execute($bill);
}
$group->delete();
return $this->resourceResponse(new GroupResource($group));
}
}
}
@@ -117,13 +117,13 @@
</div>
<div class="row">
<div class="col">
<list-component ref="pendingOrdersList" section="pendingOrdersSection" :endpoint="route('api.transaction.list')" :options="{per_page: 5, status: 2, owner_type: 'App\\Models\\Booking', type: 1, original_currency_id_in: [selectedCurrency.id], transaction_service_id: selectedService.id, does_not_have_refund_in_progress: true}">
<list-component ref="pendingOrdersList" section="pendingOrdersSection" :endpoint="route('api.transaction.list')" :options="{per_page: 5, status: 2, owner_type: 'App\\Models\\Booking', type: 1, original_currency_id_in: [selectedCurrency.id], transaction_service_id: selectedService.id, does_not_have_refund_in_progress: true, does_not_have_group: true}">
<template slot="list" slot-scope="{data}">
<supplier-pending-order-component :data="data" v-on:input="updateOrder($event)"></supplier-pending-order-component>
</template>
</list-component>
<!-- <list-polling-component ref="pendingOrdersList" section="pendingOrdersSection" :endpoint="route('api.transaction.list.job')" :options="{per_page: 5, status: 2, owner_type: 'App\\Models\\Booking', type: 1, original_currency_id_in: [selectedCurrency.id], transaction_service_id: selectedService.id, does_not_have_refund_in_progress: true}">
<!-- <list-polling-component ref="pendingOrdersList" section="pendingOrdersSection" :endpoint="route('api.transaction.list.job')" :options="{per_page: 5, status: 2, owner_type: 'App\\Models\\Booking', type: 1, original_currency_id_in: [selectedCurrency.id], transaction_service_id: selectedService.id, does_not_have_refund_in_progress: true, does_not_have_group: true}">
<template slot="list" slot-scope="{data}">
<supplier-pending-order-component :data="data" v-on:input="updateOrder($event)"></supplier-pending-order-component>
</template>
@@ -203,7 +203,7 @@
// todo-refund: activate this for partial refund
// this.$refs.pendingOrdersList.updateFilters({per_page: 10000, status: 2, type: 1, original_currency_id_in: [this.selectedCurrency.id], transaction_service_id: this.selectedService.id, is_not_fully_refunded: true});
this.$refs.pendingOrdersList.updateFilters({per_page: 10000, status: 2, type: 1, original_currency_id_in: [this.selectedCurrency.id], transaction_service_id: this.selectedService.id, does_not_have_refund_in_progress: true});
this.$refs.pendingOrdersList.updateFilters({per_page: 10000, status: 2, type: 1, original_currency_id_in: [this.selectedCurrency.id], transaction_service_id: this.selectedService.id, does_not_have_refund_in_progress: true, does_not_have_group: true});
this.selectedSupplier.status = false;
this.currencyDropdownLaunch.status = false;
+3
View File
@@ -417,6 +417,9 @@ Route::get('/pending_orders', function(){
->whereDoesntHave('transactions', function ($query) {
return $query->where('type', TransactionType::REFUND)->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]);
})
->whereDoesntHave('transactions', function ($transaction) {
$transaction->whereHas('groupTransaction');
})
->orderBy('updated_at', 'desc')
->get();