diff --git a/app/Classes/General/Eloquent/Filters/DoesNotHaveTransactionType.php b/app/Classes/General/Eloquent/Filters/DoesNotHaveTransactionType.php index 3568ac3b..4996ac3c 100644 --- a/app/Classes/General/Eloquent/Filters/DoesNotHaveTransactionType.php +++ b/app/Classes/General/Eloquent/Filters/DoesNotHaveTransactionType.php @@ -2,6 +2,7 @@ namespace App\Classes\General\Eloquent\Filters; +use Carbon\Carbon; use Illuminate\Database\Eloquent\Builder; class DoesNotHaveTransactionType implements Filter @@ -15,6 +16,8 @@ class DoesNotHaveTransactionType implements Filter { return $builder->whereDoesntHave('transactions', function (Builder $query) use($value) { $query->where('type', $value); + })->whereHas('containers', function ($query){ + return $query->whereDate('loading_date', '>=', Carbon::parse('01-09-2022')); }); } } \ No newline at end of file diff --git a/app/Classes/General/Eloquent/Filters/OwnerIdNotIn.php b/app/Classes/General/Eloquent/Filters/OwnerIdNotIn.php new file mode 100644 index 00000000..97c7dcba --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/OwnerIdNotIn.php @@ -0,0 +1,20 @@ +whereNotIn('owner_id', $value); + } + +} \ No newline at end of file diff --git a/app/Classes/General/Eloquent/Filters/PaymentReference.php b/app/Classes/General/Eloquent/Filters/PaymentReference.php new file mode 100644 index 00000000..5f5d53f5 --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/PaymentReference.php @@ -0,0 +1,20 @@ +where('payment_reference', '=', $value); + } + +} \ No newline at end of file diff --git a/app/Classes/General/Eloquent/Filters/SegmentIdIn.php b/app/Classes/General/Eloquent/Filters/SegmentIdIn.php new file mode 100644 index 00000000..de66a61f --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/SegmentIdIn.php @@ -0,0 +1,20 @@ +whereIn('segment_id', $value); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Announcements/Services/CreatesAnnouncement.php b/app/Classes/Modules/Announcements/Services/CreatesAnnouncement.php index 4a43bac8..dc2b271e 100644 --- a/app/Classes/Modules/Announcements/Services/CreatesAnnouncement.php +++ b/app/Classes/Modules/Announcements/Services/CreatesAnnouncement.php @@ -5,6 +5,7 @@ namespace App\Classes\Modules\Announcements\Services; use App\Classes\General\Eloquent\AbstractUpdateRecord; use App\Classes\Modules\Announcements\DataTransferObjects\AnnouncementObject; use App\Models\Announcement; +use DateTime; class CreatesAnnouncement extends AbstractUpdateRecord { @@ -18,9 +19,17 @@ class CreatesAnnouncement extends AbstractUpdateRecord $model = new Announcement(); $model->title = $object->getTitle(); $model->description = $object->getDescription(); - $model->starting_on = $object->getStartingOn(); - $model->ending_on = $object->getEndingOn(); + // $model->starting_on = $object->getStartingOn(); + $model->starting_on = $this->convertDateFormat($object->getStartingOn()); + // $model->ending_on = $object->getEndingOn(); + $model->ending_on = $this->convertDateFormat($object->getEndingOn()); return $this->handler($model); } + + public function convertDateFormat($value) { + $value = DateTime::createFromFormat('d-m-Y', $value)->format('Y-m-d H:i:s'); + + return $value; + } } diff --git a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php index 0f928a51..69381d4d 100644 --- a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php +++ b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php @@ -2,6 +2,8 @@ namespace App\Classes\Modules\Billplzs\ControllersLogic; +use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor; +use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor; use App\Classes\Modules\Wallets\DataTransferObjects\WalletObject; use App\Classes\Modules\Wallets\Services\UpdatesWallet; @@ -21,6 +23,7 @@ use App\Classes\Modules\Billplzs\DataTransferObjects\BillplzXSignatureObject; use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\Transactions\Services\FetchesTransaction; use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus; +use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Log; @@ -35,21 +38,27 @@ class CallbackBillplzLogic /** @var UpdatesTransactionStatus */ private $updatesTransactionStatus; - /** @var UpdatesWalletBalance */ - private $updatesWalletBalance; + /** @var UpdateDoFromVTPortalProcessor */ + private $updateDoFromVTPortalProcessor; + + /** @var UpdateDoFromYDPortalProcessor */ + private $updateDoFromYDPortalProcessor ; /** * CallbackBillplzLogic constructor. * @param GetBillplzBill $getBillplzBill * @param FetchesTransaction $fetchesTransaction * @param UpdatesTransactionStatus $updatesTransactionStatus - * @param UpdatesWalletBalance $updatesWalletBalance + * @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor + * @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor */ - public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus) + public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor) { $this->getBillplzBill = $getBillplzBill; $this->fetchesTransaction = $fetchesTransaction; $this->updatesTransactionStatus = $updatesTransactionStatus; + $this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor; + $this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor; } @@ -58,6 +67,8 @@ class CallbackBillplzLogic * @return bool|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * @throws MalformedRequestException * @throws ResourceNotFoundException + * @throws \App\Classes\Exceptions\InternalServerErrorException + * @throws \GuzzleHttp\Exception\GuzzleException */ public function execute(Request $request) { @@ -73,6 +84,10 @@ class CallbackBillplzLogic $transaction = $this->fetchesTransaction->execute(['payment_reference' => $billplzXSignatureObject->getBillPlzId()]); + $invoice = $transaction->owner; + $packingList = $invoice->owner; + $order = $packingList->owner; + if($billPlz->state === 'paid') { $status = ApprovalStatus::APPROVED; } @@ -84,8 +99,23 @@ class CallbackBillplzLogic $token = Auth::fromUser(User::find(1)); $request->headers->set('Authorization', 'Bearer '.$token); - $marking = $transaction->owner()->first()->owner()->first(); + $this->updatesTransactionStatus->execute($transaction, ApprovalStatus::APPROVED); - return $request->method() === 'POST' ? true : view('pages.payments_redirect', ['marking' => $marking->reference, 'transaction' => $transaction, 'status' => $status]); + if($transaction->amount - $invoice->amount < 0.01) { + $this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED); + + $packingList->status = ApprovalStatus::APPROVED; + $packingList->save(); + + if(app()->environment('production')){ + $this->updateDoFromVTPortalProcessor->execute($packingList); + $this->updateDoFromYDPortalProcessor->execute($packingList); + } + } + + + + + return $request->method() === 'POST' ? true : view('pages.payments_redirect', ['marking' => $order->reference, 'transaction' => $transaction, 'status' => $status]); } } \ No newline at end of file diff --git a/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php b/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php index 5b331fca..4f40da24 100644 --- a/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php +++ b/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php @@ -23,7 +23,7 @@ class CreatesBillplzBill try{ // config('billplz.maybank') $response = Http::withBasicAuth(config('billplz.api_key').':', '')->post(config('billplz.base_url').'/api/v3/bills', [ - 'collection_id' => $wallet ? config('billplz.wallet_collection_id') : config('billplz.collection_id'), + 'collection_id' => config('billplz.collection_id'), 'name' => $name, 'email' => $email, 'description' => $description, diff --git a/app/Classes/Modules/Companies/Services/AssignsCompanyToSegment.php b/app/Classes/Modules/Companies/Services/AssignsCompanyToSegment.php index 81b6e964..9c54d401 100644 --- a/app/Classes/Modules/Companies/Services/AssignsCompanyToSegment.php +++ b/app/Classes/Modules/Companies/Services/AssignsCompanyToSegment.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\Companies\Services; use App\Classes\Exceptions\MalformedRequestException; use App\Classes\General\Eloquent\AbstractUpdateRecord; +use App\Classes\ValueObjects\Constants\BusinessType; use App\Models\Company; use App\Models\Segment; use Illuminate\Database\QueryException; @@ -19,8 +20,9 @@ class AssignsCompanyToSegment extends AbstractUpdateRecord public function execute(Company $company, Segment $segment) { try { - - $company->segments()->attach($segment); + $companyModule = $company->companyModules()->where('type', BusinessType::IMPORTER)->first(); + $connection = $companyModule->connections()->where('inviter_reference', 'CIEF'); + $connection->segments()->attach($segment); return $company; diff --git a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php index 64c41820..99951553 100644 --- a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php +++ b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php @@ -102,7 +102,7 @@ class UpdateConstantLogic extends AbstractControllerLogic $constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]); - $constantValue = $this->updatesConstantValue->execute($constant->value, $request->input('id'), $request->input('value')); + $constantValue = $this->updatesConstantValue->execute($constant->value, $request->input('id'), $request->input('rate')); $object = new ConstantObject($request->input('reference'), $constantValue); diff --git a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php index f39fdb29..ac6dc26e 100644 --- a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php +++ b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php @@ -25,8 +25,8 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic */ protected function notification():array { return [ - 'title' => 'Updated Segment Constant', - 'message' => 'You have successfully updated the Segment Constant' + 'title' => 'Updated Postcode Constant', + 'message' => 'You have successfully updated the Postcode Constant' ]; } diff --git a/app/Classes/Modules/Segments/ControllersLogic/UpdateSegmentLogic.php b/app/Classes/Modules/Segments/ControllersLogic/UpdateSegmentLogic.php index 43eaa54e..f0378691 100644 --- a/app/Classes/Modules/Segments/ControllersLogic/UpdateSegmentLogic.php +++ b/app/Classes/Modules/Segments/ControllersLogic/UpdateSegmentLogic.php @@ -70,7 +70,8 @@ class UpdateSegmentLogic extends AbstractControllerLogic $segment_query = $this->fetchesSegment->execute(['id' => $request->route('id')]); $segment_object = new SegmentObject( - $request->input('name', $segment_query->name) + $request->input('name'), + $segment_query->company_module_id ); $this->canUpdateSegment->passes($segment_object); $segment_query = $this->updatesSegment->execute($segment_query, $segment_object); diff --git a/app/Classes/Modules/Segments/ControllersLogic/UpdateSegmentPriceLogic.php b/app/Classes/Modules/Segments/ControllersLogic/UpdateSegmentPriceLogic.php new file mode 100644 index 00000000..6f1567a8 --- /dev/null +++ b/app/Classes/Modules/Segments/ControllersLogic/UpdateSegmentPriceLogic.php @@ -0,0 +1,124 @@ + 'Updated Segment Price', + 'message' => 'You have successfully updated the Segment Price' + ]; + } + + /** @var CanUpdateConstant */ + private $canUpdateConstant; + + /** @var UpdatesConstant */ + private $updatesConstant; + + /** @var FetchesSegment */ + private $fetchesSegment; + + /** @var FetchesConstant */ + private $fetchesConstant; + + /** @var CanCreateConstant */ + private $canCreateConstant; + + /** @var CreatesConstant */ + private $createsConstant; + + /** @var CreatesSegment */ + private $createsSegment; + + /** @var UpdatesConstantValue */ + private $updatesConstantValue; + + /** + * UpdateConstantLogic constructor. + * @param CanUpdateConstant $canUpdateConstant + * @param UpdatesConstant $updatesConstant + * @param FetchesSegment $fetchesSegment + * @param FetchesConstant $fetchesConstant + * @param CanCreateConstant $canCreateConstant + * @param CreatesConstant $createsConstant + * @param UpdatesConstantValueByState $updatesConstantValueByState + * @param CreatesSegment $createsSegment + */ + public function __construct( + CanUpdateConstant $canUpdateConstant, + UpdatesConstant $updatesConstant, + FetchesSegment $fetchesSegment, + FetchesConstant $fetchesConstant, + CanCreateConstant $canCreateConstant, + CreatesConstant $createsConstant, + UpdatesConstantValue $updatesConstantValue, + CreatesSegment $createsSegment + ) + { + $this->canUpdateConstant = $canUpdateConstant; + $this->updatesConstant = $updatesConstant; + $this->fetchesSegment = $fetchesSegment; + $this->fetchesConstant = $fetchesConstant; + $this->canCreateConstant = $canCreateConstant; + $this->createsConstant = $createsConstant; + $this->updatesConstantValue = $updatesConstantValue; + $this->createsSegment = $createsSegment; + } + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request) : JsonResponse + { + $segment = $this->fetchesSegment->execute(['id' => $request->route('id')]); + + try { + + $constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]); + + $object = new ConstantObject($request->input('reference'), [$request->input('value')]); + + $this->canUpdateConstant->passes($object); + + } catch (ResourceNotFoundException $exception){ + + $object = new ConstantObject( + $request->input('reference'), + [$request->input('value')] + ); + + $constant = $this->createsConstant->execute($segment, $object); + } + + $constant = $this->updatesConstant->execute($constant, $object); + + return $this->resourceResponse(new ConstantResource($constant)); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Transactions/ControllersLogic/ApprovePaymentTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/ApprovePaymentTransactionLogic.php index 5db49ddf..5fc9cc78 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/ApprovePaymentTransactionLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/ApprovePaymentTransactionLogic.php @@ -9,6 +9,8 @@ use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\Documents\Services\ApprovesDocument; use App\Classes\Modules\Documents\Services\FetchesDocument; use App\Classes\Modules\Documents\Services\RejectsDocument; +use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor; +use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor; use App\Classes\Modules\Transactions\Services\FetchesTransaction; use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus; @@ -20,20 +22,22 @@ use Illuminate\Http\Request; class ApprovePaymentTransactionLogic extends AbstractControllerLogic { /** - * ApprovePaymentVerificationLogic constructor. + * ApprovePaymentTransactionLogic constructor. * @param FetchesTransaction $fetchesTransaction * @param UpdatesTransactionStatus $updatesTransactionStatus * @param ApprovesDocument $approvesDocument * @param RejectsDocument $rejectsDocument - * @param FetchesDocument $fetchesDocument - * @param CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor + * @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor + * @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor */ - public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument) + public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor) { $this->fetchesTransaction = $fetchesTransaction; $this->updatesTransactionStatus = $updatesTransactionStatus; $this->approvesDocument = $approvesDocument; $this->rejectsDocument = $rejectsDocument; + $this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor; + $this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor; } /** @@ -58,10 +62,18 @@ class ApprovePaymentTransactionLogic extends AbstractControllerLogic /** @var RejectsDocument */ private $rejectsDocument; + /** @var UpdateDoFromVTPortalProcessor */ + private $updateDoFromVTPortalProcessor; + + /** @var UpdateDoFromYDPortalProcessor */ + private $updateDoFromYDPortalProcessor ; + /** * @param Request $request * @return JsonResponse + * @throws \App\Classes\Exceptions\InternalServerErrorException * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \GuzzleHttp\Exception\GuzzleException */ public function logic(Request $request) : JsonResponse { @@ -74,7 +86,25 @@ class ApprovePaymentTransactionLogic extends AbstractControllerLogic $this->updatesTransactionStatus->execute($transaction, $status === 'approve' ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED); - // $this->createInvoiceTransactionProcessor->execute($transaction->booking); + if($transaction->status === ApprovalStatus::APPROVED){ + $invoice = $transaction->owner; + $packingList = $invoice->owner; + + if($transaction->amount - $invoice->amount < 0.01) { + $this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED); + + $packingList->status = ApprovalStatus::APPROVED; + $packingList->save(); + + if(app()->environment('production')){ + $this->updateDoFromVTPortalProcessor->execute($packingList); + $this->updateDoFromYDPortalProcessor->execute($packingList); + } + } + + } + + return $this->response([]); } 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/Classes/Modules/Transactions/ControllersLogic/CreatePaymentTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/CreatePaymentTransactionLogic.php index 04de4090..8ba7b2c8 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/CreatePaymentTransactionLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/CreatePaymentTransactionLogic.php @@ -18,6 +18,7 @@ use App\Classes\ValueObjects\Constants\TransactionType; use App\Classes\ValueObjects\Constants\PaymentMethodType; use App\Classes\ValueObjects\Constants\ApprovalStatus; +use App\Http\Resources\TransactionResource; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; @@ -83,7 +84,7 @@ class CreatePaymentTransactionLogic extends AbstractControllerLogic $payment_method = PaymentMethodType::PAYMENT_GATEWAY; $billPlzBill = $this->createsBillplzBill->execute( $company_module->name, - $company_module->employees()->first()->email, + (app()->environment(['production'])) ? $company_module->employees()->first()->email : 'uldvstar@gmail.com', 'This payment is for the invoice number . ' . $invoice_transaction->bill_no, $amount, $billNumber, @@ -119,6 +120,6 @@ class CreatePaymentTransactionLogic extends AbstractControllerLogic $payment_transaction = $this->createsPaymentTransaction->execute($invoice_transaction, $object); - return $this->response([]); + return $this->resourceResponse(new TransactionResource($payment_transaction)); } } diff --git a/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php index 50b6165f..6715133b 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php @@ -16,6 +16,7 @@ use App\Classes\Modules\Transactions\DataTransferObjects\TransactionDetailObject use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject; use App\Classes\ValueObjects\Constants\OrderRoleTypes; +use App\Classes\ValueObjects\Constants\PackingListType; use App\Classes\ValueObjects\Constants\TransactionType; use App\Classes\ValueObjects\Constants\PaymentMethodType; use App\Classes\ValueObjects\Constants\ApprovalStatus; @@ -25,6 +26,7 @@ use App\Classes\ValueObjects\Constants\SegmentConstants; use App\Classes\ValueObjects\Constants\TransactionDetailType; use App\Models\Document; +use App\Models\PackingList; use App\Models\Transaction; use Carbon\Carbon; use Illuminate\Http\JsonResponse; @@ -91,16 +93,23 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic public function logic(Request $request) : JsonResponse { $packing_list = $this->fetchesPackingList->execute(['id' => $request->input('packing_list_id')]); + $packing_list = PackingList::where('reference', $packing_list->reference)->where('type', PackingListType::SHIPPING_PACKING_LIST)->first(); - $cbm = $packing_list->packages->where('type', '!=', PackageType::OVER_WEIGHT)->sum(function($package) { + $billable_packing_list = $packing_list->packingLists()->first(); + + $billable_packing_list = $billable_packing_list ? $billable_packing_list : $packing_list; + + $cbm = $billable_packing_list->packages->where('type', '!=', PackageType::OVER_WEIGHT)->sum(function($package) { return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity); }); - $over_weight_cbm = $packing_list->packages->where('type', PackageType::OVER_WEIGHT)->sum(function($package) { + $over_weight_cbm = $billable_packing_list->packages->where('type', PackageType::OVER_WEIGHT)->sum(function($package) { return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity); }); $order = $packing_list->owner; + $companyModule = $order->companyModule; + $connection = $companyModule->connections()->first(); $address = $order->addresses()->first(); $base_price_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::BASE_PRICE]); @@ -109,12 +118,22 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic $center_postcode_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::CENTER_POSTCODE]); $outstation_postcode_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::OUTSTATION_POSTCODE]); + $noMinimumCharge = $connection->segments()->where('segments.id', 2)->first(); + $base_price = 0; $warehouse_rate = 0; $state_rate = 0; + $minimum_cbm = 0.3; + $segment_price = 0; $state_select = ''; - $base_price = $this->getConstantByKey($base_price_constant, date('Y-m-d')); + $segment_price = $connection->segments()->whereHas('constants')->get()->map(function($segment){ + return (float) $segment->constants()->first()->value[0]; + })->sort()->first(); + $segment_price = $segment_price ? $segment_price : 0; + + $packing_list_drop_date = PackingList::where('reference', $packing_list->reference)->where('type', 1)->first()->transports->first()->drop_date->format('Y-m-d'); + $base_price = $this->getConstantByKey($base_price_constant, $packing_list_drop_date); $warehouseId = $order->orderRoles()->where('role_id', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->company_module_id; $selected_warehouse_rate = $this->getConstantByKey($warehouse_rate_constant, $warehouseId); @@ -130,8 +149,42 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic $state_rate_constant = (array)$state_rate_constant; $state_rate = $state_select == '' ? 0 : $state_rate_constant[$state_select]; - $price_cbm = $base_price + $warehouse_rate + $state_rate; - $total_cbm = $price_cbm * ($cbm + $over_weight_cbm); + $container = $packing_list->containers()->first(); + $containerPackingLists = collect(); + $hasMinimumCharge = null; + + foreach ($container->packingLists as $packingList){ + if($packingList->owner->companyModule->id !== $companyModule->id) continue; + $containerPackingLists->push($packingList); + + if(!$hasMinimumCharge) { + $hasMinimumCharge = $packingList->transactions()->whereHas('transactionDetails', function ($query){ + $query->where('reference', 'MIN_CBM_CHARGES'); + })->first(); + } + + } + + $totalContainerCbm = $containerPackingLists->sum(function($packingList){ + $billable_packing_list = $packingList->packingLists()->first(); + $billable_packing_list = $billable_packing_list ? $billable_packing_list : $packingList; + return $billable_packing_list->packages->where('type', '!=', PackageType::OVER_WEIGHT)->sum(function($package) { + return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity); + }); + }); + + $minimum_charge = $minimum_cbm - $totalContainerCbm; + $minimum_charge = $minimum_charge < 0 ? 0 : $minimum_charge; + $minimum_charge = $noMinimumCharge ? 0 : $minimum_charge; + + + if($hasMinimumCharge) { + $minimum_charge = 0; + } + + $price_cbm = $base_price + $segment_price + $warehouse_rate + $state_rate; + + $total_cbm = $price_cbm * ($cbm + $minimum_charge + $over_weight_cbm); $billNumber = $this->generatesTransactionBillNumber->execute('SHIP-'); @@ -158,13 +211,13 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic $object_detail = new TransactionDetailObject( 'SHIPPING_FEE', - TransactionDetailType::SHIPPING_FEE, + TransactionDetailType::SHIPPING_FEE.'
'.round($packing_list->packages->sum('quantity'), 3).' CTNS - '.round($cbm, 3).' CBM', $cbm, $price_cbm ); $this->createsTransactionDetail->execute($invoice_transaction, $object_detail); - + if ($over_weight_cbm > 0) { $object_detail = new TransactionDetailObject( 'OVER_WEIGHT_CHARGES', @@ -176,6 +229,17 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic $this->createsTransactionDetail->execute($invoice_transaction, $object_detail); } + if ($minimum_charge > 0) { + $object_detail = new TransactionDetailObject( + 'MIN_CBM_CHARGES', + TransactionDetailType::MIN_CBM_CHARGES, + $minimum_charge, + $price_cbm + ); + + $this->createsTransactionDetail->execute($invoice_transaction, $object_detail); + } + return $this->response([]); } @@ -183,6 +247,7 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic if ($segmentConstantObject) { $base_rate = (array) $segmentConstantObject->value; $base_rate = array_key_exists($key, $base_rate) === true ? $base_rate[$key] : 0; + return $base_rate; } } diff --git a/app/Classes/Modules/Transactions/ControllersLogic/SuspendTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/SuspendTransactionLogic.php index e824547e..94ec6433 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/SuspendTransactionLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/SuspendTransactionLogic.php @@ -50,10 +50,10 @@ class SuspendTransactionLogic extends AbstractControllerLogic $transaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]); - $this->updatesTransactionStatus->execute($transaction, ApprovalStatus::SUSPENDED); - - return $this->response([]); + $transaction = $this->updatesTransactionStatus->execute($transaction, ApprovalStatus::SUSPENDED); + return $this->resourceResponse(new TransactionResource($transaction)); + } diff --git a/app/Classes/Modules/Transactions/ControllersLogic/UpdateShippingInvoiceTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/UpdateShippingInvoiceTransactionLogic.php index f60130ac..a9bc8f99 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/UpdateShippingInvoiceTransactionLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/UpdateShippingInvoiceTransactionLogic.php @@ -85,7 +85,7 @@ class UpdateShippingInvoiceTransactionLogic extends AbstractControllerLogic { $invoice_transaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]); - $old_transaction_details = $invoice_transaction->transactionDetails->whereNotIn('reference', ['SHIPPING_FEE', 'OVER_WEIGHT_CHARGES'])->pluck('id')->toArray(); + $old_transaction_details = $invoice_transaction->transactionDetails->whereNotIn('reference', ['SHIPPING_FEE', 'OVER_WEIGHT_CHARGES', 'MIN_CBM_CHARGES'])->pluck('id')->toArray(); $new_transaction_details = collect($request->input('transaction_details')); @@ -104,7 +104,7 @@ class UpdateShippingInvoiceTransactionLogic extends AbstractControllerLogic foreach($new_transaction_details as $transaction_detail){ $transaction_detail = (object) $transaction_detail; - if(!in_array($transaction_detail->reference, ['SHIPPING_FEE', 'OVER_WHEIGHT_CHARGES'])){ + if(!in_array($transaction_detail->reference, ['SHIPPING_FEE', 'OVER_WEIGHT_CHARGES', 'MIN_CBM_CHARGES'])){ $object_detail = new TransactionDetailObject( 'CUSTOM_CHARGES', isset($transaction_detail->name) ? $transaction_detail->name : TransactionDetailType::CUSTOM_CHARGES, @@ -117,8 +117,6 @@ class UpdateShippingInvoiceTransactionLogic extends AbstractControllerLogic }else{ $new_transaction_detail = $this->createsTransactionDetail->execute($invoice_transaction, $object_detail); } - - $total_cbm += $new_transaction_detail->amount; } } @@ -129,8 +127,8 @@ class UpdateShippingInvoiceTransactionLogic extends AbstractControllerLogic $invoice_transaction->issuer, 1, PaymentMethodType::CASH, - $total_cbm, - $total_cbm, + $invoice_transaction->transactionDetails()->sum('amount'), + $invoice_transaction->transactionDetails()->sum('amount'), 1, 1, 0, diff --git a/app/Classes/Modules/Transactions/ControllersLogic/UpdateTransactionStatusLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/UpdateTransactionStatusLogic.php new file mode 100644 index 00000000..1f6085e4 --- /dev/null +++ b/app/Classes/Modules/Transactions/ControllersLogic/UpdateTransactionStatusLogic.php @@ -0,0 +1,66 @@ + 'Update Transaction Status', + 'message' => 'You have successfully updated the Transaction Status' + ]; + } + + /** @var FetchesTransaction */ + private $fetchesTransaction; + + /** @var UpdatesTransactionStatus */ + private $updatesTransactionStatus; + + + /** + * SuspendTransactionLogic constructor. + * @param FetchesTransaction $fetchesTransaction + * @param UpdatesTransactionStatus $updatesTransactionStatus + */ + public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus) + { + $this->fetchesTransaction = $fetchesTransaction; + $this->updatesTransactionStatus = $updatesTransactionStatus; + } + + + public function logic(Request $request) : JsonResponse + { + $approvalArray = [ + 'approve' => ApprovalStatus::APPROVED, + 'expire' => ApprovalStatus::EXPIRED, + ]; + + $approvalStatus = $approvalArray[$request->route('status')]; + + $transaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]); + + $transaction = $this->updatesTransactionStatus->execute($transaction, $approvalStatus); + + return $this->resourceResponse(new TransactionResource($transaction)); + } + + + +} diff --git a/app/Classes/Modules/Transactions/Services/CreatesPaymentTransaction.php b/app/Classes/Modules/Transactions/Services/CreatesPaymentTransaction.php index 54afd914..98e02693 100644 --- a/app/Classes/Modules/Transactions/Services/CreatesPaymentTransaction.php +++ b/app/Classes/Modules/Transactions/Services/CreatesPaymentTransaction.php @@ -22,6 +22,7 @@ class CreatesPaymentTransaction extends AbstractUpdateRelationshipRecord $model->receiver = $object->getReceiver(); $model->recipient_bank_account_id = $object->getRecipientBankAccountId(); $model->payment_method = $object->getPaymentMethod(); + $model->payment_reference = $object->getPaymentReference(); $model->amount = $object->getAmount(); $model->original_amount = $object->getOriginalAmount(); $model->currency_id = $object->getCurrencyId(); diff --git a/app/Classes/ValueObjects/Constants/TransactionDetailType.php b/app/Classes/ValueObjects/Constants/TransactionDetailType.php index b3e1541c..69a15293 100644 --- a/app/Classes/ValueObjects/Constants/TransactionDetailType.php +++ b/app/Classes/ValueObjects/Constants/TransactionDetailType.php @@ -4,9 +4,11 @@ namespace App\Classes\ValueObjects\Constants; final class TransactionDetailType { - public const SHIPPING_FEE = 'Shipping Fee'; + public const SHIPPING_FEE = 'X1 Freight Service Charge'; - public const OVER_WEIGHT_CHARGES = 'Over weight charges'; + public const OVER_WEIGHT_CHARGES = 'Overweight Charges'; + + public const MIN_CBM_CHARGES = 'Minimum Charge for 0.3 CBM Per Container'; public const CUSTOM_CHARGES = 'Custom charges'; } diff --git a/app/Http/Controllers/Companies/AssignCompanyConnectionToConnectionSegmentController.php b/app/Http/Controllers/Companies/AssignCompanyConnectionToConnectionSegmentController.php index fab9e692..e22c554f 100644 --- a/app/Http/Controllers/Companies/AssignCompanyConnectionToConnectionSegmentController.php +++ b/app/Http/Controllers/Companies/AssignCompanyConnectionToConnectionSegmentController.php @@ -10,7 +10,7 @@ class AssignCompanyConnectionToConnectionSegmentController { /** * @param Request $request - * @param AssignCompanyToSegmentLogic $logic + * @param AssignCompanyConnectionToConnectionSegmentLogic $logic * @return JsonResponse */ public function assign(Request $request, AssignCompanyConnectionToConnectionSegmentLogic $logic): JsonResponse { diff --git a/app/Http/Controllers/Segments/UpdateSegmentPriceController.php b/app/Http/Controllers/Segments/UpdateSegmentPriceController.php new file mode 100644 index 00000000..4e403348 --- /dev/null +++ b/app/Http/Controllers/Segments/UpdateSegmentPriceController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Transactions/UpdateTransactionStatusController.php b/app/Http/Controllers/Transactions/UpdateTransactionStatusController.php new file mode 100644 index 00000000..56ed9868 --- /dev/null +++ b/app/Http/Controllers/Transactions/UpdateTransactionStatusController.php @@ -0,0 +1,21 @@ +execute($request); + } +} diff --git a/app/Http/Resources/AddressResource.php b/app/Http/Resources/AddressResource.php index f86d5c29..70461cd6 100644 --- a/app/Http/Resources/AddressResource.php +++ b/app/Http/Resources/AddressResource.php @@ -21,11 +21,11 @@ class AddressResource extends JsonResource $centerPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::CENTER_POSTCODE)->get(); $centerPostcodeConstant = $centerPostcodeConstantObject->isEmpty() ? [] : (array)$centerPostcodeConstantObject->first()->value; - $postcodeArea = in_array($this->postcode, $centerPostcodeConstant) ? 'CENTER_POSTCODE' : ''; + $postcodeArea = in_array((String)$this->postcode, $centerPostcodeConstant) ? 'CENTER_POSTCODE' : null; $outstationPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::OUTSTATION_POSTCODE)->get(); $outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value; - in_array($this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : ''; + in_array((String)$this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : null; return [ 'id' => $this->id, @@ -34,6 +34,7 @@ class AddressResource extends JsonResource 'street_two' => $this->street_two, 'district' => $this->district, 'state' => $this->state, + 'postcode' => $this->postcode, 'post_code' => $this->postcode, 'post_code_area' => $postcodeArea, 'country' => $this->country, @@ -41,6 +42,7 @@ class AddressResource extends JsonResource 'status' => (int) $this->status, 'contact' => new ContactResource($this->contacts->first()), 'remark' => new RemarkResource($this->remarks->first()), + 'type' => $this->type, $this->mergeWhen($this->relationLoaded('owner'), [ 'owner' => $this->when($this->owner instanceof Order, [ 'reference' => $this->owner->reference, diff --git a/app/Http/Resources/CompanyModuleResource.php b/app/Http/Resources/CompanyModuleResource.php index 51c651f7..22a0557d 100644 --- a/app/Http/Resources/CompanyModuleResource.php +++ b/app/Http/Resources/CompanyModuleResource.php @@ -3,6 +3,7 @@ namespace App\Http\Resources; use App\Classes\Modules\Companies\Services\FetchesCompanyServices; +use App\Classes\ValueObjects\Constants\AddressType; use App\Classes\ValueObjects\Constants\BankAccountType; use App\Classes\ValueObjects\Constants\BusinessType; use App\Classes\ValueObjects\Constants\DocumentType; @@ -41,10 +42,12 @@ class CompanyModuleResource extends JsonResource 'name' => $this->name, 'reference' => $this->reference, 'address' => new AddressResource($defaultAddress), + 'billingAddress' => new AddressResource($this->addresses()->where('type', AddressType::BILLING)->first()), 'company' => new CompanyResource($this->whenLoaded('company')), 'remarks' => RemarkResource::collection($this->remarks), 'marking' => $marking, 'warehouseCharges' => array_key_exists($this->id, $segmentConstant) ? $segmentConstant[$this->id] : null, + 'connections' => $this->connections, ]; } diff --git a/app/Http/Resources/CompanyResource.php b/app/Http/Resources/CompanyResource.php index 8e27ab73..899a9405 100644 --- a/app/Http/Resources/CompanyResource.php +++ b/app/Http/Resources/CompanyResource.php @@ -27,6 +27,7 @@ class CompanyResource extends JsonResource 'type' => (int) $this->type, 'business_type' => (int) $this->business_type, 'status' => (int) $this->status, + 'segments' => SegmentResource::collection($companyModule->connections()->first()->segments), 'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())), 'employee' => new UserResource($companyModule->employees()->first()), 'company_module' => new CompanyModuleResource($companyModule), diff --git a/app/Http/Resources/OrderResource.php b/app/Http/Resources/OrderResource.php index d2c72930..cbdaeccb 100644 --- a/app/Http/Resources/OrderResource.php +++ b/app/Http/Resources/OrderResource.php @@ -46,6 +46,7 @@ class OrderResource extends JsonResource 'received_packages' => PackingListResource::collection($this->packingLists()->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('packages')->get()), ]; }), + 'invoices' => TransactionResource::collection($this->transactions()->whereNotIn('transactions.status', [0, 1])->get()), 'remarks' => RemarkResource::collection($this->remarks), 'created_at' => $this->created_at->format('d-m-Y') ]; 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/app/Http/Resources/SegmentResource.php b/app/Http/Resources/SegmentResource.php index a587a7ff..2ec22145 100644 --- a/app/Http/Resources/SegmentResource.php +++ b/app/Http/Resources/SegmentResource.php @@ -19,7 +19,7 @@ class SegmentResource extends JsonResource return [ 'id' => $this->id, 'name' => $this->name, - 'price' => $constant ? $constant->value : 0 + 'price' => $constant ? $constant->value[0] : 0 ]; } } diff --git a/app/Http/Resources/TransactionResource.php b/app/Http/Resources/TransactionResource.php index 27840ad8..563eedf0 100644 --- a/app/Http/Resources/TransactionResource.php +++ b/app/Http/Resources/TransactionResource.php @@ -26,6 +26,8 @@ class TransactionResource extends JsonResource 'type' => (int) $this->type, 'bill_no' => $this->bill_no, 'amount' => (double) $this->amount, + 'payment_method' => (int) $this->payment_method, + 'payment_reference' => $this->payment_reference, 'outstanding' => (double) $this->amount - ($this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount')), 'service_charge' => (double) $this->service_charge, 'tax' => (double) $this->tax, @@ -47,6 +49,7 @@ class TransactionResource extends JsonResource ->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::COMPLETED, ApprovalStatus::REJECTED]) ->get() ), + 'remarks' => RemarkResource::collection($this->remarks), 'expires_on' => Carbon::parse($this->expires_on)->format('d-m-Y h:s:i'), 'updated_at' => Carbon::parse($this->update_at)->format('d-m-Y') ]; diff --git a/app/Models/Order.php b/app/Models/Order.php index 352f46fb..312cd244 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -16,10 +16,13 @@ use Illuminate\Database\Eloquent\Relations\HasManyThrough; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\MorphMany; +use Staudenmeir\EloquentHasManyDeep\HasManyDeep; +use Staudenmeir\EloquentHasManyDeep\HasRelationships; class Order extends AbstractModel implements Addressable, Packable, Remarkable, Notifiable { use SoftDeletes; + use HasRelationships; protected $table = 'orders'; @@ -160,10 +163,10 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable, } /** - * @return morphMany + * @return hasManyDeep */ - // public function transactions(): morphMany - // { - // return $this->morphMany(Transaction::class, 'owner'); - // } + public function transactions(): hasManyDeep + { + return $this->hasManyDeep(Transaction::class, [PackingList::class], ['owner_id', 'owner_id'], ['id', 'id']); + } } diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index d2432941..8bca16ed 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Classes\General\Interfaces\Documentable; +use App\Classes\General\Interfaces\Remarkable; use App\Classes\General\Interfaces\Transactionable; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\TransactionType; @@ -12,9 +13,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\Relations\MorphTo; +use Illuminate\Database\Eloquent\SoftDeletes; -class Transaction extends AbstractModel implements Documentable, Transactionable +class Transaction extends AbstractModel implements Documentable, Transactionable, Remarkable { + use SoftDeletes; + protected $table = 'transactions'; public function owner(): morphTo @@ -122,4 +126,12 @@ class Transaction extends AbstractModel implements Documentable, Transactionable { return $query->whereIn('status', [ApprovalStatus::COMPLETED]); } + + /** + * @return MorphMany + */ + public function remarks(): morphMany + { + return $this->morphMany(Remark::class, 'owner'); + } } diff --git a/database/seeders/SegmentConstantsTableSeeder.php b/database/seeders/SegmentConstantsTableSeeder.php index ef47f580..159c8586 100644 --- a/database/seeders/SegmentConstantsTableSeeder.php +++ b/database/seeders/SegmentConstantsTableSeeder.php @@ -28,10 +28,7 @@ class SegmentConstantsTableSeeder extends Seeder $today = date("Y-m-d"); $prices = []; for($ii=0; $ii<$n_days;$ii++){ - $prices[] = [ - "date" => date('Y-m-d', strtotime($today. ' + '.$ii.' days')), - "price" => rand(10, 30) / 10 - ]; + $prices[date('Y-m-d', strtotime($today. ' + '.$ii.' days'))] = rand(10, 30) / 10; } $this->insertData(1, SegmentConstants::BASE_PRICE, $prices); @@ -127,9 +124,7 @@ class SegmentConstantsTableSeeder extends Seeder $this->insertData(1, SegmentConstants::OUTSTATION_POSTCODE, $prices); // insert customer prices - $prices = [ - ['id'=> 1, 'price' => 15 ] - ]; + $prices = [15]; $this->insertData(2, SegmentConstants::CUSTOMER_RATE, $prices); } diff --git a/database/seeders/SegmentsTableSeeder.php b/database/seeders/SegmentsTableSeeder.php index 72545884..9eeca166 100644 --- a/database/seeders/SegmentsTableSeeder.php +++ b/database/seeders/SegmentsTableSeeder.php @@ -16,11 +16,11 @@ class SegmentsTableSeeder extends Seeder 'company_module_id' => 1, 'name' => 'Default Segment', ], - [ - 'id' => 2, - 'company_module_id' => 2, - 'name' => 'Normal Member', - ], + [ + 'id' => 2, + 'company_module_id' => 1, + 'name' => 'No Minimum Charge', + ] ] ); } diff --git a/resources/assets/images/fpx-logo-vector-01.png b/resources/assets/images/fpx-logo-vector-01.png new file mode 100644 index 00000000..e46fd21d Binary files /dev/null and b/resources/assets/images/fpx-logo-vector-01.png differ diff --git a/resources/assets/vue/components/addresses/elements/SelectAddressComponent.vue b/resources/assets/vue/components/addresses/elements/SelectAddressComponent.vue index 492abb73..9b1e597e 100644 --- a/resources/assets/vue/components/addresses/elements/SelectAddressComponent.vue +++ b/resources/assets/vue/components/addresses/elements/SelectAddressComponent.vue @@ -52,8 +52,9 @@ value: { required: false }, - 'section': { + section: { type: String, + default: 'addressSection' } }, diff --git a/resources/assets/vue/components/announcements/elements/AnnouncementListComponent.vue b/resources/assets/vue/components/announcements/elements/AnnouncementListComponent.vue new file mode 100644 index 00000000..0e935c50 --- /dev/null +++ b/resources/assets/vue/components/announcements/elements/AnnouncementListComponent.vue @@ -0,0 +1,133 @@ + + + \ No newline at end of file diff --git a/resources/assets/vue/components/announcements/forms/AssignAnnouncementToSegmentFormComponent.vue b/resources/assets/vue/components/announcements/forms/AssignAnnouncementToSegmentFormComponent.vue new file mode 100644 index 00000000..2763f650 --- /dev/null +++ b/resources/assets/vue/components/announcements/forms/AssignAnnouncementToSegmentFormComponent.vue @@ -0,0 +1,68 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/announcements/forms/DetachAnnouncementFromSegmentFormComponent.vue b/resources/assets/vue/components/announcements/forms/DetachAnnouncementFromSegmentFormComponent.vue new file mode 100644 index 00000000..5ac5bd36 --- /dev/null +++ b/resources/assets/vue/components/announcements/forms/DetachAnnouncementFromSegmentFormComponent.vue @@ -0,0 +1,48 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/announcements/forms/ViewAnnouncementFormComponent.vue b/resources/assets/vue/components/announcements/forms/ViewAnnouncementFormComponent.vue new file mode 100644 index 00000000..40a46cc8 --- /dev/null +++ b/resources/assets/vue/components/announcements/forms/ViewAnnouncementFormComponent.vue @@ -0,0 +1,51 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/announcements/sections/AnnouncementQuickViewSectionComponent.vue b/resources/assets/vue/components/announcements/sections/AnnouncementQuickViewSectionComponent.vue new file mode 100644 index 00000000..a40ec4c8 --- /dev/null +++ b/resources/assets/vue/components/announcements/sections/AnnouncementQuickViewSectionComponent.vue @@ -0,0 +1,55 @@ + + + \ No newline at end of file diff --git a/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue b/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue index 512fa04d..c8338065 100644 --- a/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue +++ b/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue @@ -30,6 +30,32 @@ +
+
+
+ +
+
+
+
+
+ {{segment.name}} + +
+ + + +
+
+
+ + + +
+
diff --git a/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue b/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue new file mode 100644 index 00000000..ba9d7a22 --- /dev/null +++ b/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue @@ -0,0 +1,73 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/companies/forms/DetachSegmentFormComponent.vue b/resources/assets/vue/components/companies/forms/DetachSegmentFormComponent.vue new file mode 100644 index 00000000..7bd5bd74 --- /dev/null +++ b/resources/assets/vue/components/companies/forms/DetachSegmentFormComponent.vue @@ -0,0 +1,48 @@ + + \ No newline at end of file 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/orders/sections/OrderProfileSectionComponent.vue b/resources/assets/vue/components/orders/sections/OrderProfileSectionComponent.vue index a0880e40..0b48c640 100644 --- a/resources/assets/vue/components/orders/sections/OrderProfileSectionComponent.vue +++ b/resources/assets/vue/components/orders/sections/OrderProfileSectionComponent.vue @@ -134,6 +134,23 @@
+ +
+
+
+
+

Invoices

+

You can view your invoices here and make payment.

+
+
+
+
+ +
+
+
+
+
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 535ecfdc..5daf62f7 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue @@ -9,11 +9,15 @@
{{item.order.company_module.marking}}/{{item.order.reference}} -

{{item.receive_packing_list.transport.drop_date}}

+

{{item.loading_days_ago}}

-
Unclaimed Packing List
+
Unclaimed Packing List
+
+

Container

+
{{item.packages[0].container.container_reference}}
+

Invoice Date

n/a
@@ -28,7 +32,7 @@
n/a
MYR {{ item.shippng_transaction.amount.toFixed(2) }}
-
+
@@ -53,7 +57,24 @@
-
Generate Invoice
+
+
+
Add Billing Address
+ + + +
+
+
Define Location
+ + + +
+
Generate Invoice
+
+
+ +
@@ -65,19 +86,23 @@
-
+

Container Reference

-
{{ item.packages.length ? item.packages[0].container.container_reference : 'n/a' }}
+
{{ item.packages[0].container ? item.packages[0].container.container_reference : 'n/a' }}
+
n/a

Due Date

-
{{ item.packages[0].container.transport.drop_date == null ? item.packages[0].container.transport.current_schedule.etd : item.packages[0].container.transport.drop_date }}
+
+
{{ item.packages[0].container.transport.drop_date == null ? item.packages[0].container.transport.current_schedule.etd : item.packages[0].container.transport.drop_date }}
+
n/a
+
n/a
n/a
@@ -165,7 +190,7 @@
MYR {{(Math.round((item.shippng_transaction.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
-
+
Paid Total:
@@ -174,7 +199,7 @@
Paid Total
-
+
Floating Amount:
@@ -191,8 +216,7 @@
MYR {{(Math.round((item.shippng_transaction.outstanding + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
- -
+
Make Payment
diff --git a/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingComponent.vue new file mode 100644 index 00000000..25e29424 --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingComponent.vue @@ -0,0 +1,220 @@ + + diff --git a/resources/assets/vue/components/paymentsBilling/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/PaymentHistoryComponent.vue index c76c9a07..7244fe17 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/PaymentHistoryComponent.vue @@ -9,7 +9,7 @@
Status
- {{ item.status === 1 ? 'Pending Verification' : item.status === ( 4 || 5) ? 'Rejected' : 'Processing Payment'}} + {{ item.status === 1 ? 'Pending Verification' : item.status === ( 4 || 5) ? 'Rejected' : 'Approved'}}
diff --git a/resources/assets/vue/components/paymentsBilling/forms/BillingAddressFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/BillingAddressFormComponent.vue new file mode 100644 index 00000000..c21a88b4 --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/forms/BillingAddressFormComponent.vue @@ -0,0 +1,66 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/paymentsBilling/forms/CustomerInvoiceRemarkFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/CustomerInvoiceRemarkFormComponent.vue new file mode 100644 index 00000000..b767c07e --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/forms/CustomerInvoiceRemarkFormComponent.vue @@ -0,0 +1,75 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/paymentsBilling/forms/DeleteDisputeFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/DeleteDisputeFormComponent.vue new file mode 100644 index 00000000..bd3d00d7 --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/forms/DeleteDisputeFormComponent.vue @@ -0,0 +1,33 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/paymentsBilling/forms/InvoiceItemFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/InvoiceItemFormComponent.vue index 6243f19c..b32e2b49 100644 --- a/resources/assets/vue/components/paymentsBilling/forms/InvoiceItemFormComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/forms/InvoiceItemFormComponent.vue @@ -21,12 +21,12 @@

Total

{{currency}} {{(Math.round((productTotal + Number.EPSILON) * 100) / 100).toFixed(2)}}

-
+
-
+
@@ -59,8 +59,6 @@
-

{{ data }}

-

Total

diff --git a/resources/assets/vue/components/paymentsBilling/forms/PaymentFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/PaymentFormComponent.vue index 72d56a03..8f02c823 100644 --- a/resources/assets/vue/components/paymentsBilling/forms/PaymentFormComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/forms/PaymentFormComponent.vue @@ -3,16 +3,67 @@
-

Outstanding: MYR {{ data.outstanding.toFixed(2) }}

- - - - - - -
+

Make Payment

+
- +
+
+
+
+ {{error}} +
+
+
+
+ + + + +
+
+
+
+
MYR
+
+
+
+
+
+
+
+
+
+
+
+ logo +
+

Online Banking

+
+
+
+
+
+
+
+ +
+

Manual Transfer

+
+
+
+
+
+
+
+
+
+
+
Cancel
+
+
+
Proceed
+
+
@@ -29,8 +80,15 @@ return { parameters : { amount: this.data.outstanding.toFixed(2), - transaction_id: this.data.id - } + transaction_id: this.data.id, + payment_method: '', + }, + paymentMethod: { + name: '', + id: '', + status: false + }, + error: '', } }, validations: { @@ -40,7 +98,23 @@ }, methods:{ submitForm(){ + this.parameters.payment_method = this.paymentMethod.id === 'payment_gateway' ? 5 : ''; this.submit(this.route('api.transaction.payment.create'), 'post', this.section, true, true); + }, + updatePaymentType(payment){ + this.paymentMethod = { + name: payment.name, + id: payment.id, + status: false, + } + this.error = ''; + }, + successHandler(response){ + if (response.payload) { + if (response.payload.data.payment_method === 5) { + window.location.href = this.route('billplz.bill', response.payload.data.payment_reference) + '?auto_submit=true'; + } + } } }, mixins: [formHandler] diff --git a/resources/assets/vue/components/paymentsBilling/forms/RegenerateDisputeInvoiceFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/RegenerateDisputeInvoiceFormComponent.vue new file mode 100644 index 00000000..547505a0 --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/forms/RegenerateDisputeInvoiceFormComponent.vue @@ -0,0 +1,46 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue index 8a759b4e..840c2009 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -102,7 +102,7 @@
- + diff --git a/resources/assets/vue/components/settings/elements/SegmentComponent.vue b/resources/assets/vue/components/settings/elements/SegmentComponent.vue index 0c0e8866..ceb8ca29 100644 --- a/resources/assets/vue/components/settings/elements/SegmentComponent.vue +++ b/resources/assets/vue/components/settings/elements/SegmentComponent.vue @@ -27,14 +27,14 @@
-
MYR {{item.price[data.id].amount}}
+
MYR {{item.price}}
-
+
-
+
- +
-
+
- +
@@ -50,7 +50,7 @@
Cancel
-
{{this.data?"Update":"Create"}}
+
{{data ? "Update" : "Create"}}
@@ -91,9 +91,6 @@ description: { required }, - // segment_id: { - // required - // }, starting_on:{ required }, @@ -101,26 +98,19 @@ required }, } - }, - computed:{ - }, created(){ - console.log("lado form"); + if (this.data) { + this.parameters.starting_on = this.data.starting_on; + this.parameters.ending_on = this.data.ending_on; + this.parameters.title = this.data.title; + this.parameters.description = this.data.description; + } }, methods: { submitForm(){ - //this.submit(route('api.announcement.create'), 'post', this.section, true, false); this.submit((this.data ? this.route('api.announcement.update', this.data.id) : this.route('api.announcement.create')), (this.data ? 'put' : 'post'), this.section, true, false) }, - // successHandler(response){ - // this.closeModal(); - // //this.formHandler(); - // this.resetForm(); - // }, - // errorHandler(error){ - // this.formHandler(error.message); - // } }, mixins: [ModalFormHandler], diff --git a/resources/assets/vue/components/settings/forms/BasePriceFormComponent.vue b/resources/assets/vue/components/settings/forms/BasePriceFormComponent.vue index 62d8deda..c77d5ebc 100644 --- a/resources/assets/vue/components/settings/forms/BasePriceFormComponent.vue +++ b/resources/assets/vue/components/settings/forms/BasePriceFormComponent.vue @@ -48,11 +48,6 @@ import { required } from "vuelidate/lib/validators"; export default { - props: { - section: { - default: '' - }, - }, data() { return { parameters: { diff --git a/resources/assets/vue/components/settings/forms/EditBasePriceFormComponent.vue b/resources/assets/vue/components/settings/forms/EditBasePriceFormComponent.vue index 742e95dc..086a9ea0 100644 --- a/resources/assets/vue/components/settings/forms/EditBasePriceFormComponent.vue +++ b/resources/assets/vue/components/settings/forms/EditBasePriceFormComponent.vue @@ -29,15 +29,6 @@ import { required } from "vuelidate/lib/validators"; export default { - props: { - data: { - type: Object, - required: false - }, - section: { - default: '' - }, - }, data() { return { parameters: { diff --git a/resources/assets/vue/components/settings/forms/EditSegmentPriceFormComponent.vue b/resources/assets/vue/components/settings/forms/EditSegmentPriceFormComponent.vue index df9bab4b..a6f613e3 100644 --- a/resources/assets/vue/components/settings/forms/EditSegmentPriceFormComponent.vue +++ b/resources/assets/vue/components/settings/forms/EditSegmentPriceFormComponent.vue @@ -6,10 +6,10 @@

Edit {{data.name}} Price

- +
- +
@@ -17,7 +17,7 @@
Cancel
-
Confirm
+
Confirm
@@ -28,31 +28,20 @@ import { required } from "vuelidate/lib/validators"; export default { - props: { - data: { - type: Object, - required: false - }, - section: { - default: '' - }, - }, data() { return { parameters: { reference: 'CUSTOM_PRICE', id: this.data.id, value : { - amount: this.data.price[this.data.id].amount + amount: this.data.price } } }; }, validations: { parameters: { - value: { - amount: { required } - } + value: { required } } }, mixins: [modalFormHandler] diff --git a/resources/views/layouts/base_pdf.blade.php b/resources/views/layouts/base_pdf.blade.php index ce46ac4f..8659c709 100644 --- a/resources/views/layouts/base_pdf.blade.php +++ b/resources/views/layouts/base_pdf.blade.php @@ -11,9 +11,135 @@ body { font-family: sun-extA; - padding: 0; } + .header { + margin-top: 5em; + } + + .separator { + text-align: right; + border-bottom: 0.5px solid black; + font-size: 0.7em; + } + + img.logo { + top: 10px; + } + + img { + height: 6em; + width: 9em; + } + + .title { + font-size: 2em; + font-weight: 1200; + } + + .details { + display: inline-block; + position: relative; + + } + + .sub-title { + font-size: 1.3em; + font-weight: bold; + } + + .label { + font-size: 1.1em; + font-weight: bold; + } + + .bill-to { + margin-top: 30px; + } + + table { + width: 100%; + vertical-align: top; + } + + th { + border-bottom: 1px solid black; + } + + td { + padding: 0.4em; + /* text-align: center; */ + } + + td.title { + text-align: left; + } + td.description, + th.description { + text-align: justify; + max-width: 40em; + } + + td.stock-code, + th.stock-code { + text-align: center; + } + + th { + vertical-align: middle; + } + + td, + th { + /* margin-top: 0.6em; + margin-right: 0.6em; */ + } + + .subtotal td { + border-top: 1px solid black; + } + + .total { + border-top: 1px solid black; + border-bottom: 3px double black; + font-weight: bolder; + } + + .address {} + + */ td.header-logo { + /* text-align: left; */ + width: fit-content; + } + + td.header-cief-address { + text-align: left; + margin-left: -30px; + } + + td.header-details { + text-align: left; + vertical-align: top; + } + + td.bill-to { + text-align: left; + } + + td.document-detail { + text-align: left; + border: 1px solid black; + padding: 1em 1em 1em 1em; + width: 16em; + } + + td.address { + text-align: left; + } + + .right { + text-align: right; + } diff --git a/resources/views/pages/paymentAndBilling.blade.php b/resources/views/pages/paymentAndBilling.blade.php index 59acb35b..21c8daf7 100644 --- a/resources/views/pages/paymentAndBilling.blade.php +++ b/resources/views/pages/paymentAndBilling.blade.php @@ -1,10 +1,7 @@ @extends('layouts.base_portal') @section('inner_content') -
-
- -
-
+
+
@@ -96,5 +93,47 @@
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
Dispute
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+ +
@endsection \ No newline at end of file diff --git a/resources/views/pages/payments_redirect.blade.php b/resources/views/pages/payments_redirect.blade.php index a648d8ee..58285751 100644 --- a/resources/views/pages/payments_redirect.blade.php +++ b/resources/views/pages/payments_redirect.blade.php @@ -28,23 +28,13 @@
Your Payment is Successful
-

Thank you for your payment. {{$transaction->owner instanceof \App\Models\Booking ? 'Your transfer request is now being processed and you will be notified once its complete.' : 'The amount paid has been successfully credited into your wallet.'}}

+

Thank you for your payment. The amount paid has been successfully applied to your invoice.

- @if($transaction->owner instanceof \App\Models\Booking) - -
Dashboard
-
- @endif - @if($transaction->owner instanceof \App\Models\Wallet) - -
Transaction History
-
- @endif -
{{$transaction->owner instanceof \App\Models\Booking ? 'Back to': 'Last'}} Order
+
Back to Order
@@ -65,7 +55,7 @@
Dashboard
-
{{$transaction->owner instanceof \App\Models\Booking ? 'Back to': 'Last'}} Booking
+
Back to Order
@@ -83,7 +73,7 @@
@php - $addresses = $invoice_transaction->owner->owner->addresses()->where('status', '=', 2)->first(); + $addresses = $companyModule->addresses()->where('status', '=', \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED)->where('type', '=', \App\Classes\ValueObjects\Constants\AddressType::BILLING)->first(); @endphp {{ $addresses->street_one }} {{ $addresses->street_two }} , @@ -82,53 +83,53 @@ No Description - Quantity - Unit Price (RM) - Total Amount
(RM) + Quantity + Unit Price (RM) + Total Amount
(RM) @foreach ($invoice_transaction->transactionDetails as $key => $transaction_detail) {{ $key + 1 }} - {{ $transaction_detail->name }} - {{ $transaction_detail->quantity }} - - {{ $transaction_detail->price }} + {!! $transaction_detail->name !!} + {{ round($transaction_detail->quantity, 3) }} + + {{ round($transaction_detail->price, 2) }} - {{ $transaction_detail->amount }} + {{ round($transaction_detail->amount, 2) }} @endforeach - + Subtotal - {{ number_format($invoice_transaction->amount, 2) }} + {{ round($invoice_transaction->amount, 2) }} - + Service Charges - {{ number_format($invoice_transaction->service_charge, 2) }} + {{ round($invoice_transaction->service_charge, 2) }} @if($invoice_transaction->tax > 0) - + Tax {{ number_format($invoice_transaction->tax, 2) }} @endif - + Total - {{ number_format($invoice_transaction->amount, 2) }} + {{ round($invoice_transaction->amount, 2) }} diff --git a/resources/views/pages/settings.blade.php b/resources/views/pages/settings.blade.php index 615f3eb3..e09653b0 100644 --- a/resources/views/pages/settings.blade.php +++ b/resources/views/pages/settings.blade.php @@ -3,7 +3,7 @@
-
+
@@ -171,7 +171,7 @@
-
+
@@ -285,7 +285,7 @@
- + diff --git a/resources/views/partials/menu.blade.php b/resources/views/partials/menu.blade.php index 42dd5141..952060c7 100644 --- a/resources/views/partials/menu.blade.php +++ b/resources/views/partials/menu.blade.php @@ -147,7 +147,7 @@
Shipping Queue
-
+
'company', 'as' => 'company.', 'namespace' => 'Compani Route::post('/team/create', 'AddNewMemberController@create')->name('team.create'); - Route::group(['prefix' => '{id}/segment', 'as' => 'segment.'], function () { - Route::post('/assign', 'AssignCompanyToSegmentController@assign')->name('assign'); - Route::delete('/detach/{segment_id}', 'RemoveCompanyFromSegmentController@detach')->name('detach'); - }); +// Route::group(['prefix' => '{id}/segment', 'as' => 'segment.'], function () { +// Route::post('/assign', 'AssignCompanyToSegmentController@assign')->name('assign'); +// Route::delete('/detach/{segment_id}', 'RemoveCompanyFromSegmentController@detach')->name('detach'); +// }); Route::group(['prefix' => '{id}/connection/{company_connection_id}', 'as' => 'connection.'], function () { Route::post('/assign', 'AssignCompanyConnectionToConnectionSegmentController@assign')->name('assign'); diff --git a/routes/segment.php b/routes/segment.php index caf8ff82..c59f4ca9 100644 --- a/routes/segment.php +++ b/routes/segment.php @@ -7,6 +7,7 @@ Route::group(['prefix' => 'segment', 'as' => 'segment.', 'namespace' => 'Segment Route::delete('/delete/{id}', 'DeleteSegmentController@destroy')->name('delete'); Route::get('/{id}/show', 'FetchSegmentController@fetch')->name('show'); Route::put('/update/{id}', 'UpdateSegmentController@update')->name('update'); + Route::put('price/update/{id}', 'UpdateSegmentPriceController@update')->name('price.update'); Route::get('/list', 'ListSegmentsController@list')->name('list'); Route::get('/air-shipment/item-price/list', 'ListAirShipmentPriceController@list')->name('air_shipment.price.list'); diff --git a/routes/transaction.php b/routes/transaction.php index 89545b7c..5da80295 100644 --- a/routes/transaction.php +++ b/routes/transaction.php @@ -6,6 +6,7 @@ Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' => Route::get('/list', 'ListTransactionsController@list')->name('list'); Route::delete('/suspend/{id}', 'SuspendTransactionController@suspend')->name('suspend'); + Route::put('{id}/status/update/{status}', 'UpdateTransactionStatusController@update')->where('status', 'approve|expire')->name('update'); Route::group(['prefix' => 'payment', 'as' => 'payment.'], function () { Route::post('/create', 'CreatePaymentTransactionController@create')->name('create'); diff --git a/routes/web.php b/routes/web.php index a81c8629..f36e304b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -418,4 +418,8 @@ Route::get('/payment-and-billing', function () { })->name('admin.payment-and-billing'); Route::get('/notifications/list', 'Notifications\ListNotificationsController@list')->name('notifications.list'); +Route::get('billplz/bills/{bill_no}', function($bill_no){ + return redirect(env('BILLPLZ_BASE_URL').'/bills/'.$bill_no); + })->name('billplz.bill'); + \ No newline at end of file diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php new file mode 100644 index 00000000..547152f6 --- /dev/null +++ b/tests/CreatesApplication.php @@ -0,0 +1,22 @@ +make(Kernel::class)->bootstrap(); + + return $app; + } +} diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php new file mode 100644 index 00000000..6d9e8a75 --- /dev/null +++ b/tests/Feature/ExampleTest.php @@ -0,0 +1,20 @@ +get('/swagger'); + + $response->assertStatus(200); + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php new file mode 100644 index 00000000..2932d4a6 --- /dev/null +++ b/tests/TestCase.php @@ -0,0 +1,10 @@ +assertTrue(true); + + } +}