From 623fc45442298e230afaf36985fef4dba77298b3 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Fri, 28 Feb 2025 15:51:29 +0800 Subject: [PATCH] Admin Workflow - Fix new unclear workflow requirement --- .../UpdateBookingAmountLogic.php | 55 +---- .../CreateBookingPaymentProcessor.php | 8 +- .../UpdateBookingAmountProcessor.php | 65 ++++++ ...NextQuestionMetadataV1AdminWFProcessor.php | 6 +- .../FetchNextQuestionV1AdminWFProcessor.php | 27 +-- .../SaveAnswerActionV1AdminWFProcessor.php | 31 ++- app/Http/Resources/BookingBaseResource.php | 10 +- database/seeds/QAWorkFlowSeeder.php | 204 ++++++++++++++++-- .../forms/AdminWorkFlowFormComponent.vue | 30 +-- 9 files changed, 324 insertions(+), 112 deletions(-) create mode 100644 app/Classes/Modules/Bookings/Processors/UpdateBookingAmountProcessor.php diff --git a/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountLogic.php index e40a947d..b75b0d11 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountLogic.php @@ -1,31 +1,20 @@ canUpdateBooking = $canUpdateBooking; - $this->updatesBookingFixedAmount = $updatesBookingFixedAmount; $this->fetchesBooking = $fetchesBooking; - $this->calculatesBookingOutstanding = $calculatesBookingOutstanding; - $this->updatesTransactionStatus = $updatesTransactionStatus; + $this->updateBookingAmountProcessor = $updateBookingAmountProcessor; } /** @@ -76,25 +55,11 @@ class UpdateBookingAmountLogic extends AbstractControllerLogic public function logic(Request $request) : JsonResponse { $booking = $this->fetchesBooking->execute(['id' => $request->route('id')]); + $fixAmount = floatval(str_replace(',', '', $request->input('fix_amount', $booking->fix_amount))); - $input_amount = number_format( floatval(str_replace(',', '', $request->input('fix_amount', $booking->fix_amount))), 5, '.', ''); - - $minimum_amount = $booking->fix_amount - $this->calculatesBookingOutstanding->execute($booking); - - if (((float)$input_amount + 0.01) < (float)$minimum_amount) { - throw new MalformedRequestException('Booking Amount cannot be less than '. $minimum_amount .'.'); - } - - $poTransaction = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first(); - $booking->transactions()->where('type', TransactionType::PROFORMA)->delete(); - - if($poTransaction) { - $this->updatesTransactionStatus->execute($poTransaction, ApprovalStatus::PENDING_SUBMISSION); - } - - $booking = $this->updatesBookingFixedAmount->execute($booking, $input_amount); + $this->updateBookingAmountProcessor->execute($booking, $fixAmount); return $this->resourceResponse(new BookingResource($booking)); } -} \ No newline at end of file +} diff --git a/app/Classes/Modules/Bookings/Processors/CreateBookingPaymentProcessor.php b/app/Classes/Modules/Bookings/Processors/CreateBookingPaymentProcessor.php index 93b1594a..ec1233ee 100644 --- a/app/Classes/Modules/Bookings/Processors/CreateBookingPaymentProcessor.php +++ b/app/Classes/Modules/Bookings/Processors/CreateBookingPaymentProcessor.php @@ -67,7 +67,7 @@ class CreateBookingPaymentProcessor private $calculatesBookingRefundAmount; /** - * CreateBookingPaymentLogic constructor. + * CreateBookingPaymentProcessor constructor. * @param FetchesBookingQuotation $fetchBookingQuotation * @param FetchesCompanyPaymentAttemptLimit $fetchesCompanyPaymentAttemptLimit * @param GeneratesTransactionBillNumber $generatesTransactionBillNumber @@ -109,13 +109,15 @@ class CreateBookingPaymentProcessor * @return Transaction * @throws MalformedRequestException */ - public function execute(Booking $booking, string $amount, string $paymentMethod, ?string $voucherCode, ?string $bankCode, string $email) + public function execute(Booking $booking, string $amount, string $paymentMethod, ?string $voucherCode, ?string $bankCode, string $email, bool $checkSysRecordedOutstanding = true) { $conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $amount)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::PAYMENT_METHODS[$paymentMethod]); $outstanding = $this->calculatesBookingOutstanding->execute($booking) + $this->calculatesBookingRefundAmount->execute($booking, $booking->fix_currency_id); - if($conversionObject->getAmount() > round($outstanding, 2)) throw new MalformedRequestException('Your payment must not be greater than '. $outstanding .'.'); + if($checkSysRecordedOutstanding){ + if($conversionObject->getAmount() > round($outstanding, 2)) throw new MalformedRequestException('Your payment must not be greater than '. $outstanding .'.'); + } $configurations = $this->fetchBookingQuotation->execute($booking->company, $conversionObject, $voucherCode); diff --git a/app/Classes/Modules/Bookings/Processors/UpdateBookingAmountProcessor.php b/app/Classes/Modules/Bookings/Processors/UpdateBookingAmountProcessor.php new file mode 100644 index 00000000..57b2531d --- /dev/null +++ b/app/Classes/Modules/Bookings/Processors/UpdateBookingAmountProcessor.php @@ -0,0 +1,65 @@ +updatesBookingFixedAmount = $updatesBookingFixedAmount; + $this->calculatesBookingOutstanding = $calculatesBookingOutstanding; + $this->updatesTransactionStatus = $updatesTransactionStatus; + } + + /** + * @param Booking $booking + * @return Booking $booking + * @throws \App\Classes\Exceptions\MalformedRequestException + */ + public function execute(Booking $booking, float $fixAmount) + { + $input_amount = number_format($fixAmount, 5, '.', ''); + + $minimum_amount = $booking->fix_amount - $this->calculatesBookingOutstanding->execute($booking); + + if (((float)$input_amount + 0.01) < (float)$minimum_amount) { + throw new MalformedRequestException('Booking Amount cannot be less than '. $minimum_amount .'.'); + } + + $poTransaction = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first(); + $booking->transactions()->where('type', TransactionType::PROFORMA)->delete(); + + if($poTransaction) { + $this->updatesTransactionStatus->execute($poTransaction, ApprovalStatus::PENDING_SUBMISSION); + } + + $booking = $this->updatesBookingFixedAmount->execute($booking, $input_amount); + + return $booking; + } + +} diff --git a/app/Classes/Modules/Questionnaires/Processors/FetchNextQuestionMetadataV1AdminWFProcessor.php b/app/Classes/Modules/Questionnaires/Processors/FetchNextQuestionMetadataV1AdminWFProcessor.php index ffecfb1c..0c57b6d1 100644 --- a/app/Classes/Modules/Questionnaires/Processors/FetchNextQuestionMetadataV1AdminWFProcessor.php +++ b/app/Classes/Modules/Questionnaires/Processors/FetchNextQuestionMetadataV1AdminWFProcessor.php @@ -9,9 +9,9 @@ class FetchNextQuestionMetadataV1AdminWFProcessor public function execute(QAQuestions $returnQuestion, ?array $questionMetadata) { if($returnQuestion && $returnQuestion->question_number === '1688_underpaid_order_1'){ - $processed = $questionMetadata['amount_processed']; - $amount = $questionMetadata['amount']; - $questionMetadata['amount_to_be_deducted'] = $amount - $processed; + $amountProcessed = $questionMetadata['amount_processed']; + $amountPaid = $questionMetadata['paid_amount']; + $questionMetadata['amount_to_be_deducted'] = $amountProcessed - $amountPaid; } return $questionMetadata; diff --git a/app/Classes/Modules/Questionnaires/Processors/FetchNextQuestionV1AdminWFProcessor.php b/app/Classes/Modules/Questionnaires/Processors/FetchNextQuestionV1AdminWFProcessor.php index 095de313..bb9454e3 100644 --- a/app/Classes/Modules/Questionnaires/Processors/FetchNextQuestionV1AdminWFProcessor.php +++ b/app/Classes/Modules/Questionnaires/Processors/FetchNextQuestionV1AdminWFProcessor.php @@ -106,33 +106,34 @@ class FetchNextQuestionV1AdminWFProcessor $questions = $this->listsQuestions->execute(['questionnaire_set_id' => $questionnaireSetId, 'question_number' => $question_number]); if($previousAnswer['answer'] === '1688_order_verified' && count($questions) == 0){ $questionMetadata = $questionContext['questionMetadata'] ?? null; - $processed = $questionMetadata['amount_processed']; - $amount = $questionMetadata['amount']; + $amountProcessed = $questionMetadata['amount_processed']; + $amountPaid = $questionMetadata['paid_amount']; $wallet = $booking->company->wallets()->first(); $walletAmount = $wallet->amount; - if ($processed === $amount) { + if ($amountProcessed === $amountPaid) { $question_number = '1688_proceed_order'; } - else if ($processed < $amount) { + else if ($amountProcessed > $amountPaid) { $outstanding = $this->calculatesBookingOutstanding->execute($booking) + $this->calculatesBookingRefundAmount->execute($booking, $booking->fix_currency_id); - $differenceUnder = $amount - $processed; - - $conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $differenceUnder)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::PAYMENT_METHODS['wallet']); + $differenceUnderPayinCNY = $amountProcessed - $amountPaid; + $conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $differenceUnderPayinCNY)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::PAYMENT_METHODS['wallet']); $configurations = $this->fetchBookingQuotation->execute($booking->company, $conversionObject); - $underpay = $configurations->getTotal(); + $amountUnderpay = $configurations->getTotal(); - if($underpay > round($outstanding, 2)) { - $question_number = '1688_underpaid_order_3'; - } - else if($walletAmount > $underpay) { + // if($amountUnderpay > round($outstanding, 2)) { + // $question_number = '1688_underpaid_order_3'; + // } + + if($walletAmount > $amountUnderpay) { $question_number = '1688_underpaid_order_1'; } else { $question_number = '1688_underpaid_order_2'; } - } else { + } + else { $question_number = '1688_overpaid_order'; } } diff --git a/app/Classes/Modules/Questionnaires/Processors/SaveAnswerActionV1AdminWFProcessor.php b/app/Classes/Modules/Questionnaires/Processors/SaveAnswerActionV1AdminWFProcessor.php index 159eca3b..822e7dd8 100644 --- a/app/Classes/Modules/Questionnaires/Processors/SaveAnswerActionV1AdminWFProcessor.php +++ b/app/Classes/Modules/Questionnaires/Processors/SaveAnswerActionV1AdminWFProcessor.php @@ -6,12 +6,14 @@ namespace App\Classes\Modules\Questionnaires\Processors; use App\Classes\Modules\Bookings\Processors\ApprovePurchaseOrderProcessor; use App\Classes\Modules\Bookings\Processors\UploadPurchaseOrderProcessor; use App\Classes\Modules\Bookings\Processors\CreateBookingPaymentProcessor; +use App\Classes\Modules\Bookings\Processors\UpdateBookingAmountProcessor; use App\Classes\Modules\Transactions\Processors\CreatePaymentProofDocumentProcessor; use App\Classes\Modules\Transactions\Services\FetchesTransaction; use App\Classes\Modules\Bookings\Services\FetchesBookingQuotation; use App\Classes\Modules\Currencies\DataTransferObjects\CurrencyConversionObject; use App\Classes\ValueObjects\Constants\PaymentMethodType; use App\Models\QAAnswerOptions; +use Illuminate\Support\Facades\Log; class SaveAnswerActionV1AdminWFProcessor { @@ -33,6 +35,9 @@ class SaveAnswerActionV1AdminWFProcessor /** @var CreateBookingPaymentProcessor */ private $createBookingPaymentProcessor; + /** @var UpdateBookingAmountProcessor */ + private $updateBookingAmountProcessor; + /** * SaveAnswerActionV1AdminWFProcessor constructor. * @param ApprovePurchaseOrderProcessor $approvePurchaseOrderProcessor @@ -41,8 +46,9 @@ class SaveAnswerActionV1AdminWFProcessor * @param FetchesTransaction $fetchesTransaction * @param FetchesBookingQuotation $fetchBookingQuotation * @param CreateBookingPaymentProcessor $createBookingPaymentProcessor + * @param UpdateBookingAmountProcessor $updateBookingAmountProcessor */ - public function __construct(ApprovePurchaseOrderProcessor $approvePurchaseOrderProcessor, UploadPurchaseOrderProcessor $uploadPurchaseOrderProcessor, CreatePaymentProofDocumentProcessor $createPaymentProofDocumentProcessor, FetchesTransaction $fetchesTransaction, FetchesBookingQuotation $fetchBookingQuotation, CreateBookingPaymentProcessor $createBookingPaymentProcessor) + public function __construct(ApprovePurchaseOrderProcessor $approvePurchaseOrderProcessor, UploadPurchaseOrderProcessor $uploadPurchaseOrderProcessor, CreatePaymentProofDocumentProcessor $createPaymentProofDocumentProcessor, FetchesTransaction $fetchesTransaction, FetchesBookingQuotation $fetchBookingQuotation, CreateBookingPaymentProcessor $createBookingPaymentProcessor, UpdateBookingAmountProcessor $updateBookingAmountProcessor) { $this->approvePurchaseOrderProcessor = $approvePurchaseOrderProcessor; $this->uploadPurchaseOrderProcessor = $uploadPurchaseOrderProcessor; @@ -50,6 +56,7 @@ class SaveAnswerActionV1AdminWFProcessor $this->fetchesTransaction = $fetchesTransaction; $this->fetchBookingQuotation = $fetchBookingQuotation; $this->createBookingPaymentProcessor = $createBookingPaymentProcessor; + $this->updateBookingAmountProcessor = $updateBookingAmountProcessor; } /** @@ -60,7 +67,7 @@ class SaveAnswerActionV1AdminWFProcessor if($currentQuestion['question_number'] === 'approve_po' && $answerOption && $answerOption->value === "approve_po_approved"){ $this->approvePurchaseOrderProcessor->execute($booking); } - else if($currentQuestion['question_number'] === '1688_submit') + else if($currentQuestion['question_number'] === '1688_submit' || $currentQuestion['question_number'] === '1688_underpaid_documents_submission' || $currentQuestion['question_number'] === '1688_overpaid_documents_submission') { if($filesUpload){ if ($booking && isset($filesUpload['filesA']) && isset($filesUpload['filesB'])) @@ -82,18 +89,22 @@ class SaveAnswerActionV1AdminWFProcessor else if($currentQuestion['question_number'] === '1688_underpaid_order_1') { $wallet = $booking->company->wallets()->first(); - $processed = $questionMetadata['amount_processed']; - $amount = $questionMetadata['amount']; - if ($processed < $amount) { - $differenceUnder = $amount - $processed; - $conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $differenceUnder)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::PAYMENT_METHODS['wallet']); + $amountProcessed = $questionMetadata['amount_processed']; + $amountPaid = $questionMetadata['paid_amount']; + if ($amountProcessed > $amountPaid) { + $differenceUnderInCNY = $amountProcessed - $amountPaid; + $conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $differenceUnderInCNY)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::PAYMENT_METHODS['wallet']); $configurations = $this->fetchBookingQuotation->execute($booking->company, $conversionObject); - $underpay = $configurations->getTotal(); + $amountUnderpay = $configurations->getTotal(); - if($wallet->amount > $underpay){ + if($amountUnderpay != $differenceUnderInCNY){ + $this->updateBookingAmountProcessor->execute($booking, $amountProcessed); + } + + if($wallet->amount > $amountUnderpay){ $company = $booking->company()->first(); $employee = $company->employees()->first(); - $transaction = $this->createBookingPaymentProcessor->execute($booking, (string) $differenceUnder, 'wallet', "", "", $employee->email); + $transaction = $this->createBookingPaymentProcessor->execute($booking, (string) $differenceUnderInCNY, 'wallet', "", "", $employee->email, false); } } diff --git a/app/Http/Resources/BookingBaseResource.php b/app/Http/Resources/BookingBaseResource.php index 1579551d..960be05e 100644 --- a/app/Http/Resources/BookingBaseResource.php +++ b/app/Http/Resources/BookingBaseResource.php @@ -2,6 +2,11 @@ namespace App\Http\Resources; + +use App\Classes\Modules\Bookings\Services\CalculatesBookingFloatingAmount; +use App\Classes\Modules\Bookings\Services\CalculatesBookingOutstanding; +use App\Classes\Modules\Bookings\Services\CalculatesBookingPayableAmount; +use App\Classes\Modules\Bookings\Services\CalculatesBookingRefundAmount; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\TransactionType; use App\Classes\ValueObjects\Constants\BookingAttributeNames; @@ -25,7 +30,10 @@ class BookingBaseResource extends JsonResource 'bank' => new BankResource($this->bank), 'service' => new ServiceTypeResource($this->service), 'marking' => $this->marking, - 'amount' => $this->fix_amount, + // 'amount' => $this->fix_amount, + // 'floating_amount' => floatval((App()->make(CalculatesBookingFloatingAmount::class))->execute($this->resource, $this->fix_currency_id)), + 'paid_amount' => floatval((App()->make(CalculatesBookingPayableAmount::class))->execute($this->resource, $this->fix_currency_id)) - floatval((App()->make(CalculatesBookingRefundAmount::class))->execute($this->resource, $this->fix_currency_id)), + // 'outstanding_amount' => floatval((App()->make(CalculatesBookingOutstanding::class))->execute($this->resource)), 'fixed_currency' => new CurrencyResource($this->fixedCurrency), 'order_reference_no' => $this->modelAttributes()->where('name', BookingAttributeNames::ORDER_REFERENCE_NO)->get()->map(function ($attr) { return [ diff --git a/database/seeds/QAWorkFlowSeeder.php b/database/seeds/QAWorkFlowSeeder.php index 3ceff3fe..bc875b5a 100644 --- a/database/seeds/QAWorkFlowSeeder.php +++ b/database/seeds/QAWorkFlowSeeder.php @@ -204,11 +204,23 @@ class QAWorkFlowSeeder extends Seeder 'question_number' => '1688_submit', 'question_title' => '1688_submit', 'question_type' => QAType::SUBMIT_1688_3_TYPES_DOCUMENTS, - 'next_nested_question' => '1688_issue_submit', + 'next_nested_question' => '1688_documents_submitted', 'is_start' => false, 'is_end' => false, 'group' => '1688', ], + [ + 'question_number' => '1688_documents_submitted', + 'question_title' => 'Thank you for the hard work', + 'question_type' => QAType::MULTIPLE_CHOICES, + 'is_start' => false, + 'is_end' => true, + 'answer_options' => [ + ['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'], + ['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'], + ], + 'group' => '1688', + ], [ 'question_number' => '1688_issue_submit', 'question_title' => 'Issue has been submitted', @@ -275,7 +287,7 @@ class QAWorkFlowSeeder extends Seeder 'question_type' => QAType::DEFAULT, 'is_start' => false, 'is_end' => true, - 'next_nested_question' => '1688_issue_submit', + 'next_nested_question' => '1688_underpaid_proceed_order', // 'answer_options' => [ // ['display_text' => 'Done', 'value' => '1688_issue_submit', 'next_question_number' => '1688_issue_submit'], // ], @@ -289,22 +301,22 @@ class QAWorkFlowSeeder extends Seeder 'is_start' => false, 'is_end' => false, 'answer_options' => [ - ['display_text' => 'Done', 'value' => '1688_issue_submit', 'next_question_number' => '1688_issue_submit'], - ], - 'group' => '1688', - ], - [ - 'question_number' => '1688_underpaid_order_3', - 'question_title' => 'Underpaid Order?', - 'question_description' => 'There is no outstanding on record, please go back and check if the amount processed is entered correctly.', - 'question_type' => QAType::MULTIPLE_CHOICES, - 'is_start' => false, - 'is_end' => false, - 'answer_options' => [ - ['display_text' => 'Done', 'value' => '1688_issue_submit', 'next_question_number' => '1688_issue_submit'], + ['display_text' => 'Done', 'value' => '1688_underpaid_order_2_submitted', 'next_question_number' => '1688_underpaid_order_2_submitted'], ], 'group' => '1688', ], + // [ + // 'question_number' => '1688_underpaid_order_3', + // 'question_title' => 'Underpaid Order?', + // 'question_description' => 'There is no outstanding on record, please go back and check if the amount processed is entered correctly.', + // 'question_type' => QAType::MULTIPLE_CHOICES, + // 'is_start' => false, + // 'is_end' => false, + // 'answer_options' => [ + // ['display_text' => 'Done', 'value' => '1688_issue_submit', 'next_question_number' => '1688_issue_submit'], + // ], + // 'group' => '1688', + // ], [ 'question_number' => '1688_overpaid_order', 'question_title' => 'Overpaid Order', @@ -313,10 +325,170 @@ class QAWorkFlowSeeder extends Seeder 'is_start' => false, 'is_end' => false, 'answer_options' => [ - ['display_text' => 'Done', 'value' => '1688_order_overpaid', 'next_question_number' => '1688_issue_submit'], + ['display_text' => 'Next', 'value' => '1688_overpaid_proceed_order', 'next_question_number' => '1688_overpaid_proceed_order'], ], 'group' => '1688', ], + + // 1688 underpaid - starts + [ + 'question_number' => '1688_underpaid_proceed_order', + 'question_title' => 'Please process the order on 1688', + 'question_type' => QAType::MULTIPLE_CHOICES, + 'is_start' => false, + 'is_end' => false, + 'answer_options' => [ + ['display_text' => 'Yes', 'value' => '1688_underpaid_documents_submission', 'next_question_number' => '1688_underpaid_documents_submission'], + ['display_text' => 'Got Issue', 'value' => '1688_underpaid_proceed_order_issue', 'next_question_number' => '1688_underpaid_proceed_order_issue'], + ], + 'group' => '1688', + ], + [ + 'question_number' => '1688_underpaid_proceed_order_issue', + 'question_title' => '1688_underpaid_proceed_order_issue', + 'question_type' => QAType::MULTIPLE_CHOICES, + 'is_start' => false, + 'is_end' => false, + 'answer_options' => [ + ['display_text' => 'Wrong Pin Number', 'value' => '1688_underpaid_proceed_order_issue_wrong_pin_number', 'next_question_number' => '1688_underpaid_issue_submit'], + ['display_text' => 'Not Enough Stock', 'value' => '1688_underpaid_proceed_order_issue_not_enough_stock', 'next_question_number' => '1688_underpaid_issue_submit'], + ['display_text' => 'Others', 'value' => '1688_underpaid_proceed_order_issue_others', 'next_question_number' => '1688_underpaid_proceed_order_issue_others'], + ['display_text' => 'No CrossBoarder', 'value' => '1688_underpaid_proceed_order_issue_no_crossborder', 'next_question_number' => '1688_underpaid_issue_submit'], + ['display_text' => 'AngPau', 'value' => '1688_underpaid_proceed_order_issue_angpau', 'next_question_number' => '1688_underpaid_issue_submit'], + ], + 'group' => '1688', + 'is_admin_filter' => true + ], + [ + 'question_number' => '1688_underpaid_proceed_order_issue_others', + 'question_title' => 'What other issues did you encounter? Upload documents if needed', + 'question_type' => QAType::REMARKS_WITH_DOCUMENT_UPLOAD, + 'next_nested_question' => '1688_underpaid_issue_submit', + 'is_start' => false, + 'is_end' => false, + 'group' => '1688', + 'is_admin_filter' => true + ], + [ + 'question_number' => '1688_underpaid_documents_submission', + 'question_title' => '1688_underpaid_documents_submission', + 'question_type' => QAType::SUBMIT_1688_3_TYPES_DOCUMENTS, + 'next_nested_question' => '1688_underpaid_documents_submitted', + 'is_start' => false, + 'is_end' => false, + 'group' => '1688', + ], + [ + 'question_number' => '1688_underpaid_documents_submitted', + 'question_title' => 'Thank you for your hard work', + 'question_type' => QAType::MULTIPLE_CHOICES, + 'is_start' => false, + 'is_end' => true, + 'answer_options' => [ + ['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'], + ['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'], + ], + 'group' => '1688', + ], + [ + 'question_number' => '1688_underpaid_issue_submit', + 'question_title' => 'Issue has been submitted', + 'question_type' => QAType::MULTIPLE_CHOICES, + 'is_start' => false, + 'is_end' => true, + 'answer_options' => [ + ['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'], + ['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'], + ], + 'group' => '1688', + ], + [ + 'question_number' => '1688_underpaid_order_2_submitted', + 'question_title' => 'Issue has been submitted', + 'question_type' => QAType::MULTIPLE_CHOICES, + 'is_start' => false, + 'is_end' => true, + 'answer_options' => [ + ['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'], + ['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'], + ], + 'group' => '1688', + ], + // 1688 underpaid - ends + // 1688 overpaid - starts + [ + 'question_number' => '1688_overpaid_proceed_order', + 'question_title' => 'Please process the order on 1688', + 'question_type' => QAType::MULTIPLE_CHOICES, + 'is_start' => false, + 'is_end' => false, + 'answer_options' => [ + ['display_text' => 'Yes', 'value' => '1688_overpaid_documents_submission', 'next_question_number' => '1688_overpaid_documents_submission'], + ['display_text' => 'Got Issue', 'value' => '1688_overpaid_proceed_order_issue', 'next_question_number' => '1688_overpaid_proceed_order_issue'], + ], + 'group' => '1688', + ], + [ + 'question_number' => '1688_overpaid_proceed_order_issue', + 'question_title' => '1688_overpaid_proceed_order_issue', + 'question_type' => QAType::MULTIPLE_CHOICES, + 'is_start' => false, + 'is_end' => false, + 'answer_options' => [ + ['display_text' => 'Wrong Pin Number', 'value' => '1688_overpaid_proceed_order_issue_wrong_pin_number', 'next_question_number' => '1688_overpaid_issue_submit'], + ['display_text' => 'Not Enough Stock', 'value' => '1688_overpaid_proceed_order_issue_not_enough_stock', 'next_question_number' => '1688_overpaid_issue_submit'], + ['display_text' => 'Others', 'value' => '1688_overpaid_proceed_order_issue_others', 'next_question_number' => '1688_overpaid_proceed_order_issue_others'], + ['display_text' => 'No CrossBoarder', 'value' => '1688_overpaid_proceed_order_issue_no_crossborder', 'next_question_number' => '1688_overpaid_issue_submit'], + ['display_text' => 'AngPau', 'value' => '1688_overpaid_proceed_order_issue_angpau', 'next_question_number' => '1688_overpaid_issue_submit'], + ], + 'group' => '1688', + 'is_admin_filter' => true + ], + [ + 'question_number' => '1688_overpaid_proceed_order_issue_others', + 'question_title' => 'What other issues did you encounter? Upload documents if needed', + 'question_type' => QAType::REMARKS_WITH_DOCUMENT_UPLOAD, + 'next_nested_question' => '1688_overpaid_issue_submit', + 'is_start' => false, + 'is_end' => false, + 'group' => '1688', + 'is_admin_filter' => true + ], + [ + 'question_number' => '1688_overpaid_documents_submission', + 'question_title' => '1688_overpaid_documents_submission', + 'question_type' => QAType::SUBMIT_1688_3_TYPES_DOCUMENTS, + 'next_nested_question' => '1688_overpaid_documents_submitted', + 'is_start' => false, + 'is_end' => false, + 'group' => '1688', + ], + [ + 'question_number' => '1688_overpaid_documents_submitted', + 'question_title' => 'Thank you for your hard work', + 'question_type' => QAType::MULTIPLE_CHOICES, + 'is_start' => false, + 'is_end' => true, + 'answer_options' => [ + ['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'], + ['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'], + ], + 'group' => '1688', + ], + [ + 'question_number' => '1688_overpaid_issue_submit', + 'question_title' => 'Issue has been submitted', + 'question_type' => QAType::MULTIPLE_CHOICES, + 'is_start' => false, + 'is_end' => true, + 'answer_options' => [ + ['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'], + ['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'], + ], + 'group' => '1688', + ], + // 1688 overpaid - ends + [ 'question_number' => 'approve_po', 'question_title' => 'approve_po', diff --git a/resources/assets/vue/components/general/forms/AdminWorkFlowFormComponent.vue b/resources/assets/vue/components/general/forms/AdminWorkFlowFormComponent.vue index 9c86197f..785d9ecf 100644 --- a/resources/assets/vue/components/general/forms/AdminWorkFlowFormComponent.vue +++ b/resources/assets/vue/components/general/forms/AdminWorkFlowFormComponent.vue @@ -125,23 +125,10 @@
Total:
{{(Math.round(( parseFloat(externalApiResponse.data.amount_processed) + Number.EPSILON) * 1000) / 1000).toFixed(3)}}/ - {{(Math.round((externalApiResponse.data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}} {{externalApiResponse.data.fixed_currency.short_code}} + :class="[{'text-danger' : (Math.round((parseFloat(externalApiResponse.data.amount_processed) + Number.EPSILON) * 1000) / 1000).toFixed(3) !== (Math.round((externalApiResponse.data.paid_amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}, + {'text-success' : (Math.round((parseFloat(externalApiResponse.data.amount_processed) + Number.EPSILON) * 1000) / 1000).toFixed(3) === (Math.round((externalApiResponse.data.paid_amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}]">{{(Math.round(( parseFloat(externalApiResponse.data.amount_processed) + Number.EPSILON) * 1000) / 1000).toFixed(3)}}/ + {{(Math.round((externalApiResponse.data.paid_amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}} {{externalApiResponse.data.fixed_currency.short_code}}
- -
@@ -211,7 +198,7 @@
- +
@@ -344,12 +331,12 @@
-
Total:
+
Total Paid:
- {{(Math.round((externalApiResponse.data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}} {{externalApiResponse.data.fixed_currency.short_code}} + :class="[{'text-danger' : (Math.round((parseFloat(question.answer.answer) + Number.EPSILON) * 1000) / 1000).toFixed(3) !== (Math.round((externalApiResponse.data.paid_amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}, + {'text-success' : (Math.round((parseFloat(question.answer.answer) + Number.EPSILON) * 1000) / 1000).toFixed(3) === (Math.round((externalApiResponse.data.paid_amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}]">{{(Math.round(( parseFloat(question.answer.answer) + Number.EPSILON) * 1000) / 1000).toFixed(3)}}/ --> + {{(Math.round((externalApiResponse.data.paid_amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}} {{externalApiResponse.data.fixed_currency.short_code}}
@@ -641,6 +628,7 @@ marking: this.externalApiResponse?.data?.marking, payment_history: this.externalApiResponse?.data?.payment_history, amount: this.externalApiResponse?.data?.amount, + paid_amount: this.externalApiResponse?.data?.paid_amount, amount_processed: this.externalApiResponse?.data?.amount_processed, amount_to_be_deducted: this.externalApiResponse?.data?.amount_to_be_deducted, };