From e8ff49163d6d9b32866cd29df2fcfe54cc4d24ce Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 9 Feb 2022 15:02:48 +0800 Subject: [PATCH] clean up wallet --- .../Eloquent/Filters/TransactionServiceId.php | 23 ++++++++++++ .../BookingPaymentQuotationComponent.vue | 16 ++++++--- .../SupplierPendingOrdersSectionComponent.vue | 35 ++++++++++++------- .../CustomerProfileSectionComponent.vue | 2 +- .../CustomerTransactionSectionComponent.vue | 2 +- .../wallets/elements/WalletComponent.vue | 6 +++- .../forms/WalletTopUpFormComponent.vue | 10 ++++-- 7 files changed, 70 insertions(+), 24 deletions(-) create mode 100644 app/Classes/General/Eloquent/Filters/TransactionServiceId.php diff --git a/app/Classes/General/Eloquent/Filters/TransactionServiceId.php b/app/Classes/General/Eloquent/Filters/TransactionServiceId.php new file mode 100644 index 00000000..fa0cdba5 --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/TransactionServiceId.php @@ -0,0 +1,23 @@ +where('owner_type', Booking::class)->whereHas('booking', function ($query) use($value) { + $query->where('service_id', $value); + }); + } + +} \ No newline at end of file diff --git a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue index 908ce43b..4c859f8e 100644 --- a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue +++ b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue @@ -455,15 +455,15 @@
-
+
-
You don't have sufficient credit in your wallet to complete this transaction. Please Reload your wallet.
+
You don't have sufficient credit in your wallet to complete this transaction. Please Reload your wallet.

change the payment method?

-
+
- +
@@ -475,7 +475,7 @@
- +
@@ -524,6 +524,12 @@ } } }, + computed: { + walletOutstanding(){ + let walletBalance = this.data.company.wallet ? this.data.company.wallet.amount : 0; + return walletBalance - this.calculation.total; + } + }, methods: { updatePaymentType(payment){ this.paymentMethod = { diff --git a/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue b/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue index 71d450dd..8d1b279e 100644 --- a/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue +++ b/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue @@ -181,23 +181,32 @@ this.updateService(this.suppliers[0].services[0]); }, updateSupplier(supplier){ - this.selectedSupplier = supplier; - this.selectedSupplier.status = false; - this.updateCurrency(supplier.currencies[0]); - }, - updateCurrency(currency){ - - if(currency !== this.selectedCurrency){ - this.selectedCurrency = currency; - this.$refs.pendingOrdersList.updateFilters({per_page: 10000, status: 2, type: 1, original_currency_id_in: [this.selectedCurrency.id]}); + if(supplier !== this.selectedSupplier){ + this.selectedSupplier= supplier; + this.updateList(); } - this.currencyDropdownLaunch.status = false; - this.payments = []; - }, updateService(service){ - this.selectedService = service; + if(service !== this.selectedService){ + this.selectedService = service; + this.updateList(); + } + }, + updateCurrency(currecny){ + if(currecny !== this.selectedCurrency){ + this.selectedCurrency = currecny; + this.updateList(); + } + }, + updateList(){ + + this.$refs.pendingOrdersList.updateFilters({per_page: 10000, status: 2, type: 1, original_currency_id_in: [this.selectedCurrency.id], transaction_service_id: this.selectedService.id}); + + this.selectedSupplier.status = false; + this.currencyDropdownLaunch.status = false; this.serviceDropdownLaunch.status = false; + this.payments = []; + }, updateOrder(payment){ this.payments.includes(payment) ? this.payments.splice(this.payments.indexOf(payment), 1) : this.payments.push(payment); diff --git a/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue b/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue index 50ecbacd..c8a07bf9 100644 --- a/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue +++ b/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue @@ -141,7 +141,7 @@
- +
diff --git a/resources/assets/vue/components/wallets/elements/CustomerTransactionSectionComponent.vue b/resources/assets/vue/components/wallets/elements/CustomerTransactionSectionComponent.vue index 9d30e226..f4f211e2 100644 --- a/resources/assets/vue/components/wallets/elements/CustomerTransactionSectionComponent.vue +++ b/resources/assets/vue/components/wallets/elements/CustomerTransactionSectionComponent.vue @@ -53,7 +53,7 @@
- +
diff --git a/resources/assets/vue/components/wallets/elements/WalletComponent.vue b/resources/assets/vue/components/wallets/elements/WalletComponent.vue index d341dbf3..a6b0dec6 100644 --- a/resources/assets/vue/components/wallets/elements/WalletComponent.vue +++ b/resources/assets/vue/components/wallets/elements/WalletComponent.vue @@ -28,7 +28,7 @@
- +
@@ -47,6 +47,10 @@ amount: { type: String, default: '0.00' + }, + creditable: { + type: Boolean, + default: false } }, data(){ diff --git a/resources/assets/vue/components/wallets/forms/WalletTopUpFormComponent.vue b/resources/assets/vue/components/wallets/forms/WalletTopUpFormComponent.vue index fa190598..ae5f605e 100644 --- a/resources/assets/vue/components/wallets/forms/WalletTopUpFormComponent.vue +++ b/resources/assets/vue/components/wallets/forms/WalletTopUpFormComponent.vue @@ -1,7 +1,7 @@