Compare commits
No commits in common. "0d7a1faa4421e8cfdbd8a3ee1d4ebda7ee930940" and "093a8f2b4d1a84c63a547228312b9441ed90c08a" have entirely different histories.
0d7a1faa44
...
093a8f2b4d
@ -1,195 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\masterPersetujuan;
|
||||
use App\Models\masterPersetujuanDetail;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class masterPersetujuanController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$data = [
|
||||
'title' => 'Master Persetujuan'
|
||||
];
|
||||
return view('masterPersetujuan.index', $data);
|
||||
}
|
||||
|
||||
public function datatable(){
|
||||
return masterPersetujuan::where('statusenabled', true)->with([
|
||||
'pegawai:id,namalengkap',
|
||||
'details.unitPegawai:id,name'
|
||||
])->get();
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$payloads = $request->input('data', []);
|
||||
if (!is_array($payloads) || empty($payloads)) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => 'Data tidak boleh kosong'
|
||||
], 422);
|
||||
}
|
||||
DB::connection('dbDirectory')->beginTransaction();
|
||||
try {
|
||||
foreach ($payloads as $payload) {
|
||||
$pegawaiId = $payload['pegawai_id'] ?? null; // field name tetap, isi pegawai
|
||||
if (!$pegawaiId) {
|
||||
throw new \InvalidArgumentException('Pegawai wajib diisi.');
|
||||
}
|
||||
|
||||
$master = masterPersetujuan::create([
|
||||
'pegawai_id' => $pegawaiId,
|
||||
'statusenabled' => true,
|
||||
'entry_at' => Carbon::now(),
|
||||
]);
|
||||
|
||||
$detailUnits = collect($payload['unit_akses'] ?? [])
|
||||
->filter()
|
||||
->unique()
|
||||
->values();
|
||||
foreach ($detailUnits as $unitId) {
|
||||
masterPersetujuanDetail::create([
|
||||
'master_persetujuan_file_directory_id' => $master->id,
|
||||
'unit_pegawai_id' => $unitId,
|
||||
'statusenabled' => true,
|
||||
'entry_at' => Carbon::now()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
DB::connection('dbDirectory')->commit();
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'message' => 'Data berhasil disimpan'
|
||||
], 200);
|
||||
} catch (\Throwable $th) {
|
||||
DB::connection('dbDirectory')->rollBack();
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => $th->getMessage(),
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function show(string $id)
|
||||
{
|
||||
$data = masterPersetujuan::with(['pegawai:id,nama', 'unitPegawai:id,name', 'details.unitPegawai:id,name'])
|
||||
->find($id);
|
||||
|
||||
if (!$data) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => 'Data tidak ditemukan'
|
||||
], 404);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'data' => [
|
||||
'id' => $data->id,
|
||||
'unit_pegawai_id' => $data->unit_pegawai_id,
|
||||
'unit_pegawai_nama' => $data->pegawai?->nama,
|
||||
'detail_units' => $data->details->map(function ($detail) {
|
||||
return [
|
||||
'id' => $detail->unit_pegawai_id,
|
||||
'text' => $detail->unitPegawai?->name,
|
||||
];
|
||||
})->values(),
|
||||
],
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
$data = masterPersetujuan::find($id);
|
||||
if (!$data) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => 'Data tidak ditemukan'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$unitPegawaiId = $request->input('pegawai_id');
|
||||
if (!$unitPegawaiId) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => 'Pegawai wajib diisi.'
|
||||
], 422);
|
||||
}
|
||||
|
||||
$detailUnits = collect($request->input('unit_akses', []))
|
||||
->filter()
|
||||
->unique()
|
||||
->values();
|
||||
DB::connection('dbDirectory')->beginTransaction();
|
||||
try {
|
||||
$data->update([
|
||||
'pegawai_id' => $unitPegawaiId,
|
||||
'modified_at' => Carbon::now()
|
||||
]);
|
||||
|
||||
masterPersetujuanDetail::where('master_persetujuan_file_directory_id', $data->id)->delete();
|
||||
|
||||
foreach ($detailUnits as $unitId) {
|
||||
masterPersetujuanDetail::create([
|
||||
'master_persetujuan_file_directory_id' => $data->id,
|
||||
'unit_pegawai_id' => $unitId,
|
||||
'entry_at' => Carbon::now(),
|
||||
'modified_at' => Carbon::now(),
|
||||
'statusenabled' => true
|
||||
]);
|
||||
}
|
||||
|
||||
DB::connection('dbDirectory')->commit();
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'message' => 'Data berhasil diperbarui'
|
||||
], 200);
|
||||
} catch (\Throwable $th) {
|
||||
DB::connection('dbDirectory')->rollBack();
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => $th->getMessage(),
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy(string $id)
|
||||
{
|
||||
$data = masterPersetujuan::find($id);
|
||||
if (!$data) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => 'Data tidak ditemukan'
|
||||
], 404);
|
||||
}
|
||||
|
||||
DB::connection('dbDirectory')->beginTransaction();
|
||||
try {
|
||||
masterPersetujuanDetail::where('master_persetujuan_file_directory_id', $data->id)->update([
|
||||
'statusenabled' => false,
|
||||
'modified_at' => Carbon::now(),
|
||||
]);
|
||||
$data->update([
|
||||
'statusenabled' => false,
|
||||
'modified_at' => Carbon::now(),
|
||||
]);
|
||||
|
||||
DB::connection('dbDirectory')->commit();
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'message' => 'Data berhasil dihapus'
|
||||
], 200);
|
||||
} catch (\Throwable $th) {
|
||||
DB::connection('dbDirectory')->rollBack();
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => $th->getMessage(),
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\UnitKerja;
|
||||
use App\Models\DataUser;
|
||||
use App\Models\masterPersetujuanDetail;
|
||||
|
||||
class masterPersetujuan extends Model
|
||||
{
|
||||
protected $connection = 'dbDirectory';
|
||||
protected $table = 'public.master_persetujuan_file_directory';
|
||||
public $timestamps = false;
|
||||
protected $primaryKey = 'id';
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public function unitPegawai()
|
||||
{
|
||||
return $this->belongsTo(UnitKerja::class, 'unit_pegawai_id', 'id');
|
||||
}
|
||||
|
||||
public function pegawai()
|
||||
{
|
||||
return $this->belongsTo(DataUser::class, 'pegawai_id', 'id');
|
||||
}
|
||||
|
||||
public function details()
|
||||
{
|
||||
return $this->hasMany(masterPersetujuanDetail::class, 'master_persetujuan_file_directory_id', 'id')->where('statusenabled', true);
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\UnitKerja;
|
||||
use App\Models\masterPersetujuan;
|
||||
|
||||
class masterPersetujuanDetail extends Model
|
||||
{
|
||||
protected $connection = 'dbDirectory';
|
||||
protected $table = 'public.master_persetujuan_file_directory_detail';
|
||||
public $timestamps = false;
|
||||
protected $primaryKey = 'id';
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public function master()
|
||||
{
|
||||
return $this->belongsTo(masterPersetujuan::class, 'master_persetujuan_file_directory_id', 'id');
|
||||
}
|
||||
|
||||
public function unitPegawai()
|
||||
{
|
||||
return $this->belongsTo(UnitKerja::class, 'unit_pegawai_id', 'id');
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
const datatableMasterPersetujuan = $("#table_master_persetujuan")
|
||||
|
||||
const formCreateMasterPersetujuan = $("#formCreateMasterPersetujuan")
|
||||
const modalCreate = document.getElementById('modalMasterPersetujuan')
|
||||
|
||||
const modalEdit = document.getElementById('modalEditMasterPersetujuan')
|
||||
const formEditMasterPersetujuan = $("#formEditMasterPersetujuan")
|
||||
@ -1,262 +0,0 @@
|
||||
const csrfToken = document.querySelector('input[name="_token"]')?.value ?? '';
|
||||
const defaultSuccessMessage = 'Berhasil melakukan aksi!';
|
||||
|
||||
let isCreating = false;
|
||||
let isEditing = false;
|
||||
const deletingIds = new Set();
|
||||
|
||||
function showError(message) {
|
||||
if (!message) return;
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Gagal',
|
||||
text: message,
|
||||
});
|
||||
}
|
||||
|
||||
function handleModalSuccess(modalElement, message, afterAlert = () => {}) {
|
||||
const handler = function () {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: 'Berhasil',
|
||||
text: message || defaultSuccessMessage,
|
||||
timer: 2000,
|
||||
showConfirmButton: false,
|
||||
backdrop: true,
|
||||
});
|
||||
afterAlert();
|
||||
modalElement.removeEventListener('hidden.bs.modal', handler);
|
||||
};
|
||||
|
||||
modalElement.addEventListener('hidden.bs.modal', handler);
|
||||
bootstrap.Modal.getInstance(modalElement)?.hide();
|
||||
}
|
||||
|
||||
formCreateMasterPersetujuan.on('submit', async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (isCreating) return; // cegah submit berulang
|
||||
isCreating = true;
|
||||
|
||||
try {
|
||||
const res = await fetch('/master-persetujuan', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': csrfToken,
|
||||
},
|
||||
body: new FormData(this),
|
||||
});
|
||||
|
||||
const responseData = await res.json();
|
||||
if (!responseData.status) {
|
||||
throw new Error(responseData.message || 'Terjadi kesalahan saat menyimpan data.');
|
||||
}
|
||||
|
||||
handleModalSuccess(modalCreate, responseData.message, () => {
|
||||
$('#col_add_master_persetujuan').html('');
|
||||
colCount = 1;
|
||||
formCreateMasterPersetujuan.find('select').val(null).trigger('change');
|
||||
datatableMasterPersetujuan.bootstrapTable('refresh');
|
||||
});
|
||||
} catch (err) {
|
||||
showError(err.message);
|
||||
} finally {
|
||||
isCreating = false;
|
||||
}
|
||||
});
|
||||
|
||||
async function deleteMasterPersetujuan(button) {
|
||||
const { id, name } = $(button).data();
|
||||
|
||||
if (deletingIds.has(id)) return; // cegah klik berulang id sama
|
||||
|
||||
const result = await Swal.fire({
|
||||
title: 'Apakah kamu yakin ingin menghapus data master persetujuan?',
|
||||
text: name,
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
backdrop: true,
|
||||
});
|
||||
|
||||
if (!result.isConfirmed) return;
|
||||
|
||||
try {
|
||||
deletingIds.add(id);
|
||||
|
||||
const response = await fetch(`/master-persetujuan/${id}`, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': csrfToken,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
if (!data.status) {
|
||||
throw new Error(data.message || 'Failed to delete Item.');
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
title: 'Success',
|
||||
text: 'Data berhasil dihapus',
|
||||
icon: 'success',
|
||||
showConfirmButton: false,
|
||||
timer: 1000,
|
||||
}).then(() => datatableMasterPersetujuan.bootstrapTable('refresh'));
|
||||
} catch (error) {
|
||||
showError(error.message || 'Something went wrong. Please try again later.');
|
||||
} finally {
|
||||
deletingIds.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
async function editMasterPersetujuan(button) {
|
||||
const data = $(button).data();
|
||||
new bootstrap.Modal(modalEdit).show();
|
||||
formEditMasterPersetujuan.attr('action', `/master-persetujuan/${data.id}`);
|
||||
|
||||
selectOptionPegawaiEdit();
|
||||
selectOptionUnitKerjaEdit();
|
||||
|
||||
resetEditSelections();
|
||||
|
||||
if (data.pegawai_id) {
|
||||
setOldSelect2Value('#pegawai_id_edit', data.pegawai_id, data.pegawai_nama);
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await fetch(`/master-persetujuan/${data.id}`);
|
||||
const responseData = await res.json();
|
||||
|
||||
if (!responseData.status) {
|
||||
throw new Error(responseData.message || 'Gagal memuat data akses.');
|
||||
}
|
||||
|
||||
const detailUnits = responseData.data?.detail_units;
|
||||
if (Array.isArray(detailUnits)) {
|
||||
setOldSelect2Values('#unit_akses_edit', detailUnits);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
showError(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
function resetEditSelections() {
|
||||
formEditMasterPersetujuan[0]?.reset();
|
||||
$('#pegawai_id_edit').val(null).trigger('change');
|
||||
$('#unit_akses_edit').empty().trigger('change');
|
||||
}
|
||||
|
||||
function selectOptionPegawaiEdit() {
|
||||
const selectPegawai = $('#pegawai_id_edit');
|
||||
if (selectPegawai.data('select2')) return;
|
||||
|
||||
selectPegawai.select2({
|
||||
placeholder: '-- Pilih Pegawai --',
|
||||
allowClear: true,
|
||||
width: '100%',
|
||||
dropdownParent: selectPegawai.parent(),
|
||||
ajax: {
|
||||
url: '/select-pegawai',
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
data: function (params) {
|
||||
return { q: params.term };
|
||||
},
|
||||
processResults: function (data) {
|
||||
return {
|
||||
results: data?.data.map((item) => ({
|
||||
id: item.id,
|
||||
text: item.nama,
|
||||
})),
|
||||
};
|
||||
},
|
||||
cache: true,
|
||||
},
|
||||
minimumInputLength: 1,
|
||||
});
|
||||
}
|
||||
|
||||
function selectOptionUnitKerjaEdit() {
|
||||
const selectUnit = $('#unit_akses_edit');
|
||||
if (selectUnit.data('select2')) return;
|
||||
|
||||
selectUnit.select2({
|
||||
placeholder: '-- Pilih Unit Kerja --',
|
||||
allowClear: true,
|
||||
width: '100%',
|
||||
dropdownParent: selectUnit.parent(),
|
||||
ajax: {
|
||||
url: '/select-unit-kerja',
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
data: function (params) {
|
||||
return { q: params.term };
|
||||
},
|
||||
processResults: function (data) {
|
||||
return {
|
||||
results: data?.data.map((item) => ({
|
||||
id: item.id,
|
||||
text: item.name,
|
||||
})),
|
||||
};
|
||||
},
|
||||
cache: true,
|
||||
},
|
||||
minimumInputLength: 1,
|
||||
});
|
||||
}
|
||||
|
||||
function setOldSelect2Value(selector, id, text) {
|
||||
if (!id || !text) return;
|
||||
const option = new Option(text, id, true, true);
|
||||
$(selector).append(option).trigger('change');
|
||||
}
|
||||
|
||||
function setOldSelect2Values(selector, items) {
|
||||
if (!Array.isArray(items) || items.length === 0) return;
|
||||
|
||||
items.forEach((item) => {
|
||||
if (!item?.id || !item?.text) return;
|
||||
const option = new Option(item.text, item.id, true, true);
|
||||
$(selector).append(option);
|
||||
});
|
||||
|
||||
$(selector).trigger('change');
|
||||
}
|
||||
|
||||
formEditMasterPersetujuan.on('submit', async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (isEditing) return; // cegah submit ganda
|
||||
isEditing = true;
|
||||
|
||||
try {
|
||||
const actionUrl = formEditMasterPersetujuan.attr('action');
|
||||
const formData = new FormData(this);
|
||||
formData.append('_method', 'PUT');
|
||||
|
||||
const res = await fetch(actionUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': csrfToken,
|
||||
},
|
||||
body: formData,
|
||||
});
|
||||
|
||||
const responseData = await res.json();
|
||||
if (!responseData.status) {
|
||||
throw new Error(responseData.message || 'Terjadi kesalahan saat menyimpan data.');
|
||||
}
|
||||
|
||||
handleModalSuccess(modalEdit, responseData.message, () => {
|
||||
formCreateMasterPersetujuan.find('select').val(null).trigger('change');
|
||||
datatableMasterPersetujuan.bootstrapTable('refresh');
|
||||
});
|
||||
} catch (err) {
|
||||
showError(err.message);
|
||||
} finally {
|
||||
isEditing = false;
|
||||
}
|
||||
});
|
||||
@ -1,59 +0,0 @@
|
||||
datatableMasterPersetujuan.bootstrapTable({
|
||||
url: "/datatable/master-persetujuan",
|
||||
showRefresh: true,
|
||||
sortable: true,
|
||||
search: true,
|
||||
searchOnEnterKey: false,
|
||||
searchHighlight: true,
|
||||
pagination: true,
|
||||
serverSide:true,
|
||||
pageSize: 10,
|
||||
pageList: [10, 20, 30],
|
||||
cookie: true,
|
||||
cookieIdTable: "table_master_kategori",
|
||||
icons: {
|
||||
refresh: "fas fa-sync-alt",
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
title:"Action",
|
||||
formatter: function(value, row){
|
||||
let buttons = '';
|
||||
buttons += `
|
||||
<button class="btn btn-sm btn-danger me-2" onclick="deleteMasterPersetujuan(this)"
|
||||
data-id="${row.id}" data-name="${row?.pegawai?.namalengkap}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
`
|
||||
buttons += `
|
||||
<button class="btn btn-sm btn-primary me-2" onclick="editMasterPersetujuan(this)"
|
||||
data-id="${row.id}"
|
||||
data-pegawai_id="${row?.pegawai_id}"
|
||||
data-pegawai_nama="${row?.pegawai?.namalengkap}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</button>`
|
||||
return `
|
||||
<div class="d-flex space-x">
|
||||
${buttons}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"Nama",
|
||||
field:'pegawai.namalengkap'
|
||||
},
|
||||
{
|
||||
title:"Persetujuan",
|
||||
formatter:function(value, row){
|
||||
const units = (row?.details ?? [])
|
||||
.map(detail => detail?.unit_pegawai?.name)
|
||||
.filter(Boolean);
|
||||
|
||||
return units.length
|
||||
? units.join(', ')
|
||||
: '-';
|
||||
}
|
||||
}
|
||||
],
|
||||
});
|
||||
@ -1,102 +0,0 @@
|
||||
$(document).ready(function() {
|
||||
selectOptionPegawai(0)
|
||||
selectOptionUnitKerja(0)
|
||||
});
|
||||
|
||||
function selectOptionPegawai(colCount) {
|
||||
let selectPegawai = $(`#pegawai_id_${colCount}`);
|
||||
// inisialisasi select2 untuk Unit Kerja
|
||||
selectPegawai.select2({
|
||||
placeholder: '-- Pilih Pegawai --',
|
||||
allowClear:true,
|
||||
width: '100%',
|
||||
dropdownParent: selectPegawai.parent(),
|
||||
ajax:{
|
||||
url : '/select-pegawai',
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
data: function(params){
|
||||
return { q: params.term }
|
||||
},
|
||||
processResults: function(data){
|
||||
return {
|
||||
results : data?.data.map(item => ({
|
||||
id: item.id,
|
||||
text: item.nama,
|
||||
}))
|
||||
}
|
||||
},
|
||||
cache: true,
|
||||
},
|
||||
minimumInputLength: 1,
|
||||
});
|
||||
}
|
||||
|
||||
function selectOptionUnitKerja(colCount) {
|
||||
let selectUnit = $(`#unit_akses_${colCount}`);
|
||||
selectUnit.select2({
|
||||
placeholder: '-- Pilih Unit Kerja --',
|
||||
allowClear: true,
|
||||
width: '100%',
|
||||
dropdownParent: selectUnit.parent(),
|
||||
ajax:{
|
||||
url : '/select-unit-kerja',
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
data: function(params){
|
||||
return { q: params.term }
|
||||
},
|
||||
processResults: function(data){
|
||||
return {
|
||||
results : data?.data.map(item => ({
|
||||
id: item.id,
|
||||
text: item.name,
|
||||
}))
|
||||
}
|
||||
},
|
||||
cache: true,
|
||||
},
|
||||
minimumInputLength: 1,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
let colCount = 1;
|
||||
function addForm(){
|
||||
let col = $("#col_add_master_persetujuan")
|
||||
|
||||
let html = '';
|
||||
|
||||
html += `
|
||||
<div class="row mt-3" id="col-${colCount}">
|
||||
<hr/>
|
||||
<div class="col-md-4 mb-2">
|
||||
<label>Nama</label>
|
||||
<select class="form-control" name="data[${colCount}][pegawai_id]" id="pegawai_id_${colCount}" required>
|
||||
</select>
|
||||
<small class="text-muted">Cari nama pegawai.</small>
|
||||
</div>
|
||||
<div class="col-md-8 mb-2" id="unit_akses_wrapper_${colCount}">
|
||||
<label>Unit Kerja</label>
|
||||
<select class="form-control" name="data[${colCount}][unit_akses][]" id="unit_akses_${colCount}" multiple>
|
||||
</select>
|
||||
<small class="text-muted">Bisa pilih lebih dari satu.</small>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button type="button" class="btn btn-danger mt-3 me-2" onclick="removeCol(${colCount})"><i class="fa-solid fa-trash"></i></button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
`
|
||||
col.append(html)
|
||||
selectOptionPegawai(colCount)
|
||||
selectOptionUnitKerja(colCount)
|
||||
colCount++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function removeCol(count){
|
||||
$(`#col-${count}`).remove()
|
||||
}
|
||||
@ -105,17 +105,6 @@
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li class="sidebar-item">
|
||||
<a class="sidebar-link justify-content-between"
|
||||
href="/master-persetujuan" aria-expanded="false">
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<span class="d-flex">
|
||||
<i class="ti ti-report-analytics"></i>
|
||||
</span>
|
||||
<span class="hide-menu">Master Persetujuan</span>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
@extends('layout.main')
|
||||
|
||||
@section('body_main')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card w-100">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h4 class="mb-0">Master Persetujuan</h4>
|
||||
<button type="button" class="btn btn-primary" data-bs-target="#modalMasterPersetujuan" data-bs-toggle="modal">
|
||||
<i data-feather="plus" class="me-1"></i>
|
||||
Tambah Data
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-body pt-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table" id="table_master_persetujuan"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('masterPersetujuan.modal.add')
|
||||
@include('masterPersetujuan.modal.edit')
|
||||
<!-- Scripts -->
|
||||
<script src="{{ ver('/js/masterPersetujuan/_init.js') }}"></script>
|
||||
<script src="{{ ver('/js/masterPersetujuan/dt.js') }}"></script>
|
||||
<script src="{{ ver('/js/masterPersetujuan/functions.js') }}"></script>
|
||||
<script src="{{ ver('/js/masterPersetujuan/action.js') }}"></script>
|
||||
@endsection
|
||||
@ -1,48 +0,0 @@
|
||||
<div class="modal fade" id="modalMasterPersetujuan" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-xl modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
|
||||
<!-- Modal Header -->
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5">Tambah Akses</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
|
||||
<!-- Modal Form -->
|
||||
<form enctype="multipart/form-data" method="POST" id="formCreateMasterPersetujuan">
|
||||
@csrf
|
||||
<div class="modal-body">
|
||||
<div class="container">
|
||||
<div class="border rounded-3 p-3 mb-2">
|
||||
<div class="row g-3 align-items-end">
|
||||
<div class="col-md-4 mb-2">
|
||||
<label class="form-label">Nama</label>
|
||||
<select class="form-control" name="data[0][pegawai_id]" id="pegawai_id_0" required>
|
||||
</select>
|
||||
<small class="text-muted">Cari nama pegawai.</small>
|
||||
</div>
|
||||
<div class="col-md-8 mb-2" id="unit_akses_wrapper_0">
|
||||
<label class="form-label">Unit Kerja</label>
|
||||
<select class="form-control" name="data[0][unit_akses][]" id="unit_akses_0" multiple>
|
||||
</select>
|
||||
<small class="text-muted">Bisa pilih lebih dari satu.</small>
|
||||
</div>
|
||||
</div>
|
||||
<div id="col_add_master_persetujuan"></div>
|
||||
<button type="button" class="btn btn-outline-primary btn-sm mt-2" onclick="addForm()">
|
||||
+ Tambah Form
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Footer -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Tutup</button>
|
||||
<button type="submit" class="btn btn-primary">Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,45 +0,0 @@
|
||||
<div class="modal fade" id="modalEditMasterPersetujuan" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-xl modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
|
||||
<!-- Modal Header -->
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5">Edit Data</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
|
||||
<!-- Modal Form -->
|
||||
<form enctype="multipart/form-data" method="POST" id="formEditMasterPersetujuan">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="modal-body">
|
||||
<div class="container">
|
||||
<div class="border rounded-3 p-3">
|
||||
<div class="row g-3 align-items-end">
|
||||
<div class="col-md-4 mb-2">
|
||||
<label class="form-label">Nama</label>
|
||||
<select class="form-control" name="pegawai_id" id="pegawai_id_edit" required>
|
||||
</select>
|
||||
<small class="text-muted">Cari nama pegawai.</small>
|
||||
</div>
|
||||
<div class="col-12 col-md-8" id="unit_akses_wrapper_edit">
|
||||
<label class="form-label">Unit Kerja</label>
|
||||
<select class="form-control" name="unit_akses[]" id="unit_akses_edit" multiple>
|
||||
</select>
|
||||
<small class="text-muted">Bisa pilih lebih dari satu.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Footer -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Tutup</button>
|
||||
<button type="submit" class="btn btn-primary">Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -6,7 +6,6 @@ use App\Http\Controllers\DashboardController;
|
||||
use App\Http\Controllers\MasterKategoriController;
|
||||
use App\Http\Controllers\MasterKlasifikasiController;
|
||||
use App\Http\Controllers\LogActivityController;
|
||||
use App\Http\Controllers\masterPersetujuanController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::middleware(['auth'])->group(function(){
|
||||
@ -47,9 +46,6 @@ Route::middleware(['auth'])->group(function(){
|
||||
Route::post('/pending-file/{id}/approve', [DashboardController::class, 'approvePendingFile']);
|
||||
Route::post('/pending-file/{id}/reject', [DashboardController::class, 'rejectPendingFile']);
|
||||
Route::get('/data/count-pending', [DashboardController::class, 'countDataPending']);
|
||||
|
||||
Route::resource('/master-persetujuan', masterPersetujuanController::class)->only(['index','store','show','update','destroy']);
|
||||
Route::get('datatable/master-persetujuan', [masterPersetujuanController::class, 'datatable']);
|
||||
});
|
||||
|
||||
Route::get('/login', [AuthController::class, 'index'])->name('login');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user