add module jenis pinjaman
This commit is contained in:
parent
32c83d75e3
commit
4ca59fd0c6
90
DataTables/LoanTypeDataTable.php
Normal file
90
DataTables/LoanTypeDataTable.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\DataTables;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Modules\Writeoff\Entities\LoanType;
|
||||
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 LoanTypeDataTable 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 ($loan_type) {
|
||||
return view('writeoff::parameter.loan_types._actions', compact('loan_type'));
|
||||
})->setRowId('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the query source of dataTable.
|
||||
*/
|
||||
public function query(LoanType $model)
|
||||
: QueryBuilder
|
||||
{
|
||||
return $model->newQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional method if you want to use the html builder.
|
||||
*/
|
||||
public function html()
|
||||
: HtmlBuilder
|
||||
{
|
||||
return $this->builder()
|
||||
->setTableId('loan-type-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/loan_types/_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'),
|
||||
Column::make('name')->title('Jenis Pinjaman'),
|
||||
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 'LoanType_' . 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('loan_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('kode',4)->unique();
|
||||
$table->string('name');
|
||||
$table->char('status', 1)->default('A');
|
||||
$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('loan_types');
|
||||
}
|
||||
};
|
16
Entities/LoanType.php
Normal file
16
Entities/LoanType.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Entities;
|
||||
|
||||
class LoanType extends BaseModel
|
||||
{
|
||||
protected $fillable = [
|
||||
'kode',
|
||||
'name',
|
||||
'status',
|
||||
'authorized_at',
|
||||
'authorized_status',
|
||||
'authorized_by',
|
||||
];
|
||||
|
||||
}
|
37
Http/Controllers/LoanTypeController.php
Normal file
37
Http/Controllers/LoanTypeController.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\LoanTypeDataTable;
|
||||
|
||||
class LoanTypeController 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 LoanTypes.
|
||||
*
|
||||
* @param \Modules\Writeoff\DataTables\LoanTypeDataTable $dataTable
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function index(LoanTypeDataTable $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.loan_types.index');
|
||||
}
|
||||
}
|
75
Http/Requests/LoanType/StoreLoanTypeRequest.php
Normal file
75
Http/Requests/LoanType/StoreLoanTypeRequest.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Http\Requests\LoanType;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\Validation\Validator;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
class StoreLoanTypeRequest 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:loan_types,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.loan_types.index')
|
||||
->with('error', 'Loan Type 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' => 'Loan Type created failed.'
|
||||
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||
}
|
||||
}
|
73
Http/Requests/LoanType/UpdateLoanTypeRequest.php
Normal file
73
Http/Requests/LoanType/UpdateLoanTypeRequest.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Http\Requests\LoanType;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class UpdateLoanTypeRequest 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:loan_types,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.loan_types.index')
|
||||
->with('error', 'Loan Type 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' => 'Loan Type updated failed.'
|
||||
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||
}
|
||||
|
||||
}
|
94
Livewire/LoanType/LoanTypeModal.php
Normal file
94
Livewire/LoanType/LoanTypeModal.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Livewire\LoanType;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Livewire\Component;
|
||||
use Modules\Writeoff\Entities\LoanType;
|
||||
use Modules\Writeoff\Http\Requests\LoanType\StoreLoanTypeRequest;
|
||||
use Modules\Writeoff\Http\Requests\LoanType\UpdateLoanTypeRequest;
|
||||
|
||||
class LoanTypeModal 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.loan-type.loan-type-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
|
||||
$loan_type = LoanType::find($this->id);
|
||||
$loan_type->update($data);
|
||||
|
||||
$this->dispatch('success', __('Loan Type updated'));
|
||||
} else {
|
||||
// Emit a success event with a message
|
||||
LoanType::create($data);
|
||||
$this->dispatch('success', __('New Loan Type created'));
|
||||
}
|
||||
});
|
||||
|
||||
// Reset the form fields after successful submission
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->edit_mode = true;
|
||||
|
||||
$loan_type = LoanType::find($id);
|
||||
|
||||
$this->id = $loan_type->id;
|
||||
$this->kode = $loan_type->kode;
|
||||
$this->name = $loan_type->name;
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
LoanType::destroy($id);
|
||||
|
||||
// Emit a success event with a message
|
||||
$this->dispatch('success', 'Loan Type successfully deleted');
|
||||
}
|
||||
|
||||
public function hydrate()
|
||||
{
|
||||
$this->resetErrorBag();
|
||||
$this->resetValidation();
|
||||
}
|
||||
|
||||
protected function rules()
|
||||
{
|
||||
if ($this->edit_mode) {
|
||||
$request = new UpdateLoanTypeRequest();
|
||||
} else {
|
||||
$request = new StoreLoanTypeRequest();
|
||||
}
|
||||
|
||||
return $request->rules();
|
||||
}
|
||||
}
|
||||
|
72
Resources/views/livewire/loan-type/loan-type-modal.blade.php
Normal file
72
Resources/views/livewire/loan-type/loan-type-modal.blade.php
Normal file
@ -0,0 +1,72 @@
|
||||
<div class="modal fade" id="kt_modal_add_loan_type" 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_loan_type_header">
|
||||
<!--begin::Modal title-->
|
||||
<h2 class="fw-bold">Add Jenis Pinjaman</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_loan_type_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_loan_type_scroll" data-kt-scroll="true" data-kt-scroll-activate="true" data-kt-scroll-max-height="auto" data-kt-scroll-dependencies="#kt_modal_add_loan_type_header" data-kt-scroll-wrappers="#kt_modal_add_loan_type_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 Jenis Pinjaman</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 Jenis Pinjaman"/>
|
||||
<!--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 Jenis Pinjaman</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 Jenis Pinjaman"/>
|
||||
<!--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-loan_typees-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/loan_types/_actions.blade.php
Normal file
23
Resources/views/parameter/loan_types/_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="{{ $loan_type->id }}" data-bs-toggle="modal" data-bs-target="#kt_modal_add_loan_type" 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="{{ $loan_type->id }}" data-kt-action="delete_row">
|
||||
Delete
|
||||
</a>
|
||||
</div>
|
||||
<!--end::Menu item-->
|
||||
</div>
|
||||
<!--end::Menu-->
|
37
Resources/views/parameter/loan_types/_draw-scripts.js
Normal file
37
Resources/views/parameter/loan_types/_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['loan-type-table'].ajax.reload();
|
||||
});
|
72
Resources/views/parameter/loan_types/index.blade.php
Normal file
72
Resources/views/parameter/loan_types/index.blade.php
Normal file
@ -0,0 +1,72 @@
|
||||
<x-default-layout>
|
||||
|
||||
@section('title')
|
||||
Jenis Fasilitas
|
||||
@endsection
|
||||
|
||||
@section('breadcrumbs')
|
||||
{{ Breadcrumbs::render('parameter.loan-types') }}
|
||||
@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-loan_type-table-filter="search" class="form-control form-control-solid w-250px ps-13" placeholder="Search loan_type" 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-loan_type-table-toolbar="base">
|
||||
<!--begin::Add loan_type-->
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#kt_modal_add_loan_type">
|
||||
{!! getIcon('plus', 'fs-2', '', 'i') !!}
|
||||
Add Jenis Fasilitas
|
||||
</button>
|
||||
<!--end::Add loan_type-->
|
||||
</div>
|
||||
<!--end::Toolbar-->
|
||||
|
||||
<!--begin::Modal-->
|
||||
<livewire:writeoff::loan-type.loan-type-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['loan-type-table'].search(this.value).draw();
|
||||
});
|
||||
document.addEventListener('livewire:initialized', function () {
|
||||
Livewire.on('success', function () {
|
||||
$('#kt_modal_add_loan_type').modal('hide');
|
||||
window.LaravelDataTables['loan-type-table'].ajax.reload();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
</x-default-layout>
|
@ -44,6 +44,14 @@
|
||||
<span class="menu-title">Jenis Fasilitas</span>
|
||||
</a>
|
||||
<!--end:Menu link-->
|
||||
<!--begin:Menu link-->
|
||||
<a class="menu-link {{ isset($route[1]) && $route[1] == 'loan_types' ? 'active' : '' }}" href="{{ route('parameter.loan_types.index') }}">
|
||||
<span class="menu-bullet">
|
||||
<span class="bullet bullet-dot"></span>
|
||||
</span>
|
||||
<span class="menu-title">Jenis Pinjaman</span>
|
||||
</a>
|
||||
<!--end:Menu link-->
|
||||
</div>
|
||||
<!--end:Menu item-->
|
||||
</div>
|
||||
|
@ -27,3 +27,8 @@
|
||||
$trail->parent('parameter');
|
||||
$trail->push('Jenis Fasilitas', route('parameter.facility_types.index'));
|
||||
});
|
||||
|
||||
Breadcrumbs::for('parameter.loan-types', function (BreadcrumbTrail $trail) {
|
||||
$trail->parent('parameter');
|
||||
$trail->push('Jenis Pinjaman', route('parameter.loan_types.index'));
|
||||
});
|
||||
|
@ -16,4 +16,5 @@ Route::name('parameter.')->prefix('parameter')->group(function() {
|
||||
Route::get('currencies', 'CurrencyController@index')->name('currencies.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