feat: Implement order management with datatable display and updated forms
This commit is contained in:
@@ -1,35 +1,42 @@
|
||||
@extends("administrator.layout.master")
|
||||
@section("content")
|
||||
@php use App\Enums\Product\ProductTypeEnums; @endphp
|
||||
@extends('administrator.layout.master')
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbItems = [
|
||||
['label' => 'Order'],
|
||||
['label' => 'Order Management', 'url' => route('administrator.pages.order.index')],
|
||||
['label' => 'Add New Order', 'active' => true],
|
||||
];
|
||||
@endphp
|
||||
<x-admin-breadcrumb :items="$breadcrumbItems" />
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
@if(auth()->guard('admins')->user()->can("add order"))
|
||||
<div class="card card-outline card-primary">
|
||||
<form action="{{ route('administrator.pages.order.store') }}" method="post">
|
||||
@csrf
|
||||
<div class="card-header p-0 border-bottom-0">
|
||||
<ul class="nav nav-tabs" id="custom-tabs-four-tab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill"
|
||||
href="#detail" role="tab"
|
||||
aria-controls="detail" aria-selected="true">Customer Information</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill"
|
||||
href="#product" role="tab"
|
||||
aria-controls="product" aria-selected="false">Product Service</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="tab-content" id="custom-tabs-four-tabContent">
|
||||
<div class="tab-pane fade active show"
|
||||
id="detail" role="tabpanel"
|
||||
aria-labelledby="detail">
|
||||
<div class="card-body">
|
||||
{{--Client User--}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-4" for="customer_id">Client User</label>
|
||||
<div class="col-md-8">
|
||||
<select class="form-control select2" name="customer_id" id="customer_id"
|
||||
style="width: 100%">
|
||||
<form action="{{ route('administrator.pages.order.store') }}" method="post">
|
||||
@csrf
|
||||
<div class="row align-items-start">
|
||||
<div class="col-md-8">
|
||||
<div class="card card-outline card-primary">
|
||||
<div class="card-header bg-white">
|
||||
<ul class="nav nav-tabs" id="custom-tabs-four-tab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-bs-toggle="tab" href="#detail" role="tab"
|
||||
aria-controls="detail" aria-selected="true">Customer Information</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="tab" href="#product" role="tab" aria-controls="product"
|
||||
aria-selected="false">Product Service</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="tab-content" id="custom-tabs-four-tabContent">
|
||||
<div class="tab-pane fade active show" id="detail" role="tabpanel" aria-labelledby="detail">
|
||||
<div class="form-group mb-3">
|
||||
<label for="customer_id">Client User</label>
|
||||
<select class="form-control select2" name="customer_id" id="customer_id">
|
||||
@if($customer->count())
|
||||
@foreach($customer->all() as $item)
|
||||
<option value="{{ $item->id }}">
|
||||
@@ -39,113 +46,78 @@
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{--Payment Method--}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-4" for="payment_id">Payment Method</label>
|
||||
<div class="col-md-8">
|
||||
<select class="form-control" name="payment_id" id="payment_id">
|
||||
<div class="form-group mb-3">
|
||||
<label for="payment_id">Payment Method</label>
|
||||
<select class="form-control select2" name="payment_id" id="payment_id">
|
||||
@if($payment->count())
|
||||
@foreach($payment->all() as $item)
|
||||
<option value="{{ $item->id }}">
|
||||
{{ $item->name }}
|
||||
</option>
|
||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{--Promotion Code--}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-4" for="discount_id">Promotion Code</label>
|
||||
<div class="col-md-8">
|
||||
<select class="form-control" name="discount_id" id="discount_id">
|
||||
<div class="form-group mb-3">
|
||||
<label for="discount_id">Promotion Code</label>
|
||||
<select class="form-control select2" name="discount_id" id="discount_id">
|
||||
<option value="">--------</option>
|
||||
@if($discount->count())
|
||||
@foreach($discount->all() as $item)
|
||||
<option value="{{ $item->id }}">
|
||||
{{ $item->code }}
|
||||
</option>
|
||||
<option value="{{ $item->id }}">{{ $item->code }}</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{--Orders Status--}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-4" for="status">Orders Status</label>
|
||||
<div class="col-md-8">
|
||||
<select class="form-control" name="status" id="status">
|
||||
<div class="form-group mb-3">
|
||||
<label for="status">Orders Status</label>
|
||||
<select class="form-control select2" name="status" id="status">
|
||||
<option value="0">Pending</option>
|
||||
<option value="1">Active</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{--Orders Action--}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-4" for="status">Orders Status</label>
|
||||
<div class="col-md-8 form-group row">
|
||||
<div class="col align-items-center d-flex">
|
||||
<label class="mr-2" for="Invoice">Create Invoice</label>
|
||||
<input type="checkbox" name="create_invoice" checked id="Invoice">
|
||||
<div class="form-group mb-3">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" name="create_invoice" id="create_invoice"
|
||||
class="form-check-input" value="1" checked>
|
||||
<label class="form-check-label" for="create_invoice">
|
||||
Create Invoice
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade"
|
||||
id="product"
|
||||
role="tabpanel"
|
||||
aria-labelledby="product">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card-body append-new__product">
|
||||
<div class="box clients-summary__box p-4">
|
||||
{{--Product Type--}}
|
||||
<div class="row form-group">
|
||||
<label for="order_product_type" class="col-md-4">Product Type
|
||||
(*)</label>
|
||||
<div class="col-md-8">
|
||||
<select class="form-control order_product_type"
|
||||
data-append="product[0][product_id]"
|
||||
name="product[0][type]">
|
||||
<option value="0">-----------</option>
|
||||
@if($type->count())
|
||||
@foreach($type->all() as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
<div class="tab-pane fade" id="product" role="tabpanel" aria-labelledby="product">
|
||||
<div class="append-new__product mb-3">
|
||||
<div class="border rounded p-3 mb-3">
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label>Product Type (*)</label>
|
||||
<select class="form-control select2 order_product_type"
|
||||
data-append="product[0][product_id]" name="product[0][type]"
|
||||
id="product_type">
|
||||
<option value="">-----------</option>
|
||||
@foreach(ProductTypeEnums::cases() as $type)
|
||||
<option value="{{ $type->value }}">{{ $type->label() }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{{--Product--}}
|
||||
<div class="row form-group">
|
||||
<label for="product_id" class="col-md-4">Product (*)</label>
|
||||
<div class="col-md-8">
|
||||
<select class="form-control product_id"
|
||||
name="product[0][product_id]">
|
||||
<option value="0">-----------</option>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label>Product (*)</label>
|
||||
<select class="form-control select2 product_id"
|
||||
name="product[0][product_id]" id="product_id">
|
||||
<option value="">-----------</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{{--Domain--}}
|
||||
<div class="row form-group">
|
||||
<label for="Domain" class="col-md-4">Domain</label>
|
||||
<div class="col-md-8">
|
||||
<input type="text" class="form-control Domain"
|
||||
name="product[0][domain]"
|
||||
value="">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label>Domain</label>
|
||||
<input type="text" class="form-control" name="product[0][domain]" value="">
|
||||
</div>
|
||||
</div>
|
||||
{{--Billing Cycle--}}
|
||||
<div class="row form-group">
|
||||
<label for="billing" class="col-md-4">Billing Cycle (*)</label>
|
||||
<div class="col-md-8">
|
||||
<select class="form-control billing" name="product[0][billing]">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label>Billing Cycle (*)</label>
|
||||
<select class="form-control select2" name="product[0][billing]">
|
||||
<option value="0">Free</option>
|
||||
<option value="1">One Time</option>
|
||||
<option value="2" selected>Monthly</option>
|
||||
@@ -154,67 +126,58 @@
|
||||
<option value="5">Annually</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{{--Product Quantity--}}
|
||||
<div class="row form-group">
|
||||
<label for="quantity" class="col-md-4">Quantity (*)</label>
|
||||
<div class="col-md-8">
|
||||
<input type="number" class="form-control quantity"
|
||||
name="product[0][quantity]"
|
||||
value="1" min="1">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label>Quantity (*)</label>
|
||||
<input type="number" class="form-control" name="product[0][quantity]"
|
||||
value="1" min="1">
|
||||
</div>
|
||||
</div>
|
||||
{{--Product Price--}}
|
||||
<div class="row form-group">
|
||||
<label for="price_custom" class="col-md-4">Price Override</label>
|
||||
<div class="col-md-8">
|
||||
<input type="number" class="form-control price_custom"
|
||||
name="product[0][price_custom]" value="" min="1">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label>Price Override</label>
|
||||
<input type="number" class="form-control" name="product[0][price_custom]"
|
||||
value="" min="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a href="javascript:void(0)"
|
||||
class="btn btn-outline-primary btn-add__newProduct">Add
|
||||
new Product</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="clients-summary__box">
|
||||
<h4 class="title">Order Summary</h4>
|
||||
<!--Box info-->
|
||||
<div class="summary__box">
|
||||
<table class="table table-borderless">
|
||||
<tbody class="append-element__js">
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="tax">
|
||||
<td class="fs-20">VAT @ 10.00%</td>
|
||||
<td></td>
|
||||
<td class="text-right fs-20" id="tax_append">0đ</td>
|
||||
</tr>
|
||||
<tr class="total">
|
||||
<td class="fs-20">Total</td>
|
||||
<td></td>
|
||||
<td class="text-right fs-20" id="total_append">0đ</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-outline-primary btn-add__newProduct">
|
||||
<i class="fas fa-plus"></i> Add new Product
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer text-right">
|
||||
<a href="{{ route('administrator.pages.order.index') }}" class="btn bg-gradient-secondary">Cancel</a>
|
||||
<button type="submit" class="btn bg-gradient-primary">Confirm Order</button>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="card card-outline card-primary">
|
||||
<div class="card-header bg-white">
|
||||
<h5 class="card-title m-0">Order Summary</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-borderless">
|
||||
<tbody class="append-element__js"></tbody>
|
||||
<tfoot>
|
||||
<tr class="tax">
|
||||
<td>VAT @ 10.00%</td>
|
||||
<td class="text-end" id="tax_append">0đ</td>
|
||||
</tr>
|
||||
<tr class="total">
|
||||
<td><strong>Total</strong></td>
|
||||
<td class="text-end" id="total_append">0đ</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<x-fixed-action-bar>
|
||||
<x-button-crm type="button" variant="secondary" size="sm" icon="arrow-left"
|
||||
route="administrator.pages.order.index">Cancel</x-button-crm>
|
||||
<x-button-crm type="submit" variant="primary" size="sm" icon="check-circle">Confirm Order</x-button-crm>
|
||||
</x-fixed-action-bar>
|
||||
</form>
|
||||
@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
|
||||
@@ -222,9 +185,9 @@
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
const apiGetProduct = '{{ route('api.getProduct') }}';
|
||||
const apiGetProductType = '{{route('api.getProductType')}}';
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@push('custom-scripts')
|
||||
@foreach (config('assets.datatable.js') as $datatable)
|
||||
<script src="{{ asset($datatable) }}"></script>
|
||||
@endforeach
|
||||
@endpush
|
||||
Reference in New Issue
Block a user