182 lines
9.0 KiB
PHP
182 lines
9.0 KiB
PHP
@php use Carbon\Carbon; @endphp
|
|
@extends("admin.main")
|
|
@section("content")
|
|
@if(auth()->guard('admins')->user()->can("edit order"))
|
|
<div class="card card-outline card-primary">
|
|
<div class="card-body">
|
|
<div class="row form-group">
|
|
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
|
|
<tbody>
|
|
<tr>
|
|
<td class="fieldlabel">Date</td>
|
|
<td class="fieldarea">{{ Carbon::parse($order->date)->format("d/m/Y H:i:s") }}</td>
|
|
<td width="15%" class="fieldlabel">Payment Method</td>
|
|
<td class="fieldarea">{{ $order->payment->name ?? 'VN Pay' }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" class="fieldlabel">Order #</td>
|
|
<td class="fieldarea">{{ $order->order_num }} (ID: {{$order->id}})</td>
|
|
<td class="fieldlabel">Amount</td>
|
|
<td class="fieldarea">@money($order->amount) đ</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fieldlabel">Client</td>
|
|
<td class="fieldarea">
|
|
<a href="{{ route('customer.info',['userid' => $order->customer->id]) }}">{{ $order->customer->firstname . ' ' . $order->customer->lastname }}</a>
|
|
<br>
|
|
{{ $order->customer->address }}
|
|
</td>
|
|
<td class="fieldlabel">Invoice #</td>
|
|
<td class="fieldarea">{{ $order->invoice_id !== 0 ? $order->invoice_id : "No Invoice" }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fieldlabel">Status</td>
|
|
<td class="fieldarea">{!! App\Http\Helpers\Helper::OrderStatus($order->status) !!}</td>
|
|
<td class="fieldlabel">IP Address</td>
|
|
<td class="fieldarea">
|
|
{{ $order->client_ip }}
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="fieldlabel">Order Placed By</td>
|
|
<td class="fieldarea">
|
|
@if($order->user)
|
|
{{ $order->user->username }} (#ID: {{ $order->user->id }})
|
|
<em>{{ $order->user->email }}</em>
|
|
@endif
|
|
</td>
|
|
<td class="fieldlabel">Promotion Code</td>
|
|
<td class="fieldarea">
|
|
@if($order->discount)
|
|
{{ $order->discount->code }}
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="row form-group">
|
|
<div class="col-md-12">
|
|
<h3 class="mb-3">Order Item</h3>
|
|
<table class="table table-invoice table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>Item</th>
|
|
<th>Description</th>
|
|
<th>Billing Cycle</th>
|
|
<th>Amount</th>
|
|
<th style="width: 40px">Status</th>
|
|
<th>Payment Status</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@if($order->orderItem->isNotEmpty())
|
|
@foreach($order->orderItem->all() as $item)
|
|
<tr>
|
|
<td class="text-center">
|
|
@if($item->type && in_array($item->Type->id,[3,4]))
|
|
<a href="{{ route('customer.product',['userid' => $item->customer_id,'product' =>$item->relid,'type' => $item->type_id ]) }}">
|
|
{{ $item->type->name }}
|
|
</a>
|
|
@else
|
|
{{ $item->type->name }}
|
|
@endif
|
|
</td>
|
|
<td>
|
|
{{ $item->description }}
|
|
</td>
|
|
<td class="text-center">
|
|
{{ Helper::billing_cycle($item->billing) }}
|
|
</td>
|
|
<td class="text-center">
|
|
@money($item->amount) đ
|
|
</td>
|
|
<td class="text-center">
|
|
@if($item->status)
|
|
{!! $item->status->getStatus() !!}
|
|
@endif
|
|
</td>
|
|
|
|
<td class="text-center">
|
|
@if($order->invoice_id !== 0)
|
|
{!! $order->invoice->getStatus() !!}
|
|
@else
|
|
No Invoice Due
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
@if( $order->status !== 1)
|
|
<div class="row mt-2 form-group">
|
|
<div class="col-md-12">
|
|
<label class="box-input__checker">
|
|
<span>Auto Create Product (Hosting/VPS)</span>
|
|
<input type="checkbox" name="module_checker" checked="checked">
|
|
<span class="checkmark"></span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
<div class="card-footer text-center">
|
|
<form
|
|
onclick=" {{ $order->status === 1 ? "return false;" : "" }}"
|
|
class="d-lg-inline"
|
|
action="{{ route('admin.order.update',['id' => $order->id,'action' => 'accept']) }}"
|
|
method="post">
|
|
@method('put')
|
|
@csrf
|
|
<input type="hidden" name="module" value="1">
|
|
<button type="submit"
|
|
class="btn {{ $order->status === 1 ? "disabled" : "" }} bg-gradient-success">
|
|
<i class="far fa-check-circle"></i>
|
|
Accept Order
|
|
</button>
|
|
</form>
|
|
<form class="d-lg-inline"
|
|
action="{{ route('admin.order.update',['id' => $order->id,'action' => 'cancel']) }}"
|
|
method="post">
|
|
@method('put')
|
|
@csrf
|
|
<button type="submit"
|
|
class="btn bg-gradient-secondary">Cancel Order
|
|
</button>
|
|
</form>
|
|
<form class="d-lg-inline" action="{{ route('admin.order.destroy',['id' => $order->id]) }}"
|
|
method="post">
|
|
@method('delete')
|
|
@csrf
|
|
<button type="submit"
|
|
class="btn bg-gradient-danger">Delete Order
|
|
</button>
|
|
</form>
|
|
<a href="{{ route('admin.order.index') }}" class="btn bg-gradient-secondary">
|
|
Back
|
|
</a>
|
|
</div>
|
|
</div>
|
|
@else
|
|
<div class="alert alert-danger alert-dismissible">
|
|
<h5 class="mb-0"><i class="icon fas fa-ban"></i> Access Denied - You are not assigned to any Order
|
|
management department</h5>
|
|
</div>
|
|
@endif
|
|
|
|
@endsection
|
|
@push("scripts")
|
|
<script type="text/javascript">
|
|
$('.box-input__checker span').click(function () {
|
|
let inputModule = $('input[name="module"][type="hidden"]');
|
|
$('input[name="module_checker"]').prop('checked') ?
|
|
inputModule.val(0) :
|
|
inputModule.val(1)
|
|
});
|
|
</script>
|
|
@endpush
|