mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
fixing bugs
This commit is contained in:
@@ -15,11 +15,19 @@ class CalculatesBookingFloatingAmount
|
||||
return $type === 1 ?
|
||||
$booking->transactions()->selectRaw('sum(amount - service_charge - tax) as sub_total')
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION, ApprovalStatus::PENDING_VERIFICATION])
|
||||
->whereDate('expires_on', '>', Carbon::now())->get()->sum('sub_total') :
|
||||
$booking->transactions()->where('type', TransactionType::PAYMENT)
|
||||
->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION, ApprovalStatus::PENDING_VERIFICATION])
|
||||
->whereDate('expires_on', '>', Carbon::now())->sum('original_amount');
|
||||
->where(function($query){
|
||||
$query->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION])
|
||||
->whereDate('expires_on', '>=', Carbon::now());
|
||||
})->orWhere(function($query){
|
||||
$query->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION]);
|
||||
})->get()->sum('sub_total')
|
||||
: $booking->transactions()->where('type', TransactionType::PAYMENT)
|
||||
->where(function($query){
|
||||
$query->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION])
|
||||
->whereDate('expires_on', '>=', Carbon::now());
|
||||
})->orWhere(function($query){
|
||||
$query->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION]);
|
||||
})->get()->sum('original_amount');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,11 +7,17 @@ use App\Classes\Modules\Bookings\DataTransferObjects\CalculationObject;
|
||||
use App\Http\Resources\BankResource;
|
||||
use App\Models\Bank;
|
||||
use Carbon\Carbon;
|
||||
use Carbon\CarbonInterval;
|
||||
|
||||
class GeneratesBookingQuotation
|
||||
{
|
||||
|
||||
public function execute(CalculationObject $calculationObject, ?int $paymentAttemptLimit = 0){
|
||||
$date = Carbon::now();
|
||||
$days = $date->diffInDays($date->copy()->addMinutes($paymentAttemptLimit));
|
||||
$hours = $date->diffInHours($date->copy()->addMinutes($paymentAttemptLimit)->subDays($days)) ;
|
||||
$minutes = $date->diffInMinutes($date->copy()->addMinutes($paymentAttemptLimit)->subDays($days)->subHours($hours));
|
||||
|
||||
return [
|
||||
'bank' => new BankResource(Bank::find($calculationObject->getConfigurations()->getBankId())),
|
||||
'rate' => $calculationObject->getConfigurations()->getRate(),
|
||||
@@ -24,7 +30,7 @@ class GeneratesBookingQuotation
|
||||
'sub_total' => $calculationObject->getSubTotal(),
|
||||
'total' => $calculationObject->getTotal(),
|
||||
'date' => Carbon::now()->timezone('Asia/Singapore')->format('h:i a, jS M, Y \G\M\T T'),
|
||||
'payment_attempt_limit' => $paymentAttemptLimit
|
||||
'payment_attempt_limit' => CarbonInterval::days($days)->hours($hours)->minutes($minutes)->forHumans()
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@
|
||||
</div>
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<div class="font-heading text-danger fs-10 m-b-5">Please upload your payment proof before the booking expires within 12 hours 30 minutes.</div>
|
||||
<div class="font-heading text-danger fs-10 m-b-5">Please upload your payment proof before the booking expires within {{calculation.payment_attempt_limit}}.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-5">
|
||||
|
||||
@@ -176,8 +176,8 @@
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.products = this.data.purchase_order.details;
|
||||
this.submitted = this.data.purchase_order.status === 1 || this.data.purchase_order.status === 2;
|
||||
this.products = this.data.purchase_order ? this.data.purchase_order.details : [];
|
||||
this.submitted = this.data.purchase_order ? this.data.purchase_order.status === 1 || this.data.purchase_order.status === 2: false;
|
||||
},
|
||||
computed: {
|
||||
productTotal(){
|
||||
|
||||
@@ -76,7 +76,6 @@
|
||||
},
|
||||
mounted(){
|
||||
let vm = this;
|
||||
Dropzone.autoDiscover = false;
|
||||
|
||||
var dropzone = new Dropzone(this.$el, {
|
||||
url: '#',
|
||||
@@ -88,6 +87,8 @@
|
||||
previewTemplate: '<div class="row m-l-0 m-r-0 align-items-center m-t-5 m-b-5 bg-master-lightest text-left p-t-10 p-b-10 "> <div class="col-auto p-r-0"> <img data-dz-thumbnail style="width: 35px; height: 35px;" /> </div> <div class="col"> <div class="row m-b-5"> <div class="col"> <div class="dz-filename fs-8 bold"><span data-dz-name></span></div> </div> </div> <div class="row"> <div class="col"> <div class="dz-size muted light fs-10" data-dz-size></div> </div> </div> </div> <div class="col-auto"><i class="fs-16 fa fa-times-circle pointer hint-text" data-dz-remove></i></div> </div>'
|
||||
});
|
||||
|
||||
dropzone.autoDiscover = false;
|
||||
|
||||
dropzone.on("removedfile", function() {
|
||||
vm.updateFiles(dropzone.files);
|
||||
});
|
||||
@@ -97,10 +98,10 @@
|
||||
vm.isLoading = true;
|
||||
|
||||
if(file.name.split('.').pop() === 'pdf'){
|
||||
$(file.previewElement).find("img[data-dz-thumbnail]").attr("src", "/images/icons/pdf.png");
|
||||
$(file.previewElement).closest("img[data-dz-thumbnail]").attr("src", "/images/icons/pdf.png");
|
||||
}
|
||||
if(file.name.split('.').pop().indexOf("xls") !== -1){
|
||||
$(file.previewElement).find("img[data-dz-thumbnail]").attr("src", "/images/icons/xlsx.png");
|
||||
$(file.previewElement).closest("img[data-dz-thumbnail]").attr("src", "/images/icons/xlsx.png");
|
||||
}
|
||||
|
||||
Promise.all(dropzone.files.map(function(file){
|
||||
@@ -115,15 +116,15 @@
|
||||
});
|
||||
|
||||
dropzone.on("dragover", function() {
|
||||
$(vm.$el).find('.dragzone').css('opacity', 0.5)
|
||||
$(vm.$el).closest('.dragzone').css('opacity', 0.5)
|
||||
});
|
||||
|
||||
dropzone.on("dragleave", function() {
|
||||
$(vm.$el).find('.dragzone').css('opacity', 1)
|
||||
$(vm.$el).closest('.dragzone').css('opacity', 1)
|
||||
});
|
||||
|
||||
dropzone.on("drop", function() {
|
||||
$(vm.$el).find('.dragzone').css('opacity', 1)
|
||||
$(vm.$el).closest('.dragzone').css('opacity', 1)
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
|
||||
Reference in New Issue
Block a user