mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-22 05:54:08 +00:00
55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<?php
|
|
|
|
|
|
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
|
|
use App\Classes\ValueObjects\Constants\PackageType;
|
|
|
|
use App\Models\Document;
|
|
use App\Models\Transaction;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Illuminate\Support\Str;
|
|
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
|
|
|
|
class ShippingEstimationCalculatorLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => '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
|
|
]);
|
|
}
|
|
|
|
}
|