tambah fungsi add fasilitas
This commit is contained in:
103
DataTables/FasilitasDataTable.php
Normal file
103
DataTables/FasilitasDataTable.php
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Master\DataTables;
|
||||||
|
|
||||||
|
use Modules\Master\Entities\Gender;
|
||||||
|
use Yajra\DataTables\Html\Column;
|
||||||
|
use Yajra\DataTables\Services\DataTable;
|
||||||
|
|
||||||
|
class GenderDataTable extends DataTable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Build DataTable class.
|
||||||
|
*
|
||||||
|
* @param mixed $query Results from query() method.
|
||||||
|
*
|
||||||
|
* @return \Yajra\DataTables\DataTableAbstract
|
||||||
|
*/
|
||||||
|
public function dataTable($query)
|
||||||
|
{
|
||||||
|
|
||||||
|
return datatables()
|
||||||
|
->eloquent($query)
|
||||||
|
->filter(function ($query) {
|
||||||
|
$search = request()->get('search');
|
||||||
|
if ($search['value'] !== "") {
|
||||||
|
$query->where('name', 'like', "%" . $search['value'] . "%");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->addIndexColumn()
|
||||||
|
->addColumn('status', function ($model) {
|
||||||
|
return view('master::gender._status', compact('model'));
|
||||||
|
})
|
||||||
|
->addColumn('action', function ($model) {
|
||||||
|
return view('master::gender._action', compact('model'));
|
||||||
|
})
|
||||||
|
->rawColumns(['status','action']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get query source of dataTable.
|
||||||
|
*
|
||||||
|
* @param \Modules\Gender\Entities\Gender $model
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
|
*/
|
||||||
|
public function query(Gender $model)
|
||||||
|
{
|
||||||
|
return $model->newQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional method if you want to use html builder.
|
||||||
|
*
|
||||||
|
* @return \Yajra\DataTables\Html\Builder
|
||||||
|
*/
|
||||||
|
public function html()
|
||||||
|
{
|
||||||
|
return $this->builder()
|
||||||
|
->setTableId('master-gender-table')
|
||||||
|
->columns($this->getColumns())
|
||||||
|
->minifiedAjax()
|
||||||
|
->orderBy(1, 'asc')
|
||||||
|
->stateSave(false)
|
||||||
|
->responsive()
|
||||||
|
->autoWidth(false)
|
||||||
|
->parameters([
|
||||||
|
'scrollX' => false,
|
||||||
|
'drawCallback' => 'function() { KTMenu.createInstances(); }',
|
||||||
|
])
|
||||||
|
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get columns.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getColumns()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
|
||||||
|
Column::make('name')->title(__('Name')),
|
||||||
|
Column::computed('status')->title(__('Status'))->width(50)->addClass('text-center')->exportable(false),
|
||||||
|
Column::computed('action')
|
||||||
|
->exportable(false)
|
||||||
|
->printable(false)
|
||||||
|
->width(100)
|
||||||
|
->addClass('text-center')
|
||||||
|
->responsivePriority(-1),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get filename for export.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function filename()
|
||||||
|
: string
|
||||||
|
{
|
||||||
|
return 'Gender_' . date('YmdHis');
|
||||||
|
}
|
||||||
|
}
|
47
Database/Migrations/2023_08_04_062326_fasilitas.php
Normal file
47
Database/Migrations/2023_08_04_062326_fasilitas.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('', function (Blueprint $table) {
|
||||||
|
Schema::create('fasilitas', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('nomor_rekening');
|
||||||
|
$table->string('jenis_fasilitas');
|
||||||
|
$table->string('saldo');
|
||||||
|
$table->string('start_date');
|
||||||
|
$table->string('due_date');
|
||||||
|
$table->string('jangka_waktu');
|
||||||
|
$table->string('fixed_rate');
|
||||||
|
$table->string('keterangan');
|
||||||
|
$table->string('status', 1)->default('1');
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
$table->unsignedBigInteger("created_by")->nullable();
|
||||||
|
$table->unsignedBigInteger("updated_by")->nullable();
|
||||||
|
$table->unsignedBigInteger("deleted_by")->nullable();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('fasilitas');
|
||||||
|
}
|
||||||
|
};
|
33
Entities/Fasilitas.php
Normal file
33
Entities/Fasilitas.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\KonfirmasiBank\Entities;
|
||||||
|
|
||||||
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class Fasilitas extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
//public $incrementing = false;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
"'id',
|
||||||
|
'nomor_rekening'
|
||||||
|
'jenis_fasilitas',
|
||||||
|
'saldo',
|
||||||
|
'start_date',
|
||||||
|
'due_date',
|
||||||
|
'jangka_waktu',
|
||||||
|
'fixed_rate',
|
||||||
|
'keterangan'"
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
36
Entities/LimitReference.php
Normal file
36
Entities/LimitReference.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\KonfirmasiBank\Entities;
|
||||||
|
|
||||||
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class LimitReference extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $connection = 'db2';
|
||||||
|
protected $table = 'STG_DB.LIMIT_REFERENCE';
|
||||||
|
protected $primaryKey = 'ID';
|
||||||
|
|
||||||
|
//public $incrementing = false;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
"'ID',
|
||||||
|
'DESC_NAME'
|
||||||
|
'SHORT_NAME',
|
||||||
|
'REDUCING_LIMIT',
|
||||||
|
'LIMIT_MNEMONIC',
|
||||||
|
'LIMIT_PERCENTAGE',
|
||||||
|
'DESCRIPTION',
|
||||||
|
'BATCH_DATE',
|
||||||
|
'INSERT_DATE'"
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -8,9 +8,13 @@
|
|||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Modules\KonfirmasiBank\DataTables\ViewAccountDataTable;
|
use Modules\KonfirmasiBank\DataTables\ViewAccountDataTable;
|
||||||
use Modules\KonfirmasiBank\Entities\ViewAccount;
|
use Modules\KonfirmasiBank\Entities\ViewAccount;
|
||||||
|
use Modules\KonfirmasiBank\Entities\LimitReference;
|
||||||
|
use Modules\KonfirmasiBank\Entities\Fasilitas;
|
||||||
use Dompdf\Dompdf;
|
use Dompdf\Dompdf;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Facades\View;
|
use Illuminate\Support\Facades\View;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Modules\KonfirmasiBank\Http\Requests\Fasilitas\StoreFasilitasRequest;
|
||||||
class KonfirmasiBankController extends Controller
|
class KonfirmasiBankController extends Controller
|
||||||
{
|
{
|
||||||
public $user;
|
public $user;
|
||||||
@ -25,20 +29,6 @@
|
|||||||
addVendor('chained-select');
|
addVendor('chained-select');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*/
|
|
||||||
// public function index(ViewAccountDataTable $dataTable)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// if (is_null($this->user) || !$this->user->can('konfirmasibank.read')) {
|
|
||||||
// abort(403, 'Sorry !! You are Unauthorized to view any master data !');
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return $dataTable->render('konfirmasibank::index');
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
@ -50,10 +40,10 @@
|
|||||||
$currentYear = $today->format("Y");
|
$currentYear = $today->format("Y");
|
||||||
|
|
||||||
// Menambahkan 5 tahun ke tanggal saat ini
|
// Menambahkan 5 tahun ke tanggal saat ini
|
||||||
$futureYear = $today->subYear(3)->format('Y');
|
$pastYear = $today->subYear(3)->format('Y');
|
||||||
|
|
||||||
$data['currentYear'] = $currentYear;
|
$data['currentYear'] = $currentYear;
|
||||||
$data['pastYear'] = $futureYear;
|
$data['pastYear'] = $pastYear;
|
||||||
// dd($data);
|
// dd($data);
|
||||||
|
|
||||||
return view('konfirmasibank::pages.index',compact('data'));
|
return view('konfirmasibank::pages.index',compact('data'));
|
||||||
@ -72,7 +62,7 @@
|
|||||||
$data[$key]['WORKING_BALANCE'] = $account->WORKING_BALANCE;
|
$data[$key]['WORKING_BALANCE'] = $account->WORKING_BALANCE;
|
||||||
$data[$key]['PRODUCT'] = $account->PRODUCT;
|
$data[$key]['PRODUCT'] = $account->PRODUCT;
|
||||||
$data[$key]['CURRENCY'] = $account->CURRENCY;
|
$data[$key]['CURRENCY'] = $account->CURRENCY;
|
||||||
$data[$key]['MATURITY_DATE'] = $account->MATURITY_DATE;
|
$data[$key]['MATURITY_DATE'] = $account->MATURITY_DATE ?? '-';
|
||||||
}
|
}
|
||||||
return json_encode($data);
|
return json_encode($data);
|
||||||
}
|
}
|
||||||
@ -174,10 +164,176 @@
|
|||||||
// Keluarkan file PDF ke browser
|
// Keluarkan file PDF ke browser
|
||||||
$pdf->stream('"Konfirmasi_bank_"'.$ListPinjaman[0]->SHORT_NAME.'"'. $formattedDate.'".pdf"');
|
$pdf->stream('"Konfirmasi_bank_"'.$ListPinjaman[0]->SHORT_NAME.'"'. $formattedDate.'".pdf"');
|
||||||
|
|
||||||
// $pdf->render();
|
}
|
||||||
// return $pdf->stream('Konfirmasi_bank_"'.$ListPinjaman[0]->SHORT_NAME.'"'. $formattedDate.'""');
|
|
||||||
|
public function addFasilitas(Request $request){
|
||||||
|
|
||||||
|
if (is_null($this->user) || !$this->user->can('konfirmasibank.report')) {
|
||||||
|
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$fasilitas = Fasilitas::where('status', 1)->where('created_by',$this->user->id)->paginate(10);
|
||||||
|
|
||||||
|
$limitReference = LimitReference::all();
|
||||||
|
$data['fasilitas'] = $fasilitas;
|
||||||
|
$data['limitReference'] = $limitReference;
|
||||||
|
|
||||||
|
return view('konfirmasibank::pages.index_fasilitas',compact('data'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function postFasilitas(Request $request){
|
||||||
|
|
||||||
|
if (is_null($this->user) || !$this->user->can('konfirmasibank.create')) {
|
||||||
|
abort(403, 'Sorry !! You are Unauthorized to create any konfirmasibank.create !');
|
||||||
|
}
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'nomor_rekening' => 'required|string|max:10|unique:fasilitas,nomor_rekening',
|
||||||
|
'jenis_fasilitas' => 'required|string',
|
||||||
|
'saldo' => 'required|string',
|
||||||
|
'start_date' => 'required|string',
|
||||||
|
'due_date' => 'required|string',
|
||||||
|
'jangka_waktu' => 'required|string',
|
||||||
|
'fixed_rate' => 'required|string'
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validated) {
|
||||||
|
try {
|
||||||
|
// Create New User
|
||||||
|
$fasilitas = new Fasilitas();
|
||||||
|
$fasilitas->nomor_rekening = $request->nomor_rekening;
|
||||||
|
$fasilitas->jenis_fasilitas = $request->jenis_fasilitas;
|
||||||
|
$fasilitas->saldo = $request->saldo;
|
||||||
|
$fasilitas->start_date = $request->start_date;
|
||||||
|
$fasilitas->due_date = $request->due_date;
|
||||||
|
$fasilitas->jangka_waktu = $request->jangka_waktu;
|
||||||
|
$fasilitas->fixed_rate = $request->fixed_rate;
|
||||||
|
$fasilitas->keterangan = $request->keterangan;
|
||||||
|
|
||||||
|
$fasilitas->save();
|
||||||
|
return redirect()->route('konfirmasibank.addFasilitas')->with('success', 'Data berhasil ditambahkan');
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return json_encode([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => $e->getMessage()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function editFasilitas(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (is_null($this->user) || !$this->user->can('konfirmasibank.update')) {
|
||||||
|
abort(403, 'Sorry !! You are Unauthorized to edit any role !');
|
||||||
|
}
|
||||||
|
|
||||||
|
$fasilitas = Fasilitas::find($request->id);
|
||||||
|
|
||||||
|
return json_encode( $fasilitas);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $id
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function updateFasilitas(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (is_null($this->user) || !$this->user->can('konfirmasibank.update')) {
|
||||||
|
abort(403, 'Sorry !! You are Unauthorized to edit any role !');
|
||||||
|
}
|
||||||
|
|
||||||
|
$today = Carbon::now();
|
||||||
|
// Menambahkan 1 tahun ke tanggal saat ini
|
||||||
|
// $currentYear = $today->format("YYYY-MM-DD");
|
||||||
|
|
||||||
|
// Validation Data\
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'nomor_rekening' => 'required|string|max:10|unique:fasilitas,nomor_rekening',
|
||||||
|
'jenis_fasilitas' => 'required|string',
|
||||||
|
'saldo' => 'required|string',
|
||||||
|
'start_date' => 'required|string',
|
||||||
|
'due_date' => 'required|string',
|
||||||
|
'jangka_waktu' => 'required|string',
|
||||||
|
'fixed_rate' => 'required|string'
|
||||||
|
// Other validation rules
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json(['errors' => $validator->errors()], 422); // Return validation errors as JSON
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($validator) {
|
||||||
|
try {
|
||||||
|
$fasilitas = Fasilitas::findOrFail($request->id);
|
||||||
|
$fasilitas->nomor_rekening = $request->nomor_rekening;
|
||||||
|
$fasilitas->jenis_fasilitas = $request->jenis_fasilitas;
|
||||||
|
$fasilitas->saldo = $request->saldo;
|
||||||
|
$fasilitas->start_date = $request->start_date;
|
||||||
|
$fasilitas->due_date = $request->due_date;
|
||||||
|
$fasilitas->jangka_waktu = $request->jangka_waktu;
|
||||||
|
$fasilitas->fixed_rate = $request->fixed_rate;
|
||||||
|
$fasilitas->keterangan = $request->keterangan;
|
||||||
|
$fasilitas->updated_at = $today;
|
||||||
|
$fasilitas->save();
|
||||||
|
|
||||||
|
echo json_encode(['status' => 'success', 'message' => ' fasilitas updated successfully.']);
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => ' fasilitas updated failed.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
echo json_encode(['status' => 'error', 'message' => ' fasilitas updated failed.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
*
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function destroyFasilitas(Request $request)
|
||||||
|
{
|
||||||
|
if (is_null($this->user) || !$this->user->can('konfirmasibank.delete')) {
|
||||||
|
abort(403, 'Sorry !! You are Unauthorized to delete any konfirmasibank module !');
|
||||||
|
}
|
||||||
|
|
||||||
|
$fasilitas = Fasilitas::findOrFail($request->id);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$fasilitas->status = 0;
|
||||||
|
$fasilitas->save();
|
||||||
|
echo json_encode(['status' => 'success', 'message' => ' fasilitas deleted successfully.']);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => ' fasilitas deleted failed.']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
71
Http/Requests/Fasilitas/StoreFasilitasRequest.php
Normal file
71
Http/Requests/Fasilitas/StoreFasilitasRequest.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\KonfirmasiBank\Http\Requests\Fasilitas;
|
||||||
|
|
||||||
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use Illuminate\Validation\Validator;
|
||||||
|
use Modules\KonfirmasiBank\Http\Requests\MasterRequest;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
|
||||||
|
class StoreFasilitasRequest extends MasterRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 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|string|max:10|unique:fasilitas,nomor_rekening',
|
||||||
|
'jenis_fasilitas' => 'required|string',
|
||||||
|
'saldo' => 'required|string',
|
||||||
|
'start_date' => 'required|string',
|
||||||
|
'due_date' => 'required|string',
|
||||||
|
'jangka_waktu' => 'required|string',
|
||||||
|
'fixed_rate' => 'required|string'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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('konfirmasibank.addFasilitas')->with('error', 'Fasilitas 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' => 'Fasilitas created failed.'
|
||||||
|
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||||
|
}
|
||||||
|
}
|
71
Http/Requests/Fasilitas/UpdateFasilitasRequest.php
Normal file
71
Http/Requests/Fasilitas/UpdateFasilitasRequest.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\KonfirmasiBank\Http\Requests\Fasilitas;
|
||||||
|
|
||||||
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use Illuminate\Validation\Validator;
|
||||||
|
use Modules\KonfirmasiBank\Http\Requests\MasterRequest;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
|
||||||
|
class UpdateFasilitasRequest extends MasterRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 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|string|max:10|unique:fasilitas,nomor_rekening',
|
||||||
|
'jenis_fasilitas' => 'required|string',
|
||||||
|
'saldo' => 'required|string',
|
||||||
|
'start_date' => 'required|string',
|
||||||
|
'due_date' => 'required|string',
|
||||||
|
'jangka_waktu' => 'required|string',
|
||||||
|
'fixed_rate' => 'required|string'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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('konfirmasibank.addFasilitas')->with('error', 'Fasilitas 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' => 'Fasilitas created failed.'
|
||||||
|
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||||
|
}
|
||||||
|
}
|
19
Http/Requests/MasterRequest.php
Normal file
19
Http/Requests/MasterRequest.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\KonfirmasiBank\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class MasterRequest extends FormRequest
|
||||||
|
{
|
||||||
|
protected function prepareForValidation()
|
||||||
|
{
|
||||||
|
$status = 0;
|
||||||
|
if ($this->status == "on") {
|
||||||
|
$status = 1;
|
||||||
|
}
|
||||||
|
$this->merge([
|
||||||
|
'status' => $status
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
15
Resources/views/pages/dynamic_table.blade.php
Normal file
15
Resources/views/pages/dynamic_table.blade.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<table class="table table-striped " id="">
|
||||||
|
<tbody id="">
|
||||||
|
<tr style="display:none" class="loading1">
|
||||||
|
<td class="text-center"><input class="" type="text" name=""></td>
|
||||||
|
<td class="text-center"><input class="" type="text" name=""></td>
|
||||||
|
<td class="text-center"><input class="" type="text" name=""></td>
|
||||||
|
<td class="text-center"><input class="" type="text" name=""></td>
|
||||||
|
<td class="text-center"><input class="" type="text" name=""></td>
|
||||||
|
<td class="text-center"><input class="" type="text" name=""></td>
|
||||||
|
<td class="text-center"><input class="" type="text" name=""></td>
|
||||||
|
<td class="text-center"><input class="" type="text" name=""></td>
|
||||||
|
<td class="text-center"><input class="" type="text" name=""></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
@ -31,7 +31,7 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm">Periode</label>
|
<label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm">Periode</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<input type="text" class="form-control form-control-sm" name="periode" min="{{$data["currentYear"]}}" max="{{$data["pastYear"]}}" id="periode" placeholder="Periode">
|
<input type="number" class="form-control form-control-sm" min="{{$data['pastYear']}}" max="{{$data['currentYear']}}" name="periode" clear id="periode" placeholder="Periode">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-end">
|
<div class="text-end">
|
||||||
@ -41,8 +41,6 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 ">
|
<div class="col-md-3 ">
|
||||||
|
|
||||||
|
|
||||||
<form class="form_customer2" method="POST" action="{{ route($route[0] . '.export') }}">
|
<form class="form_customer2" method="POST" action="{{ route($route[0] . '.export') }}">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
@ -53,21 +51,25 @@
|
|||||||
<input type="hidden" style="margin-bottom: 5px" name="periode" />
|
<input type="hidden" style="margin-bottom: 5px" name="periode" />
|
||||||
<div class="text-right ">
|
<div class="text-right ">
|
||||||
<div class="d-flex justify-content-end ">
|
<div class="d-flex justify-content-end ">
|
||||||
<button type="submit" class="btn btn-light-primary exportPdf" style="display:none">
|
<button type="submit" class="btn btn-light-primary btn-sm exportPdf" style="display:none">
|
||||||
<i class="ki-duotone ki-exit-down fs-2"><span class="path1"></span><span
|
<i class="ki-duotone ki-exit-down fs-2"><span class="path1"></span><span
|
||||||
class="path2"></span></i>
|
class="path2"></span></i>
|
||||||
Export Report
|
Export Report
|
||||||
</button>
|
</button>
|
||||||
|
<a href="{{ route($route[0] . '.addFasilitas') }}" type="button" class="btn btn-light-info btn-sm " style="">
|
||||||
|
<i class="ki-duotone ki-plus fs-2"><span class="path1"></span><span
|
||||||
|
class="path2"></span></i>
|
||||||
|
Fasilitas
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body pt-6">
|
<div class="card-body pt-6">
|
||||||
<form class="form_customer3" method="POST" action="{{ route($route[0] . '.export') }}">
|
<form class="form_customer3" method="POST" action="{{ route($route[0] . '.export') }}">
|
||||||
@ -77,17 +79,75 @@
|
|||||||
All
|
All
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Button to trigger the modal -->
|
||||||
|
|
||||||
<div class="table-responsive " style="overflow-x:auto;">
|
<div class="table-responsive " style="overflow-x:auto;">
|
||||||
<div id="user_table">
|
<div id="user_table">
|
||||||
@include('konfirmasibank::pages.table')
|
@include('konfirmasibank::pages.table')
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!--end::Card body-->
|
<!--end::Card body-->
|
||||||
</div>
|
</div>
|
||||||
<!--end::Card-->
|
<!-- The Modal -->
|
||||||
|
<div class="modal" id="myModal">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<!-- Modal Header -->
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title">Tambah Fasilitas</h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal body -->
|
||||||
|
<div class="modal-body">
|
||||||
|
<!-- Your horizontal form goes here -->
|
||||||
|
<form class="form-horizontal" id="myForm">
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="name" class="col-sm-4 col-form-label">No Rekening:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control form-control-sm" id="norek" name="norek" placeholder="Nomor Rekening">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="name" class="col-sm-4 col-form-label">Cabang:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control form-control-sm" name="cabang" placeholder="Pilih Cabang">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="name" class="col-sm-4 col-form-label">Jenis Rekening:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control form-control-sm" name="jns_rekening" placeholder="Jenis Rekening">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="name" class="col-sm-4 col-form-label">Jenis Pinjaman:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control form-control-sm" name="jns_pinjaman" placeholder="Jenis Pinjaman">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="name" class="col-sm-4 col-form-label">Jenis Fasilitas:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control form-control-sm" name="jns_fasilitas" placeholder="Jenis Fasilitas">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Add more form fields as needed -->
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal footer -->
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal" id ="cancelBtn">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" id="submitFormBtn">Submit</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@push('customscript')
|
@push('customscript')
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
@ -123,11 +183,6 @@
|
|||||||
$('.loading1').hide();
|
$('.loading1').hide();
|
||||||
let dateString ='';
|
let dateString ='';
|
||||||
$.each(items, function(i, index) {
|
$.each(items, function(i, index) {
|
||||||
if (items[i]['MATURITY_DATE']) {
|
|
||||||
dateString = moment(items[i]['MATURITY_DATE']).format("YYYY-MM-DD");
|
|
||||||
} else {
|
|
||||||
dateString = '-';
|
|
||||||
}
|
|
||||||
$('#dataBody').append('<tr class="secondrow"><td>' + (
|
$('#dataBody').append('<tr class="secondrow"><td>' + (
|
||||||
no++) +
|
no++) +
|
||||||
'</td><td>' + items[i]['ACCOUNT_NUMBER'] +
|
'</td><td>' + items[i]['ACCOUNT_NUMBER'] +
|
||||||
@ -136,7 +191,7 @@
|
|||||||
'</td><td>' + items[i]['WORKING_BALANCE'] +
|
'</td><td>' + items[i]['WORKING_BALANCE'] +
|
||||||
'</td><td>' + items[i]['PRODUCT'] +
|
'</td><td>' + items[i]['PRODUCT'] +
|
||||||
'</td><td>' + items[i]['CURRENCY']+
|
'</td><td>' + items[i]['CURRENCY']+
|
||||||
'</td><td class="text-center">'+ dateString +
|
'</td><td class="text-center">'+ items[i]['MATURITY_DATE'] +
|
||||||
'</td><td class="tes"><div style="padding-left:22px" class="form-check form-check-custom form-check-solid me-10"><input class=" form-check-input h-20px w-20px acc_no" type="checkbox" name="account_number" value="' +
|
'</td><td class="tes"><div style="padding-left:22px" class="form-check form-check-custom form-check-solid me-10"><input class=" form-check-input h-20px w-20px acc_no" type="checkbox" name="account_number" value="' +
|
||||||
items[i]['ACCOUNT_NUMBER'] + '"></div></td></tr>'
|
items[i]['ACCOUNT_NUMBER'] + '"></div></td></tr>'
|
||||||
);
|
);
|
||||||
@ -173,6 +228,24 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Open the modal when the button is clicked
|
||||||
|
$("#openModalBtn").click(function() {
|
||||||
|
$("#myModal").modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle form submission when the "Submit" button is clicked
|
||||||
|
$("#submitFormBtn").click(function() {
|
||||||
|
var formData = $("#myForm2").serialize();
|
||||||
|
console.log(formData);
|
||||||
|
$("#myModal").modal('hide');
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#cancelBtn").click(function() {
|
||||||
|
$("#myModal").modal('hide');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
374
Resources/views/pages/index_fasilitas.blade.php
Normal file
374
Resources/views/pages/index_fasilitas.blade.php
Normal file
@ -0,0 +1,374 @@
|
|||||||
|
<x-default-layout>
|
||||||
|
@php
|
||||||
|
$route = explode('.', Route::currentRouteName());
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<!--begin::Card-->
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}" />
|
||||||
|
<div class="card card-xxl-stretch mb-5 mb-xl-8">
|
||||||
|
<!--begin::Card body-->
|
||||||
|
<div class="card-body pt-6">
|
||||||
|
<div class="d-flex justify-content-end ">
|
||||||
|
<button type="button" class="btn btn-primary btn-sm " style="margin-right:35px" id="openModalBtn">
|
||||||
|
<i class="ki-duotone ki-exit-down fs-2"><span class="path1"></span><span class="path2"></span></i>
|
||||||
|
Tambah
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="card-body pt-6">
|
||||||
|
<div class="table-responsive " style="overflow-x:auto;">
|
||||||
|
<div id="user_table">
|
||||||
|
@include('konfirmasibank::pages.table_fasilitas')
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-end ">
|
||||||
|
<a href="{{ route($route[0] . '.index') }}" type="button" class="btn btn-danger btn-sm " style="">
|
||||||
|
<i class="ki-duotone ki-exit-left fs-2"><span class="path1"></span><span
|
||||||
|
class="path2"></span></i>
|
||||||
|
Kembali
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--end::Card body-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal -->
|
||||||
|
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
||||||
|
aria-hidden="true">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<!-- Modal header -->
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="myModalLabel">Tambah Fasilitas</h5>
|
||||||
|
<button type="button" class="closeButton" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal body -->
|
||||||
|
<div class="modal-body">
|
||||||
|
<form class="form-horizontal" id="myFormInput" action="{{ route($route[0] . '.postFasilitas') }}">
|
||||||
|
@csrf
|
||||||
|
<!-- Add your form fields here -->
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">No Rekening</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" class="form-control form-control-sm " name="nomor_rekening"
|
||||||
|
placeholder="Nomor Rekening">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Jenis Fasilitas</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<select class="form-select form-select-sm" aria-label="Small select example">
|
||||||
|
<option selected>Pilih Jenis Fasilitas</option>
|
||||||
|
@foreach ($data['limitReference'] as $item)
|
||||||
|
<option value="{{$item->SHORT_NAME}}">{{$item->SHORT_NAME}}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Saldo</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" class="form-control form-control-sm " name="saldo" placeholder="Saldo">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Start Date</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="date" class="form-control form-control-sm " name="start_date"
|
||||||
|
placeholder="Start Date">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Due Date</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="date" class="form-control form-control-sm " name="due_date"
|
||||||
|
placeholder="Due Date">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Jangka Waktu</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" class="form-control form-control-sm " name="jangka_waktu"
|
||||||
|
placeholder="Jangka Waktu">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Fixed Rate</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" class="form-control form-control-sm " name="fixed_rate"
|
||||||
|
placeholder="Fixed Rate">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Keterangan</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<textarea type="text" class="form-control form-control-sm " name="keterangan"
|
||||||
|
placeholder="Keterangan"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Add more form fields here -->
|
||||||
|
|
||||||
|
<!-- Modal footer -->
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary btn-sm closeButton"
|
||||||
|
data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" id="submitFormBtn">Submit</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade myModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<!-- Modal header -->
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="myModalLabel">Tambah Fasilitas</h5>
|
||||||
|
<button type="button" class="closeButton" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal body -->
|
||||||
|
<div class="modal-body">
|
||||||
|
<div id="errors"></div>
|
||||||
|
<form class="form-horizontal" id="myFormUpdate" action="{{ route($route[0] . '.updateFasilitas') }}">
|
||||||
|
@csrf
|
||||||
|
<!-- Add your form fields here -->
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">No Rekening</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="hidden" class="form-control form-control-sm " id="id" name="id">
|
||||||
|
<input type="text" class="form-control form-control-sm " id="norek" name="nomor_rekening"
|
||||||
|
placeholder="Nomor Rekening">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Jenis Fasilitas</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
{{-- <input type="text" class="form-control form-control-sm " id="jnsFasilitas" name="jenis_fasilitas" placeholder="Jenis Fasilitas"> --}}
|
||||||
|
<select class="form-select form-select-sm" aria-label="Small select example"
|
||||||
|
id="jnsFaasilitas-select" name="jenis_fasilitas">
|
||||||
|
<option selected>Pilih Jenis Fasilitas</option>
|
||||||
|
@foreach ($data['limitReference'] as $item)
|
||||||
|
<option value="{{$item->SHORT_NAME}}">{{$item->SHORT_NAME}}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Saldo</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" class="form-control form-control-sm " id="saldo" name="saldo"
|
||||||
|
placeholder="Saldo">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Start Date</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="date" class="form-control form-control-sm" id="startDate" name="start_date"
|
||||||
|
placeholder="Start Date">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Due Date</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="date" class="form-control form-control-sm " id="dueDatae" name="due_date"
|
||||||
|
placeholder="Due Date">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Jangka Waktu</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" class="form-control form-control-sm " id="jangkaWaktu" name="jangka_waktu"
|
||||||
|
placeholder="Jangka Waktu">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Fixed Rate</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" class="form-control form-control-sm " id="fixedRate" name="fixed_rate"
|
||||||
|
placeholder="Fixed Rate">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="inputName" class="col-sm-3 col-form-label">Keterangan</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<textarea type="text" class="form-control form-control-sm " id="ket" name="keterangan"
|
||||||
|
placeholder="Keterangan"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Add more form fields here -->
|
||||||
|
|
||||||
|
<!-- Modal footer -->
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary btn-sm closeButton2"
|
||||||
|
data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" id="submitFormUpdate">Submit</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@push('customscript')
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
// Open the modal when the "Open Modal" button is clicked
|
||||||
|
$("#openModalBtn").click(function() {
|
||||||
|
$("#myModal").modal('show');
|
||||||
|
});
|
||||||
|
$(".closeButton").click(function() {
|
||||||
|
$("#myModal").modal('hide');
|
||||||
|
});
|
||||||
|
$(".closeButton2").click(function() {
|
||||||
|
$(".myModalEdit").modal('hide');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle form submission when the "Submit" button inside the modal is clicked
|
||||||
|
$("#submitFormBtn").click(function(e) {
|
||||||
|
// Serialize the form data
|
||||||
|
e.preventDefault();
|
||||||
|
var formData = $("#myFormInput").serialize();
|
||||||
|
// Send an AJAX request to the form submission route
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: "{{ route('konfirmasibank.postFasilitas') }}",
|
||||||
|
data: formData,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(response) {
|
||||||
|
// Handle success response (e.g., show a success message)
|
||||||
|
var _data = JSON.parse(data);
|
||||||
|
toastr.success(_data.message);
|
||||||
|
form[0].reset();
|
||||||
|
$('#table4').ajax.reload();
|
||||||
|
// Optionally, close the modal
|
||||||
|
$("#myModal").modal('hide');
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
// Handle error response (if applicable)
|
||||||
|
var errors = data.responseJSON.errors;
|
||||||
|
$.each(errors, function(key, value) {
|
||||||
|
toastr.error(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".btnEdit").click(function(e) {
|
||||||
|
// Serialize the form data
|
||||||
|
e.preventDefault();
|
||||||
|
var id = $(this).data('id');
|
||||||
|
var dataToSend = {
|
||||||
|
_token: $('meta[name="csrf-token"]').attr('content'),
|
||||||
|
id: id
|
||||||
|
};
|
||||||
|
// Send an AJAX request to the form submission route
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: "{{ route('konfirmasibank.editFasilitas') }}",
|
||||||
|
data: dataToSend,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(response) {
|
||||||
|
console.log(response);
|
||||||
|
$('#jnsFaasilitas-select option[value="' + response.jenis_fasilitas + '"]').prop(
|
||||||
|
'selected', true);
|
||||||
|
$('input[name="nomor_rekening"]').val(response.nomor_rekening);
|
||||||
|
$('input[name="jenis_fasilitas"]').val(response.jenis_fasilitas);
|
||||||
|
$('input[name="saldo"]').val(response.saldo);
|
||||||
|
$('input[name="start_date"]').val(response.start_date);
|
||||||
|
$('input[name="due_date"]').val(response.due_date);
|
||||||
|
$('input[name="jangka_waktu"]').val(response.jangka_waktu);
|
||||||
|
$('input[name="fixed_rate"]').val(response.fixed_rate);
|
||||||
|
$('#ket').val(response.keterangan);
|
||||||
|
$('#id').val(response.id);
|
||||||
|
$("#myModalEdit").modal('show');
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
// Handle error response (if applicable)
|
||||||
|
var errors = data.responseJSON.errors;
|
||||||
|
$.each(errors, function(key, value) {
|
||||||
|
toastr.error(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("#submitFormUpdate").click(function(e) {
|
||||||
|
// Serialize the form data
|
||||||
|
e.preventDefault();
|
||||||
|
var formData = $("#myFormUpdate").serialize();
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "{{ route('konfirmasibank.updateFasilitas') }}",
|
||||||
|
data: formData, // serializes the form's elements.
|
||||||
|
success: function(data) {
|
||||||
|
$(".myModalEdit").modal('hide');
|
||||||
|
var _data = JSON.parse(data);
|
||||||
|
toastr.success(_data.message);
|
||||||
|
location.reload();
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(data, textStatus, errorThrown) {
|
||||||
|
var errors = data.responseJSON.errors;
|
||||||
|
$.each(errors, function(key, value) {
|
||||||
|
toastr.error(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$(".btnDelete").click(function(e) {
|
||||||
|
// var form = $(this).closest("form");
|
||||||
|
var id = $(this).data('id');
|
||||||
|
var dataToSend = {
|
||||||
|
_token: $('meta[name="csrf-token"]').attr('content'),
|
||||||
|
id: id
|
||||||
|
};
|
||||||
|
e.preventDefault();
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Are you sure?',
|
||||||
|
text: "You won't be able to revert this!",
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Yes, delete it!'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "{{ route('konfirmasibank.destroyFasilitas') }}",
|
||||||
|
data: dataToSend, // serializes the form's elements.
|
||||||
|
success: function(data) {
|
||||||
|
toastr.success('has been deleted.', 'Success!', {
|
||||||
|
timeOut: 5000
|
||||||
|
});
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</x-default-layout>
|
@ -23,7 +23,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
53
Resources/views/pages/table_fasilitas.blade.php
Normal file
53
Resources/views/pages/table_fasilitas.blade.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<table class="table table-striped " id="table4">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-center">No</th>
|
||||||
|
<th class="text-center">No Rekening</th>
|
||||||
|
<th class="text-center">Jenis Rekening</th>
|
||||||
|
<th class="text-center">Saldo</th>
|
||||||
|
<th class="text-center">Start Date</th>
|
||||||
|
<th class="text-center">Due Date</th>
|
||||||
|
<th class="text-center">Fixed Rate</th>
|
||||||
|
<th class="text-center">Keterangan</th>
|
||||||
|
<th class="text-center" width="100px">Aksi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="dataBody">
|
||||||
|
@php
|
||||||
|
$no = 1;
|
||||||
|
@endphp
|
||||||
|
@if (count($data['fasilitas']) > 0)
|
||||||
|
@foreach ($data['fasilitas'] as $item)
|
||||||
|
<tr class="row-none">
|
||||||
|
<td class="text-center">{{($no++ )}}</td>
|
||||||
|
<td class="text-center">{{$item['nomor_rekening']}}</td>
|
||||||
|
<td class="text-center">{{$item['jenis_fasilitas']}}</td>
|
||||||
|
<td class="text-center">{{$item['saldo']}}</td>
|
||||||
|
<td class="text-center">{{$item['start_date']}}</td>
|
||||||
|
<td class="text-center">{{$item['due_date']}}</td>
|
||||||
|
<td class="text-center">{{$item['fixed_rate']}}</td>
|
||||||
|
<td class="text-center">{{$item['keterangan']}}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<a href="#" class="kt_edit_form btn btn-icon btn-bg-light btn-active-light-warning btn-sm me-1 btnEdit" data-id="{{$item['id']}}">{!!getIcon("pencil", "fs-1 text-warning","duotune") !!}</a>
|
||||||
|
<a href="#" class="kt_edit_form btn btn-icon btn-bg-light btn-active-light-danger btn-sm me-1 btnDelete"data-id="{{$item['id']}}">{!! getIcon("trash", "fs-1 text-danger","duotune") !!}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
@else
|
||||||
|
<tr class="row-none">
|
||||||
|
<td colspan="10" class="text-center">Tidak Ada Data Yang Ditampilkan</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<tr style="display:none" class="loading1">
|
||||||
|
<td colspan="10" class="text-center">
|
||||||
|
<div class="spinner-border" role="status">
|
||||||
|
<span class="visually-hidden">Loading...</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="d-flex">
|
||||||
|
{!! $data['fasilitas']->links() !!}
|
||||||
|
</div>
|
@ -17,14 +17,12 @@ $module = file_get_contents(dirname(__FILE__, 2) . '/module.json');
|
|||||||
$module = json_decode($module);
|
$module = json_decode($module);
|
||||||
|
|
||||||
Route::group(['middleware' => ['auth', 'verified']], function () {
|
Route::group(['middleware' => ['auth', 'verified']], function () {
|
||||||
//Route::resource('konfirmasibank', KonfirmasiBankController::class);
|
|
||||||
// Route::post('konfirmasibank/getPdf', [KonfirmasiBankController::class, 'getPdf'])->name('getPdf');
|
|
||||||
Route::get('/konfirmasibank', 'KonfirmasiBankController@index')->name('konfirmasibank.index');
|
Route::get('/konfirmasibank', 'KonfirmasiBankController@index')->name('konfirmasibank.index');
|
||||||
//Route::get('/list', [CustomerController::class, 'list'])->name('customer.list');
|
Route::get('konfirmasibank/getData',array('as'=>'getData','uses'=>'KonfirmasiBankController@getData'));
|
||||||
Route::get('getData',array('as'=>'getData','uses'=>'KonfirmasiBankController@getData'));
|
Route::post('konfirmasibank/export', [KonfirmasiBankController::class, 'export'])->name('konfirmasibank.export');
|
||||||
//Route::post('getPdf/',array('as'=>'getPdf','uses'=>'CustomerController@getPdf'));
|
Route::get('konfirmasibank/addFasilitas',[KonfirmasiBankController::class,'addFasilitas'])->name('konfirmasibank.addFasilitas');
|
||||||
Route::post('export', [KonfirmasiBankController::class, 'export'])->name('konfirmasibank.export');
|
Route::post('konfirmasibank/postFasilitas','KonfirmasiBankController@postFasilitas')->name('konfirmasibank.postFasilitas');
|
||||||
//Route::get('/store', 'CustomerController@store');
|
Route::post('konfirmasibank/editFasilitas','KonfirmasiBankController@editFasilitas')->name('konfirmasibank.editFasilitas');
|
||||||
// Route::get('/create', [CustomerController::class, 'create'])->name('customer.create');
|
Route::post('konfirmasibank/update','KonfirmasiBankController@updateFasilitas')->name('konfirmasibank.updateFasilitas');
|
||||||
//Route::Post('/export',[KonfirmasiBankController::class,'export'])->name('konfirmasibank.export');
|
Route::post('konfirmasibank/destroy','KonfirmasiBankController@destroyFasilitas')->name('konfirmasibank.destroyFasilitas');
|
||||||
});
|
});
|
Reference in New Issue
Block a user