add module product
This commit is contained in:
parent
10f37b372e
commit
99a55080dc
90
DataTables/ProductDataTable.php
Normal file
90
DataTables/ProductDataTable.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\DataTables;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Modules\Writeoff\Entities\Product;
|
||||
use Nwidart\Modules\Facades\Module;
|
||||
use Yajra\DataTables\EloquentDataTable;
|
||||
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use Yajra\DataTables\Services\DataTable;
|
||||
|
||||
class ProductDataTable extends DataTable
|
||||
{
|
||||
/**
|
||||
* Build the DataTable class.
|
||||
*
|
||||
* @param QueryBuilder $query Results from query() method.
|
||||
*/
|
||||
public function dataTable(QueryBuilder $query)
|
||||
: EloquentDataTable
|
||||
{
|
||||
return (new EloquentDataTable($query))->filter(function ($query) {
|
||||
if (request()->has('search')) {
|
||||
$search = request()->get('search');
|
||||
$query->where('kode', 'like', "%" . $search['value'] . "%")
|
||||
->orWhere('name', 'like', "%" . $search['value'] . "%");
|
||||
}
|
||||
})->addIndexColumn()->editColumn('updated_at', function ($row) {
|
||||
return $row->updated_at->locale('id')->translatedFormat('d F Y H:i:s');
|
||||
})->rawColumns(['action'])->addColumn('action', function ($product) {
|
||||
return view('writeoff::parameter.products._actions', compact('product'));
|
||||
})->setRowId('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the query source of dataTable.
|
||||
*/
|
||||
public function query(Product $model)
|
||||
: QueryBuilder
|
||||
{
|
||||
return $model->newQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional method if you want to use the html builder.
|
||||
*/
|
||||
public function html()
|
||||
: HtmlBuilder
|
||||
{
|
||||
return $this->builder()
|
||||
->setTableId('product-table')
|
||||
->columns($this->getColumns())
|
||||
->minifiedAjax()
|
||||
->stateSave(false)
|
||||
->responsive()
|
||||
->autoWidth(true)
|
||||
->orderBy(1)
|
||||
->parameters([
|
||||
'scrollX' => false,
|
||||
'drawCallback' => 'function() { KTMenu.createInstances(); }',
|
||||
])
|
||||
->addTableClass('align-middle table-row-dashed fs-6 gy-5')
|
||||
->drawCallback("function() {" . file_get_contents(Module::getModulePath('writeoff').'Resources/views/parameter/products/_draw-scripts.js') . "}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the dataTable columns definition.
|
||||
*/
|
||||
public function getColumns()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
|
||||
Column::make('kode')->title('Kode Product'),
|
||||
Column::make('name')->title('Nama Product'),
|
||||
Column::make('updated_at')->title('Last Update'),
|
||||
Column::computed('action')->exportable(false)->printable(false)->width(60)->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filename for export.
|
||||
*/
|
||||
protected function filename()
|
||||
: string
|
||||
{
|
||||
return 'Product_' . date('YmdHis');
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('products', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('kode',4)->unique();
|
||||
$table->string('name');
|
||||
$table->boolean('status')->default(true)->nullable();
|
||||
$table->timestamps();
|
||||
$table->timestamp('authorized_at')->nullable();
|
||||
$table->char('authorized_status', 1)->nullable();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->unsignedBigInteger('deleted_by')->nullable();
|
||||
$table->unsignedBigInteger('authorized_by')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('products');
|
||||
}
|
||||
};
|
20
Entities/Product.php
Normal file
20
Entities/Product.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Entities;
|
||||
|
||||
class Product extends BaseModel
|
||||
{
|
||||
protected $fillable = [
|
||||
'kode',
|
||||
'name',
|
||||
'status',
|
||||
'authorized_at',
|
||||
'authorized_status',
|
||||
'authorized_by',
|
||||
];
|
||||
|
||||
public function rekenings()
|
||||
{
|
||||
return $this->hasMany(Rekening::class);
|
||||
}
|
||||
}
|
37
Http/Controllers/ProductController.php
Normal file
37
Http/Controllers/ProductController.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Modules\Writeoff\DataTables\ProductDataTable;
|
||||
|
||||
class ProductController extends Controller
|
||||
{
|
||||
public $user;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware(function ($request, $next) {
|
||||
$this->user = Auth::guard('web')->user();
|
||||
return $next($request);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the Currencies.
|
||||
*
|
||||
* @param \Modules\Writeoff\DataTables\ProductDataTable $dataTable
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function index(ProductDataTable $dataTable, Request $request)
|
||||
{
|
||||
if (is_null($this->user) || !$this->user->can('master.read')) {
|
||||
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
|
||||
}
|
||||
|
||||
return $dataTable->render('writeoff::parameter.products.index');
|
||||
}
|
||||
}
|
72
Http/Requests/Product/StoreProductRequest.php
Normal file
72
Http/Requests/Product/StoreProductRequest.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Http\Requests\Product;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\Validation\Validator;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
class StoreProductRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize()
|
||||
: bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
|
||||
*/
|
||||
public function rules()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'kode' => 'required|string|max:4|min:4|unique:products,kode',
|
||||
'name' => 'required|string|max:100'
|
||||
];
|
||||
}
|
||||
|
||||
public function ignored(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the validator instance.
|
||||
*/
|
||||
public function withValidator(Validator $validator)
|
||||
: void
|
||||
{
|
||||
$validator->after(function (Validator $validator) {
|
||||
if ($validator->errors()->any()) {
|
||||
$errors = json_decode($validator->errors()->toJson(), true);
|
||||
|
||||
|
||||
foreach ($errors as $key => $value) {
|
||||
flash($value[0]);
|
||||
}
|
||||
return redirect()->route('parameter.products.index')->with('error', 'Product created failed.');
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator)
|
||||
: JsonResponse
|
||||
{
|
||||
$errors = (new ValidationException($validator))->errors();
|
||||
|
||||
throw new HttpResponseException(response()->json([
|
||||
'success' => false,
|
||||
'errors' => $errors,
|
||||
'messages' => 'Product created failed.'
|
||||
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||
}
|
||||
}
|
69
Http/Requests/Product/UpdateProductRequest.php
Normal file
69
Http/Requests/Product/UpdateProductRequest.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Http\Requests\Product;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class UpdateProductRequest extends FormRequest
|
||||
{
|
||||
|
||||
public $_id;
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize()
|
||||
: bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
|
||||
*/
|
||||
public function rules()
|
||||
: array
|
||||
{
|
||||
$this->_id = json_decode(json_decode(file_get_contents('php://input'))->components[0]->snapshot)->data->id;
|
||||
|
||||
return [
|
||||
'kode' => 'required|string|max:4|min:4|unique:products,kode,' . $this->_id,
|
||||
'name' => 'required|string|max:100'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the validator instance.
|
||||
*/
|
||||
public function withValidator(Validator $validator)
|
||||
: void
|
||||
{
|
||||
$validator->after(function (Validator $validator) {
|
||||
if ($validator->errors()->any()) {
|
||||
$error = json_decode($validator->errors()->toJson(), true);
|
||||
foreach ($error as $key => $value) {
|
||||
flash($value[0]);
|
||||
}
|
||||
|
||||
return redirect()->route('parameter.products.index')->with('error', 'Product updated failed.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator)
|
||||
: JsonResponse
|
||||
{
|
||||
$errors = (new ValidationException($validator))->errors();
|
||||
|
||||
throw new HttpResponseException(response()->json([
|
||||
'success' => false,
|
||||
'errors' => $errors,
|
||||
'messages' => 'Product updated failed.'
|
||||
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||
}
|
||||
}
|
94
Livewire/Product/ProductModal.php
Normal file
94
Livewire/Product/ProductModal.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Livewire\Product;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Livewire\Component;
|
||||
use Modules\Writeoff\Entities\Product;
|
||||
use Modules\Writeoff\Http\Requests\Product\StoreProductRequest;
|
||||
use Modules\Writeoff\Http\Requests\Product\UpdateProductRequest;
|
||||
|
||||
class ProductModal extends Component
|
||||
{
|
||||
public $id;
|
||||
public $kode;
|
||||
public $name;
|
||||
|
||||
public $edit_mode = false;
|
||||
|
||||
protected $listeners = [
|
||||
'delete' => 'delete',
|
||||
'update' => 'update',
|
||||
];
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('writeoff::livewire.product.product-modal');
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
$this->validate();
|
||||
|
||||
// Validate the form input data
|
||||
DB::transaction(function () {
|
||||
// Prepare the data for creating a new user
|
||||
$data = [
|
||||
'kode' => $this->kode,
|
||||
'name' => $this->name
|
||||
];
|
||||
|
||||
if ($this->edit_mode) {
|
||||
// Emit a success event with a message
|
||||
$product = Product::find($this->id);
|
||||
$product->update($data);
|
||||
|
||||
$this->dispatch('success', __('Product updated'));
|
||||
} else {
|
||||
// Emit a success event with a message
|
||||
Product::create($data);
|
||||
$this->dispatch('success', __('New Product created'));
|
||||
}
|
||||
});
|
||||
|
||||
// Reset the form fields after successful submission
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->edit_mode = true;
|
||||
|
||||
$product = Product::find($id);
|
||||
|
||||
$this->id = $product->id;
|
||||
$this->kode = $product->kode;
|
||||
$this->name = $product->name;
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
Product::destroy($id);
|
||||
|
||||
// Emit a success event with a message
|
||||
$this->dispatch('success', 'Product successfully deleted');
|
||||
}
|
||||
|
||||
public function hydrate()
|
||||
{
|
||||
$this->resetErrorBag();
|
||||
$this->resetValidation();
|
||||
}
|
||||
|
||||
protected function rules()
|
||||
{
|
||||
if ($this->edit_mode) {
|
||||
$request = new UpdateProductRequest();
|
||||
} else {
|
||||
$request = new StoreProductRequest();
|
||||
}
|
||||
|
||||
return $request->rules();
|
||||
}
|
||||
}
|
||||
|
72
Resources/views/livewire/product/product-modal.blade.php
Normal file
72
Resources/views/livewire/product/product-modal.blade.php
Normal file
@ -0,0 +1,72 @@
|
||||
<div class="modal fade" id="kt_modal_add_product" tabindex="-1" aria-hidden="true" wire:ignore.self>
|
||||
<!--begin::Modal dialog-->
|
||||
<div class="modal-dialog modal-dialog-centered mw-650px">
|
||||
<!--begin::Modal content-->
|
||||
<div class="modal-content">
|
||||
<!--begin::Modal header-->
|
||||
<div class="modal-header" id="kt_modal_add_product_header">
|
||||
<!--begin::Modal title-->
|
||||
<h2 class="fw-bold">Add Produk</h2>
|
||||
<!--end::Modal title-->
|
||||
<!--begin::Close-->
|
||||
<div class="btn btn-icon btn-sm btn-active-icon-primary" data-bs-dismiss="modal" aria-label="Close">
|
||||
{!! getIcon('cross','fs-1') !!}
|
||||
</div>
|
||||
<!--end::Close-->
|
||||
</div>
|
||||
<!--end::Modal header-->
|
||||
<!--begin::Modal body-->
|
||||
<div class="modal-body px-5 my-7">
|
||||
<!--begin::Form-->
|
||||
<form id="kt_modal_add_product_form" class="form" action="#" wire:submit.prevent="submit">
|
||||
<!--begin::Scroll-->
|
||||
<div class="d-flex flex-column scroll-y px-5 px-lg-10" id="kt_modal_add_product_scroll" data-kt-scroll="true" data-kt-scroll-activate="true" data-kt-scroll-max-height="auto" data-kt-scroll-dependencies="#kt_modal_add_product_header" data-kt-scroll-wrappers="#kt_modal_add_product_scroll" data-kt-scroll-offset="300px">
|
||||
|
||||
<!--begin::Input group-->
|
||||
<div class="fv-row mb-7">
|
||||
<!--begin::Label-->
|
||||
<label class="required fw-semibold fs-6 mb-2">Kode Produk</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="text" wire:model.defer="kode" name="kode" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Kode Produk"/>
|
||||
<!--end::Input-->
|
||||
@error('kode')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
<!--end::Input group-->
|
||||
<!--begin::Input group-->
|
||||
<div class="fv-row mb-7">
|
||||
<!--begin::Label-->
|
||||
<label class="required fw-semibold fs-6 mb-2">Nama Produk</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="text" wire:model.defer="name" name="name" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Nama Produk"/>
|
||||
<!--end::Input-->
|
||||
@error('name')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
<!--end::Input group-->
|
||||
|
||||
</div>
|
||||
<!--end::Scroll-->
|
||||
<!--begin::Actions-->
|
||||
<div class="text-center pt-15">
|
||||
<button type="reset" class="btn btn-light me-3" data-bs-dismiss="modal" aria-label="Close" wire:loading.attr="disabled">Discard</button>
|
||||
<button type="submit" class="btn btn-primary" data-kt-products-modal-action="submit">
|
||||
<span class="indicator-label" wire:loading.remove>Submit</span>
|
||||
<span class="indicator-progress" wire:loading wire:target="submit">
|
||||
Please wait...
|
||||
<span class="spinner-border spinner-border-sm align-middle ms-2"></span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<!--end::Actions-->
|
||||
</form>
|
||||
<!--end::Form-->
|
||||
</div>
|
||||
<!--end::Modal body-->
|
||||
</div>
|
||||
<!--end::Modal content-->
|
||||
</div>
|
||||
<!--end::Modal dialog-->
|
||||
</div>
|
23
Resources/views/parameter/products/_actions.blade.php
Normal file
23
Resources/views/parameter/products/_actions.blade.php
Normal file
@ -0,0 +1,23 @@
|
||||
<a href="#" class="btn btn-light btn-active-light-primary btn-flex btn-center btn-sm" data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end">
|
||||
Actions
|
||||
<i class="ki-duotone ki-down fs-5 ms-1"></i>
|
||||
</a>
|
||||
<!--begin::Menu-->
|
||||
<div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-600 menu-state-bg-light-primary fw-semibold fs-7 w-125px py-4" data-kt-menu="true">
|
||||
<!--begin::Menu item-->
|
||||
<div class="menu-item px-3">
|
||||
<a href="#" class="menu-link px-3" data-kt-id="{{ $product->id }}" data-bs-toggle="modal" data-bs-target="#kt_modal_add_product" data-kt-action="update_row">
|
||||
Edit
|
||||
</a>
|
||||
</div>
|
||||
<!--end::Menu item-->
|
||||
|
||||
<!--begin::Menu item-->
|
||||
<div class="menu-item px-3">
|
||||
<a href="#" class="menu-link px-3" data-kt-id="{{ $product->id }}" data-kt-action="delete_row">
|
||||
Delete
|
||||
</a>
|
||||
</div>
|
||||
<!--end::Menu item-->
|
||||
</div>
|
||||
<!--end::Menu-->
|
37
Resources/views/parameter/products/_draw-scripts.js
Normal file
37
Resources/views/parameter/products/_draw-scripts.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Initialize KTMenu
|
||||
KTMenu.init();
|
||||
|
||||
// Add click event listener to delete buttons
|
||||
document.querySelectorAll('[data-kt-action="delete_row"]').forEach(function (element) {
|
||||
element.addEventListener('click', function () {
|
||||
Swal.fire({
|
||||
text: 'Are you sure you want to remove?',
|
||||
icon: 'warning',
|
||||
buttonsStyling: false,
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Yes',
|
||||
cancelButtonText: 'No',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-danger',
|
||||
cancelButton: 'btn btn-secondary',
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
Livewire.dispatch('delete', { id : this.getAttribute('data-kt-id') });
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Add click event listener to update buttons
|
||||
document.querySelectorAll('[data-kt-action="update_row"]').forEach(function (element) {
|
||||
element.addEventListener('click', function () {
|
||||
Livewire.dispatch('update', { id : this.getAttribute('data-kt-id') });
|
||||
});
|
||||
});
|
||||
|
||||
// Listen for 'success' event emitted by Livewire
|
||||
Livewire.on('success', (message) => {
|
||||
// Reload the users-table datatable
|
||||
LaravelDataTables['product-table'].ajax.reload();
|
||||
});
|
72
Resources/views/parameter/products/index.blade.php
Normal file
72
Resources/views/parameter/products/index.blade.php
Normal file
@ -0,0 +1,72 @@
|
||||
<x-default-layout>
|
||||
|
||||
@section('title')
|
||||
Produk
|
||||
@endsection
|
||||
|
||||
@section('breadcrumbs')
|
||||
{{ Breadcrumbs::render('parameter.products') }}
|
||||
@endsection
|
||||
|
||||
<div class="card">
|
||||
<!--begin::Card header-->
|
||||
<div class="card-header border-0 pt-6">
|
||||
<!--begin::Card title-->
|
||||
<div class="card-title">
|
||||
<!--begin::Search-->
|
||||
<div class="d-flex align-items-center position-relative my-1">
|
||||
{!! getIcon('magnifier', 'fs-3 position-absolute ms-5') !!}
|
||||
<input type="text" data-kt-product-table-filter="search" class="form-control form-control-solid w-250px ps-13" placeholder="Search product" id="mySearchInput"/>
|
||||
</div>
|
||||
<!--end::Search-->
|
||||
</div>
|
||||
<!--begin::Card title-->
|
||||
|
||||
<!--begin::Card toolbar-->
|
||||
<div class="card-toolbar">
|
||||
<!--begin::Toolbar-->
|
||||
<div class="d-flex justify-content-end" data-kt-product-table-toolbar="base">
|
||||
<!--begin::Add product-->
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#kt_modal_add_product">
|
||||
{!! getIcon('plus', 'fs-2', '', 'i') !!}
|
||||
Add Produk
|
||||
</button>
|
||||
<!--end::Add product-->
|
||||
</div>
|
||||
<!--end::Toolbar-->
|
||||
|
||||
<!--begin::Modal-->
|
||||
<livewire:writeoff::product.product-modal/>
|
||||
<!--end::Modal-->
|
||||
</div>
|
||||
<!--end::Card toolbar-->
|
||||
</div>
|
||||
<!--end::Card header-->
|
||||
|
||||
<!--begin::Card body-->
|
||||
<div class="card-body py-4">
|
||||
<!--begin::Table-->
|
||||
<div class="table-responsive">
|
||||
{{ $dataTable->table() }}
|
||||
</div>
|
||||
<!--end::Table-->
|
||||
</div>
|
||||
<!--end::Card body-->
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
{{ $dataTable->scripts() }}
|
||||
<script>
|
||||
document.getElementById('mySearchInput').addEventListener('keyup', function () {
|
||||
window.LaravelDataTables['product-table'].search(this.value).draw();
|
||||
});
|
||||
document.addEventListener('livewire:initialized', function () {
|
||||
Livewire.on('success', function () {
|
||||
$('#kt_modal_add_product').modal('hide');
|
||||
window.LaravelDataTables['product-table'].ajax.reload();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
</x-default-layout>
|
@ -29,6 +29,14 @@
|
||||
</a>
|
||||
<!--end:Menu link-->
|
||||
<!--begin:Menu link-->
|
||||
<a class="menu-link {{ isset($route[1]) && $route[1] == 'products' ? 'active' : '' }}" href="{{ route('parameter.products.index') }}">
|
||||
<span class="menu-bullet">
|
||||
<span class="bullet bullet-dot"></span>
|
||||
</span>
|
||||
<span class="menu-title">Produk</span>
|
||||
</a>
|
||||
<!--end:Menu link-->
|
||||
<!--begin:Menu link-->
|
||||
<a class="menu-link {{ isset($route[1]) && $route[1] == 'guarantee_types' ? 'active' : '' }}" href="{{ route('parameter.guarantee_types.index') }}">
|
||||
<span class="menu-bullet">
|
||||
<span class="bullet bullet-dot"></span>
|
||||
|
@ -18,6 +18,11 @@
|
||||
$trail->push('Mata Uang', route('parameter.currencies.index'));
|
||||
});
|
||||
|
||||
Breadcrumbs::for('parameter.products', function (BreadcrumbTrail $trail) {
|
||||
$trail->parent('parameter');
|
||||
$trail->push('Produk', route('parameter.products.index'));
|
||||
});
|
||||
|
||||
Breadcrumbs::for('parameter.guarantee-types', function (BreadcrumbTrail $trail) {
|
||||
$trail->parent('parameter');
|
||||
$trail->push('Jenis Jaminan', route('parameter.guarantee_types.index'));
|
||||
|
@ -14,6 +14,7 @@
|
||||
Route::name('parameter.')->prefix('parameter')->group(function() {
|
||||
Route::get('branches', 'BranchController@index')->name('branches.index');
|
||||
Route::get('currencies', 'CurrencyController@index')->name('currencies.index');
|
||||
Route::get('products', 'ProductController@index')->name('products.index');
|
||||
Route::get('guarantee-types', 'GuaranteeTypeController@index')->name('guarantee_types.index');
|
||||
Route::get('facility-types', 'FacilityTypeController@index')->name('facility_types.index');
|
||||
Route::get('loan-types', 'LoanTypeController@index')->name('loan_types.index');
|
||||
|
Loading…
Reference in New Issue
Block a user