feat: implement consumable inventory module, network LAN access, and CI/CD enhancements
- Modul Consumable Item: model master, buku besar transaksi (stock ledger), purchase unit conversion, stock opname, dan transaction reversal - Integrasi ke Employee Management, Asset Unit, dan tiket/work order - Konfigurasi akses jaringan lokal (LAN) via 0.0.0.0:8000, ALLOWED_HOSTS, dan CSRF_TRUSTED_ORIGINS otomatis - Script pembuka firewall Windows (buka_firewall_lan.bat) dan menu interaktif run.bat - Skema migrasi 0019_consumableitem_consumabletransaction - Seeder 11 item consumable riil (seed_consumables.py) - Test suite komprehensif (41 automated tests, 100% lulus) - Pipeline CI/CD GitHub Actions (.github/workflows/ci.yml)
This commit is contained in:
@@ -0,0 +1,400 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block page_title %}Status Aset{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="mb-8 flex flex-col sm:flex-row sm:justify-between sm:items-end space-y-4 sm:space-y-0">
|
||||
<div>
|
||||
<p class="text-xs font-bold tracking-wider text-kerinci uppercase mb-1">Manajemen Aset</p>
|
||||
<div class="flex items-center space-x-3">
|
||||
<h2 class="text-3xl font-extrabold text-gray-900">Status Aset</h2>
|
||||
<button onclick="openGuideModal()" class="w-5 h-5 rounded-full bg-gray-200 text-gray-600 hover:bg-kerinci hover:text-white flex items-center justify-center text-xs font-extrabold transition-colors shadow-sm shrink-0" title="Panduan Halaman">!</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center space-x-3 w-full sm:w-auto">
|
||||
<div class="relative inline-block w-full sm:w-auto flex-1 sm:flex-none">
|
||||
<button onclick="var d = document.getElementById('exportMenuStatus'); d.style.display = d.style.display === 'block' ? 'none' : 'block'; event.stopPropagation();" class="w-full border border-kerinci text-kerinci rounded-xl px-4 py-2 text-sm font-bold hover:bg-kerinci/10 transition-colors flex items-center space-x-2 justify-center">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
|
||||
<span>Ekspor Data</span>
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
|
||||
</button>
|
||||
<div id="exportMenuStatus" style="display: none;" class="absolute right-0 mt-2 w-48 bg-white rounded-xl shadow-[0_8px_30px_rgb(0,0,0,0.12)] border border-gray-100 z-50">
|
||||
<a href="{% url 'status_aset_export_pdf' %}?tab={{ tab }}&cat={{ cat_filter }}{% if search_query %}&q={{ search_query }}{% endif %}" target="_blank" class="flex items-center px-4 py-3 text-sm text-gray-700 hover:bg-gray-50 hover:text-kerinci rounded-t-xl font-bold transition-colors">
|
||||
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
|
||||
Format PDF
|
||||
</a>
|
||||
<div class="h-px bg-gray-100 mx-2"></div>
|
||||
<a href="{% url 'status_aset_export_excel' %}?tab={{ tab }}&cat={{ cat_filter }}{% if search_query %}&q={{ search_query }}{% endif %}" class="flex items-center px-4 py-3 text-sm text-green-600 hover:bg-green-50 rounded-b-xl font-bold transition-colors">
|
||||
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
|
||||
Format Excel (.xlsx)
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tabs -->
|
||||
<div class="flex space-x-2 mb-6 border-b border-gray-200 overflow-x-auto whitespace-nowrap scrollbar-hide">
|
||||
<a href="?tab=tersedia&cat={{ cat_filter }}&q={{ search_query }}" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if tab == 'tersedia' %}border-kerinci text-kerinci{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||||
Tersedia
|
||||
<span class="ml-2 {% if tab == 'tersedia' %}bg-kerinci/10 text-kerinci{% else %}bg-gray-100 text-gray-500{% endif %} text-[10px] px-2 py-0.5 rounded-full font-extrabold">{{ counts.tersedia }}</span>
|
||||
</a>
|
||||
<a href="?tab=digunakan&cat={{ cat_filter }}&q={{ search_query }}" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if tab == 'digunakan' %}border-kerinci text-kerinci{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||||
Digunakan
|
||||
<span class="ml-2 {% if tab == 'digunakan' %}bg-kerinci/10 text-kerinci{% else %}bg-gray-100 text-gray-500{% endif %} text-[10px] px-2 py-0.5 rounded-full font-extrabold">{{ counts.digunakan }}</span>
|
||||
</a>
|
||||
<a href="?tab=rusak&cat={{ cat_filter }}&q={{ search_query }}" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if tab == 'rusak' %}border-kerinci text-kerinci{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||||
Maintenance
|
||||
<span class="ml-2 {% if tab == 'rusak' %}bg-kerinci/10 text-kerinci{% else %}bg-gray-100 text-gray-500{% endif %} text-[10px] px-2 py-0.5 rounded-full font-extrabold">{{ counts.rusak }}</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Search and Filters -->
|
||||
<div class="mb-4 flex flex-col sm:flex-row sm:items-center sm:justify-between space-y-3 sm:space-y-0">
|
||||
<form id="searchForm" method="GET" class="relative w-full sm:w-96">
|
||||
<input type="hidden" name="tab" value="{{ tab }}">
|
||||
<input type="hidden" name="cat" value="{{ cat_filter }}">
|
||||
<input type="text" id="searchInput" name="q" value="{{ search_query }}" placeholder="Cari NIK, nama, area, lokasi, kode unit, atau aset..." class="w-full pl-10 pr-4 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci focus:ring-1 focus:ring-kerinci bg-white shadow-sm placeholder-gray-400">
|
||||
<svg class="w-5 h-5 text-gray-400 absolute left-3 top-2.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
|
||||
</form>
|
||||
|
||||
<div class="flex space-x-1 bg-gray-100 p-1 rounded-xl w-full sm:w-auto">
|
||||
<a href="?tab={{ tab }}&cat=karyawan&q={{ search_query }}" class="flex-1 sm:flex-none text-center px-4 py-2 rounded-lg text-sm font-bold transition-colors {% if cat_filter == 'karyawan' %}bg-kerinci text-white shadow-sm{% else %}text-gray-500 hover:text-gray-900 hover:bg-gray-200{% endif %}">Aset Karyawan</a>
|
||||
<a href="?tab={{ tab }}&cat=network&q={{ search_query }}" class="flex-1 sm:flex-none text-center px-4 py-2 rounded-lg text-sm font-bold transition-colors {% if cat_filter == 'network' %}bg-kerinci text-white shadow-sm{% else %}text-gray-500 hover:text-gray-900 hover:bg-gray-200{% endif %}">Aset Network</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table -->
|
||||
<div class="bg-white rounded-none sm:rounded-2xl shadow-sm border border-gray-100 overflow-hidden w-full" id="tableContainer">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-left border-collapse">
|
||||
<thead>
|
||||
<tr class="bg-[#002060] text-white text-[11px] uppercase tracking-widest">
|
||||
<th class="p-4 font-bold text-center w-16">No</th>
|
||||
<th class="p-4 font-bold">Kode Unit</th>
|
||||
<th class="p-4 font-bold min-w-[250px]">Nama Aset</th>
|
||||
<th class="p-4 font-bold text-center">Status</th>
|
||||
{% if tab != 'tersedia' %}
|
||||
<th class="p-4 font-bold">{% if cat_filter == "network" %}Lokasi{% else %}Dipegang Oleh{% endif %}</th>
|
||||
{% endif %}
|
||||
<th class="p-4 font-bold text-center">Riwayat Unit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-sm divide-y divide-gray-50">
|
||||
{% for unit in units %}
|
||||
<tr class="hover:bg-gray-50/50 transition-colors">
|
||||
<td class="p-4 text-gray-500 font-medium text-center">{{ forloop.counter }}</td>
|
||||
<td class="p-4">
|
||||
<a href="{% url 'unit_history' unit.id %}" class="font-bold text-gray-900 hover:text-kerinci transition-colors inline-block w-max">{{ unit.unit_code }}</a>
|
||||
</td>
|
||||
<td class="p-4">
|
||||
<a href="{% url 'asset_units' unit.asset.id %}" class="block group">
|
||||
<p class="font-medium text-gray-800 group-hover:text-kerinci transition-colors">{{ unit.asset.name }}</p>
|
||||
<p class="text-[10px] text-gray-400 mt-0.5">{{ unit.asset.category.name }}</p>
|
||||
</a>
|
||||
</td>
|
||||
<td class="p-4 text-center">
|
||||
<button onclick="openStatusModal('{{ unit.id }}', '{{ unit.unit_code }}', '{{ unit.status }}', '{% if unit.assigned_to %}{{ unit.assigned_to.name|escapejs }}{% endif %}', '{{ unit.asset.category.name|escapejs }}', '{{ unit.area|default_if_none:""|escapejs }}', '{{ unit.location|default_if_none:""|escapejs }}')" class="hover:opacity-80 transition-opacity focus:outline-none focus:ring-2 focus:ring-kerinci focus:ring-offset-1 rounded-md" title="Klik untuk ubah status">
|
||||
{% if unit.status == 'tersedia' %}
|
||||
<span style="display:inline-flex;align-items:center;gap:4px;" class="bg-emerald-50 border border-emerald-200 text-emerald-700 hover:bg-emerald-100 transition-colors px-2.5 py-1 rounded-md text-[10px] font-extrabold uppercase tracking-wider">Tersedia <svg width="10" height="10" fill="none" stroke="currentColor" viewBox="0 0 24 24" style="opacity:0.7;flex-shrink:0;"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"></path></svg></span>
|
||||
{% elif unit.status == 'digunakan' %}
|
||||
<span style="display:inline-flex;align-items:center;gap:4px;" class="bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 transition-colors px-2.5 py-1 rounded-md text-[10px] font-extrabold uppercase tracking-wider">Digunakan <svg width="10" height="10" fill="none" stroke="currentColor" viewBox="0 0 24 24" style="opacity:0.7;flex-shrink:0;"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"></path></svg></span>
|
||||
{% elif unit.status == 'rusak' %}
|
||||
<span style="display:inline-flex;align-items:center;gap:4px;" class="bg-red-50 border border-red-200 text-red-700 hover:bg-red-100 transition-colors px-2.5 py-1 rounded-md text-[10px] font-extrabold uppercase tracking-wider">Maintenance <svg width="10" height="10" fill="none" stroke="currentColor" viewBox="0 0 24 24" style="opacity:0.7;flex-shrink:0;"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"></path></svg></span>
|
||||
{% else %}
|
||||
<span style="display:inline-flex;align-items:center;gap:4px;" class="bg-gray-50 border border-gray-200 text-gray-600 hover:bg-gray-100 transition-colors px-2.5 py-1 rounded-md text-[10px] font-extrabold uppercase tracking-wider">{{ unit.get_status_display }} <svg width="10" height="10" fill="none" stroke="currentColor" viewBox="0 0 24 24" style="opacity:0.7;flex-shrink:0;"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"></path></svg></span>
|
||||
{% endif %}
|
||||
</button>
|
||||
</td>
|
||||
{% if tab != 'tersedia' %}
|
||||
<td class="p-4">
|
||||
{% if unit.assigned_to %}
|
||||
<a href="{% url 'employee_detail' unit.assigned_to.id %}" class="flex flex-col group w-max">
|
||||
<p class="font-bold text-gray-800 transition-colors group-hover:text-kerinci">{{ unit.assigned_to.name }}</p>
|
||||
<p class="text-xs text-gray-400 transition-colors group-hover:text-kerinci/70">NIK: {{ unit.assigned_to.nik }}</p>
|
||||
</a>
|
||||
{% elif unit.area %}
|
||||
<div class="flex flex-col">
|
||||
<p class="font-bold text-kerinci">{{ unit.area }}</p>
|
||||
<p class="text-xs text-gray-500 max-w-[200px] truncate" title="{{ unit.location }}">{{ unit.location }}</p>
|
||||
</div>
|
||||
{% else %}
|
||||
<span class="text-gray-300 text-xs italic">-</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td class="p-4 text-center">
|
||||
<a href="{% url 'unit_history' unit.id %}" class="inline-flex items-center justify-center p-2 text-kerinci hover:bg-kerinci-light rounded-xl transition-colors" title="Riwayat Unit">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="{% if tab == 'tersedia' %}5{% else %}6{% endif %}" class="p-8 text-center text-gray-400 text-sm">
|
||||
<div class="flex flex-col items-center justify-center space-y-3">
|
||||
<svg class="w-12 h-12 text-gray-200" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
|
||||
<p>Belum ada data unit {% if tab == 'rusak' %}maintenance{% else %}{{ tab }}{% endif %} saat ini.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% include 'components/pagination.html' %}
|
||||
</div>
|
||||
|
||||
<div id="statusUnitModal" class="fixed inset-0 z-50 hidden flex items-center justify-center">
|
||||
<div class="absolute inset-0 bg-gray-900/40 backdrop-blur-sm" onclick="closeStatusUnitModal()"></div>
|
||||
<div class="bg-white rounded-2xl shadow-2xl w-11/12 max-w-md relative mx-auto z-10 p-6">
|
||||
<h3 class="text-xl font-bold text-gray-900 mb-4">Update Status Unit</h3>
|
||||
<p class="text-sm text-gray-500 mb-1">Kode Unit: <strong id="su_code" class="text-gray-900"></strong></p>
|
||||
<p id="su_assigned_info" class="text-sm text-gray-500 mb-4 hidden">Dipegang Oleh: <strong id="su_assigned_name" class="text-gray-900"></strong></p>
|
||||
<form id="statusUnitForm" method="POST" class="space-y-4">
|
||||
{% csrf_token %}
|
||||
<div>
|
||||
<label class="block text-sm font-bold text-gray-700 mb-1">Status Baru</label>
|
||||
<select id="su_status" name="status" class="w-full px-4 py-2 rounded-lg border border-gray-200 text-sm focus:outline-none focus:border-kerinci focus:ring-1 focus:ring-kerinci bg-gray-50">
|
||||
<option value="tersedia" id="opt_su_tersedia">Tersedia</option>
|
||||
<option value="digunakan" id="opt_su_digunakan" class="hidden" disabled>Digunakan</option>
|
||||
<option value="rusak">Diperbaiki (Rusak / Maintenance)</option>
|
||||
</select>
|
||||
<p id="su_bast_warning" class="text-xs text-amber-600 mt-1 hidden font-bold">* Aset sedang digunakan. Pengembalian atau Mutasi harus melalui menu Distribusi Aset.</p>
|
||||
</div>
|
||||
|
||||
<div id="su_notes_container" class="hidden">
|
||||
<label class="block text-sm font-bold text-gray-700 mb-1">Catatan Kejadian <span class="text-red-500">*</span></label>
|
||||
<textarea id="su_notes" name="notes" rows="2" class="w-full px-4 py-2 rounded-lg border border-gray-200 text-sm focus:outline-none focus:border-kerinci focus:ring-1 focus:ring-kerinci bg-gray-50" placeholder="Jelaskan alasan perbaikan / keluhan kerusakan..."></textarea>
|
||||
</div>
|
||||
<div id="su_network_fields" class="hidden space-y-4 pt-4 border-t border-gray-100 mt-4">
|
||||
<p class="text-xs font-bold text-gray-500 uppercase">Detail Lokasi Pemasangan</p>
|
||||
<div>
|
||||
<label class="block text-sm font-bold text-gray-700 mb-1">Area <span class="text-red-500">*</span></label>
|
||||
<select id="su_area" name="area" class="w-full px-4 py-2 rounded-lg border border-gray-200 text-sm focus:outline-none focus:border-kerinci focus:ring-1 focus:ring-kerinci bg-gray-50">
|
||||
<option value="">-- Pilih Area --</option>
|
||||
<option value="Regulating Weir (RW)">Regulating Weir (RW)</option>
|
||||
<option value="Jakon">Jakon</option>
|
||||
<option value="Beringin Tunggal (BT)">Beringin Tunggal (BT)</option>
|
||||
<option value="DAM">DAM</option>
|
||||
<option value="Adit 1">Adit 1</option>
|
||||
<option value="Adit 2">Adit 2</option>
|
||||
<option value="Adit 3">Adit 3</option>
|
||||
<option value="Gudang Induk (GI)">Gudang Induk (GI)</option>
|
||||
<option value="Vertical Shaft (VS)">Vertical Shaft (VS)</option>
|
||||
<option value="Power House (PH)">Power House (PH)</option>
|
||||
<option value="Lain-lainnya">Lain-lainnya</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-bold text-gray-700 mb-1">Lokasi Spesifik <span class="text-red-500">*</span></label>
|
||||
<input type="text" id="su_location" name="location" class="w-full px-4 py-2 rounded-lg border border-gray-200 text-sm focus:outline-none focus:border-kerinci focus:ring-1 focus:ring-kerinci bg-gray-50" placeholder="Misal: Dinding server room barat...">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="mt-6 flex justify-end space-x-3 pt-4 border-t border-gray-100">
|
||||
<button type="button" onclick="closeStatusUnitModal()" class="px-4 py-2 border border-gray-300 text-gray-700 font-bold rounded-lg text-sm hover:bg-gray-50 transition-colors">Batal</button>
|
||||
<button type="submit" class="px-4 py-2 bg-kerinci text-white font-bold rounded-lg text-sm shadow-sm hover:bg-kerinci/90 transition-colors">
|
||||
Simpan Status
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// JS for status modal
|
||||
function openStatusModal(id, fullCode, status, assignedTo, categoryName, area, location) {
|
||||
document.getElementById('statusUnitForm').action = '/unit/' + id + '/status/';
|
||||
document.getElementById('su_code').innerText = fullCode;
|
||||
|
||||
const assignedInfo = document.getElementById('su_assigned_info');
|
||||
const assignedName = document.getElementById('su_assigned_name');
|
||||
if (assignedTo && assignedTo !== 'None' && assignedTo !== '' && assignedTo !== 'true') {
|
||||
assignedName.innerText = assignedTo;
|
||||
assignedInfo.classList.remove('hidden');
|
||||
} else {
|
||||
assignedInfo.classList.add('hidden');
|
||||
}
|
||||
|
||||
const statSelect = document.getElementById('su_status');
|
||||
const optTersedia = document.getElementById('opt_su_tersedia');
|
||||
const optDigunakan = document.getElementById('opt_su_digunakan');
|
||||
const warnText = document.getElementById('su_bast_warning');
|
||||
|
||||
const netFields = document.getElementById('su_network_fields');
|
||||
const areaInput = document.getElementById('su_area');
|
||||
const locInput = document.getElementById('su_location');
|
||||
|
||||
netFields.classList.add('hidden');
|
||||
areaInput.required = false;
|
||||
locInput.required = false;
|
||||
areaInput.value = area && area !== 'None' ? area : '';
|
||||
locInput.value = location && location !== 'None' ? location : '';
|
||||
|
||||
const isNetwork = categoryName && categoryName.includes('Network');
|
||||
|
||||
if (assignedTo && assignedTo !== 'None' && assignedTo !== '') {
|
||||
optDigunakan.disabled = false;
|
||||
optDigunakan.classList.remove('hidden');
|
||||
optTersedia.disabled = true;
|
||||
optTersedia.classList.add('hidden');
|
||||
warnText.classList.remove('hidden');
|
||||
let empName = assignedTo === 'true' ? 'karyawan' : assignedTo;
|
||||
warnText.innerHTML = '* Aset sedang digunakan oleh <strong class="font-extrabold underline">' + empName + '</strong>. Pengembalian harus melalui menu Distribusi Aset.';
|
||||
} else if (isNetwork) {
|
||||
optDigunakan.disabled = false;
|
||||
optDigunakan.classList.remove('hidden');
|
||||
optTersedia.disabled = false;
|
||||
optTersedia.classList.remove('hidden');
|
||||
warnText.classList.add('hidden');
|
||||
} else {
|
||||
optDigunakan.disabled = true;
|
||||
optDigunakan.classList.add('hidden');
|
||||
optTersedia.disabled = false;
|
||||
optTersedia.classList.remove('hidden');
|
||||
warnText.classList.add('hidden');
|
||||
}
|
||||
|
||||
statSelect.value = status;
|
||||
|
||||
statSelect.onchange = function() {
|
||||
const notesContainer = document.getElementById('su_notes_container');
|
||||
const notesInput = document.getElementById('su_notes');
|
||||
|
||||
if (this.value === 'rusak') {
|
||||
notesContainer.classList.remove('hidden');
|
||||
notesInput.required = true;
|
||||
} else {
|
||||
notesContainer.classList.add('hidden');
|
||||
notesInput.required = false;
|
||||
}
|
||||
|
||||
if ((this.value === 'digunakan' || this.value === 'rusak') && isNetwork) {
|
||||
netFields.classList.remove('hidden');
|
||||
areaInput.required = true;
|
||||
locInput.required = true;
|
||||
} else {
|
||||
netFields.classList.add('hidden');
|
||||
areaInput.required = false;
|
||||
locInput.required = false;
|
||||
}
|
||||
};
|
||||
|
||||
statSelect.onchange();
|
||||
document.getElementById('statusUnitModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
function closeStatusUnitModal() {
|
||||
document.getElementById('statusUnitModal').classList.add('hidden');
|
||||
}
|
||||
|
||||
// AJAX Search
|
||||
let searchTimeout;
|
||||
const searchInput = document.getElementById('searchInput');
|
||||
if (searchInput) {
|
||||
const val = searchInput.value;
|
||||
if (val) {
|
||||
searchInput.focus();
|
||||
searchInput.value = '';
|
||||
searchInput.value = val;
|
||||
}
|
||||
|
||||
searchInput.addEventListener('input', function() {
|
||||
clearTimeout(searchTimeout);
|
||||
searchTimeout = setTimeout(() => {
|
||||
const url = new URL(window.location.href);
|
||||
url.searchParams.set('q', searchInput.value);
|
||||
|
||||
// Update Export PDF Button URL
|
||||
const exportBtn = document.getElementById('exportPdfBtn');
|
||||
if (exportBtn) {
|
||||
const exportUrl = new URL(exportBtn.href);
|
||||
if (searchInput.value) {
|
||||
exportUrl.searchParams.set('q', searchInput.value);
|
||||
} else {
|
||||
exportUrl.searchParams.delete('q');
|
||||
}
|
||||
exportBtn.href = exportUrl.toString();
|
||||
}
|
||||
|
||||
const tableContainer = document.getElementById('tableContainer');
|
||||
tableContainer.style.opacity = '0.5';
|
||||
tableContainer.style.transition = 'opacity 0.2s';
|
||||
|
||||
fetch(url)
|
||||
.then(response => response.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(html, 'text/html');
|
||||
const newTableContainer = doc.getElementById('tableContainer');
|
||||
|
||||
if (newTableContainer) {
|
||||
tableContainer.innerHTML = newTableContainer.innerHTML;
|
||||
}
|
||||
|
||||
tableContainer.style.opacity = '1';
|
||||
window.history.pushState({}, '', url);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching search results:', error);
|
||||
tableContainer.style.opacity = '1';
|
||||
});
|
||||
}, 300);
|
||||
});
|
||||
|
||||
document.getElementById('searchForm').addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block page_title_guide %}Manajemen Status Aset{% endblock %}
|
||||
|
||||
{% block page_guide_content %}
|
||||
<div class="space-y-4">
|
||||
<p>Halaman <strong>Status Aset</strong> memungkinkan Anda untuk memantau kondisi fisik secara *real-time* dari setiap unit individu. Di halaman ini Anda dapat:</p>
|
||||
|
||||
<div class="space-y-3">
|
||||
<div class="flex items-start space-x-3 bg-gray-50 p-4 rounded-xl border border-gray-100">
|
||||
<div class="mt-0.5 text-kerinci bg-kerinci-light rounded p-1 shrink-0">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
||||
</div>
|
||||
<div>
|
||||
<h4 class="font-bold text-gray-900 mb-1">Filter Kategori & Kondisi</h4>
|
||||
<p>Gunakan tab untuk melihat barang yang <strong>Tersedia</strong> (gudang), <strong>Digunakan</strong> (dipegang karyawan/dipasang), atau dalam masa <strong>Maintenance</strong> (rusak). Anda juga bisa memisahkan khusus Aset Karyawan dan Network.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-start space-x-3 bg-gray-50 p-4 rounded-xl border border-gray-100">
|
||||
<div class="mt-0.5 text-blue-500 bg-blue-50 rounded p-1 shrink-0">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"></path></svg>
|
||||
</div>
|
||||
<div>
|
||||
<h4 class="font-bold text-gray-900 mb-1">Mengubah Status secara Manual (Penting)</h4>
|
||||
<p>Klik langsung pada <strong>Label/Badge Status</strong> (contoh: label "Tersedia" warna hijau) di dalam tabel untuk membuka pop-up. Dari sana Anda bisa mengubah status barang tersebut secara manual menjadi *Maintenance* atau lainnya jika ada kerusakan fisik.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-start space-x-3 bg-gray-50 p-4 rounded-xl border border-gray-100">
|
||||
<div class="mt-0.5 text-indigo-500 bg-indigo-50 rounded p-1 shrink-0">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
||||
</div>
|
||||
<div>
|
||||
<h4 class="font-bold text-gray-900 mb-1">Riwayat Unit & Ekspor</h4>
|
||||
<p>Sama seperti halaman lain, klik ikon <strong>Jam / Waktu</strong> untuk melacak rekam jejak historis unit tersebut, serta gunakan tombol <strong>Ekspor PDF</strong> untuk mencetak daftar aset berdasarkan filter status yang sedang Anda lihat.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
<script>
|
||||
document.addEventListener('click', function() {
|
||||
var menu = document.getElementById('exportMenuStatus');
|
||||
if (menu) menu.style.display = 'none';
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user