fix waybill, transaction status
This commit is contained in:
parent
f547c6e158
commit
097c9f12ee
|
|
@ -188,8 +188,8 @@ class CheckoutController extends Controller
|
||||||
|
|
||||||
|
|
||||||
$payment = $item->payments()->where("method_type",'App\Models\XenditLink')
|
$payment = $item->payments()->where("method_type",'App\Models\XenditLink')
|
||||||
->where("status",'PENDING')
|
->where("status",'PENDING')
|
||||||
->first();
|
->first();
|
||||||
$invoice_url = $payment ? @$payment->method->invoice_url: "";
|
$invoice_url = $payment ? @$payment->method->invoice_url: "";
|
||||||
|
|
||||||
return redirect()->to($invoice_url)->withHeaders([
|
return redirect()->to($invoice_url)->withHeaders([
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,5 @@ class OrderController extends Controller
|
||||||
|
|
||||||
return view('account.orders', compact('orders'));
|
return view('account.orders', compact('orders'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,19 @@ class Transaction extends Model
|
||||||
return __('order.status.'.strtolower($this->attributes['status']));
|
return __('order.status.'.strtolower($this->attributes['status']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getStatusColorAttribute()
|
||||||
|
{
|
||||||
|
return match($this->attributes['status']) {
|
||||||
|
'wait_payment' => 'warning',
|
||||||
|
'wait_process' => 'info',
|
||||||
|
'on_process' => 'primary',
|
||||||
|
'on_delivery' => 'success',
|
||||||
|
'closed' => 'success',
|
||||||
|
'cancelled' => 'danger',
|
||||||
|
default => 'secondary',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public function getTotalAttribute()
|
public function getTotalAttribute()
|
||||||
{
|
{
|
||||||
return $this->attributes['subtotal'] + $this->attributes['shipping_price'];
|
return $this->attributes['subtotal'] + $this->attributes['shipping_price'];
|
||||||
|
|
|
||||||
|
|
@ -61,4 +61,9 @@ class User extends Authenticatable
|
||||||
{
|
{
|
||||||
return $this->hasMany(Address::class);
|
return $this->hasMany(Address::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPhotoUrlAttribute()
|
||||||
|
{
|
||||||
|
return $this->photo ? env('WMS_ASSET_URL') . '/' . $this->photo : asset('img/photo-placeholder.png');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,11 @@ class Xendit
|
||||||
|
|
||||||
$url = "https://api.xendit.co/v2/invoices";
|
$url = "https://api.xendit.co/v2/invoices";
|
||||||
$key = env("XENDIT_PRIVATE_KEY");
|
$key = env("XENDIT_PRIVATE_KEY");
|
||||||
|
|
||||||
|
|
||||||
|
$payload['success_redirect_url'] = route('orders');
|
||||||
|
$payload['failure_redirect_url'] = route('orders');
|
||||||
|
|
||||||
$res = Http::withBasicAuth($key, "")
|
$res = Http::withBasicAuth($key, "")
|
||||||
->withBody(json_encode($payload), 'application/json')
|
->withBody(json_encode($payload), 'application/json')
|
||||||
->post($url);
|
->post($url);
|
||||||
|
|
@ -21,4 +26,25 @@ class Xendit
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function checkInvoiceStatus(string $invoiceId)
|
||||||
|
{
|
||||||
|
$url = $this->baseUrl . "/v2/invoices/{$invoiceId}";
|
||||||
|
|
||||||
|
$res = Http::withBasicAuth($this->key, "")
|
||||||
|
->get($url);
|
||||||
|
|
||||||
|
if ($res->successful()) {
|
||||||
|
return $res->json();
|
||||||
|
}
|
||||||
|
|
||||||
|
Log::error("Xendit Check Invoice Failed", [
|
||||||
|
'invoice_id' => $invoiceId,
|
||||||
|
'status' => $res->status(),
|
||||||
|
'body' => $res->body()
|
||||||
|
]);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
'title' => 'Orders',
|
||||||
'status' => [
|
'status' => [
|
||||||
'wait_payment' => 'Wait Payment',
|
'wait_payment' => 'Wait Payment',
|
||||||
|
'wait_process' => 'Wait Process',
|
||||||
|
'on_process' => 'On Process',
|
||||||
|
'on_delivery' => 'On Delivery',
|
||||||
|
'closed' => 'Closed',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
'title' => 'Pesanan',
|
||||||
'status' => [
|
'status' => [
|
||||||
'wait_payment' => 'Menunggu Pembayaran',
|
'wait_payment' => 'Menunggu Pembayaran',
|
||||||
|
'wait_process' => 'Menunggu Diproses',
|
||||||
|
'on_process' => 'Sedang Diproses',
|
||||||
|
'on_delivery' => 'Sedang Dikirim',
|
||||||
|
'closed' => 'Selesai',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -10,19 +10,19 @@
|
||||||
<div class="border-bottom py-4">
|
<div class="border-bottom py-4">
|
||||||
<div class="nav flex-nowrap align-items-center justify-content-between pb-1 mb-3">
|
<div class="nav flex-nowrap align-items-center justify-content-between pb-1 mb-3">
|
||||||
<h2 class="h6 mb-0">{{ __('account_info.basic_info') }}</h2>
|
<h2 class="h6 mb-0">{{ __('account_info.basic_info') }}</h2>
|
||||||
<a aria-controls="basicInfoPreview basicInfoEdit" aria-expanded="false"
|
{{-- <a aria-controls="basicInfoPreview basicInfoEdit" aria-expanded="false"
|
||||||
class="nav-link hiding-collapse-toggle text-decoration-underline p-0 collapsed"
|
class="nav-link hiding-collapse-toggle text-decoration-underline p-0 collapsed"
|
||||||
data-bs-toggle="collapse" href=".basic-info">{{ __('account_info.edit') }}</a>
|
data-bs-toggle="collapse" href=".basic-info">{{ __('account_info.edit') }}</a> --}}
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse basic-info @if(session('error') || $errors->has('name') || $errors->has('email') || $errors->has('phone') || $errors->has('birth_date') || $errors->has('photo')) @else show @endif" id="basicInfoPreview">
|
{{-- <div class="collapse basic-info @if(session('error') || $errors->has('name') || $errors->has('email') || $errors->has('phone') || $errors->has('birth_date') || $errors->has('photo')) @else show @endif" id="basicInfoPreview">
|
||||||
<ul class="list-unstyled fs-sm m-0">
|
<ul class="list-unstyled fs-sm m-0">
|
||||||
<li>{{ auth()->user()->name }}</li>
|
<li>{{ auth()->user()->name }}</li>
|
||||||
<li>{{ auth()->user()->email }}</li>
|
<li>{{ auth()->user()->email }}</li>
|
||||||
{{-- <li>English</li> --}}
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div> --}}
|
||||||
|
|
||||||
<div class="collapse basic-info @if(session('error') || $errors->has('name') || $errors->has('email') || $errors->has('phone') || $errors->has('birth_date') || $errors->has('photo')) show @endif" id="basicInfoEdit">
|
<div class="collapse basic-info show" id="basicInfoEdit">
|
||||||
<form class="row g-3 g-sm-4 needs-validation" novalidate="" enctype="multipart/form-data" method="POST" action="{{ route('profile.update') }}">
|
<form class="row g-3 g-sm-4 needs-validation" novalidate="" enctype="multipart/form-data" method="POST" action="{{ route('profile.update') }}">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
<label class="form-label">{{ __('account_info.profile_photo') }}</label>
|
<label class="form-label">{{ __('account_info.profile_photo') }}</label>
|
||||||
<div class="d-flex align-items-center gap-4">
|
<div class="d-flex align-items-center gap-4">
|
||||||
<div class="position-relative">
|
<div class="position-relative">
|
||||||
|
|
||||||
<div class="avatar avatar-lg" style="aspect-ratio: 1/1; overflow: hidden; max-width: 300px; width: 100%; height: auto;">
|
<div class="avatar avatar-lg" style="aspect-ratio: 1/1; overflow: hidden; max-width: 300px; width: 100%; height: auto;">
|
||||||
@if(auth()->user()->photo)
|
@if(auth()->user()->photo)
|
||||||
<img src="{{ asset('storage/' . auth()->user()->photo) }}" alt="{{ auth()->user()->name }}" class="avatar-img rounded-circle" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.src='{{ asset('img/photo-placeholder.png') }}'">
|
<img src="{{ asset('storage/' . auth()->user()->photo) }}" alt="{{ auth()->user()->name }}" class="avatar-img rounded-circle" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.src='{{ asset('img/photo-placeholder.png') }}'">
|
||||||
|
|
@ -77,8 +78,8 @@
|
||||||
<label class="form-label" for="phone">{{ __('account_info.phone_number') }}</label>
|
<label class="form-label" for="phone">{{ __('account_info.phone_number') }}</label>
|
||||||
<div class="position-relative">
|
<div class="position-relative">
|
||||||
<input class="form-control"
|
<input class="form-control"
|
||||||
id="phone" name="phone" placeholder="" required="" type="text"
|
id="phone" name="phone" required="" type="text" placeholder="{{ __('account_info.not_set') }}"
|
||||||
value="{{ auth()->user()->phone ?? __('account_info.not_set') }}" />
|
value="{{ auth()->user()->phone ?? '' }}" />
|
||||||
<div class="invalid-feedback">{{ __('account_info.please_enter_phone_number') }}</div>
|
<div class="invalid-feedback">{{ __('account_info.please_enter_phone_number') }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -131,9 +132,9 @@
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="d-flex gap-3 pt-2 pt-sm-0">
|
<div class="d-flex gap-3 pt-2 pt-sm-0">
|
||||||
<button class="btn btn-primary" type="submit">{{ __('account_info.save_changes') }}</button>
|
<button class="btn btn-primary" type="submit">{{ __('account_info.save_changes') }}</button>
|
||||||
<button aria-controls="basicInfoPreview basicInfoEdit" aria-expanded="true"
|
{{-- <button aria-controls="basicInfoPreview basicInfoEdit" aria-expanded="true"
|
||||||
class="btn btn-secondary" data-bs-target=".basic-info" data-bs-toggle="collapse"
|
class="btn btn-secondary" data-bs-target=".basic-info" data-bs-toggle="collapse"
|
||||||
type="button">{{ __('account_info.close') }}</button>
|
type="button">{{ __('account_info.close') }}</button> --}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<!-- Page title + Sorting selects -->
|
<!-- Page title + Sorting selects -->
|
||||||
<div class="row align-items-center pb-3 pb-md-4 mb-md-1 mb-lg-2">
|
<div class="row align-items-center pb-3 pb-md-4 mb-md-1 mb-lg-2">
|
||||||
<div class="col-md-4 col-xl-6 mb-3 mb-md-0">
|
<div class="col-md-4 col-xl-6 mb-3 mb-md-0">
|
||||||
<h1 class="h2 me-3 mb-0">Orders</h1>
|
<h1 class="h2 me-3 mb-0">{{ __('order.title') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8 col-xl-6">
|
<div class="col-md-8 col-xl-6">
|
||||||
<div class="row row-cols-1 row-cols-sm-2 g-3 g-xxl-4">
|
<div class="row row-cols-1 row-cols-sm-2 g-3 g-xxl-4">
|
||||||
|
|
@ -89,7 +89,7 @@
|
||||||
<ul class="list-unstyled fw-normal text-body m-0 d-md-none">
|
<ul class="list-unstyled fw-normal text-body m-0 d-md-none">
|
||||||
<li>{{ \Carbon\Carbon::parse($order->created_at)->format('d M Y') }}</li>
|
<li>{{ \Carbon\Carbon::parse($order->created_at)->format('d M Y') }}</li>
|
||||||
<li class="d-flex align-items-center">
|
<li class="d-flex align-items-center">
|
||||||
<span class="bg-info rounded-circle p-1 me-2"></span>
|
<span class="bg-{{ $order->status_color }} rounded-circle p-1 me-2"></span>
|
||||||
{{ $order->status_title }}
|
{{ $order->status_title }}
|
||||||
</li>
|
</li>
|
||||||
<li class="fw-medium text-body-emphasis">Rp
|
<li class="fw-medium text-body-emphasis">Rp
|
||||||
|
|
@ -136,25 +136,9 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<!-- Pagination -->
|
<!-- Pagination -->
|
||||||
<nav aria-label="Page navigation example" class="pt-3 pb-2 pb-sm-0 mt-2 mt-md-3">
|
<div class="pt-3 pb-2 pb-sm-0 mt-2 mt-md-3">
|
||||||
<ul class="pagination">
|
{{ $orders->links() }}
|
||||||
<li aria-current="page" class="page-item active">
|
</div>
|
||||||
<span class="page-link">
|
|
||||||
1
|
|
||||||
<span class="visually-hidden">(current)</span>
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<li class="page-item">
|
|
||||||
<a class="page-link" href="#">2</a>
|
|
||||||
</li>
|
|
||||||
<li class="page-item">
|
|
||||||
<a class="page-link" href="#">3</a>
|
|
||||||
</li>
|
|
||||||
<li class="page-item">
|
|
||||||
<a class="page-link" href="#">4</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
<li class="d-flex justify-content-between mb-1">
|
<li class="d-flex justify-content-between mb-1">
|
||||||
No Resi:
|
No Resi:
|
||||||
<span class="text-body-emphasis fw-medium text-end ms-2">
|
<span class="text-body-emphasis fw-medium text-end ms-2">
|
||||||
{{ $order?->waybill_number ?? '-' }}
|
{{ $order?->shipping?->waybill_id ?? '-' }}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="d-flex justify-content-between">
|
<li class="d-flex justify-content-between">
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,13 @@
|
||||||
|
|
||||||
@include('layouts.partials/account-sidebar')
|
@include('layouts.partials/account-sidebar')
|
||||||
|
|
||||||
@yield('content')
|
@yield('content')
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
@include('layouts.partials/footer')
|
@include('layouts.partials/footer2')
|
||||||
|
|
||||||
@include('layouts.partials/back-to-top')
|
@include('layouts.partials/back-to-top')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,5 @@ Route::middleware(['auth'])->prefix('/orders')->group(function () {
|
||||||
Route::get('/', [OrderController::class, 'index'])->name('orders');
|
Route::get('/', [OrderController::class, 'index'])->name('orders');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/terms-and-conditions', [TncController::class, 'index'])->name('terms-and-conditions');
|
Route::get('/terms-and-conditions', [TncController::class, 'index'])->name('terms-and-conditions');
|
||||||
Route::get('/help', [HelpController::class, 'index'])->name('help');
|
Route::get('/help', [HelpController::class, 'index'])->name('help');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue