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')
|
||||
->where("status",'PENDING')
|
||||
->first();
|
||||
->where("status",'PENDING')
|
||||
->first();
|
||||
$invoice_url = $payment ? @$payment->method->invoice_url: "";
|
||||
|
||||
return redirect()->to($invoice_url)->withHeaders([
|
||||
|
|
|
|||
|
|
@ -16,4 +16,5 @@ class OrderController extends Controller
|
|||
|
||||
return view('account.orders', compact('orders'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,6 +104,19 @@ class Transaction extends Model
|
|||
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()
|
||||
{
|
||||
return $this->attributes['subtotal'] + $this->attributes['shipping_price'];
|
||||
|
|
|
|||
|
|
@ -61,4 +61,9 @@ class User extends Authenticatable
|
|||
{
|
||||
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";
|
||||
$key = env("XENDIT_PRIVATE_KEY");
|
||||
|
||||
|
||||
$payload['success_redirect_url'] = route('orders');
|
||||
$payload['failure_redirect_url'] = route('orders');
|
||||
|
||||
$res = Http::withBasicAuth($key, "")
|
||||
->withBody(json_encode($payload), 'application/json')
|
||||
->post($url);
|
||||
|
|
@ -21,4 +26,25 @@ class Xendit
|
|||
|
||||
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
|
||||
|
||||
return [
|
||||
'title' => 'Orders',
|
||||
'status' => [
|
||||
'wait_payment' => 'Wait Payment',
|
||||
'wait_process' => 'Wait Process',
|
||||
'on_process' => 'On Process',
|
||||
'on_delivery' => 'On Delivery',
|
||||
'closed' => 'Closed',
|
||||
],
|
||||
];
|
||||
|
|
@ -1,7 +1,12 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'title' => 'Pesanan',
|
||||
'status' => [
|
||||
'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="nav flex-nowrap align-items-center justify-content-between pb-1 mb-3">
|
||||
<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"
|
||||
data-bs-toggle="collapse" href=".basic-info">{{ __('account_info.edit') }}</a>
|
||||
data-bs-toggle="collapse" href=".basic-info">{{ __('account_info.edit') }}</a> --}}
|
||||
</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">
|
||||
<li>{{ auth()->user()->name }}</li>
|
||||
<li>{{ auth()->user()->email }}</li>
|
||||
{{-- <li>English</li> --}}
|
||||
|
||||
</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') }}">
|
||||
@csrf
|
||||
|
||||
|
|
@ -36,6 +36,7 @@
|
|||
<label class="form-label">{{ __('account_info.profile_photo') }}</label>
|
||||
<div class="d-flex align-items-center gap-4">
|
||||
<div class="position-relative">
|
||||
|
||||
<div class="avatar avatar-lg" style="aspect-ratio: 1/1; overflow: hidden; max-width: 300px; width: 100%; height: auto;">
|
||||
@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') }}'">
|
||||
|
|
@ -77,8 +78,8 @@
|
|||
<label class="form-label" for="phone">{{ __('account_info.phone_number') }}</label>
|
||||
<div class="position-relative">
|
||||
<input class="form-control"
|
||||
id="phone" name="phone" placeholder="" required="" type="text"
|
||||
value="{{ auth()->user()->phone ?? __('account_info.not_set') }}" />
|
||||
id="phone" name="phone" required="" type="text" placeholder="{{ __('account_info.not_set') }}"
|
||||
value="{{ auth()->user()->phone ?? '' }}" />
|
||||
<div class="invalid-feedback">{{ __('account_info.please_enter_phone_number') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -131,9 +132,9 @@
|
|||
<div class="col-12">
|
||||
<div class="d-flex gap-3 pt-2 pt-sm-0">
|
||||
<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"
|
||||
type="button">{{ __('account_info.close') }}</button>
|
||||
type="button">{{ __('account_info.close') }}</button> --}}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<!-- Page title + Sorting selects -->
|
||||
<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">
|
||||
<h1 class="h2 me-3 mb-0">Orders</h1>
|
||||
<h1 class="h2 me-3 mb-0">{{ __('order.title') }}</h1>
|
||||
</div>
|
||||
<div class="col-md-8 col-xl-6">
|
||||
<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">
|
||||
<li>{{ \Carbon\Carbon::parse($order->created_at)->format('d M Y') }}</li>
|
||||
<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 }}
|
||||
</li>
|
||||
<li class="fw-medium text-body-emphasis">Rp
|
||||
|
|
@ -136,25 +136,9 @@
|
|||
</table>
|
||||
</div>
|
||||
<!-- Pagination -->
|
||||
<nav aria-label="Page navigation example" class="pt-3 pb-2 pb-sm-0 mt-2 mt-md-3">
|
||||
<ul class="pagination">
|
||||
<li aria-current="page" class="page-item active">
|
||||
<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 class="pt-3 pb-2 pb-sm-0 mt-2 mt-md-3">
|
||||
{{ $orders->links() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
<li class="d-flex justify-content-between mb-1">
|
||||
No Resi:
|
||||
<span class="text-body-emphasis fw-medium text-end ms-2">
|
||||
{{ $order?->waybill_number ?? '-' }}
|
||||
{{ $order?->shipping?->waybill_id ?? '-' }}
|
||||
</span>
|
||||
</li>
|
||||
<li class="d-flex justify-content-between">
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
|
||||
@include('layouts.partials/account-sidebar')
|
||||
|
||||
@yield('content')
|
||||
@yield('content')
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@include('layouts.partials/footer')
|
||||
@include('layouts.partials/footer2')
|
||||
|
||||
@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('/terms-and-conditions', [TncController::class, 'index'])->name('terms-and-conditions');
|
||||
Route::get('/help', [HelpController::class, 'index'])->name('help');
|
||||
|
|
|
|||
Loading…
Reference in New Issue