Compare commits
7 Commits
f715a8d637
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d1f83872c | |||
| 4c2fefe9c3 | |||
| 7d90548717 | |||
| 0a16246138 | |||
| abbabf4af8 | |||
| f145b9e2ec | |||
| ea969beedc |
@@ -37,5 +37,6 @@ user_guide_src/cilexer/pycilexer.egg-info/*
|
||||
/tests/results/
|
||||
/dev-docs/
|
||||
/ai-rules/
|
||||
*.omo/
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"sessionID": "ses_068c091cfffeSZ25RoesHkRZHA",
|
||||
"updatedAt": "2026-07-25T03:09:04.625Z",
|
||||
"sources": {
|
||||
"background-task": {
|
||||
"state": "idle",
|
||||
"updatedAt": "2026-07-25T03:09:04.625Z"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"sessionID": "ses_0690d5681fferVVn0tDzMM9Ow7",
|
||||
"updatedAt": "2026-07-25T08:09:46.929Z",
|
||||
"sources": {
|
||||
"background-task": {
|
||||
"state": "idle",
|
||||
"updatedAt": "2026-07-25T08:09:46.929Z"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
## TODO Baru - Catch-up penyusutan multi-bulan
|
||||
|
||||
- [ ] Refactor logic depreciation_asset agar memproses multi-bulan (catch-up)
|
||||
- [ ] Terapkan loop per bulan dari bulan setelah tanggal patokan sampai bulan berjalan
|
||||
- [ ] Pertahankan idempotent check per bulan berdasarkan asset_mutations
|
||||
- [ ] Generate mutasi + jurnal per bulan yang eligible
|
||||
- [ ] Update nilai buku & akumulasi penyusutan asset setelah proses loop
|
||||
- [ ] Tambahkan detail response per bulan (processed/skipped reason)
|
||||
- [ ] Validasi syntax PHP untuk Cronjob.php
|
||||
- [x] Refactor logic depreciation_asset agar memproses multi-bulan (catch-up)
|
||||
- [x] Terapkan loop per bulan dari bulan setelah tanggal patokan sampai bulan berjalan
|
||||
- [x] Pertahankan idempotent check per bulan berdasarkan asset_mutations
|
||||
- [x] Generate mutasi + jurnal per bulan yang eligible
|
||||
- [x] Update nilai buku & akumulasi penyusutan asset setelah proses loop
|
||||
- [x] Tambahkan detail response per bulan (processed/skipped reason)
|
||||
- [x] Validasi syntax PHP untuk Cronjob.php
|
||||
|
||||
@@ -60,3 +60,6 @@ $route['iclock/cdata'] = 'AttendanceWebhook/cdata';
|
||||
$route['dbcompare/sql'] = 'Dbcompare/sql';
|
||||
$route['dbcompare/sql_download'] = 'Dbcompare/sql_download';
|
||||
|
||||
// teknisi log barang
|
||||
$route['teknisi/log_barang'] = 'teknisi/log_barang';
|
||||
|
||||
|
||||
@@ -22,9 +22,10 @@ class Asset extends CI_Controller {
|
||||
// ================= GET DATA =================
|
||||
public function get_data(){
|
||||
$data = $this->db
|
||||
->select('assets.*, lokasi_asset.nama as nama_lokasi')
|
||||
->select('assets.*, lokasi_asset.nama as nama_lokasi, item_barcodes.barcode as barcode, item_barcodes.id as barcode_id')
|
||||
->from('assets')
|
||||
->join('lokasi_asset', 'lokasi_asset.id = assets.lokasi_asset_id', 'left')
|
||||
->join('item_barcodes', 'item_barcodes.id = assets.barcode_id', 'left')
|
||||
->order_by('assets.tanggal_perolehan','DESC')
|
||||
->get()
|
||||
->result();
|
||||
@@ -37,7 +38,7 @@ class Asset extends CI_Controller {
|
||||
$no++,
|
||||
$d->tanggal_perolehan,
|
||||
$d->kode_asset ?? '-',
|
||||
$d->nama_asset,
|
||||
$d->nama_asset . ($d->barcode_id ? '<br><small class="text-muted"><i>'.$d->barcode.'</i></small>' : ''),
|
||||
$d->nama_lokasi ?? '-',
|
||||
$d->keterangan ?? '-',
|
||||
number_format($d->nilai_perolehan),
|
||||
@@ -204,6 +205,7 @@ class Asset extends CI_Controller {
|
||||
// INSERT ASSET
|
||||
$this->db->insert('assets',[
|
||||
'item_id' => $item_id,
|
||||
'barcode_id' => $barcode_id,
|
||||
'kode_asset' => 'AST-'.time(),
|
||||
'nama_asset' => $nama_asset,
|
||||
'harga_per_unit' => $harga,
|
||||
|
||||
@@ -1193,7 +1193,7 @@ class Invoices extends CI_Controller {
|
||||
public function get_accounts_assets()
|
||||
{
|
||||
$data = $this->db
|
||||
->where_in('kode_akun', [101,102,207,201,202,203,204,205,209])
|
||||
->where_in('tipe', ['asset','liability'])
|
||||
->order_by('kode_akun', 'ASC')
|
||||
->get('accounts')
|
||||
->result();
|
||||
|
||||
@@ -187,6 +187,7 @@ class Items extends CI_Controller {
|
||||
|
||||
$barcodes = $this->db
|
||||
->where('item_id',$item_id)
|
||||
->where('status !=', 'sold_out')
|
||||
->order_by('id','ASC')
|
||||
->get('item_barcodes')
|
||||
->result();
|
||||
@@ -419,7 +420,7 @@ class Items extends CI_Controller {
|
||||
->or_like('i.nama_barang', $barcode, 'both')
|
||||
->or_like('ib.serial_number', $barcode, 'both')
|
||||
->group_end()
|
||||
->limit(15)
|
||||
// ->limit(15)
|
||||
->get()
|
||||
->result();
|
||||
|
||||
@@ -968,6 +969,8 @@ class Items extends CI_Controller {
|
||||
|
||||
// hapus item
|
||||
$this->db->delete('stock_logs',['item_id'=>$id]);
|
||||
$this->db->delete('item_movements',['item_id'=>$id]);
|
||||
$this->db->delete('item_barcodes',['item_id'=>$id]);
|
||||
$this->db->delete('items',['id'=>$id]);
|
||||
|
||||
$j = $this->db->get_where('journals', [
|
||||
@@ -1086,6 +1089,7 @@ class Items extends CI_Controller {
|
||||
ib.id as barcode_id,
|
||||
ib.item_id,
|
||||
ib.qty_sisa,
|
||||
ib.barcode,
|
||||
ib.warehouse_id,
|
||||
ib.status as barcode_status,
|
||||
i.nama_barang,
|
||||
@@ -1181,6 +1185,9 @@ class Items extends CI_Controller {
|
||||
'qty_sisa' => $new_qty_sisa,
|
||||
'status' => $new_qty_sisa <= 0 ? 'installed' : $barcode->barcode_status
|
||||
]);
|
||||
|
||||
$this->db->where('barcode', $barcode->barcode)->where('status', 'active')->update('item_technician', ['status' => 'inactive', 'deleted_at' => date('Y-m-d H:i:s')]);
|
||||
|
||||
// END - Item Movement & item barcodes update status
|
||||
|
||||
$this->db->trans_complete();
|
||||
|
||||
@@ -80,6 +80,7 @@ class Teknisi extends CI_Controller {
|
||||
'serial_number' => $item->serial_number,
|
||||
'barcode_id' => $item->barcode_id,
|
||||
'item_id' => $item->item_id,
|
||||
'barcode_status' => $item->barcode_status,
|
||||
'teknisi_id' => $teknisi ? $teknisi->user_id : null,
|
||||
'teknisi_name' => $teknisi ? $teknisi->full_name : null,
|
||||
'teknisi_code' => $teknisi ? $teknisi->employee_code : null
|
||||
@@ -87,6 +88,18 @@ class Teknisi extends CI_Controller {
|
||||
]);
|
||||
}
|
||||
|
||||
function get_date_by_employee_id()
|
||||
{
|
||||
$user_id = (int)$this->input->get('user_id');
|
||||
if (!$user_id) {
|
||||
echo json_encode(['status' => false, 'message' => 'ID teknisi tidak valid']);
|
||||
return;
|
||||
}
|
||||
|
||||
$dates = $this->ptm->get_dates_by_employee_id($user_id);
|
||||
echo json_encode(['status' => true, 'data' => $dates]);
|
||||
}
|
||||
|
||||
public function batch_kembalikan()
|
||||
{
|
||||
$barcodes = $this->input->post('barcodes');
|
||||
@@ -208,6 +221,7 @@ class Teknisi extends CI_Controller {
|
||||
|
||||
$result[] = [
|
||||
$no++,
|
||||
$row->tanggal ?? date('d/m/Y'),
|
||||
htmlspecialchars($row->barcode, ENT_QUOTES, 'UTF-8'),
|
||||
htmlspecialchars($row->nama_barang, ENT_QUOTES, 'UTF-8'),
|
||||
htmlspecialchars($row->serial_number, ENT_QUOTES, 'UTF-8') ?: '-',
|
||||
@@ -239,15 +253,32 @@ class Teknisi extends CI_Controller {
|
||||
return;
|
||||
}
|
||||
|
||||
$items = $this->ptm->get_teknisi_items_full($user_id);
|
||||
$noFaktur = 'GRJN/K/' . date('d/m/Y');
|
||||
$tanggal = date('d F Y');
|
||||
$tanggal_param = $this->input->get('tanggal');
|
||||
$items = [];
|
||||
if ($tanggal_param) {
|
||||
$items = $this->ptm->get_teknisi_items_full($user_id, $tanggal_param);
|
||||
}
|
||||
|
||||
if ($tanggal_param) {
|
||||
if ($tanggal_param === 'all') {
|
||||
$noFaktur = 'GRJN/K/ALL' . date('/m/Y');
|
||||
$tanggal = date('d F Y');
|
||||
} else {
|
||||
$ts = strtotime($tanggal_param);
|
||||
$noFaktur = 'GRJN/K/' . date('d/m/Y', $ts);
|
||||
$tanggal = date('d F Y', $ts);
|
||||
}
|
||||
} else {
|
||||
$noFaktur = 'GRJN/K/' . date('d/m/Y');
|
||||
$tanggal = date('d F Y');
|
||||
}
|
||||
|
||||
$itemsData = [];
|
||||
$no = 1;
|
||||
foreach ($items as $item) {
|
||||
$itemsData[] = [
|
||||
'no' => $no++,
|
||||
'tanggal' => $item->tanggal ?? date('d/m/Y'),
|
||||
'barcode' => $item->barcode ?? '-',
|
||||
'nama_barang' => $item->nama_barang ?? '-',
|
||||
'serial_number' => $item->serial_number ?? '-',
|
||||
@@ -274,9 +305,6 @@ class Teknisi extends CI_Controller {
|
||||
|
||||
public function generate_pdf_barang_bawaan($user_id = null)
|
||||
{
|
||||
if ($this->session->userdata('role') != 'Admin') {
|
||||
show_error('Akses ditolak', 403);
|
||||
}
|
||||
|
||||
$user_id = (int)$user_id;
|
||||
if (!$user_id) {
|
||||
@@ -292,9 +320,22 @@ class Teknisi extends CI_Controller {
|
||||
show_error('Teknisi tidak ditemukan', 404);
|
||||
}
|
||||
|
||||
$items = $this->ptm->get_teknisi_items_full($user_id);
|
||||
$noFaktur = 'GRJN/K/' . date('d/m/Y');
|
||||
$tanggal = date('d F Y');
|
||||
$tanggal_param = $this->input->get('tanggal');
|
||||
|
||||
if ($tanggal_param === 'all') {
|
||||
$items = $this->ptm->get_teknisi_items_full($user_id);
|
||||
$noFaktur = 'GRJN/K/ALL' . date('/m/Y');
|
||||
$tanggal = 'Semua Tanggal';
|
||||
} elseif ($tanggal_param) {
|
||||
$ts = strtotime($tanggal_param);
|
||||
$items = $this->ptm->get_teknisi_items_full($user_id, $tanggal_param);
|
||||
$noFaktur = 'GRJN/K/' . date('d/m/Y', $ts);
|
||||
$tanggal = date('d/m/Y', $ts);
|
||||
} else {
|
||||
$items = $this->ptm->get_teknisi_items_full($user_id);
|
||||
$noFaktur = 'GRJN/K/' . date('d/m/Y');
|
||||
$tanggal = date('d/m/Y');
|
||||
}
|
||||
|
||||
require_once(APPPATH . 'third_party/fpdf/fpdf.php');
|
||||
require_once(APPPATH . 'libraries/PDF_BarangBawaan.php');
|
||||
@@ -436,4 +477,42 @@ class Teknisi extends CI_Controller {
|
||||
|
||||
echo json_encode(['status' => true, 'message' => $msg, 'errors' => $errors]);
|
||||
}
|
||||
|
||||
public function get_log_data()
|
||||
{
|
||||
$data = $this->ptm->get_log_barang();
|
||||
|
||||
$result = [];
|
||||
$no = 1;
|
||||
|
||||
foreach ($data as $row) {
|
||||
$status_badge = $row->status === 'active'
|
||||
? '<span class="badge bg-success">ACTIVE</span>'
|
||||
: '<span class="badge bg-secondary">INACTIVE</span>';
|
||||
|
||||
$result[] = [
|
||||
$no++,
|
||||
htmlspecialchars($row->teknisi_name ?? '-', ENT_QUOTES, 'UTF-8'),
|
||||
htmlspecialchars($row->item_code ?? '-', ENT_QUOTES, 'UTF-8'),
|
||||
htmlspecialchars($row->barcode, ENT_QUOTES, 'UTF-8'),
|
||||
htmlspecialchars($row->nama_barang ?? '-', ENT_QUOTES, 'UTF-8'),
|
||||
$row->created_at ? date('d/m/Y H:i', strtotime($row->created_at)) : '-',
|
||||
$row->status === 'inactive' && $row->deleted_at ? date('d/m/Y H:i', strtotime($row->deleted_at)) : '-',
|
||||
$status_badge,
|
||||
];
|
||||
}
|
||||
|
||||
echo json_encode(['data' => $result]);
|
||||
}
|
||||
|
||||
public function log_barang()
|
||||
{
|
||||
$data = [
|
||||
"active_menu" => "peralatan_teknisi",
|
||||
];
|
||||
|
||||
$this->load->view('partials/header', $data);
|
||||
$this->load->view('peralatan_teknisi/log_barang', $data);
|
||||
$this->load->view('partials/footer');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class PDF_BarangBawaan extends FPDF
|
||||
private $tanggal;
|
||||
private $teknisi;
|
||||
|
||||
private $colWidths = [10, 28, 48, 30, 12, 62];
|
||||
private $colWidths = [8, 18, 27, 42, 24, 10, 46, 15];
|
||||
|
||||
public function __construct($orientation = 'L', $unit = 'mm', $size = 'A5')
|
||||
{
|
||||
@@ -57,7 +57,7 @@ class PDF_BarangBawaan extends FPDF
|
||||
$this->SetTextColor(255, 255, 255);
|
||||
$this->SetFont('Arial', 'B', 7);
|
||||
|
||||
$headers = ['No', 'Barcode', 'Nama Barang', 'Serial Number', 'Jumlah', 'Keterangan'];
|
||||
$headers = ['No', 'Tanggal', 'Barcode', 'Nama Barang', 'Serial Number', 'Jumlah', 'Keterangan', 'Server'];
|
||||
foreach ($headers as $i => $h) {
|
||||
$this->Cell($this->colWidths[$i], 7, $h, 1, 0, 'C', true);
|
||||
}
|
||||
@@ -73,8 +73,8 @@ class PDF_BarangBawaan extends FPDF
|
||||
$minRowH = 8;
|
||||
$no = 1;
|
||||
|
||||
$colsMultiCell = [false, false, true, true, false, true];
|
||||
$cellAligns = ['C', 'L', 'L', 'L', 'C', 'L'];
|
||||
$colsMultiCell = [false, false, true, true, true, false, true, false];
|
||||
$cellAligns = ['C', 'C', 'L', 'L', 'L', 'C', 'L', 'L'];
|
||||
|
||||
foreach ($items as $item) {
|
||||
$keterangan = isset($item->keterangan) ? $item->keterangan : '';
|
||||
@@ -82,14 +82,17 @@ class PDF_BarangBawaan extends FPDF
|
||||
$serial = $item->serial_number ?? '-';
|
||||
$barcode = $item->barcode ?? '-';
|
||||
$jumlah = isset($item->qty_sisa) ? (int)$item->qty_sisa : 1;
|
||||
$server = '';
|
||||
|
||||
$cellValues = [
|
||||
(string)$no,
|
||||
$item->tanggal ?? '-',
|
||||
$barcode,
|
||||
$namaBarang,
|
||||
$serial,
|
||||
(string)$jumlah,
|
||||
$keterangan
|
||||
$keterangan,
|
||||
$server
|
||||
];
|
||||
|
||||
$maxLines = 1;
|
||||
@@ -121,7 +124,8 @@ class PDF_BarangBawaan extends FPDF
|
||||
foreach ($cellValues as $i => $val) {
|
||||
$this->SetXY($currentX, $startY);
|
||||
if ($colsMultiCell[$i]) {
|
||||
$contentH = $maxLines * $lineH;
|
||||
$colLines = $this->NbLines($this->colWidths[$i], $val);
|
||||
$contentH = $colLines * $lineH;
|
||||
$offsetY = ($rowH - $contentH) / 2;
|
||||
$this->SetXY($currentX, $startY + $offsetY);
|
||||
$this->MultiCell($this->colWidths[$i], $lineH, $val, 0, $cellAligns[$i]);
|
||||
|
||||
@@ -65,6 +65,7 @@ class PeralatanTeknisi_model extends CI_Model {
|
||||
->from('item_barcodes ib')
|
||||
->join('items i', 'i.id = ib.item_id', 'left')
|
||||
->where('ib.barcode', $barcode)
|
||||
->where('ib.qty_sisa >', 0)
|
||||
->get()
|
||||
->row();
|
||||
|
||||
@@ -74,6 +75,7 @@ class PeralatanTeknisi_model extends CI_Model {
|
||||
->from('item_barcodes ib')
|
||||
->join('items i', 'i.id = ib.item_id', 'left')
|
||||
->where('ib.serial_number', $barcode)
|
||||
->where('ib.qty_sisa >', 0)
|
||||
->get()
|
||||
->row();
|
||||
}
|
||||
@@ -164,6 +166,19 @@ class PeralatanTeknisi_model extends CI_Model {
|
||||
return ['status' => true, 'message' => $msg, 'errors' => $errors];
|
||||
}
|
||||
|
||||
public function get_dates_by_employee_id($user_id)
|
||||
{
|
||||
return $this->db
|
||||
->select("DATE(it.created_at) as tanggal")
|
||||
->from('item_technician it')
|
||||
->where('it.user_id', $user_id)
|
||||
->where('it.status', 'active')
|
||||
->group_by("DATE(it.created_at)")
|
||||
->order_by("DATE(it.created_at)", "DESC")
|
||||
->get()
|
||||
->result();
|
||||
}
|
||||
|
||||
public function batch_dibawa(array $barcodes, $user_id)
|
||||
{
|
||||
$now = date('Y-m-d H:i:s');
|
||||
@@ -362,10 +377,11 @@ class PeralatanTeknisi_model extends CI_Model {
|
||||
public function get_teknisi_items_data($user_id, $start, $length, $search, $order_col, $order_dir)
|
||||
{
|
||||
$sort_cols = [
|
||||
1 => 'it.barcode',
|
||||
2 => 'i.nama_barang',
|
||||
3 => 'ib.serial_number',
|
||||
4 => 'it.status'
|
||||
1 => 'it.created_at',
|
||||
2 => 'it.barcode',
|
||||
3 => 'i.nama_barang',
|
||||
4 => 'ib.serial_number',
|
||||
5 => 'it.status'
|
||||
];
|
||||
|
||||
$this->db
|
||||
@@ -375,7 +391,7 @@ class PeralatanTeknisi_model extends CI_Model {
|
||||
ib.serial_number,
|
||||
ib.qty_sisa,
|
||||
it.status,
|
||||
it.created_at
|
||||
DATE_FORMAT(it.created_at, '%d/%m/%Y') as tanggal
|
||||
")
|
||||
->from('item_technician it')
|
||||
->join('items i', 'i.id = it.item_id', 'left')
|
||||
@@ -484,21 +500,28 @@ class PeralatanTeknisi_model extends CI_Model {
|
||||
->row();
|
||||
}
|
||||
|
||||
public function get_teknisi_items_full($user_id)
|
||||
public function get_teknisi_items_full($user_id, $tanggal = null)
|
||||
{
|
||||
return $this->db
|
||||
$this->db
|
||||
->select("
|
||||
it.barcode,
|
||||
i.nama_barang,
|
||||
ib.serial_number,
|
||||
ib.qty_sisa,
|
||||
it.status
|
||||
it.status,
|
||||
DATE_FORMAT(it.created_at, '%d/%m/%Y') as tanggal
|
||||
")
|
||||
->from('item_technician it')
|
||||
->join('items i', 'i.id = it.item_id', 'left')
|
||||
->join('item_barcodes ib', 'ib.barcode = it.barcode', 'left')
|
||||
->where('it.user_id', $user_id)
|
||||
->where('it.status', 'active')
|
||||
->where('it.status', 'active');
|
||||
|
||||
if ($tanggal AND $tanggal != 'all') {
|
||||
$this->db->where('DATE(it.created_at)', $tanggal);
|
||||
}
|
||||
|
||||
return $this->db
|
||||
->order_by('it.created_at', 'ASC')
|
||||
->get()
|
||||
->result();
|
||||
@@ -508,4 +531,26 @@ class PeralatanTeknisi_model extends CI_Model {
|
||||
{
|
||||
return 'GRJN/K/' . date('d/m/Y');
|
||||
}
|
||||
|
||||
public function get_log_barang()
|
||||
{
|
||||
return $this->db
|
||||
->select("
|
||||
it.barcode,
|
||||
it.item_id,
|
||||
it.user_id,
|
||||
it.status,
|
||||
it.created_at,
|
||||
it.deleted_at,
|
||||
ke.full_name as teknisi_name,
|
||||
i.kode_detail as item_code,
|
||||
i.nama_barang
|
||||
")
|
||||
->from('item_technician it')
|
||||
->join('k_employees ke', 'ke.id = it.user_id', 'left')
|
||||
->join('items i', 'i.id = it.item_id', 'left')
|
||||
->order_by('it.created_at', 'DESC')
|
||||
->get()
|
||||
->result();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ $('.btn-add-bayar').click(function(){
|
||||
|
||||
$('#tableBayar tbody').append(`
|
||||
<tr>
|
||||
<td><select class="form-control account_id">${accountOptionsAssets}</select></td>
|
||||
<td style="width: 60%;"><select class="form-control account_id select-search">${accountOptionsAssets}</select></td>
|
||||
<td><input type="text" class="form-control debit text-end format-rupiah"></td>
|
||||
<td><button class="btn btn-danger btn-remove">X</button></td>
|
||||
</tr>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
:root {
|
||||
--tech-primary: #ff9800;
|
||||
--tech-primary-light: #fff3e0;
|
||||
--tech-primary-dark: #e65100;
|
||||
--tech-primary-dark: #ff9800;
|
||||
}
|
||||
|
||||
body {
|
||||
@@ -78,6 +78,15 @@ body {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.table-tech td .badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 65px;
|
||||
padding: 0.35em 0.65em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.table-tech tbody tr:hover {
|
||||
background: #fff3e0;
|
||||
}
|
||||
@@ -189,10 +198,15 @@ body {
|
||||
<div class="bg-warning text-white p-2 rounded-3 d-flex align-items-center justify-content-center" style="width:38px;height:38px;">
|
||||
<i class="bi bi-tools fs-5"></i>
|
||||
</div>
|
||||
<div>
|
||||
<div class="flex-grow-1">
|
||||
<h5 class="mb-0 fw-bold" style="color:#1a1a2e;">Peralatan Teknisi</h5>
|
||||
<small class="text-muted">Kelola barang bawaan, pengembalian, dan transfer antar teknisi</small>
|
||||
</div>
|
||||
<div>
|
||||
<a href="<?= base_url('teknisi/log_barang'); ?>" class="btn btn-warning" id="btnLogBarang">
|
||||
<i class="bi bi-journal-text me-1"></i> Log Barang Teknisi
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-3">
|
||||
@@ -476,11 +490,12 @@ body {
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:50px">No</th>
|
||||
<th>Tanggal</th>
|
||||
<th>Barcode</th>
|
||||
<th>Nama Barang</th>
|
||||
<th>Serial Number</th>
|
||||
<th>Jumlah</th>
|
||||
<th style="width:100px">Status</th>
|
||||
<th class="text-center" style="width:100px">Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
@@ -517,7 +532,9 @@ body {
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<small class="text-muted">Tanggal</small><br>
|
||||
<strong id="fbTanggal">-</strong>
|
||||
<select class="form-select form-select-sm d-inline-block" id="fbTanggalList" style="max-width:2000px">
|
||||
<option value="">-- Pilih Tanggal --</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<small class="text-muted">Teknisi</small><br>
|
||||
@@ -529,16 +546,17 @@ body {
|
||||
</div>
|
||||
|
||||
<!-- Data table -->
|
||||
<h6 class="fw-bold mb-2"><i class="bi bi-box me-1"></i> Barang Bawaan</h6>
|
||||
<h6 class="fw-bold mb-2 mt-5"><i class="bi bi-box me-1"></i> Barang Bawaan</h6>
|
||||
<div class="table-responsive">
|
||||
<table id="tableFormBarang" class="table table-tech table-hover table-striped align-middle w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:50px">No</th>
|
||||
<th style="width:85px">Tanggal</th>
|
||||
<th>Barcode</th>
|
||||
<th>Nama Barang</th>
|
||||
<th>Serial Number</th>
|
||||
<th style="width:20px">Jumlah</th>
|
||||
<th style="width:100px">Jumlah</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
@@ -737,9 +755,10 @@ $(function(){
|
||||
{ data: 2 },
|
||||
{ data: 3 },
|
||||
{ data: 4 },
|
||||
{ data: 5, className: 'text-center' }
|
||||
{ data: 5 },
|
||||
{ data: 6, className: 'text-center' }
|
||||
],
|
||||
order: [[1, 'asc']],
|
||||
order: [[1, 'desc']],
|
||||
// language: { url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json" },
|
||||
pageLength: 10,
|
||||
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, 'All']]
|
||||
@@ -755,16 +774,35 @@ $(function(){
|
||||
let dtFormBarang;
|
||||
let _formBarangUserId = null;
|
||||
|
||||
$(document).on('click', '.btn-form-barang-bawaan', function(){
|
||||
let userId = $(this).data('id');
|
||||
let nama = $(this).data('nama');
|
||||
_formBarangUserId = userId;
|
||||
function loadListTanggal(userId) {
|
||||
$.get("<?= base_url('teknisi/get_date_by_employee_id'); ?>", {user_id: userId}, function(r){
|
||||
if (!r.status) {
|
||||
Swal.fire({icon:'error', text:r.message});
|
||||
return;
|
||||
}
|
||||
|
||||
$('#fbNoFaktur').text('Memuat...');
|
||||
$('#fbTanggal').text('-');
|
||||
$('#fbTeknisi').text(nama);
|
||||
let opt='<option value="">-- Pilih Tanggal --</option><option value="all">ALL</option>';
|
||||
r.data.forEach(d=>{
|
||||
let parts = d.tanggal.split('-');
|
||||
let display = parts[2] + '/' + parts[1] + '/' + parts[0];
|
||||
opt += `<option value="${d.tanggal}">${display}</option>`;
|
||||
});
|
||||
$('#fbTanggalList').html(opt);
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
$.get("<?= base_url('teknisi/get_form_barang_bawaan_data'); ?>", {user_id: userId}, function(r){
|
||||
function loadFormBarangData() {
|
||||
let tanggalVal = $('#fbTanggalList').val();
|
||||
|
||||
if (!tanggalVal) {
|
||||
$('#fbNoFaktur').text('Memuat...');
|
||||
if (dtFormBarang) {
|
||||
dtFormBarang.clear().draw();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$.get("<?= base_url('teknisi/get_form_barang_bawaan_data'); ?>", {user_id: _formBarangUserId, tanggal: tanggalVal}, function(r){
|
||||
if (!r.status) {
|
||||
Swal.fire({icon:'error', text:r.message});
|
||||
return;
|
||||
@@ -772,8 +810,6 @@ $(function(){
|
||||
|
||||
let d = r.data;
|
||||
$('#fbNoFaktur').text(d.no_faktur);
|
||||
$('#fbTanggal').text(d.tanggal);
|
||||
$('#fbTeknisi').text(d.teknisi);
|
||||
|
||||
if (dtFormBarang) {
|
||||
dtFormBarang.destroy();
|
||||
@@ -783,24 +819,63 @@ $(function(){
|
||||
data: d.items,
|
||||
columns: [
|
||||
{ data: 'no' },
|
||||
{ data: 'tanggal' },
|
||||
{ data: 'barcode' },
|
||||
{ data: 'nama_barang' },
|
||||
{ data: 'serial_number' },
|
||||
{ data: 'jumlah', className: 'text-center' }
|
||||
],
|
||||
// language: { url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json" },
|
||||
pageLength: 10,
|
||||
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, 'All']],
|
||||
order: []
|
||||
});
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
$('#fbTanggalList').on('change', function() {
|
||||
loadFormBarangData();
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-form-barang-bawaan', function(){
|
||||
let userId = $(this).data('id');
|
||||
let nama = $(this).data('nama');
|
||||
_formBarangUserId = userId;
|
||||
|
||||
$('#fbNoFaktur').text('Memuat...');
|
||||
$('#fbTanggalList').val('');
|
||||
$('#fbTeknisi').text(nama);
|
||||
|
||||
if (!dtFormBarang) {
|
||||
dtFormBarang = $('#tableFormBarang').DataTable({
|
||||
data: [],
|
||||
columns: [
|
||||
{ data: 'no' },
|
||||
{ data: 'tanggal' },
|
||||
{ data: 'barcode' },
|
||||
{ data: 'nama_barang' },
|
||||
{ data: 'serial_number' },
|
||||
{ data: 'jumlah', className: 'text-center' }
|
||||
],
|
||||
pageLength: 10,
|
||||
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, 'All']],
|
||||
order: [],
|
||||
language: {
|
||||
emptyTable: "No data available"
|
||||
}
|
||||
});
|
||||
} else {
|
||||
dtFormBarang.clear().draw();
|
||||
}
|
||||
|
||||
loadListTanggal(userId);
|
||||
|
||||
$('#modalFormBarangBawaan').modal('show');
|
||||
});
|
||||
|
||||
$('#btnCetakPDF').click(function(){
|
||||
if (_formBarangUserId) {
|
||||
let url = "<?= base_url('teknisi/generate_pdf_barang_bawaan/'); ?>" + _formBarangUserId;
|
||||
let tanggalVal = $('#fbTanggalList').val();
|
||||
let url = "<?= base_url('teknisi/generate_pdf_barang_bawaan/'); ?>" + _formBarangUserId + '?tanggal=' + encodeURIComponent(tanggalVal);
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
});
|
||||
@@ -961,6 +1036,16 @@ $(function(){
|
||||
return;
|
||||
}
|
||||
|
||||
if (r.data.barcode_status === 'sold_out') {
|
||||
Swal.fire({
|
||||
icon: 'warning',
|
||||
title: 'Barang Tidak Dapat Dibawa',
|
||||
text: 'Barcode ' + r.data.barcode + ' sudah berstatus SOLD OUT sehingga tidak dapat diproses.'
|
||||
});
|
||||
$('#scanDibawa').val('').focus();
|
||||
return;
|
||||
}
|
||||
|
||||
let data = r.data;
|
||||
let no = dibawaData.length + 1;
|
||||
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.4.1/css/responsive.bootstrap5.min.css">
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--tech-primary: #ff9800;
|
||||
--tech-primary-light: #fff3e0;
|
||||
--tech-primary-dark: #ff9800;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #f5f7fb;
|
||||
}
|
||||
|
||||
.tech-card {
|
||||
border: none;
|
||||
border-radius: 14px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.tech-card .card-header-custom {
|
||||
background: linear-gradient(135deg, var(--tech-primary), var(--tech-primary-dark));
|
||||
color: #fff;
|
||||
padding: 14px 20px;
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.tech-card .card-body {
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.table-tech thead th {
|
||||
background: #f8f9fa;
|
||||
font-weight: 600;
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: .4px;
|
||||
color: #495057;
|
||||
border-bottom: 2px solid #ffcc80;
|
||||
padding: 10px 8px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.table-tech tbody td {
|
||||
padding: 8px;
|
||||
vertical-align: middle;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.table-tech td .badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 65px;
|
||||
padding: 0.35em 0.65em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.table-tech tbody tr:hover {
|
||||
background: #fff3e0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container-fluid px-3 mt-3">
|
||||
|
||||
<div class="d-flex align-items-center gap-2 mb-3">
|
||||
<div class="bg-warning text-white p-2 rounded-3 d-flex align-items-center justify-content-center" style="width:38px;height:38px;">
|
||||
<i class="bi bi-journal-text fs-5"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<h5 class="mb-0 fw-bold" style="color:#1a1a2e;">Log Barang Teknisi</h5>
|
||||
<small class="text-muted">Riwayat barang yang pernah dibawa oleh teknisi</small>
|
||||
</div>
|
||||
<div>
|
||||
<a href="<?= base_url('teknisi'); ?>" class="btn btn-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i> Kembali
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card tech-card">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-tech table-striped w-100" id="tblLogBarang">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Nama Teknisi</th>
|
||||
<th>Kode Barang</th>
|
||||
<th>Barcode</th>
|
||||
<th>Nama Barang</th>
|
||||
<th>Tanggal Dibawa</th>
|
||||
<th>Tanggal Kembali</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
$('#tblLogBarang').DataTable({
|
||||
processing: true,
|
||||
serverSide: false,
|
||||
ajax: {
|
||||
url: "<?= base_url('teknisi/get_log_data'); ?>",
|
||||
dataSrc: 'data'
|
||||
},
|
||||
columns: [
|
||||
{ data: 0 },
|
||||
{ data: 1 },
|
||||
{ data: 2 },
|
||||
{ data: 3 },
|
||||
{ data: 4 },
|
||||
{ data: 5 },
|
||||
{ data: 6 },
|
||||
{ data: 7 }
|
||||
],
|
||||
pageLength: 25,
|
||||
lengthMenu: [
|
||||
[25, 50, 100, -1],
|
||||
[25, 50, 100, 'All']
|
||||
],
|
||||
responsive: true,
|
||||
searching: true,
|
||||
paging: true,
|
||||
ordering: true,
|
||||
info: true,
|
||||
language: {
|
||||
search: "Cari:",
|
||||
lengthMenu: "Tampilkan _MENU_ data",
|
||||
info: "Menampilkan _START_ - _END_ dari _TOTAL_ data",
|
||||
zeroRecords: "Tidak ada data",
|
||||
paginate: {
|
||||
first: "Awal",
|
||||
last: "Akhir",
|
||||
next: "»",
|
||||
previous: "«"
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user