update from prod
This commit is contained in:
@@ -1,168 +1,171 @@
|
|||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
|
||||||
class Accounts extends CI_Controller {
|
class Accounts extends CI_Controller {
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->load->model('DynamicModel', 'dm');
|
$this->load->model('DynamicModel', 'dm');
|
||||||
|
|
||||||
if (!$this->session->userdata('logged_in')) {
|
if (!$this->session->userdata('logged_in')) {
|
||||||
redirect('auth');
|
redirect('auth');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
|
||||||
if($this->session->userdata('role') != 'Admin'){
|
if($this->session->userdata('role') != 'Admin'){
|
||||||
show_error('Akses ditolak', 403);
|
show_error('Akses ditolak', 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
"active_menu" => "accounts",
|
"active_menu" => "accounts",
|
||||||
"parent_accounts" => $this->db->get('accounts')->result()
|
"parent_accounts" => $this->db->get('accounts')->result()
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->load->view('partials/header', $data);
|
$this->load->view('partials/header', $data);
|
||||||
$this->load->view('accounts/layout', $data);
|
$this->load->view('accounts/layout', $data);
|
||||||
$this->load->view('partials/footer');
|
$this->load->view('partials/footer');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_data()
|
public function get_data()
|
||||||
{
|
{
|
||||||
$this->dm->setTable('accounts')
|
$this->dm->setTable('accounts')
|
||||||
->setColumn(
|
->setColumn(
|
||||||
[null,'kode_akun','nama_akun','tipe','posisi','kategori',null],
|
[null,'kode_akun','nama_akun','tipe','posisi','kategori',null],
|
||||||
['kode_akun','nama_akun','tipe'],
|
['kode_akun','nama_akun','tipe'],
|
||||||
['kode_akun'=>'ASC']
|
['kode_akun'=>'ASC']
|
||||||
);
|
);
|
||||||
|
|
||||||
$list = $this->dm->get_datatables();
|
$list = $this->dm->get_datatables();
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$no = $_POST['start'];
|
$no = $_POST['start'];
|
||||||
|
|
||||||
foreach ($list as $row) {
|
foreach ($list as $row) {
|
||||||
$no++;
|
$no++;
|
||||||
|
|
||||||
$data[] = [
|
$data[] = [
|
||||||
$no,
|
$no,
|
||||||
$row->kode_akun,
|
$row->kode_akun,
|
||||||
$row->nama_akun,
|
$row->priority,
|
||||||
ucfirst($row->tipe),
|
$row->nama_akun,
|
||||||
ucfirst($row->posisi),
|
ucfirst($row->tipe),
|
||||||
ucfirst($row->kategori),
|
ucfirst($row->posisi),
|
||||||
'
|
ucfirst($row->kategori),
|
||||||
<button class="btn btn-sm btn-warning btn-edit" data-id="'.$row->id.'">Edit</button>
|
'
|
||||||
<button class="btn btn-sm btn-danger btn-delete" data-id="'.$row->id.'">Delete</button>
|
<button class="btn btn-sm btn-warning btn-edit" data-id="'.$row->id.'">Edit</button>
|
||||||
'
|
<button class="btn btn-sm btn-danger btn-delete" data-id="'.$row->id.'">Delete</button>
|
||||||
];
|
'
|
||||||
}
|
];
|
||||||
|
}
|
||||||
echo json_encode([
|
|
||||||
"draw" => $_POST['draw'],
|
echo json_encode([
|
||||||
"recordsTotal" => $this->dm->count_all(),
|
"draw" => $_POST['draw'],
|
||||||
"recordsFiltered" => $this->dm->count_filtered(),
|
"recordsTotal" => $this->dm->count_all(),
|
||||||
"data" => $data
|
"recordsFiltered" => $this->dm->count_filtered(),
|
||||||
]);
|
"data" => $data
|
||||||
}
|
]);
|
||||||
|
}
|
||||||
// ================= SAVE
|
|
||||||
public function save()
|
// ================= SAVE
|
||||||
{
|
public function save()
|
||||||
$tipe = $this->input->post('tipe');
|
{
|
||||||
|
$tipe = $this->input->post('tipe');
|
||||||
$data = [
|
|
||||||
'kode_akun' => $this->input->post('kode_akun'),
|
$data = [
|
||||||
'nama_akun' => $this->input->post('nama_akun'),
|
'kode_akun' => $this->input->post('kode_akun'),
|
||||||
'tipe' => $tipe,
|
'nama_akun' => $this->input->post('nama_akun'),
|
||||||
'posisi' => in_array($tipe, ['asset','expense']) ? 'debit' : 'kredit',
|
'tipe' => $tipe,
|
||||||
'kategori' => in_array($tipe, ['asset','liability','equity']) ? 'neraca' : 'laba_rugi',
|
'posisi' => in_array($tipe, ['asset','expense']) ? 'debit' : 'kredit',
|
||||||
'parent_id' => $this->input->post('parent_id') ?: NULL
|
'kategori' => in_array($tipe, ['asset','liability','equity']) ? 'neraca' : 'laba_rugi',
|
||||||
];
|
'parent_id' => $this->input->post('parent_id') ?: NULL,
|
||||||
|
'priority' => $this->input->post('priority') ?: NULL
|
||||||
$insert = $this->dm->setTable('accounts')->insert($data);
|
];
|
||||||
|
|
||||||
if($insert){
|
$insert = $this->dm->setTable('accounts')->insert($data);
|
||||||
log_activity(
|
|
||||||
'Accounts',
|
if($insert){
|
||||||
'create',
|
log_activity(
|
||||||
'Menambah akun: '.$data['kode_akun'].' - '.$data['nama_akun']
|
'Accounts',
|
||||||
);
|
'create',
|
||||||
}
|
'Menambah akun: '.$data['kode_akun'].' - '.$data['nama_akun']
|
||||||
|
);
|
||||||
echo json_encode([
|
}
|
||||||
'status' => $insert ? true : false,
|
|
||||||
'message' => $insert ? 'Data berhasil disimpan' : 'Gagal simpan'
|
echo json_encode([
|
||||||
]);
|
'status' => $insert ? true : false,
|
||||||
}
|
'message' => $insert ? 'Data berhasil disimpan' : 'Gagal simpan'
|
||||||
|
]);
|
||||||
// ================= UPDATE
|
}
|
||||||
public function update()
|
|
||||||
{
|
// ================= UPDATE
|
||||||
$id = $this->input->post('id');
|
public function update()
|
||||||
$tipe = $this->input->post('tipe');
|
{
|
||||||
|
$id = $this->input->post('id');
|
||||||
$data = [
|
$tipe = $this->input->post('tipe');
|
||||||
'kode_akun' => $this->input->post('kode_akun'),
|
|
||||||
'nama_akun' => $this->input->post('nama_akun'),
|
$data = [
|
||||||
'tipe' => $tipe,
|
'kode_akun' => $this->input->post('kode_akun'),
|
||||||
'posisi' => in_array($tipe, ['asset','expense']) ? 'debit' : 'kredit',
|
'nama_akun' => $this->input->post('nama_akun'),
|
||||||
'kategori' => in_array($tipe, ['asset','liability','equity']) ? 'neraca' : 'laba_rugi',
|
'tipe' => $tipe,
|
||||||
'parent_id' => $this->input->post('parent_id') ?: NULL
|
'posisi' => in_array($tipe, ['asset','expense']) ? 'debit' : 'kredit',
|
||||||
];
|
'kategori' => in_array($tipe, ['asset','liability','equity']) ? 'neraca' : 'laba_rugi',
|
||||||
|
'parent_id' => $this->input->post('parent_id') ?: NULL,
|
||||||
$update = $this->dm->setTable('accounts')->update($id, $data);
|
'priority' => $this->input->post('priority') ?: NULL
|
||||||
|
];
|
||||||
if($update){
|
|
||||||
log_activity(
|
$update = $this->dm->setTable('accounts')->update($id, $data);
|
||||||
'Accounts',
|
|
||||||
'update',
|
if($update){
|
||||||
'Update akun ID '.$id.' menjadi: '.$data['kode_akun'].' - '.$data['nama_akun']
|
log_activity(
|
||||||
);
|
'Accounts',
|
||||||
}
|
'update',
|
||||||
|
'Update akun ID '.$id.' menjadi: '.$data['kode_akun'].' - '.$data['nama_akun']
|
||||||
echo json_encode([
|
);
|
||||||
'status' => $update ? true : false,
|
}
|
||||||
'message' => $update ? 'Data berhasil diupdate' : 'Gagal update'
|
|
||||||
]);
|
echo json_encode([
|
||||||
}
|
'status' => $update ? true : false,
|
||||||
|
'message' => $update ? 'Data berhasil diupdate' : 'Gagal update'
|
||||||
public function detail($id)
|
]);
|
||||||
{
|
}
|
||||||
$data = $this->dm->setTable('accounts')->find($id);
|
|
||||||
echo json_encode($data);
|
public function detail($id)
|
||||||
}
|
{
|
||||||
|
$data = $this->dm->setTable('accounts')->find($id);
|
||||||
public function delete($id)
|
echo json_encode($data);
|
||||||
{
|
}
|
||||||
// cek apakah jadi parent
|
|
||||||
$child = $this->db->where('parent_id',$id)->count_all_results('accounts');
|
public function delete($id)
|
||||||
|
{
|
||||||
if($child > 0){
|
// cek apakah jadi parent
|
||||||
echo json_encode([
|
$child = $this->db->where('parent_id',$id)->count_all_results('accounts');
|
||||||
'status'=>false,
|
|
||||||
'message'=>'Tidak bisa hapus, akun punya child'
|
if($child > 0){
|
||||||
]);
|
echo json_encode([
|
||||||
return;
|
'status'=>false,
|
||||||
}
|
'message'=>'Tidak bisa hapus, akun punya child'
|
||||||
|
]);
|
||||||
$delete = $this->dm->setTable('accounts')->delete($id);
|
return;
|
||||||
|
}
|
||||||
if($delete){
|
|
||||||
log_activity(
|
$delete = $this->dm->setTable('accounts')->delete($id);
|
||||||
'Accounts',
|
|
||||||
'delete',
|
if($delete){
|
||||||
'Menghapus akun ID '.$id,
|
log_activity(
|
||||||
'success'
|
'Accounts',
|
||||||
);
|
'delete',
|
||||||
}
|
'Menghapus akun ID '.$id,
|
||||||
|
'success'
|
||||||
echo json_encode([
|
);
|
||||||
'status' => $delete ? true : false,
|
}
|
||||||
'message' => $delete ? 'Data berhasil dihapus' : 'Gagal hapus'
|
|
||||||
]);
|
echo json_encode([
|
||||||
}
|
'status' => $delete ? true : false,
|
||||||
|
'message' => $delete ? 'Data berhasil dihapus' : 'Gagal hapus'
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -646,7 +646,7 @@ class Items extends CI_Controller {
|
|||||||
public function get_accounts()
|
public function get_accounts()
|
||||||
{
|
{
|
||||||
$data = $this->db
|
$data = $this->db
|
||||||
->where_in('kode_akun', [101,102,201])
|
->where_in('kode_akun', [101,102,201,122,125,105])
|
||||||
->order_by('kode_akun','ASC')
|
->order_by('kode_akun','ASC')
|
||||||
->get('accounts')
|
->get('accounts')
|
||||||
->result();
|
->result();
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ class Neraca extends CI_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->db->group_by('a.id');
|
$this->db->group_by('a.id');
|
||||||
$this->db->order_by('a.kode_akun','ASC');
|
$this->db->order_by('a.priority','ASC');
|
||||||
|
|
||||||
$rows = $this->db->get()->result();
|
$rows = $this->db->get()->result();
|
||||||
|
|
||||||
|
|||||||
@@ -1,215 +1,223 @@
|
|||||||
<div class="container mt-4">
|
<div class="container mt-4">
|
||||||
<div class="card modern-card shadow-sm border-0 rounded-4">
|
<div class="card modern-card shadow-sm border-0 rounded-4">
|
||||||
<div class="card-body p-4">
|
<div class="card-body p-4">
|
||||||
|
|
||||||
<div class="d-flex justify-content-between mb-3">
|
<div class="d-flex justify-content-between mb-3">
|
||||||
<h5 class="mb-0">Chart of Account (COA)</h5>
|
<h5 class="mb-0">Chart of Account (COA)</h5>
|
||||||
<button class="btn btn-warning btn-add">Tambah Akun</button>
|
<button class="btn btn-warning btn-add">Tambah Akun</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="tableAccounts" class="table modern-table align-middle w-100">
|
<table id="tableAccounts" class="table modern-table align-middle w-100">
|
||||||
<thead class="table-light">
|
<thead class="table-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="5%">No</th>
|
<th width="5%">No</th>
|
||||||
<th>Kode</th>
|
<th>Kode</th>
|
||||||
<th>Nama</th>
|
<th>Urutan Laporan</th>
|
||||||
<th>Tipe</th>
|
<th>Nama</th>
|
||||||
<th>Posisi</th>
|
<th>Tipe</th>
|
||||||
<th>Kategori</th>
|
<th>Posisi</th>
|
||||||
<th width="15%">Aksi</th>
|
<th>Kategori</th>
|
||||||
</tr>
|
<th width="15%">Aksi</th>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody></tbody>
|
</thead>
|
||||||
</table>
|
<tbody></tbody>
|
||||||
</div>
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<!-- MODAL -->
|
|
||||||
<div class="modal fade" id="modalAccount">
|
<!-- MODAL -->
|
||||||
<div class="modal-dialog modal-dialog-centered">
|
<div class="modal fade" id="modalAccount">
|
||||||
<div class="modal-content rounded-4">
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
<div class="modal-header bg-warning text-white">
|
<div class="modal-content rounded-4">
|
||||||
<h5 class="modal-title">Tambah Akun</h5>
|
<div class="modal-header bg-warning text-white">
|
||||||
<button class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
<h5 class="modal-title">Tambah Akun</h5>
|
||||||
</div>
|
<button class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||||
|
</div>
|
||||||
<div class="modal-body">
|
|
||||||
|
<div class="modal-body">
|
||||||
<input type="hidden" id="inputId">
|
|
||||||
|
<input type="hidden" id="inputId">
|
||||||
<label class="fw-semibold">Kode Akun</label>
|
|
||||||
<input type="text" class="form-control" id="kode_akun">
|
<label class="fw-semibold">Kode Akun</label>
|
||||||
|
<input type="text" class="form-control" id="kode_akun">
|
||||||
<label class="fw-semibold mt-2">Nama Akun</label>
|
|
||||||
<input type="text" class="form-control" id="nama_akun">
|
<label class="fw-semibold mt-2">Nama Akun</label>
|
||||||
|
<input type="text" class="form-control" id="nama_akun">
|
||||||
<label class="fw-semibold mt-2">Tipe</label>
|
|
||||||
<select class="form-control" id="tipe">
|
<label class="fw-semibold mt-2">Urutan Laporan</label>
|
||||||
<option value="asset">Asset</option>
|
<input type="number" class="form-control" id="priority">
|
||||||
<option value="liability">Liability</option>
|
|
||||||
<option value="equity">Equity</option>
|
<label class="fw-semibold mt-2">Tipe</label>
|
||||||
<option value="revenue">Revenue</option>
|
<select class="form-control" id="tipe">
|
||||||
<option value="expense">Expense</option>
|
<option value="asset">Asset</option>
|
||||||
</select>
|
<option value="liability">Liability</option>
|
||||||
|
<option value="equity">Equity</option>
|
||||||
<label class="fw-semibold mt-2">Parent</label>
|
<option value="revenue">Revenue</option>
|
||||||
<select class="form-control" id="parent_id">
|
<option value="expense">Expense</option>
|
||||||
<option value="">-- Tanpa Parent --</option>
|
</select>
|
||||||
<?php foreach($parent_accounts as $p): ?>
|
|
||||||
<option value="<?= $p->id ?>">
|
<label class="fw-semibold mt-2">Parent</label>
|
||||||
<?= $p->kode_akun ?> - <?= $p->nama_akun ?>
|
<select class="form-control" id="parent_id">
|
||||||
</option>
|
<option value="">-- Tanpa Parent --</option>
|
||||||
<?php endforeach; ?>
|
<?php foreach($parent_accounts as $p): ?>
|
||||||
</select>
|
<option value="<?= $p->id ?>">
|
||||||
|
<?= $p->kode_akun ?> - <?= $p->nama_akun ?>
|
||||||
</div>
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
<div class="modal-footer">
|
</select>
|
||||||
<button class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
|
||||||
<button class="btn btn-warning" id="btnSimpan">Simpan</button>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
<div class="modal-footer">
|
||||||
</div>
|
<button class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
||||||
</div>
|
<button class="btn btn-warning" id="btnSimpan">Simpan</button>
|
||||||
|
</div>
|
||||||
<script>
|
</div>
|
||||||
$(function(){
|
</div>
|
||||||
|
</div>
|
||||||
let table = $('#tableAccounts').DataTable({
|
|
||||||
processing: true,
|
<script>
|
||||||
serverSide: true,
|
$(function(){
|
||||||
responsive: true,
|
|
||||||
autoWidth: false,
|
let table = $('#tableAccounts').DataTable({
|
||||||
order: [],
|
processing: true,
|
||||||
ajax: {
|
serverSide: true,
|
||||||
url: "<?= base_url('accounts/get_data'); ?>",
|
responsive: true,
|
||||||
type: "POST"
|
autoWidth: false,
|
||||||
},
|
order: [],
|
||||||
columns: [
|
ajax: {
|
||||||
{ data: 0, orderable:false },
|
url: "<?= base_url('accounts/get_data'); ?>",
|
||||||
{ data: 1 },
|
type: "POST"
|
||||||
{ data: 2 },
|
},
|
||||||
{ data: 3 },
|
columns: [
|
||||||
{ data: 4 },
|
{ data: 0, orderable:false },
|
||||||
{ data: 5 },
|
{ data: 1 },
|
||||||
{ data: 6, orderable:false }
|
{ data: 2 },
|
||||||
],
|
{ data: 3 },
|
||||||
language: {
|
{ data: 4 },
|
||||||
processing: `<div class="text-center"><div class="spinner-border text-warning"></div></div>`
|
{ data: 5 },
|
||||||
}
|
{ data: 6 },
|
||||||
});
|
{ data: 7, orderable:false }
|
||||||
|
],
|
||||||
// ================= RESET FORM
|
language: {
|
||||||
function resetForm(){
|
processing: `<div class="text-center"><div class="spinner-border text-warning"></div></div>`
|
||||||
$('#inputId').val('');
|
}
|
||||||
$('#kode_akun').val('');
|
});
|
||||||
$('#nama_akun').val('');
|
|
||||||
$('#tipe').val('asset');
|
// ================= RESET FORM
|
||||||
$('#parent_id').val('');
|
function resetForm(){
|
||||||
$('#modalAccount .modal-title').text('Tambah Akun');
|
$('#inputId').val('');
|
||||||
}
|
$('#kode_akun').val('');
|
||||||
|
$('#nama_akun').val('');
|
||||||
// ================= OPEN MODAL
|
$('#priority').val('');
|
||||||
$('.btn-add').click(function(){
|
$('#tipe').val('asset');
|
||||||
resetForm();
|
$('#parent_id').val('');
|
||||||
$('#btnSimpan').data('action','add');
|
$('#modalAccount .modal-title').text('Tambah Akun');
|
||||||
$('#modalAccount').modal('show');
|
}
|
||||||
});
|
|
||||||
|
// ================= OPEN MODAL
|
||||||
// ================= SAVE / UPDATE
|
$('.btn-add').click(function(){
|
||||||
$('#btnSimpan').click(function(){
|
resetForm();
|
||||||
|
$('#btnSimpan').data('action','add');
|
||||||
let action = $(this).data('action');
|
$('#modalAccount').modal('show');
|
||||||
|
});
|
||||||
let data = {
|
|
||||||
id: $('#inputId').val(),
|
// ================= SAVE / UPDATE
|
||||||
kode_akun: $('#kode_akun').val().trim(),
|
$('#btnSimpan').click(function(){
|
||||||
nama_akun: $('#nama_akun').val().trim(),
|
|
||||||
tipe: $('#tipe').val(),
|
let action = $(this).data('action');
|
||||||
parent_id: $('#parent_id').val()
|
|
||||||
};
|
let data = {
|
||||||
|
id: $('#inputId').val(),
|
||||||
if(!data.kode_akun || !data.nama_akun){
|
kode_akun: $('#kode_akun').val().trim(),
|
||||||
Swal.fire('Warning','Kode & Nama wajib diisi','warning');
|
nama_akun: $('#nama_akun').val().trim(),
|
||||||
return;
|
priority: $('#priority').val().trim(),
|
||||||
}
|
tipe: $('#tipe').val(),
|
||||||
|
parent_id: $('#parent_id').val()
|
||||||
let url = action === 'add'
|
};
|
||||||
? "<?= base_url('accounts/save'); ?>"
|
|
||||||
: "<?= base_url('accounts/update'); ?>";
|
if(!data.kode_akun || !data.nama_akun){
|
||||||
|
Swal.fire('Warning','Kode & Nama wajib diisi','warning');
|
||||||
$.ajax({
|
return;
|
||||||
url: url,
|
}
|
||||||
type: 'POST',
|
|
||||||
data: data,
|
let url = action === 'add'
|
||||||
dataType: 'json',
|
? "<?= base_url('accounts/save'); ?>"
|
||||||
success: function(res){
|
: "<?= base_url('accounts/update'); ?>";
|
||||||
if(res.status){
|
|
||||||
$('#modalAccount').modal('hide');
|
$.ajax({
|
||||||
table.ajax.reload(null,false);
|
url: url,
|
||||||
Swal.fire('Sukses', res.message, 'success');
|
type: 'POST',
|
||||||
} else {
|
data: data,
|
||||||
Swal.fire('Error', res.message, 'error');
|
dataType: 'json',
|
||||||
}
|
success: function(res){
|
||||||
},
|
if(res.status){
|
||||||
error: function(){
|
$('#modalAccount').modal('hide');
|
||||||
Swal.fire('Error','Terjadi kesalahan server','error');
|
table.ajax.reload(null,false);
|
||||||
}
|
Swal.fire('Sukses', res.message, 'success');
|
||||||
});
|
} else {
|
||||||
});
|
Swal.fire('Error', res.message, 'error');
|
||||||
|
}
|
||||||
// ================= EDIT
|
},
|
||||||
$(document).on('click','.btn-edit',function(){
|
error: function(){
|
||||||
|
Swal.fire('Error','Terjadi kesalahan server','error');
|
||||||
let id = $(this).data('id');
|
}
|
||||||
|
});
|
||||||
$.get("<?= base_url('accounts/detail/'); ?>" + id, function(res){
|
});
|
||||||
|
|
||||||
$('#inputId').val(res.id);
|
// ================= EDIT
|
||||||
$('#kode_akun').val(res.kode_akun);
|
$(document).on('click','.btn-edit',function(){
|
||||||
$('#nama_akun').val(res.nama_akun);
|
|
||||||
$('#tipe').val(res.tipe);
|
let id = $(this).data('id');
|
||||||
$('#parent_id').val(res.parent_id);
|
|
||||||
|
$.get("<?= base_url('accounts/detail/'); ?>" + id, function(res){
|
||||||
$('#modalAccount .modal-title').text('Edit Akun');
|
|
||||||
$('#btnSimpan').data('action','edit');
|
$('#inputId').val(res.id);
|
||||||
|
$('#kode_akun').val(res.kode_akun);
|
||||||
$('#modalAccount').modal('show');
|
$('#nama_akun').val(res.nama_akun);
|
||||||
|
$('#priority').val(res.priority);
|
||||||
},'json');
|
$('#tipe').val(res.tipe);
|
||||||
});
|
$('#parent_id').val(res.parent_id);
|
||||||
|
|
||||||
// ================= DELETE
|
$('#modalAccount .modal-title').text('Edit Akun');
|
||||||
$(document).on('click','.btn-delete',function(){
|
$('#btnSimpan').data('action','edit');
|
||||||
|
|
||||||
let id = $(this).data('id');
|
$('#modalAccount').modal('show');
|
||||||
|
|
||||||
Swal.fire({
|
},'json');
|
||||||
title: 'Yakin hapus?',
|
});
|
||||||
text: 'Data tidak bisa dikembalikan!',
|
|
||||||
icon: 'warning',
|
// ================= DELETE
|
||||||
showCancelButton: true,
|
$(document).on('click','.btn-delete',function(){
|
||||||
confirmButtonText: 'Ya, hapus'
|
|
||||||
}).then((result)=>{
|
let id = $(this).data('id');
|
||||||
if(result.isConfirmed){
|
|
||||||
|
Swal.fire({
|
||||||
$.get("<?= base_url('accounts/delete/'); ?>" + id, function(res){
|
title: 'Yakin hapus?',
|
||||||
|
text: 'Data tidak bisa dikembalikan!',
|
||||||
if(res.status){
|
icon: 'warning',
|
||||||
table.ajax.reload(null,false);
|
showCancelButton: true,
|
||||||
Swal.fire('Sukses', res.message, 'success');
|
confirmButtonText: 'Ya, hapus'
|
||||||
} else {
|
}).then((result)=>{
|
||||||
Swal.fire('Error', res.message, 'error');
|
if(result.isConfirmed){
|
||||||
}
|
|
||||||
|
$.get("<?= base_url('accounts/delete/'); ?>" + id, function(res){
|
||||||
},'json');
|
|
||||||
}
|
if(res.status){
|
||||||
});
|
table.ajax.reload(null,false);
|
||||||
});
|
Swal.fire('Sukses', res.message, 'success');
|
||||||
|
} else {
|
||||||
});
|
Swal.fire('Error', res.message, 'error');
|
||||||
|
}
|
||||||
|
|
||||||
|
},'json');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -995,7 +995,7 @@ $(function(){
|
|||||||
|
|
||||||
refreshTable(dtKembalikan, kembalikanData);
|
refreshTable(dtKembalikan, kembalikanData);
|
||||||
$('#scanKembalikan').val('').focus();
|
$('#scanKembalikan').val('').focus();
|
||||||
Swal.fire({icon:'success', text:'Barang ditambahkan ke daftar pengembalian', timer:1200, showConfirmButton:false});
|
// Swal.fire({icon:'success', text:'Barang ditambahkan ke daftar pengembalian', timer:1200, showConfirmButton:false});
|
||||||
}, 'json');
|
}, 'json');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1059,7 +1059,7 @@ $(function(){
|
|||||||
|
|
||||||
refreshTable(dtDibawa, dibawaData);
|
refreshTable(dtDibawa, dibawaData);
|
||||||
$('#scanDibawa').val('').focus();
|
$('#scanDibawa').val('').focus();
|
||||||
Swal.fire({icon:'success', text:'Barang ditambahkan ke daftar bawaan', timer:1200, showConfirmButton:false});
|
// Swal.fire({icon:'success', text:'Barang ditambahkan ke daftar bawaan', timer:1200, showConfirmButton:false});
|
||||||
}, 'json');
|
}, 'json');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 150 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 133 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 150 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 138 KiB |
Reference in New Issue
Block a user