feat: Implement order and invoice management, enhance addon features, and remove the 'Type' module.

This commit is contained in:
pbao9
2026-02-11 17:02:07 +07:00
parent 58a9aa685b
commit 556b2c02e6
47 changed files with 1367 additions and 497 deletions
@@ -1,81 +1,137 @@
@extends("administrator.layout.master")
@section("content")
<div class="card card-outline card-primary">
<form action="{{ route('addon.store') }}" method="post">
@csrf
<div class="card-body">
<div class="row">
<div class="col">
{{--Product name--}}
<div class="form-group row">
<label class="col-md-4" for="name">Name</label>
<div class="col-md-8">
<input type="text" id="name" name="name" placeholder=".com,.vn,..."
value="{{ old('name') }}" class="form-control">
</div>
</div>
@extends('administrator.layout.master')
@push('plugin-styles')
@foreach (config('assets.datatable.css') as $datatable)
<link href="{{ asset($datatable) }}" rel="stylesheet" />
@endforeach
@endpush
{{--Price--}}
<div class="form-group row">
<label class="col-md-4" for="price">Price</label>
<div class="col-md-8">
<input type="number" id="price" name="price" placeholder="100000"
value="{{ old('price') ?? 0 }}" class="form-control">
</div>
</div>
{{--Price Sales--}}
<div class="form-group row">
<label class="col-md-4" for="min">Min</label>
<div class="col-md-8">
<input type="number" id="min" name="min" placeholder="0"
value="{{ old('min') }}" class="form-control">
</div>
</div>
{{--Renewal--}}
<div class="form-group row">
<label class="col-md-4" for="max">Max</label>
<div class="col-md-8">
<input type="number" id="max" name="max" placeholder="100000"
value="{{ old('max') }}" class="form-control">
</div>
</div>
{{--Transfer--}}
<div class="form-group row">
<label class="col-md-4" for="step">Step</label>
<div class="col-md-8">
<input type="number" id="step" name="step" placeholder="1"
value="{{ old('step') }}" class="form-control">
</div>
</div>
{{--Transfer--}}
<div class="form-group row">
<label class="col-md-4" for="prefix">Prefix</label>
<div class="col-md-8">
<input type="text" id="prefix" name="prefix" placeholder="vCore"
value="{{ old('prefix') }}" class="form-control">
</div>
</div>
{{--Product Type--}}
<div class="form-group row">
<label class="col-md-4" for="lastname">Product Type</label>
<div class="col-md-8">
<select class="custom-select" name="type_id">
<option value="1">Addon</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="card-footer">
<a href="{{ route('addon.index') }}" class="btn btn-outline-secondary">Back</a>
<button type="submit" class="btn btn-outline-primary">Save</button>
</div>
</form>
</div>
@section('breadcrumb')
@php
$breadcrumbItems = [
['label' => 'Product'],
['label' => 'Product Addons'],
['label' => 'Product Addons List', 'url' => route('addon.index')],
['label' => 'Add new addon', 'active' => true],
];
@endphp
<x-admin-breadcrumb :items="$breadcrumbItems" />
@endsection
@php
use App\Enums\Status;
@endphp
@section('content')
@if (auth()->guard('admins')->user()->can('manager product'))
<div class="card card-outline card-primary">
<div class="card-header">
Create New Addon
</div>
<form action="{{ route('addon.store') }}" method="post">
@csrf
<div class="card-body">
<div class="row">
<div class="col">
{{-- Name --}}
<div class="row form-group align-items-center mb-0">
<label for="name" class="col-md-3 text-right">Name</label>
<div class="col-md-9 bg-customer p-1">
<input type="text" id="name" name="name" placeholder="CPU, RAM, Disk..."
value="{{ old('name') }}" class="form-control">
</div>
</div>
{{-- Code --}}
<div class="row form-group align-items-center mb-0">
<label for="code" class="col-md-3 text-right">Code</label>
<div class="col-md-9 bg-customer p-1">
<input type="text" id="code" name="code" placeholder="cpu, ram, disk..."
value="{{ old('code') }}" class="form-control">
</div>
</div>
{{-- Price --}}
<div class="row form-group align-items-center mb-0">
<label for="price" class="col-md-3 text-right">Price</label>
<div class="col-md-9 bg-customer p-1">
<input type="number" id="price" name="price" placeholder="100000"
value="{{ old('price') ?? 0 }}" class="form-control">
</div>
</div>
{{-- Min --}}
<div class="row form-group align-items-center mb-0">
<label for="min" class="col-md-3 text-right">Min</label>
<div class="col-md-9 bg-customer p-1">
<input type="number" id="min" name="min" placeholder="0"
value="{{ old('min') }}" class="form-control">
</div>
</div>
{{-- Max --}}
<div class="row form-group align-items-center mb-0">
<label for="max" class="col-md-3 text-right">Max</label>
<div class="col-md-9 bg-customer p-1">
<input type="number" id="max" name="max" placeholder="100000"
value="{{ old('max') }}" class="form-control">
</div>
</div>
{{-- Step --}}
<div class="row form-group align-items-center mb-0">
<label for="step" class="col-md-3 text-right">Step</label>
<div class="col-md-9 bg-customer p-1">
<input type="number" id="step" name="step" placeholder="1"
value="{{ old('step') }}" class="form-control">
</div>
</div>
{{-- Prefix --}}
<div class="row form-group align-items-center mb-0">
<label for="prefix" class="col-md-3 text-right">Prefix</label>
<div class="col-md-9 bg-customer p-1">
<input type="text" id="prefix" name="prefix" placeholder="vCore, GB..."
value="{{ old('prefix') }}" class="form-control">
</div>
</div>
{{-- Status --}}
<div class="row form-group align-items-center mb-0">
<label for="status" class="col-md-3 text-right">Status</label>
<div class="col-md-9 bg-customer p-1">
<select class="select2 single__select" id="status" name="status">
@foreach (Status::getOptions() as $value => $label)
<option value="{{ $value }}">
{{ $label }}
</option>
@endforeach
</select>
</div>
</div>
</div>
</div>
</div>
<x-fixed-action-bar>
<x-button-crm type="button" variant="secondary" size="sm" icon="arrow-left"
route="addon.index">Cancel</x-button-crm>
<x-button-crm type="submit" variant="primary" size="sm" icon="plus-circle">Create
Addon</x-button-crm>
</x-fixed-action-bar>
</form>
</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 Product
management department</h5>
</div>
@endif
@endsection
@push('plugin-scripts')
@foreach (config('assets.datatable.js') as $datatable)
<script src="{{ asset($datatable) }}"></script>
@endforeach
<script>
$(document).ready(function () {
$('.select2').select2();
});
</script>
@endpush
@@ -0,0 +1,6 @@
<div class="d-flex gap-2">
<x-button-crm type="button" variant="outline-primary" size="sm" route="addon.edit" :params="['id' => $row->id]"
icon="pencil">Chỉnh sửa</x-button-crm>
<x-button-crm type="button" variant="outline-danger" size="sm" route="addon.destroy" :params="['id' => $row->id]"
icon="trash">Xóa</x-button-crm>
</div>
@@ -0,0 +1,13 @@
@php
$status = App\Enums\Status::tryFrom($row->status);
@endphp
@if($status)
<x-admin-badge :variant="$status->value">
{{ $status->label() }}
</x-admin-badge>
@else
<x-admin-badge variant="secondary">
Unknown
</x-admin-badge>
@endif
@@ -1,4 +1,26 @@
@extends("administrator.layout.master")
@extends('administrator.layout.master')
@push('plugin-styles')
@foreach (config('assets.datatable.css') as $datatable)
<link href="{{ asset($datatable) }}" rel="stylesheet" />
@endforeach
@endpush
@section('breadcrumb')
@php
$breadcrumbItems = [
['label' => 'Product'],
['label' => 'Product Addons'],
['label' => 'Product Addons List', 'url' => route('addon.index')],
['label' => 'Edit addon', 'active' => true],
];
@endphp
<x-admin-breadcrumb :items="$breadcrumbItems" />
@endsection
@php
use App\Enums\Status;
@endphp
@section("content")
<div class="card card-outline card-primary">
<form action="{{ route('addon.update', ['id' => $addon->id]) }}" method="post">
@@ -12,7 +34,7 @@
<label class="col-md-4" for="name">Name</label>
<div class="col-md-8">
<input type="text" id="name" name="name" placeholder=".com,.vn,..."
value="{{ old('name') ?? $addon->name }}" class="form-control">
value="{{ old('name') ?? $addon->name }}" class="form-control">
</div>
</div>
@@ -21,7 +43,7 @@
<label class="col-md-4" for="price">Price</label>
<div class="col-md-8">
<input type="number" id="price" name="price" placeholder="100000"
value="{{ old('price') ?? $addon->price }}" class="form-control">
value="{{ old('price') ?? $addon->price }}" class="form-control">
</div>
</div>
@@ -30,7 +52,7 @@
<label class="col-md-4" for="min">Min</label>
<div class="col-md-8">
<input type="number" id="min" name="min" placeholder="0"
value="{{ old('min') ?? $addon->min }}" class="form-control">
value="{{ old('min') ?? $addon->min }}" class="form-control">
</div>
</div>
@@ -39,7 +61,7 @@
<label class="col-md-4" for="max">Max</label>
<div class="col-md-8">
<input type="number" id="max" name="max" placeholder="100000"
value="{{ old('max') ?? $addon->max }}" class="form-control">
value="{{ old('max') ?? $addon->max }}" class="form-control">
</div>
</div>
@@ -48,7 +70,7 @@
<label class="col-md-4" for="step">Step</label>
<div class="col-md-8">
<input type="number" id="step" name="step" placeholder="1"
value="{{ old('step') ?? $addon->step }}" class="form-control">
value="{{ old('step') ?? $addon->step }}" class="form-control">
</div>
</div>
@@ -58,25 +80,28 @@
<label class="col-md-4" for="prefix">Prefix</label>
<div class="col-md-8">
<input type="text" id="prefix" name="prefix" placeholder="vCore"
value="{{ old('prefix') ?? $addon->prefix }}" class="form-control">
</div>
</div>
{{--Product Type--}}
<div class="form-group row">
<label class="col-md-4" for="lastname">Product Type</label>
<div class="col-md-8">
<select class="custom-select" name="type_id">
<option value="1" @selected($addon->type_id == 1)>Addon</option>
</select>
value="{{ old('prefix') ?? $addon->prefix }}" class="form-control">
</div>
</div>
</div>
</div>
</div>
<div class="card-footer">
<a href="{{ route('addon.index') }}" class="btn btn-outline-secondary">Back</a>
<button type="submit" class="btn btn-outline-primary">Save</button>
</div>
<x-fixed-action-bar>
<x-button-crm type="button" variant="secondary" size="sm" icon="arrow-left"
route="addon.index">Cancel</x-button-crm>
<x-button-crm type="submit" variant="primary" size="sm" icon="pencil">Edit
Addon</x-button-crm>
</x-fixed-action-bar>
</form>
</div>
@endsection
@push('plugin-scripts')
@foreach (config('assets.datatable.js') as $datatable)
<script src="{{ asset($datatable) }}"></script>
@endforeach
<script>
$(document).ready(function () {
$('.select2').select2();
});
</script>
@endpush
@@ -1,59 +1,49 @@
@extends("administrator.layout.master")
@section("content")
<div class="card card-primary card-outline">
<div class="card-header">
<a href="{{ route('addon.create') }}" class="btn btn-outline-secondary">
<i class="fas fa-plus"></i> Add New Addon
</a>
</div>
<div class="card-body">
<table class="table table-invoice table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th>Type</th>
<th style="width:40px"></th>
<th style="width: 40px"></th>
</tr>
</thead>
<tbody>
@if(count($addOns) > 0)
@foreach($addOns->all() as $item)
<tr>
<td class="text-center">
{{ $item->name }}
</td>
<td class="text-center">
{{ number_format($item->price,0,',','.') }} vnđ
</td>
<td class="text-center">
{{ $item->Type->name }}
</td>
<td>
<a class="btn btn-warning btn-sm" href="{{ route('addon.edit',['id' => $item->id]) }}">
<i class="fas fa-user-edit"></i>
</a>
</td>
<td>
<form method="post" class="d-inline"
action="{{ route('addon.destroy',['id' => $item->id]) }}">
@csrf
@method('delete')
<button type="submit" data-toggle="tooltip" data-placement="top" title=""
class="btn btn-sm btn-danger" data-original-title="Xoá">
<i class="fas fa-trash"></i>
</button>
</form>
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
<div class="card-footer">
{{ $addOns->withQueryString()->links() }}
</div>
</div>
@extends('administrator.layout.master')
@push('plugin-styles')
@foreach (config('assets.datatable.css') as $datatable)
<link href="{{ asset($datatable) }}" rel="stylesheet" />
@endforeach
@endpush
@section('breadcrumb')
@php
$breadcrumbItems = [
['label' => 'Product'],
['label' => 'Product Addons'],
['label' => 'Product Addons List', 'active' => true],
];
@endphp
<x-admin-breadcrumb :items="$breadcrumbItems" />
@endsection
@section("content")
@if (auth()->guard('admins')->user()->can('manager product'))
<div class="card card-primary card-outline">
<div class="card-header d-flex justify-content-end gap-2">
@include('administrator.pages.block.addon.btn')
</div>
<div class="card-body">
<x-datatable id="addonTable" ajax="{{ route('addon.datatable') }}" :columns="[
['key' => 'name', 'label' => 'Addon Name'],
['key' => 'prefix', 'label' => 'Prefix'],
['key' => 'min', 'label' => 'Min'],
['key' => 'max', 'label' => 'Max'],
['key' => 'step', 'label' => 'Step'],
['key' => 'price', 'label' => 'Price'],
['key' => 'status', 'label' => 'Status'],
['key' => 'action', 'label' => 'Action'],
]" />
</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 Product
management department</h5>
</div>
@endif
@endsection
@push('plugin-scripts')
@foreach (config('assets.datatable.js') as $datatable)
<script src="{{ asset($datatable) }}"></script>
@endforeach
@endpush
@@ -0,0 +1,4 @@
@if(auth()->guard('admins')->user()->can("manager product"))
<x-button-crm type="button" variant="outline-primary" size="sm" route="addon.create" icon="plus-circle">Thêm
addon</x-button-crm>
@endif