pricing shipping list
This commit is contained in:
parent
d298649398
commit
d80b42c297
|
|
@ -65,4 +65,9 @@ AWS_USE_PATH_STYLE_ENDPOINT=false
|
|||
VITE_APP_NAME="${APP_NAME}"
|
||||
|
||||
|
||||
WMS_ASSET_URL="https://dev.smgdev.top/api/storage"
|
||||
WMS_ASSET_URL="https://dev.smgdev.top/api/storage"
|
||||
|
||||
|
||||
BITESHIP_URL=
|
||||
BITESHIP_KEY=
|
||||
BITESHIP_COURIER_ALL=grab,gojek,tiki,jnt,anteraja
|
||||
|
|
|
|||
|
|
@ -120,6 +120,9 @@ class LoginEmailController extends Controller
|
|||
'device' => 'web',
|
||||
]);
|
||||
|
||||
|
||||
Auth::login($check, true);
|
||||
|
||||
|
||||
|
||||
return redirect()->route('home')->with('success', __('otp.login_success'));
|
||||
|
|
|
|||
|
|
@ -115,6 +115,9 @@ class LoginWaController extends Controller
|
|||
'device' => 'web',
|
||||
]);
|
||||
|
||||
|
||||
Auth::login($check, true);
|
||||
|
||||
return redirect()->route('home')->with('success', __('otp.login_success'));
|
||||
|
||||
} catch (\Illuminate\Validation\ValidationException $e) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use App\Http\Controllers\Controller;
|
|||
use App\Models\Customer;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
|
@ -120,4 +121,13 @@ class ProfileController extends Controller
|
|||
return back()->with('error', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function logout(Request $request)
|
||||
{
|
||||
Auth::logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
return redirect()->route('login');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
|||
use App\Models\Address;
|
||||
use App\Models\Location;
|
||||
use App\Repositories\Member\Cart\MemberCartRepository;
|
||||
use App\Repositories\Member\ShippingRepository;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CheckoutController extends Controller
|
||||
|
|
@ -21,8 +22,14 @@ class CheckoutController extends Controller
|
|||
|
||||
|
||||
$total = $subtotal;
|
||||
|
||||
|
||||
|
||||
$carts = $memberCartRepository->getList($request);
|
||||
|
||||
|
||||
return view('checkout.v1-delivery-1', [
|
||||
'carts' => $request->user()->carts,
|
||||
'carts' => $carts,
|
||||
'subtotal' => $subtotal,
|
||||
'total' => $total,
|
||||
'store' => $store,
|
||||
|
|
@ -35,16 +42,17 @@ class CheckoutController extends Controller
|
|||
$delivery_method = $request->input('delivery_method') ?? 'shipping';
|
||||
$address_id = $request->input('address_id');
|
||||
|
||||
|
||||
if ($address_id == null) {
|
||||
$address_list = Address::where('user_id', $request->user()->id)->orderBy('is_primary','desc')->get();
|
||||
$address_id = $address_list->first()->id;
|
||||
}
|
||||
|
||||
if ($delivery_method == null || $address_id == null) {
|
||||
|
||||
return redirect()->back()->with('error', 'Delivery method or address is required');
|
||||
}
|
||||
|
||||
|
||||
if ($delivery_method == 'shipping') {
|
||||
session(['checkout_delivery_method' => $delivery_method]);
|
||||
session(['checkout_address_id' => $address_id]);
|
||||
|
|
@ -61,55 +69,39 @@ class CheckoutController extends Controller
|
|||
}
|
||||
|
||||
|
||||
public function chooseShipping(Request $request, MemberCartRepository $memberCartRepository)
|
||||
public function chooseShipping(Request $request, MemberCartRepository $memberCartRepository, ShippingRepository $shippingRepository)
|
||||
{
|
||||
try {
|
||||
$delivery_method = $request->input('delivery_method');
|
||||
$address_id = $request->input('address_id');
|
||||
$delivery_method = session('checkout_delivery_method');
|
||||
$address_id = session('checkout_address_id');
|
||||
|
||||
$subtotal = $memberCartRepository->getSubtotal($request->input('location_id'));
|
||||
$location_id = session('location_id', 22);
|
||||
|
||||
$subtotal = $memberCartRepository->getSubtotal($location_id);
|
||||
$total = $subtotal;
|
||||
|
||||
|
||||
|
||||
$shipping_list = [
|
||||
[
|
||||
'courier' => 'JNE',
|
||||
'service' => 'REG',
|
||||
'title' => 'JNE Regular',
|
||||
'cost' => 10000,
|
||||
],
|
||||
[
|
||||
'courier' => 'JNE',
|
||||
'service' => 'YES',
|
||||
'title' => 'JNE YES (Same Day)',
|
||||
'cost' => 25000,
|
||||
],
|
||||
[
|
||||
'courier' => 'J&T',
|
||||
'service' => 'EZ',
|
||||
'title' => 'J&T Express',
|
||||
'cost' => 12000,
|
||||
],
|
||||
[
|
||||
'courier' => 'SiCepat',
|
||||
'service' => 'REG',
|
||||
'title' => 'SiCepat Regular',
|
||||
'cost' => 11000,
|
||||
],
|
||||
[
|
||||
'courier' => 'Gojek',
|
||||
'service' => 'Same Day',
|
||||
'title' => 'Gojek Same Day',
|
||||
'cost' => 20000,
|
||||
],
|
||||
[
|
||||
'courier' => 'Grab',
|
||||
'service' => 'Instant',
|
||||
'title' => 'Grab Instant',
|
||||
'cost' => 22000,
|
||||
],
|
||||
];
|
||||
$request->merge(['location_id' => $location_id]);
|
||||
$carts = $memberCartRepository->getList($request);
|
||||
|
||||
$shipping_list = collect($shippingRepository->getList([
|
||||
"location_id" => $location_id,
|
||||
"address_id" => $address_id,
|
||||
"items" => $carts,
|
||||
])['pricing'])->map(function($row){
|
||||
return [
|
||||
'courier' => $row['courier_code'],
|
||||
'service' => $row['courier_service_code'],
|
||||
'title' => $row['courier_name']." - ".$row['courier_service_name'],
|
||||
'description' => $row['duration'],
|
||||
'cost' => $row['shipping_fee'],
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return view('checkout.v1-delivery-1-shipping', [
|
||||
'carts' => $request->user()->carts,
|
||||
|
|
@ -121,6 +113,8 @@ class CheckoutController extends Controller
|
|||
'shipping_list' => $shipping_list,
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
dd($e);
|
||||
|
||||
return redirect()->route('checkout.delivery')->with('error', 'Invalid checkout data');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class Rate
|
|||
$items = $params["items"];
|
||||
$sha1 = sha1(json_encode($items));
|
||||
|
||||
|
||||
$key = implode("_", [$origin_latitude, $origin_longitude, $destination_latitude, $destination_longitude, $sha1]);
|
||||
return Cache::remember("rates_".$key, 60 * 60 * 24, function()
|
||||
use ($origin_latitude,
|
||||
|
|
|
|||
|
|
@ -52,8 +52,7 @@
|
|||
for="shipping_{{ $loop->index }}">
|
||||
<div>
|
||||
<strong>{{ $shipping['title'] }}</strong>
|
||||
<div class="text-muted small">{{ $shipping['courier'] }} -
|
||||
{{ $shipping['service'] }}</div>
|
||||
<div class="text-muted small">{{ $shipping['description'] }}</div>
|
||||
</div>
|
||||
<div class="text-primary fw-bold">
|
||||
Rp {{ number_format($shipping['cost'], 0, ',', '.') }}
|
||||
|
|
|
|||
|
|
@ -71,8 +71,10 @@
|
|||
<option value="{{ $address->id }}"
|
||||
data-first-name="{{ $address->name }}" data-last-name=""
|
||||
data-address="{{ $address->address }}"
|
||||
data-city="{{ $address->city_name }}"
|
||||
data-state="{{ $address->province_name }}"
|
||||
data-city="{{ $address->city->name }}"
|
||||
data-district="{{ $address->district->name }}"
|
||||
data-subdistrict="{{ $address->subdistrict->name }}"
|
||||
data-state="{{ $address->province->name }}"
|
||||
data-postcode="{{ $address->postal_code }}"
|
||||
data-phone="{{ $address->phone }}"
|
||||
{{ $address->is_primary || $key === 0 ? 'selected' : '' }}>
|
||||
|
|
@ -162,7 +164,7 @@
|
|||
<form action="{{ route('checkout.delivery.process') }}" method="post">
|
||||
@csrf
|
||||
<input type="hidden" name="delivery_method" id="deliveryMethodInput" value="shipping">
|
||||
<input type="hidden" name="address_id" id="addressIdInput" value="">
|
||||
<input type="hidden" name="address_id" id="addressIdInput" value="{{ $address_list->first()->id }}">
|
||||
<button type="submit" class="btn btn-lg btn-primary w-100"
|
||||
id="continueButton">
|
||||
<span
|
||||
|
|
|
|||
|
|
@ -10,86 +10,7 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- Search offcanvas -->
|
||||
<div class="offcanvas offcanvas-top" id="searchBox" data-bs-backdrop="static" tabindex="-1">
|
||||
<div class="offcanvas-header border-bottom p-0 py-lg-1">
|
||||
<form class="container d-flex align-items-center">
|
||||
<input type="search" class="form-control form-control-lg fs-lg border-0 rounded-0 py-3 ps-0"
|
||||
placeholder="Search the products" data-autofocus="offcanvas">
|
||||
<button type="reset" class="btn-close fs-lg" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="offcanvas-body px-0">
|
||||
<div class="container text-center">
|
||||
<svg class="text-body-tertiary opacity-60 mb-4" xmlns="http://www.w3.org/2000/svg" width="60"
|
||||
viewBox="0 0 512 512" fill="currentColor">
|
||||
<path
|
||||
d="M340.115,361.412l-16.98-16.98c-34.237,29.36-78.733,47.098-127.371,47.098C87.647,391.529,0,303.883,0,195.765S87.647,0,195.765,0s195.765,87.647,195.765,195.765c0,48.638-17.738,93.134-47.097,127.371l16.98,16.98l11.94-11.94c5.881-5.881,15.415-5.881,21.296,0l112.941,112.941c5.881,5.881,5.881,15.416,0,21.296l-45.176,45.176c-5.881,5.881-15.415,5.881-21.296,0L328.176,394.648c-5.881-5.881-5.881-15.416,0-21.296L340.115,361.412z M195.765,361.412c91.484,0,165.647-74.163,165.647-165.647S287.249,30.118,195.765,30.118S30.118,104.28,30.118,195.765S104.28,361.412,195.765,361.412z M360.12,384l91.645,91.645l23.88-23.88L384,360.12L360.12,384z M233.034,233.033c5.881-5.881,15.415-5.881,21.296,0c5.881,5.881,5.881,15.416,0,21.296c-32.345,32.345-84.786,32.345-117.131,0c-5.881-5.881-5.881-15.415,0-21.296c5.881-5.881,15.416-5.881,21.296,0C179.079,253.616,212.45,253.616,233.034,233.033zM135.529,180.706c-12.475,0-22.588-10.113-22.588-22.588c0-12.475,10.113-22.588,22.588-22.588c12.475,0,22.588,10.113,22.588,22.588C158.118,170.593,148.005,180.706,135.529,180.706z M256,180.706c-12.475,0-22.588-10.113-22.588-22.588c0-12.475,10.113-22.588,22.588-22.588s22.588,10.113,22.588,22.588C278.588,170.593,268.475,180.706,256,180.706z" />
|
||||
</svg>
|
||||
<h6 class="mb-2">Your search results will appear here</h6>
|
||||
<p class="fs-sm mb-0">Start typing in the search field above to see instant search results.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('layouts.partials/offcanvas')
|
||||
|
||||
<!-- Bonuses info modal -->
|
||||
<div class="modal fade" id="bonusesModal" tabindex="-1" aria-labelledby="bonusesModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="bonusesModalLabel">My bonuses</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-sm-6 mb-4 mb-sm-0">
|
||||
<div class="position-relative bg-warning text-center rounded-4 overflow-hidden">
|
||||
<div class="position-relative z-1 py-3 px-4">
|
||||
<svg class="text-white opacity-75 mb-2" xmlns="http://www.w3.org/2000/svg"
|
||||
width="24" height="24" viewBox="0 0 16 16" fill="currentColor">
|
||||
<path
|
||||
d="M1.333 9.667H7.5V16h-5c-.64 0-1.167-.527-1.167-1.167V9.667zm13.334 0v5.167c0 .64-.527 1.167-1.167 1.167h-5V9.667h6.167zM0 5.833V7.5c0 .64.527 1.167 1.167 1.167h.167H7.5v-1-3H1.167C.527 4.667 0 5.193 0 5.833zm14.833-1.166H8.5v3 1h6.167.167C15.473 8.667 16 8.14 16 7.5V5.833c0-.64-.527-1.167-1.167-1.167z" />
|
||||
<path
|
||||
d="M8 5.363a.5.5 0 0 1-.495-.573C7.752 3.123 9.054-.03 12.219-.03c1.807.001 2.447.977 2.447 1.813 0 1.486-2.069 3.58-6.667 3.58zM12.219.971c-2.388 0-3.295 2.27-3.595 3.377 1.884-.088 3.072-.565 3.756-.971.949-.563 1.287-1.193 1.287-1.595 0-.599-.747-.811-1.447-.811z" />
|
||||
<path
|
||||
d="M8.001 5.363c-4.598 0-6.667-2.094-6.667-3.58 0-.836.641-1.812 2.448-1.812 3.165 0 4.467 3.153 4.713 4.819a.5.5 0 0 1-.495.573zM3.782.971c-.7 0-1.448.213-1.448.812 0 .851 1.489 2.403 5.042 2.566C7.076 3.241 6.169.971 3.782.971z" />
|
||||
</svg>
|
||||
<div class="h2 text-white pb-1 mb-2">100</div>
|
||||
<p class="fs-sm fw-medium text-white opacity-75 mb-0">1 bonus = 1$</p>
|
||||
</div>
|
||||
<div class="position-absolute bg-white bg-opacity-10 rounded-circle"
|
||||
style="top: -15px; right: -128px; width: 165px; height: 165px"></div>
|
||||
<div class="position-absolute bg-white bg-opacity-10 rounded-circle"
|
||||
style="top: -15px; left: -128px; width: 165px; height: 165px"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ul class="list-unstyled fs-sm m-0">
|
||||
<li class="d-flex align-items-center justify-content-between">
|
||||
Available:
|
||||
<span class="text-dark-emphasis fw-semibold ms-2">100</span>
|
||||
</li>
|
||||
<li class="d-flex align-items-center justify-content-between">
|
||||
Waiting activation:
|
||||
<span class="text-dark-emphasis fw-semibold ms-2">0</span>
|
||||
</li>
|
||||
<li class="d-flex align-items-center justify-content-between">
|
||||
Total:
|
||||
<span class="text-dark-emphasis fw-semibold ms-2">100</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('layouts.partials/navbar', ['account' => true])
|
||||
|
||||
<x-layout.header />
|
||||
<!-- Page content -->
|
||||
<main class="content-wrapper">
|
||||
<div class="container py-5 mt-n2 mt-sm-0">
|
||||
|
|
|
|||
|
|
@ -97,11 +97,13 @@
|
|||
</a>
|
||||
</nav>
|
||||
<nav class="list-group list-group-borderless pt-3">
|
||||
<a class="list-group-item list-group-item-action d-flex align-items-center"
|
||||
href="{{ route('second', ['account', 'signin']) }}">
|
||||
<i class="ci-log-out fs-base opacity-75 me-2"></i>
|
||||
{{ __('account_sidebar.log_out') }}
|
||||
</a>
|
||||
<form action="{{ route('profile.logout') }}" method="POST" class="d-inline">
|
||||
@csrf
|
||||
<button type="submit" class="list-group-item list-group-item-action d-flex align-items-center w-100 text-start border-0 bg-transparent">
|
||||
<i class="ci-log-out fs-base opacity-75 me-2"></i>
|
||||
{{ __('account_sidebar.log_out') }}
|
||||
</button>
|
||||
</form>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ Route::group(['prefix' => '/login/google'], function () {
|
|||
Route::get('/profile', [ProfileController::class, 'index'])->name('profile');
|
||||
Route::post('/profile', [ProfileController::class, 'update'])->name('profile.update');
|
||||
Route::put('/profile/password', [ProfileController::class, 'updatePassword'])->name('profile.password.update');
|
||||
|
||||
Route::post('/profile/logout', [ProfileController::class, 'logout'])->name('profile.logout');
|
||||
|
||||
Route::middleware(['auth'])->prefix('/addresses')->group(function () {
|
||||
Route::get('/', [AddressController::class, 'index'])->name('addresses');
|
||||
|
|
|
|||
Loading…
Reference in New Issue