add module rekening
This commit is contained in:
parent
37515c2313
commit
27fc3e56dc
124
DataTables/RekeningDataTable.php
Normal file
124
DataTables/RekeningDataTable.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\DataTables;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Modules\Writeoff\Entities\Branch;
|
||||
use Modules\Writeoff\Entities\Currency;
|
||||
use Modules\Writeoff\Entities\Debitur;
|
||||
use Modules\Writeoff\Entities\Product;
|
||||
use Modules\Writeoff\Entities\Rekening;
|
||||
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 RekeningDataTable 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('nomor_rekening', 'like', "%" . $search['value'] . "%");
|
||||
}
|
||||
})->addIndexColumn()->editColumn('registered_at', function ($row) {
|
||||
$date = Carbon::create($row->registered_at);
|
||||
return $date->locale('id')->translatedFormat('d F Y');
|
||||
})->editColumn('debitur', function ($row) {
|
||||
$debitur = null;
|
||||
if($row->debitur_id){
|
||||
$debitur = Debitur::find($row->debitur_id);
|
||||
}
|
||||
return $debitur->id ? $debitur->kode.' - '.$debitur->name : '-';
|
||||
|
||||
})->editColumn('branch', function ($row) {
|
||||
$branch = null;
|
||||
if($row->branch_id){
|
||||
$branch = Branch::find($row->branch_id);
|
||||
}
|
||||
return $branch->id ? $branch->kode.' - '.$branch->name : '-';
|
||||
})->editColumn('product', function ($row) {
|
||||
$product = null;
|
||||
if($row->product_id){
|
||||
$product = Product::find($row->product_id);
|
||||
}
|
||||
return $product->id ? $product->kode.' - '.$product->name : '-';
|
||||
})->editColumn('currency', function ($row) {
|
||||
return $row->currency_id ? Currency::find($row->currency_id)->name : '-';
|
||||
})->editColumn('status', function ($row) {
|
||||
$status = $row->status ? '<span class="badge badge-light-success">Aktif</span>' : '<span class="badge badge-light-danger">Tidak Aktif</span>';
|
||||
$oto = $row->authorized_at !== null ? '<span class="badge badge-light-success">Authorised</span>' : '<span class="badge badge-light-danger">Not Authorised</span>';
|
||||
return $status . ' ' . $oto;
|
||||
})->rawColumns(['action', 'status'])->addColumn('action', function ($rekening) {
|
||||
return view('writeoff::parameter.rekening._actions', compact('rekening'));
|
||||
})->setRowId('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the query source of dataTable.
|
||||
*/
|
||||
public function query(Rekening $model)
|
||||
: QueryBuilder
|
||||
{
|
||||
return $model->newQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional method if you want to use the html builder.
|
||||
*/
|
||||
public function html()
|
||||
: HtmlBuilder
|
||||
{
|
||||
return $this->builder()
|
||||
->setTableId('rekening-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/debitur/_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('nomor_rekening')->title('Nomor Rekening'),
|
||||
Column::make('debitur')->title('Debitur'),
|
||||
Column::make('branch')->title('Cabang'),
|
||||
Column::make('product')->title('Produk'),
|
||||
Column::make('currency')->title('Mata Uang'),
|
||||
Column::make('registered_at')->title('Tanggal Buka Rekening'),
|
||||
Column::make('status')->title('Status'),
|
||||
Column::computed('action')->exportable(false)->printable(false)->width(60)->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filename for export.
|
||||
*/
|
||||
protected function filename()
|
||||
: string
|
||||
{
|
||||
return 'Rekening_' . date('YmdHis');
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Modules\Writeoff\Entities\Branch;
|
||||
use Modules\Writeoff\Entities\Currency;
|
||||
use Modules\Writeoff\Entities\Debitur;
|
||||
use Modules\Writeoff\Entities\Product;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up()
|
||||
: void
|
||||
{
|
||||
Schema::create('rekening', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(Branch::class)->constrained()->onDelete('cascade');
|
||||
$table->foreignIdFor(Debitur::class)->constrained('debitur')->onDelete('cascade');
|
||||
$table->foreignIdFor(Product::class)->constrained()->onDelete('cascade');
|
||||
$table->foreignIdFor(Currency::class)->constrained()->onDelete('cascade');
|
||||
$table->string('nomor_rekening', 10)->unique();
|
||||
$table->date('registered_at')->nullable();
|
||||
|
||||
$table->string('limit_ref',10)->nullable();
|
||||
$table->boolean('status_rekening')->default(true)->nullable();
|
||||
$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('rekening');
|
||||
}
|
||||
};
|
@ -20,4 +20,10 @@
|
||||
{
|
||||
return $this->hasMany(Debitur::class);
|
||||
}
|
||||
|
||||
public function rekenings()
|
||||
{
|
||||
return $this->hasMany(Rekening::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
43
Entities/Rekening.php
Normal file
43
Entities/Rekening.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Entities;
|
||||
|
||||
class Rekening extends BaseModel
|
||||
{
|
||||
protected $table = 'rekening';
|
||||
protected $fillable = [
|
||||
'branch_id',
|
||||
'debitur_id',
|
||||
'product_id',
|
||||
'currency_id',
|
||||
'nomor_rekening',
|
||||
'status_rekening',
|
||||
'status',
|
||||
'limit_ref',
|
||||
'registered_at',
|
||||
'authorized_at',
|
||||
'authorized_status',
|
||||
'authorized_by',
|
||||
];
|
||||
|
||||
public function branch()
|
||||
{
|
||||
return $this->belongsTo(Branch::class);
|
||||
}
|
||||
|
||||
public function debitur()
|
||||
{
|
||||
return $this->belongsTo(Debitur::class);
|
||||
}
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
public function currency()
|
||||
{
|
||||
return $this->belongsTo(Currency::class);
|
||||
}
|
||||
|
||||
}
|
37
Http/Controllers/RekeningController.php
Normal file
37
Http/Controllers/RekeningController.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\RekeningDataTable;
|
||||
|
||||
class RekeningController 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 Rekenings.
|
||||
*
|
||||
* @param \Modules\Writeoff\DataTables\RekeningDataTable $dataTable
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function index(RekeningDataTable $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.rekening.index');
|
||||
}
|
||||
}
|
80
Http/Requests/Rekening/StoreRekeningRequest.php
Normal file
80
Http/Requests/Rekening/StoreRekeningRequest.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Http\Requests\Rekening;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\Validation\Validator;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
class StoreRekeningRequest 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 [
|
||||
'nomor_rekening' => 'required|numeric|digits:10|unique:rekening,nomor_rekening',
|
||||
'branch_id' => 'required|integer|exists:branches,id',
|
||||
'debitur_id' => 'required|integer|exists:debitur,id',
|
||||
'product_id' => 'required|integer|exists:products,id',
|
||||
'currency_id' => 'required|integer|exists:currencies,id',
|
||||
'status' => 'nullable|boolean',
|
||||
'status_rekening' => 'nullable|boolean',
|
||||
'limit_ref' => 'nullable|string|max:10',
|
||||
'registered_at' => 'nullable|date_format:Y-m-d'
|
||||
];
|
||||
}
|
||||
|
||||
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.rekening.index')->with('error', 'Rekening 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' => 'Rekening created failed.'
|
||||
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||
}
|
||||
}
|
77
Http/Requests/Rekening/UpdateRekeningRequest.php
Normal file
77
Http/Requests/Rekening/UpdateRekeningRequest.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Http\Requests\Rekening;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class UpdateRekeningRequest 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 [
|
||||
'nomor_rekening' => 'required|numeric|digits:10|unique:rekening,nomor_rekening,' . $this->_id,
|
||||
'branch_id' => 'required|integer|exists:branches,id',
|
||||
'debitur_id' => 'required|integer|exists:debitur,id',
|
||||
'product_id' => 'required|integer|exists:products,id',
|
||||
'currency_id' => 'required|integer|exists:currencies,id',
|
||||
'status' => 'required|boolean',
|
||||
'status_rekening' => 'required|boolean',
|
||||
'limit_ref' => 'nullable|string|max:10',
|
||||
'registered_at' => 'nullable|date_format:Y-m-d'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.rekening.index')->with('error', 'Rekening 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' => 'Rekening updated failed.'
|
||||
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||
}
|
||||
}
|
130
Livewire/Rekening/RekeningModal.php
Normal file
130
Livewire/Rekening/RekeningModal.php
Normal file
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Livewire\Rekening;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Livewire\Component;
|
||||
use Modules\Writeoff\Entities\Branch;
|
||||
use Modules\Writeoff\Entities\Currency;
|
||||
use Modules\Writeoff\Entities\Debitur;
|
||||
use Modules\Writeoff\Entities\Product;
|
||||
use Modules\Writeoff\Entities\Rekening;
|
||||
use Modules\Writeoff\Http\Requests\Rekening\StoreRekeningRequest;
|
||||
use Modules\Writeoff\Http\Requests\Rekening\UpdateRekeningRequest;
|
||||
|
||||
class RekeningModal extends Component
|
||||
{
|
||||
public $id;
|
||||
public $nomor_rekening;
|
||||
public $status_rekening;
|
||||
public $branch_id;
|
||||
public $debitur_id;
|
||||
public $product_id;
|
||||
public $currency_id;
|
||||
|
||||
public $status;
|
||||
public $limit_ref;
|
||||
public $registered_at;
|
||||
|
||||
public $edit_mode = false;
|
||||
|
||||
protected $listeners = [
|
||||
'delete' => 'delete',
|
||||
'update' => 'update',
|
||||
];
|
||||
|
||||
public function render()
|
||||
{
|
||||
$cabang = Branch::all();
|
||||
$debitur = Debitur::all();
|
||||
$product = Product::all();
|
||||
$currency = Currency::all();
|
||||
|
||||
return view('writeoff::livewire.rekening.rekening-modal', compact([
|
||||
'cabang',
|
||||
'debitur',
|
||||
'product',
|
||||
'currency'
|
||||
]));
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
$this->validate();
|
||||
|
||||
// Validate the form input data
|
||||
DB::transaction(function () {
|
||||
// Prepare the data for creating a new user
|
||||
$data = [
|
||||
'nomor_rekening' => $this->nomor_rekening,
|
||||
'branch_id' => $this->branch_id,
|
||||
'debitur_id' => $this->debitur_id,
|
||||
'product_id' => $this->product_id,
|
||||
'currency_id' => $this->currency_id,
|
||||
'status' => $this->status,
|
||||
'status_rekening' => $this->status_rekening,
|
||||
'limit_ref' => $this->limit_ref,
|
||||
'registered_at' => $this->registered_at
|
||||
];
|
||||
|
||||
|
||||
if ($this->edit_mode) {
|
||||
// Emit a success event with a message
|
||||
$rekening = Rekening::find($this->id);
|
||||
$rekening->update($data);
|
||||
|
||||
$this->dispatch('success', __('Rekening updated'));
|
||||
} else {
|
||||
// Emit a success event with a message
|
||||
Rekening::create($data);
|
||||
$this->dispatch('success', __('New Rekening created'));
|
||||
}
|
||||
});
|
||||
|
||||
// Reset the form fields after successful submission
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->edit_mode = true;
|
||||
|
||||
$rekening = Rekening::find($id);
|
||||
|
||||
$this->id = $rekening->id;
|
||||
$this->nomor_rekening = $rekening->nomor_rekening;
|
||||
$this->branch_id = $rekening->branch_id;
|
||||
$this->debitur_id = $rekening->debitur_id;
|
||||
$this->product_id = $rekening->product_id;
|
||||
$this->currency_id = $rekening->currency_id;
|
||||
$this->status = $rekening->status == 1 ? true : false;
|
||||
$this->status_rekening = $rekening->status_rekening == 1 ? true : false;
|
||||
$this->limit_ref = $rekening->limit_ref;
|
||||
$this->registered_at = $rekening->registered_at;
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
Rekening::destroy($id);
|
||||
|
||||
// Emit a success event with a message
|
||||
$this->dispatch('success', 'Rekening successfully deleted');
|
||||
}
|
||||
|
||||
public function hydrate()
|
||||
{
|
||||
$this->resetErrorBag();
|
||||
$this->resetValidation();
|
||||
}
|
||||
|
||||
protected function rules()
|
||||
{
|
||||
if ($this->edit_mode) {
|
||||
$request = new UpdateRekeningRequest();
|
||||
} else {
|
||||
$request = new StoreRekeningRequest();
|
||||
}
|
||||
return $request->rules();
|
||||
}
|
||||
}
|
||||
|
171
Resources/views/livewire/rekening/rekening-modal.blade.php
Normal file
171
Resources/views/livewire/rekening/rekening-modal.blade.php
Normal file
@ -0,0 +1,171 @@
|
||||
<div class="modal fade" id="kt_modal_add_rekening" 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_rekening_header">
|
||||
<!--begin::Modal title-->
|
||||
<h2 class="fw-bold">Add Rekening</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_rekening_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_rekening_scroll" data-kt-scroll="true" data-kt-scroll-activate="true" data-kt-scroll-max-height="auto" data-kt-scroll-dependencies="#kt_modal_add_rekening_header" data-kt-scroll-wrappers="#kt_modal_add_rekening_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">Nomor Rekening</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="text" wire:model.defer="nomor_rekening" name="nomor_rekening" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Nomor Rekening"/>
|
||||
<!--end::Input-->
|
||||
@error('nomor_rekening')
|
||||
<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">Cabang</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<select wire:model.defer="branch_id" name="branch_id" class="form-control form-control-solid mb-3 mb-lg-0">
|
||||
<option value="">Pilih Cabang</option>
|
||||
@foreach($cabang as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->kode }} - {{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<!--end::Input-->
|
||||
@error('branch_id')
|
||||
<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">Debitur</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<select wire:model.defer="debitur_id" name="debitur_id" class="form-control form-control-solid mb-3 mb-lg-0">
|
||||
<option value="">Pilih Debitur</option>
|
||||
@foreach($debitur as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->kode }} - {{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<!--end::Input-->
|
||||
@error('debitur_id')
|
||||
<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">Produk</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<select wire:model.defer="product_id" name="product_id" class="form-control form-control-solid mb-3 mb-lg-0">
|
||||
<option value="">Pilih Produk</option>
|
||||
@foreach($product as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->kode }} - {{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<!--end::Input-->
|
||||
@error('debitur_id')
|
||||
<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">Mata Uang</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<select wire:model.defer="currency_id" name="currency_id" class="form-control form-control-solid mb-3 mb-lg-0">
|
||||
<option value="">Pilih Mata Uang</option>
|
||||
@foreach($currency as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->kode }} - {{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<!--end::Input-->
|
||||
@error('currency_id')
|
||||
<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">Tanggal Buka Rekening</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="date" wire:model.defer="registered_at" name="registered_at" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Tanggal Buka Rekekning"/>
|
||||
<!--end::Input-->
|
||||
@error('registered_at')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
<!--end::Input group-->
|
||||
<!--begin::Input group-->
|
||||
<div class="fv-row mb-7">
|
||||
<!--begin::Label-->
|
||||
<label class="fw-semibold fs-6 mb-2">Limit Reff</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="text" wire:model.defer="limit_ref" name="limit_ref" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Limit Ref"/>
|
||||
<!--end::Input-->
|
||||
@error('limit_ref')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
<!--end::Input group-->
|
||||
<label class="fw-semibold fs-6 mb-2">Status Rekening</label>
|
||||
<div class="form-check form-switch form-check-custom form-check-solid mb-5" style="display: block!important;">
|
||||
<input class="form-check-input h-20px w-30px me-5" type="checkbox" wire:model.defer="status_rekening" id="status_rekening" name="status_rekekning"/>
|
||||
<label class="form-check-label" for="status_rekening">
|
||||
Aktif
|
||||
</label>
|
||||
@error('status_rekening')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
|
||||
<label class="fw-semibold fs-6 mb-2">Status Data</label>
|
||||
<div class="form-check form-switch form-check-custom form-check-solid" style="display: block!important;">
|
||||
<input class="form-check-input h-20px w-30px me-5" type="checkbox" wire:model.defer="status" id="status" name="status"/>
|
||||
<label class="form-check-label" for="status">
|
||||
Aktif
|
||||
</label>
|
||||
@error('status')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
|
||||
</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-rekening-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/rekening/_actions.blade.php
Normal file
23
Resources/views/parameter/rekening/_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="{{ $rekening->id }}" data-bs-toggle="modal" data-bs-target="#kt_modal_add_rekening" 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="{{ $rekening->id }}" data-kt-action="delete_row">
|
||||
Delete
|
||||
</a>
|
||||
</div>
|
||||
<!--end::Menu item-->
|
||||
</div>
|
||||
<!--end::Menu-->
|
37
Resources/views/parameter/rekening/_draw-scripts.js
Normal file
37
Resources/views/parameter/rekening/_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['rekening-table'].ajax.reload();
|
||||
});
|
72
Resources/views/parameter/rekening/index.blade.php
Normal file
72
Resources/views/parameter/rekening/index.blade.php
Normal file
@ -0,0 +1,72 @@
|
||||
<x-default-layout>
|
||||
|
||||
@section('title')
|
||||
Rekening
|
||||
@endsection
|
||||
|
||||
@section('breadcrumbs')
|
||||
{{ Breadcrumbs::render('parameter.rekening') }}
|
||||
@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-rekening-table-filter="search" class="form-control form-control-solid w-250px ps-13" placeholder="Search rekening" 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-rekening-table-toolbar="base">
|
||||
<!--begin::Add rekening-->
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#kt_modal_add_rekening">
|
||||
{!! getIcon('plus', 'fs-2', '', 'i') !!}
|
||||
Add Rekening
|
||||
</button>
|
||||
<!--end::Add rekening-->
|
||||
</div>
|
||||
<!--end::Toolbar-->
|
||||
|
||||
<!--begin::Modal-->
|
||||
<livewire:writeoff::rekening.rekening-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['rekening-table'].search(this.value).draw();
|
||||
});
|
||||
document.addEventListener('livewire:initialized', function () {
|
||||
Livewire.on('success', function () {
|
||||
$('#kt_modal_add_rekening').modal('hide');
|
||||
window.LaravelDataTables['rekening-table'].ajax.reload();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
</x-default-layout>
|
@ -68,6 +68,14 @@
|
||||
<span class="menu-title">Debitur</span>
|
||||
</a>
|
||||
<!--end:Menu link-->
|
||||
<!--begin:Menu link-->
|
||||
<a class="menu-link {{ isset($route[1]) && $route[1] == 'rekening' ? 'active' : '' }}" href="{{ route('parameter.rekening.index') }}">
|
||||
<span class="menu-bullet">
|
||||
<span class="bullet bullet-dot"></span>
|
||||
</span>
|
||||
<span class="menu-title">Rekening</span>
|
||||
</a>
|
||||
<!--end:Menu link-->
|
||||
</div>
|
||||
<!--end:Menu item-->
|
||||
</div>
|
||||
|
@ -42,3 +42,7 @@
|
||||
$trail->parent('parameter');
|
||||
$trail->push('Debitur', route('parameter.debitur.index'));
|
||||
});
|
||||
Breadcrumbs::for('parameter.rekening', function (BreadcrumbTrail $trail) {
|
||||
$trail->parent('parameter');
|
||||
$trail->push('Rekening', route('parameter.rekening.index'));
|
||||
});
|
||||
|
@ -19,4 +19,5 @@ Route::name('parameter.')->prefix('parameter')->group(function() {
|
||||
Route::get('facility-types', 'FacilityTypeController@index')->name('facility_types.index');
|
||||
Route::get('loan-types', 'LoanTypeController@index')->name('loan_types.index');
|
||||
Route::get('debitur', 'DebiturController@index')->name('debitur.index');
|
||||
Route::get('rekening', 'RekeningController@index')->name('rekening.index');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user