Customer's Cancer Order Endpoint Fixed

This commit is contained in:
devansh bawari 2021-07-06 13:29:41 +05:30
parent 3bd237e656
commit b8ccf82246
3 changed files with 38 additions and 4 deletions

View File

@ -281,7 +281,7 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
'view' => 'shop::customers.account.orders.print'
])->name('customer.orders.print');
Route::get('/orders/cancel/{id}', 'Webkul\Shop\Http\Controllers\OrderController@cancel')->name('customer.orders.cancel');
Route::post('/orders/cancel/{id}', 'Webkul\Shop\Http\Controllers\OrderController@cancel')->name('customer.orders.cancel');
/* Reviews route */
//Customer reviews

View File

@ -21,7 +21,11 @@
@if ($order->canCancel())
<a href="{{ route('customer.orders.cancel', $order->id) }}" class="btn btn-lg btn-primary" v-alert:message="'{{ __('shop::app.customer.account.order.view.cancel-confirm-msg') }}'" style="float: right;">
<form id="cancelOrderForm" action="{{ route('customer.orders.cancel', $order->id) }}" method="post">
@csrf
</form>
<a href="javascript:void(0);" class="btn btn-lg btn-primary" onclick="cancelOrder('{{ __('shop::app.customer.account.order.view.cancel-confirm-msg') }}')" style="float: right;">
{{ __('shop::app.customer.account.order.view.cancel-btn-title') }}
</a>
@endif
@ -560,3 +564,16 @@
</div>
@endsection
@push('scripts')
<script>
function cancelOrder(message) {
if (! confirm(message)) {
event.preventDefault();
return;
}
$('#cancelOrderForm').submit();
}
</script>
@endpush

View File

@ -28,7 +28,11 @@
@if ($order->canCancel())
<span class="account-action">
<a href="{{ route('customer.orders.cancel', $order->id) }}" class="theme-btn light unset float-right" v-alert:message="'{{ __('shop::app.customer.account.order.view.cancel-confirm-msg') }}'" style="float: right">
<form id="cancelOrderForm" action="{{ route('customer.orders.cancel', $order->id) }}" method="post">
@csrf
</form>
<a href="javascript:void(0);" class="theme-btn light unset float-right" onclick="cancelOrder('{{ __('shop::app.customer.account.order.view.cancel-confirm-msg') }}')" style="float: right">
{{ __('shop::app.customer.account.order.view.cancel-btn-title') }}
</a>
</span>
@ -579,4 +583,17 @@
{!! view_render_event('bagisto.shop.customers.account.orders.view.after', ['order' => $order]) !!}
</div>
</div>
@endsection
@endsection
@push('scripts')
<script>
function cancelOrder(message) {
if (! confirm(message)) {
event.preventDefault();
return;
}
$('#cancelOrderForm').submit();
}
</script>
@endpush