diff --git a/app/Classes/Modules/Transactions/ControllersLogic/ApproveShippingInvoiceTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/ApproveShippingInvoiceTransactionLogic.php index 5bcb33ce..d038bae9 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/ApproveShippingInvoiceTransactionLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/ApproveShippingInvoiceTransactionLogic.php @@ -69,7 +69,7 @@ class ApproveShippingInvoiceTransactionLogic extends AbstractControllerLogic { $packing_list = $this->fetchesPackingList->execute(['id' => $request->route('id')]); - $invoice_transaction = $packing_list->transactions->where('type', TransactionType::SHIPPING_INVOICE)->first(); + $invoice_transaction = $packing_list->transactions()->where('transactions.type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::PENDING_SUBMISSION])->first(); $this->updatesTransactionStatus->execute($invoice_transaction, ApprovalStatus::APPROVED); diff --git a/app/Http/Resources/PackingListResource.php b/app/Http/Resources/PackingListResource.php index 5256e3de..7dcd6a68 100644 --- a/app/Http/Resources/PackingListResource.php +++ b/app/Http/Resources/PackingListResource.php @@ -2,6 +2,7 @@ namespace App\Http\Resources; +use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\PackingListType; use App\Classes\ValueObjects\Constants\TransactionType; use App\Classes\ValueObjects\Constants\RoleTypes; @@ -34,7 +35,9 @@ class PackingListResource extends JsonResource $this->mergeWhen($this->owner instanceof Order, [ 'order' => New OrderResource($this->owner) ]), - 'shippng_transaction' => new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->first()), + 'shippng_transaction' => new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereNotIn('status', [ApprovalStatus::SUSPENDED, ApprovalStatus::EXPIRED])->first()), + 'suspended_invoice' => new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->first()), + // 'suspended_invoices' => TransactionResource::collection($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->get()), ]; } } diff --git a/resources/assets/vue/components/general/elements/RemarkComponent.vue b/resources/assets/vue/components/general/elements/RemarkComponent.vue new file mode 100644 index 00000000..f2f9bf30 --- /dev/null +++ b/resources/assets/vue/components/general/elements/RemarkComponent.vue @@ -0,0 +1,32 @@ + + diff --git a/resources/assets/vue/components/general/elements/RemarkListComponent.vue b/resources/assets/vue/components/general/elements/RemarkListComponent.vue new file mode 100644 index 00000000..da218ea9 --- /dev/null +++ b/resources/assets/vue/components/general/elements/RemarkListComponent.vue @@ -0,0 +1,71 @@ + + diff --git a/resources/assets/vue/components/general/forms/RemarkCommentFormComponent.vue b/resources/assets/vue/components/general/forms/RemarkCommentFormComponent.vue new file mode 100644 index 00000000..7da26ca8 --- /dev/null +++ b/resources/assets/vue/components/general/forms/RemarkCommentFormComponent.vue @@ -0,0 +1,55 @@ + + diff --git a/resources/assets/vue/components/paymentsBilling/elements/AdminDisputePaymentsBillingComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/AdminDisputePaymentsBillingComponent.vue new file mode 100644 index 00000000..1f0416ca --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/elements/AdminDisputePaymentsBillingComponent.vue @@ -0,0 +1,130 @@ + + diff --git a/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue index 30f0cca6..f67da627 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue @@ -27,26 +27,6 @@
n/a
MYR {{ item.shippng_transaction.amount.toFixed(2) }}
-
-

Billing Question

-
{{ item.shippng_transaction.remarks[0].content }}
-
-
-
- -
- - - -
-
-
- -
- - - -
diff --git a/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingComponent.vue index 3a2e5363..d309dfea 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingComponent.vue @@ -4,42 +4,43 @@
-
+

Invoice Date

{{ item.updated_at }}

Status

Payment Completed
-
Suspended
-
Expired
+
Dispute in progress
+
Cancelled Invoice
Pending Payment
-
+

Amount

MYR {{ item.amount.toFixed(2) }}
- -
+

Billing Question

- {{ item.remarks[0].content }} - - - - - + {{ latestComment.content }} + +
- - - - - + +
+
+ +
+ +
+
-
+
Billing Question?
@@ -62,7 +63,7 @@
-
+
@@ -70,7 +71,7 @@
-
+
@@ -158,6 +159,16 @@
+
+
+
+
+
Billing question
+ +
+
+
+
@@ -189,6 +200,10 @@ }, overweight(){ return (Math.ceil((this.item.packages.reduce((total, obj) => (obj.type === 2 ? obj.cbm : 0) + total, 0)) * 1000) / 1000).toFixed(3) + }, + latestComment() { + let questions = this.item.remarks; + return questions.slice().reverse()[0]; } }, created(){ diff --git a/resources/assets/vue/components/paymentsBilling/forms/CustomerInvoiceRemarkFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/CustomerInvoiceRemarkFormComponent.vue index 9d0da49d..b767c07e 100644 --- a/resources/assets/vue/components/paymentsBilling/forms/CustomerInvoiceRemarkFormComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/forms/CustomerInvoiceRemarkFormComponent.vue @@ -27,7 +27,7 @@
Cancel
-
{{ data.remarks.length > 0 ? 'Edit' : 'Create' }}
+
Create
@@ -51,7 +51,7 @@ data(){ return { parameters: { - content: this.data.remarks.length > 0 ? this.data.remarks[0].content : '', + content: '', model_type: this.module_type } } @@ -65,10 +65,8 @@ }, methods: { submitForm() { - if (!this.data.remarks.length) { - this.submit(this.route('api.transaction.suspend', this.data.id), 'delete', this.section, false, true); - } - this.submit(this.data.remarks.length > 0 ? this.route('api.remark.update', this.data.remarks[0].id) : this.route('api.remark.create', this.data.id), this.data.remarks.length > 0 ? 'put' : 'post', this.section, true, true); + this.submit(this.route('api.transaction.suspend', this.data.id), 'delete', this.section, false, true); + this.submit(this.route('api.remark.create', this.data.id), 'post', this.section, true, true); } }, mixins: [ModalFormHandler] diff --git a/resources/assets/vue/components/paymentsBilling/forms/DeleteDisputeFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/DeleteDisputeFormComponent.vue index bd7dc400..bd3d00d7 100644 --- a/resources/assets/vue/components/paymentsBilling/forms/DeleteDisputeFormComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/forms/DeleteDisputeFormComponent.vue @@ -15,7 +15,7 @@
Cancel
-
Delete
+
Delete
diff --git a/resources/assets/vue/components/paymentsBilling/forms/RegenerateDisputeInvoiceFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/RegenerateDisputeInvoiceFormComponent.vue index 9285759c..547505a0 100644 --- a/resources/assets/vue/components/paymentsBilling/forms/RegenerateDisputeInvoiceFormComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/forms/RegenerateDisputeInvoiceFormComponent.vue @@ -36,7 +36,7 @@ }, methods: { submitForm() { - this.submit(this.route('api.transaction.update', this.item.shippng_transaction.id, 'expire'), 'put', this.section, false, true); + this.submit(this.route('api.transaction.update', this.item.suspended_invoice.id, 'expire'), 'put', this.section, false, true); this.submit(this.route('api.transaction.invoice.create'), 'post', this.section, true, true); } }, diff --git a/resources/views/pages/paymentAndBilling.blade.php b/resources/views/pages/paymentAndBilling.blade.php index b6f5bda4..21c8daf7 100644 --- a/resources/views/pages/paymentAndBilling.blade.php +++ b/resources/views/pages/paymentAndBilling.blade.php @@ -120,7 +120,7 @@