diff --git a/app/Classes/Modules/Transactions/ControllersLogic/ShippingEstimationCalculatorLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/ShippingEstimationCalculatorLogic.php new file mode 100644 index 00000000..165b680b --- /dev/null +++ b/app/Classes/Modules/Transactions/ControllersLogic/ShippingEstimationCalculatorLogic.php @@ -0,0 +1,54 @@ + 'Shipping estimation', + 'message' => 'You have successfully calculate the Shipping Estimation' + ]; + } + + public function __construct(){} + + public function logic(Request $request) : JsonResponse + { + + $base_price = 0; + $warehouse_rate = 0; + $state_rate = 0; + $state_select = ''; + + $width = $request->input('width') / 100; // metre + $length = $request->input('length') / 100; // metre + $height = $request->input('height') / 100; // metre + + $dimension = (float) ($width * $length * $height); + + return $this->response([ + 'width' => $width, 'length' => $length, 'height' => $height, + 'dimension' => $dimension + ]); + } + +} diff --git a/app/Http/Controllers/Transactions/ShippingEstimationCalculatorController.php b/app/Http/Controllers/Transactions/ShippingEstimationCalculatorController.php new file mode 100644 index 00000000..d83a49b6 --- /dev/null +++ b/app/Http/Controllers/Transactions/ShippingEstimationCalculatorController.php @@ -0,0 +1,20 @@ +execute($request); + } +} diff --git a/routes/transaction.php b/routes/transaction.php index c3e1b2f2..e5a64bc2 100644 --- a/routes/transaction.php +++ b/routes/transaction.php @@ -14,6 +14,8 @@ Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' => route::post('/shipping-invoice/create', 'CreateShippingInvoiceTransactionController@create')->name('supplier.create'); + route::post('/shipping-invoice/calculator', 'ShippingEstimationCalculatorController@calculate')->name('shipping.estimation.calculator'); + // Route::group(['prefix' => '{id}/payment', 'as' => 'payment.'], function () { // Route::post('quotation', 'FetchBookingPaymentQuotationController@fetch')->name('quotation'); // Route::post('create', 'CreateBookingPaymentController@create')->name('create');