686 lines
42 KiB
HTML
686 lines
42 KiB
HTML
{% extends 'base.html' %}
|
|||
|
|
|
||
|
|
{% block page_title %}Daftar Aset
|
||
|
|
{% endblock %}
|
||
|
|
|
||
|
|
{% block content %}
|
||
|
|
<div class="mb-8 flex flex-col sm:flex-row sm:justify-between sm:items-center space-y-4 sm:space-y-0">
|
||
|
|
<div>
|
||
|
|
<p class="text-xs font-bold text-kerinci uppercase tracking-widest mb-1">Manajemen Aset</p>
|
||
|
|
<div class="flex items-center space-x-3">
|
||
|
|
<h2 class="text-3xl font-extrabold text-gray-900">Daftar 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('exportMenuAsset'); 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 Aset</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="exportMenuAsset" 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 'asset_export_pdf' %}?tab={{ active_tab }}" 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 'asset_export_excel' %}?tab={{ active_tab }}" 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>
|
||
|
|
{% if not is_read_only %}
|
||
|
|
<button onclick="openAddAssetModal()" class="bg-kerinci text-white border border-kerinci rounded-xl shadow-sm px-4 py-2 text-sm font-bold hover:bg-kerinci/90 transition-colors flex items-center space-x-2 justify-center w-full sm:w-auto flex-1 sm:flex-none">
|
||
|
|
<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 4v16m8-8H4"></path></svg>
|
||
|
|
<span>Tambah Aset</span>
|
||
|
|
</button>
|
||
|
|
{% endif %}
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Category Tabs -->
|
||
|
|
<div class="flex space-x-2 mb-6 border-b border-gray-200 overflow-x-auto whitespace-nowrap scrollbar-hide">
|
||
|
|
<a href="?tab=karyawan" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if active_tab == 'karyawan' %}border-kerinci text-kerinci{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||
|
|
Aset Karyawan
|
||
|
|
<span class="ml-2 {% if active_tab == 'karyawan' %}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.karyawan|default:"0" }}</span>
|
||
|
|
</a>
|
||
|
|
<a href="?tab=network" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if active_tab == 'network' %}border-kerinci text-kerinci{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||
|
|
Aset Network & Infrastruktur
|
||
|
|
<span class="ml-2 {% if active_tab == 'network' %}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.network|default:"0" }}</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="mb-4">
|
||
|
|
<form id="searchForm" method="GET" class="relative w-full sm:w-96">
|
||
|
|
<input type="hidden" name="tab" value="{{ active_tab }}">
|
||
|
|
<input type="text" id="searchInput" name="q" value="{{ search_query }}" placeholder="Cari kode, nama aset, atau merek..." 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>
|
||
|
|
|
||
|
|
<div class="bg-white rounded-none sm:rounded-2xl shadow-sm border border-gray-100 overflow-hidden" 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 w-32">Kode Aset</th>
|
||
|
|
<th class="p-4 font-bold min-w-[250px]">Nama Aset</th>
|
||
|
|
<th class="p-4 font-bold">Merek</th>
|
||
|
|
<th class="p-4 font-bold text-center">Jumlah (Qty)</th>
|
||
|
|
{% if active_tab == 'karyawan' %}
|
||
|
|
<th class="p-4 font-bold text-center">Ketersediaan</th>
|
||
|
|
{% endif %}
|
||
|
|
<th class="p-4 font-bold text-center w-24">Aksi</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody class="text-sm divide-y divide-gray-200">
|
||
|
|
{% for asset in assets %}
|
||
|
|
<tr class="hover:bg-gray-50 transition-colors cursor-pointer group" onclick="openAssetModal(this)"
|
||
|
|
data-id="{{ asset.id }}"
|
||
|
|
data-code="{{ asset.asset_code }}"
|
||
|
|
data-name="{{ asset.name }}"
|
||
|
|
data-brand="{{ asset.brand|default:'' }}"
|
||
|
|
data-cat="{{ asset.category.name }}"
|
||
|
|
data-cat-id="{{ asset.category.id }}"
|
||
|
|
data-qty="{{ asset.qty }}"
|
||
|
|
data-uom="{{ asset.uom }}"
|
||
|
|
data-price="{{ asset.price }}"
|
||
|
|
data-total="{{ asset.total_price }}"
|
||
|
|
data-tersedia="{{ asset.unit_tersedia }}"
|
||
|
|
data-digunakan="{{ asset.unit_digunakan }}">
|
||
|
|
<td class="p-4 text-center text-gray-500">{{ forloop.counter }}</td>
|
||
|
|
<td class="p-4 font-bold text-gray-600">{{ asset.asset_code }}</td>
|
||
|
|
<td class="p-4">
|
||
|
|
<p class="font-bold text-gray-800">{{ asset.name }}</p>
|
||
|
|
</td>
|
||
|
|
<td class="p-4 text-gray-600 font-medium">{{ asset.brand|default:"-" }}</td>
|
||
|
|
<td class="p-4 text-center">
|
||
|
|
<a href="/aset/{{ asset.id }}/units/" onclick="event.stopPropagation();" class="inline-flex items-center justify-center space-x-1 px-4 py-1.5 bg-emerald-50 text-emerald-600 font-bold rounded-full text-sm border border-emerald-100 hover:bg-emerald-100 transition-colors">
|
||
|
|
<span>{{ asset.qty }} {{ asset.uom|default:"Unit" }}</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="M9 5l7 7-7 7"></path></svg>
|
||
|
|
</a>
|
||
|
|
</td>
|
||
|
|
{% if active_tab == 'karyawan' %}
|
||
|
|
<td class="p-4 text-center">
|
||
|
|
<span class="font-extrabold text-emerald-600">{{ asset.unit_tersedia }}</span>
|
||
|
|
<span class="text-gray-300 mx-1">/</span>
|
||
|
|
<span class="font-bold text-blue-600">{{ asset.unit_digunakan }}</span>
|
||
|
|
</td>
|
||
|
|
{% endif %}
|
||
|
|
<td class="p-4 text-center">
|
||
|
|
<button onclick="editAssetDirectly(event, this.closest('tr'))" class="p-2 bg-amber-50 text-amber-600 hover:bg-amber-100 rounded-lg transition-colors border border-amber-100" title="Edit Aset">
|
||
|
|
<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="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path></svg>
|
||
|
|
</button>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
{% empty %}
|
||
|
|
<tr>
|
||
|
|
<td colspan="8" class="p-8 text-center text-gray-400 text-sm">
|
||
|
|
Belum ada data aset untuk kategori ini.
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
{% endfor %}
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
{% include 'components/pagination.html' %}
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Modal Detail Aset -->
|
||
|
|
<div id="assetModal" class="fixed inset-0 z-50 hidden flex items-center justify-center">
|
||
|
|
<div class="absolute inset-0 bg-gray-900/40 backdrop-blur-sm transition-opacity opacity-0" id="modalOverlay" onclick="closeModal()"></div>
|
||
|
|
|
||
|
|
<div class="bg-white rounded-2xl shadow-2xl w-[90%] mx-auto max-h-[90vh] overflow-y-auto max-w-lg relative z-10 p-6 transform transition-all scale-95 opacity-0" id="modalCard">
|
||
|
|
<!-- Header -->
|
||
|
|
<div class="flex justify-between items-start mb-5">
|
||
|
|
<div>
|
||
|
|
<p class="text-[10px] font-extrabold text-kerinci uppercase tracking-widest mb-1" id="m-cat"></p>
|
||
|
|
<h3 class="text-2xl font-extrabold text-gray-900 leading-tight" id="m-name"></h3>
|
||
|
|
<p class="text-sm font-medium text-gray-500 mt-1">Kode Induk: <span id="m-code" class="text-gray-900 font-bold"></span></p>
|
||
|
|
<p class="text-sm font-medium text-gray-500">Merek: <span id="m-brand" class="text-gray-900 font-bold"></span></p>
|
||
|
|
</div>
|
||
|
|
<button onclick="closeModal()" class="text-gray-400 hover:bg-gray-100 p-2 rounded-lg transition-colors">
|
||
|
|
<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="M6 18L18 6M6 6l12 12"></path></svg>
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Body -->
|
||
|
|
<div class="space-y-4">
|
||
|
|
<div class="grid grid-cols-2 gap-4 bg-gray-50 p-4 rounded-xl border border-gray-100">
|
||
|
|
{% if active_tab == 'karyawan' %}
|
||
|
|
<div class="col-span-2">
|
||
|
|
<p class="text-xs text-gray-500 uppercase tracking-wider font-bold mb-1">Ketersediaan Unit</p>
|
||
|
|
<div class="flex items-center space-x-1 mt-1 text-sm">
|
||
|
|
<span class="text-emerald-600 font-extrabold" id="m-tersedia"></span>
|
||
|
|
<span class="text-gray-400 text-xs mr-2">tersedia</span>
|
||
|
|
<span class="text-gray-300">|</span>
|
||
|
|
<span class="text-blue-600 font-extrabold ml-2" id="m-digunakan"></span>
|
||
|
|
<span class="text-gray-400 text-xs">digunakan</span>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
{% endif %}
|
||
|
|
<div>
|
||
|
|
<p class="text-xs text-gray-500 uppercase tracking-wider font-bold mb-1">Total Kuantitas</p>
|
||
|
|
<p class="font-medium text-sm text-gray-900"><span id="m-qty"></span> <span id="m-uom"></span></p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a href="#" id="m-btn-units" class="w-full flex items-center justify-center space-x-2 bg-indigo-50 text-indigo-600 font-bold py-3 rounded-xl hover:bg-indigo-100 transition-colors">
|
||
|
|
<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="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"></path></svg>
|
||
|
|
<span>Lihat Unit Aset</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Footer Actions -->
|
||
|
|
<div class="mt-6 flex justify-end space-x-3 pt-4 border-t border-gray-100">
|
||
|
|
<button id="m-btn-edit" onclick="openEditModalFromCurrent()" class="px-5 py-2.5 bg-amber-50 text-amber-600 font-bold rounded-xl text-sm hover:bg-amber-100 transition-colors flex items-center space-x-2">
|
||
|
|
<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="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path></svg>
|
||
|
|
<span>Edit Data</span>
|
||
|
|
</button>
|
||
|
|
<button id="m-btn-delete" class="hidden px-5 py-2.5 bg-red-50 text-red-600 font-bold rounded-xl text-sm hover:bg-red-100 transition-colors flex items-center space-x-2">
|
||
|
|
<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 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path></svg>
|
||
|
|
<span>Hapus</span>
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Modal Konfirmasi Hapus -->
|
||
|
|
<div id="deleteConfirmModal" class="fixed inset-0 z-50 hidden flex items-center justify-center">
|
||
|
|
<div class="absolute inset-0 bg-gray-900/40 backdrop-blur-sm transition-opacity opacity-0" id="deleteOverlay" onclick="closeDeleteModal()"></div>
|
||
|
|
|
||
|
|
<div class="bg-white rounded-2xl shadow-2xl w-[90%] mx-auto max-h-[90vh] overflow-y-auto max-w-lg relative z-10 p-8 transform transition-all scale-95 opacity-0 text-center" id="deleteCard">
|
||
|
|
<div class="w-20 h-20 bg-red-50 border-[6px] border-red-100 text-red-500 rounded-full flex items-center justify-center mx-auto mb-6">
|
||
|
|
<svg class="w-10 h-10" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h3 class="text-2xl font-extrabold text-gray-900 mb-2">Hapus "<span id="d-code"></span>"?</h3>
|
||
|
|
<p class="text-gray-500 mb-8 max-w-md mx-auto">Apakah Anda yakin ingin menghapus aset <strong id="d-name"></strong> secara permanen? Aksi ini tidak dapat dibatalkan dan semua data historis terkait aset ini akan ikut terpengaruh.</p>
|
||
|
|
|
||
|
|
<form id="deleteForm" method="POST" class="flex justify-center space-x-4">
|
||
|
|
{% csrf_token %}
|
||
|
|
<button type="button" onclick="closeDeleteModal()" class="px-8 py-3.5 border border-gray-300 text-gray-700 font-bold rounded-xl text-sm hover:bg-gray-50 transition-colors">Batal, Kembali</button>
|
||
|
|
<button type="submit" class="px-8 py-3.5 bg-red-500 text-white font-bold rounded-xl text-sm shadow-sm shadow-red-500/30 hover:bg-red-600 transition-colors">Ya, Hapus Permanen</button>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
function editAssetDirectly(event, row) {
|
||
|
|
event.stopPropagation(); // Mencegah modal detail terbuka
|
||
|
|
window.currentAssetData = {
|
||
|
|
id: row.getAttribute('data-id'),
|
||
|
|
code: row.getAttribute('data-code'),
|
||
|
|
name: row.getAttribute('data-name'),
|
||
|
|
brand: row.getAttribute('data-brand'),
|
||
|
|
cat_id: row.getAttribute('data-cat-id'),
|
||
|
|
uom: row.getAttribute('data-uom')
|
||
|
|
};
|
||
|
|
openEditModalFromCurrent();
|
||
|
|
}
|
||
|
|
|
||
|
|
function openAssetModal(row) {
|
||
|
|
// Set Data
|
||
|
|
document.getElementById('m-cat').innerText = row.getAttribute('data-cat');
|
||
|
|
document.getElementById('m-name').innerText = row.getAttribute('data-name');
|
||
|
|
document.getElementById('m-code').innerText = row.getAttribute('data-code');
|
||
|
|
document.getElementById('m-brand').innerText = row.getAttribute('data-brand') || '-';
|
||
|
|
document.getElementById('m-qty').innerText = row.getAttribute('data-qty');
|
||
|
|
document.getElementById('m-uom').innerText = row.getAttribute('data-uom');
|
||
|
|
|
||
|
|
const elTersedia = document.getElementById('m-tersedia');
|
||
|
|
if (elTersedia) {
|
||
|
|
elTersedia.innerText = row.getAttribute('data-tersedia');
|
||
|
|
document.getElementById('m-digunakan').innerText = row.getAttribute('data-digunakan');
|
||
|
|
}
|
||
|
|
|
||
|
|
// Set Links
|
||
|
|
const id = row.getAttribute('data-id');
|
||
|
|
window.currentAssetData = {
|
||
|
|
id: id,
|
||
|
|
code: row.getAttribute('data-code'),
|
||
|
|
name: row.getAttribute('data-name'),
|
||
|
|
brand: row.getAttribute('data-brand'),
|
||
|
|
cat_id: row.getAttribute('data-cat-id'),
|
||
|
|
uom: row.getAttribute('data-uom')
|
||
|
|
};
|
||
|
|
// document.getElementById('m-btn-edit').href is no longer needed since it's a button calling openEditModalFromCurrent()
|
||
|
|
document.getElementById('m-btn-units').href = '/aset/' + id + '/units/';
|
||
|
|
|
||
|
|
// Hook up delete button to open second modal or block if has units
|
||
|
|
const btnDelete = document.getElementById('m-btn-delete');
|
||
|
|
const qty = parseInt(row.getAttribute('data-qty') || '0');
|
||
|
|
|
||
|
|
if (qty > 0) {
|
||
|
|
btnDelete.className = 'hidden px-5 py-2.5 bg-gray-100 text-gray-400 font-bold rounded-xl text-sm cursor-not-allowed flex items-center space-x-2';
|
||
|
|
btnDelete.title = 'Aset tidak dapat dihapus karena masih memiliki ' + qty + ' unit fisik terdaftar.';
|
||
|
|
btnDelete.onclick = function(e) {
|
||
|
|
e.preventDefault();
|
||
|
|
alert('Peringatan: Aset tidak dapat dihapus karena masih memiliki ' + qty + ' unit fisik di dalamnya.\n\nSilakan hapus semua unit fisik aset ini terlebih dahulu dari menu "Lihat Unit Aset".');
|
||
|
|
};
|
||
|
|
} else {
|
||
|
|
btnDelete.className = 'hidden px-5 py-2.5 bg-red-50 text-red-600 font-bold rounded-xl text-sm hover:bg-red-100 transition-colors flex items-center space-x-2';
|
||
|
|
btnDelete.title = '';
|
||
|
|
btnDelete.onclick = function(e) {
|
||
|
|
e.preventDefault();
|
||
|
|
openDeleteModal(id, row.getAttribute('data-code'), row.getAttribute('data-name'));
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
// Show Modal
|
||
|
|
const modal = document.getElementById('assetModal');
|
||
|
|
const overlay = document.getElementById('modalOverlay');
|
||
|
|
const card = document.getElementById('modalCard');
|
||
|
|
|
||
|
|
modal.classList.remove('hidden');
|
||
|
|
setTimeout(() => {
|
||
|
|
overlay.classList.remove('opacity-0');
|
||
|
|
overlay.classList.add('opacity-100');
|
||
|
|
card.classList.remove('scale-95', 'opacity-0');
|
||
|
|
card.classList.add('scale-100', 'opacity-100');
|
||
|
|
}, 10);
|
||
|
|
}
|
||
|
|
|
||
|
|
function closeModal() {
|
||
|
|
const modal = document.getElementById('assetModal');
|
||
|
|
const overlay = document.getElementById('modalOverlay');
|
||
|
|
const card = document.getElementById('modalCard');
|
||
|
|
|
||
|
|
overlay.classList.remove('opacity-100');
|
||
|
|
overlay.classList.add('opacity-0');
|
||
|
|
card.classList.remove('scale-100', 'opacity-100');
|
||
|
|
card.classList.add('scale-95', 'opacity-0');
|
||
|
|
|
||
|
|
setTimeout(() => {
|
||
|
|
modal.classList.add('hidden');
|
||
|
|
}, 300);
|
||
|
|
}
|
||
|
|
|
||
|
|
function openDeleteModal(id, code, name) {
|
||
|
|
closeModal(); // Hide the first modal
|
||
|
|
|
||
|
|
document.getElementById('d-code').innerText = code;
|
||
|
|
document.getElementById('d-name').innerText = name;
|
||
|
|
document.getElementById('deleteForm').action = '/aset/' + id + '/delete/';
|
||
|
|
|
||
|
|
const modal = document.getElementById('deleteConfirmModal');
|
||
|
|
const overlay = document.getElementById('deleteOverlay');
|
||
|
|
const card = document.getElementById('deleteCard');
|
||
|
|
|
||
|
|
modal.classList.remove('hidden');
|
||
|
|
setTimeout(() => {
|
||
|
|
overlay.classList.remove('opacity-0');
|
||
|
|
overlay.classList.add('opacity-100');
|
||
|
|
card.classList.remove('scale-95', 'opacity-0');
|
||
|
|
card.classList.add('scale-100', 'opacity-100');
|
||
|
|
}, 10); // Start animation slightly after rendering
|
||
|
|
}
|
||
|
|
|
||
|
|
function closeDeleteModal() {
|
||
|
|
const modal = document.getElementById('deleteConfirmModal');
|
||
|
|
const overlay = document.getElementById('deleteOverlay');
|
||
|
|
const card = document.getElementById('deleteCard');
|
||
|
|
|
||
|
|
overlay.classList.remove('opacity-100');
|
||
|
|
overlay.classList.add('opacity-0');
|
||
|
|
card.classList.remove('scale-100', 'opacity-100');
|
||
|
|
card.classList.add('scale-95', 'opacity-0');
|
||
|
|
|
||
|
|
setTimeout(() => {
|
||
|
|
modal.classList.add('hidden');
|
||
|
|
}, 300);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Auto-search menggunakan AJAX agar halaman tidak ter-reload penuh
|
||
|
|
let searchTimeout = null;
|
||
|
|
const searchInput = document.getElementById('searchInput');
|
||
|
|
if (searchInput) {
|
||
|
|
// Memindahkan cursor ke akhir teks jika ada value awal
|
||
|
|
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);
|
||
|
|
|
||
|
|
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 newContainer = doc.getElementById('tableContainer');
|
||
|
|
if (newContainer) {
|
||
|
|
tableContainer.innerHTML = newContainer.innerHTML;
|
||
|
|
}
|
||
|
|
tableContainer.style.opacity = '1';
|
||
|
|
// Update URL tanpa reload
|
||
|
|
window.history.pushState({}, '', url);
|
||
|
|
})
|
||
|
|
.catch(error => {
|
||
|
|
console.error('Error during search fetch:', error);
|
||
|
|
tableContainer.style.opacity = '1';
|
||
|
|
});
|
||
|
|
}, 300); // 300ms delay lebih responsif untuk AJAX
|
||
|
|
});
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<!-- Modal Tambah Aset -->
|
||
|
|
<div id="addAssetModal" class="fixed inset-0 z-[60] hidden flex items-center justify-center overflow-y-auto">
|
||
|
|
<div class="fixed inset-0 bg-gray-900/40 backdrop-blur-sm" onclick="closeAddAssetModal()"></div>
|
||
|
|
<div class="bg-white rounded-2xl shadow-2xl w-11/12 max-w-2xl relative mx-auto z-10 my-8">
|
||
|
|
<div class="p-6 border-b border-gray-100 flex justify-between items-center">
|
||
|
|
<h3 class="text-xl font-bold text-gray-900">Tambah Aset Baru</h3>
|
||
|
|
<button onclick="closeAddAssetModal()" class="text-gray-400 hover:text-gray-600 transition-colors">
|
||
|
|
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
<form id="addAssetForm" action="{% url 'asset_add' %}" method="POST" class="p-6 space-y-6" onsubmit="submitAddAsset(event)">
|
||
|
|
{% csrf_token %}
|
||
|
|
|
||
|
|
<div id="addAssetError" class="hidden bg-red-50 border border-red-200 text-red-600 px-4 py-3 rounded-xl text-sm font-bold flex items-center space-x-2">
|
||
|
|
<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 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg>
|
||
|
|
<span id="addAssetErrorText"></span>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">Kategori Aset <span class="text-red-500">*</span></label>
|
||
|
|
<select name="category" required class="w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci focus:ring-2 focus:ring-kerinci-light bg-gray-50">
|
||
|
|
<option value="">-- Pilih Kategori --</option>
|
||
|
|
{% for cat in categories %}
|
||
|
|
<option value="{{ cat.id }}">{{ cat.name }}</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">Kode Aset <span class="text-red-500">*</span></label>
|
||
|
|
<input type="text" id="addAssetCode" name="asset_code" required placeholder="Misal: DLL, LNV" class="w-full px-4 py-3 rounded-xl border border-gray-200 text-sm text-gray-900 focus:outline-none focus:border-kerinci focus:ring-2 focus:ring-kerinci-light bg-white uppercase">
|
||
|
|
<p class="text-xs text-gray-500 mt-1">* Kode aset tidak boleh sama dengan kode aset yang lain.</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">Nama Aset <span class="text-red-500">*</span></label>
|
||
|
|
<input type="text" name="name" placeholder="Misal: Laptop Lenovo ThinkPad" required class="w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci focus:ring-2 focus:ring-kerinci-light bg-gray-50">
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">Merek (Brand) <span class="text-red-500">*</span></label>
|
||
|
|
<input type="text" name="brand" required placeholder="Misal: Lenovo, Dell" class="w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci focus:ring-2 focus:ring-kerinci-light bg-gray-50">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">Satuan (UoM) <span class="text-red-500">*</span></label>
|
||
|
|
<input type="text" name="uom" required placeholder="Unit, Pcs, Roll..." class="w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci focus:ring-2 focus:ring-kerinci-light bg-gray-50">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="pt-4 border-t border-gray-100 flex justify-end space-x-3">
|
||
|
|
<button type="button" onclick="closeAddAssetModal()" class="px-6 py-3 border border-gray-300 text-gray-700 font-bold rounded-xl text-sm hover:bg-gray-50 transition-colors">Batal</button>
|
||
|
|
<button type="submit" class="px-6 py-3 bg-kerinci text-white font-bold rounded-xl text-sm shadow-sm shadow-kerinci/30 hover:bg-kerinci/90 transition-colors flex items-center justify-center">
|
||
|
|
<span>Simpan Aset Baru</span>
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
function openAddAssetModal() {
|
||
|
|
document.getElementById('addAssetModal').classList.remove('hidden');
|
||
|
|
document.body.style.overflow = 'hidden';
|
||
|
|
}
|
||
|
|
|
||
|
|
function closeAddAssetModal() {
|
||
|
|
document.getElementById('addAssetModal').classList.add('hidden');
|
||
|
|
document.body.style.overflow = '';
|
||
|
|
document.getElementById('addAssetForm').reset();
|
||
|
|
document.getElementById('addAssetError').classList.add('hidden');
|
||
|
|
document.getElementById('addAssetCode').classList.remove('border-red-300', 'ring-1', 'ring-red-300');
|
||
|
|
}
|
||
|
|
|
||
|
|
async function submitAddAsset(event) {
|
||
|
|
event.preventDefault();
|
||
|
|
const form = event.target;
|
||
|
|
const formData = new FormData(form);
|
||
|
|
const submitBtn = form.querySelector('button[type="submit"]');
|
||
|
|
|
||
|
|
submitBtn.disabled = true;
|
||
|
|
const originalText = submitBtn.innerHTML;
|
||
|
|
submitBtn.innerHTML = '<svg class="animate-spin h-5 w-5 mr-3 text-white" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" fill="none"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> Menyimpan...';
|
||
|
|
|
||
|
|
try {
|
||
|
|
const response = await fetch(form.action, {
|
||
|
|
method: 'POST',
|
||
|
|
body: formData,
|
||
|
|
headers: {
|
||
|
|
'X-Requested-With': 'XMLHttpRequest'
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
const data = await response.json();
|
||
|
|
|
||
|
|
if (data.success) {
|
||
|
|
window.location.reload();
|
||
|
|
} else {
|
||
|
|
const errorDiv = document.getElementById('addAssetError');
|
||
|
|
const errorText = document.getElementById('addAssetErrorText');
|
||
|
|
const inputField = document.getElementById('addAssetCode');
|
||
|
|
|
||
|
|
errorText.textContent = data.error;
|
||
|
|
errorDiv.classList.remove('hidden');
|
||
|
|
|
||
|
|
inputField.classList.add('border-red-300', 'ring-1', 'ring-red-300');
|
||
|
|
|
||
|
|
submitBtn.disabled = false;
|
||
|
|
submitBtn.innerHTML = originalText;
|
||
|
|
}
|
||
|
|
} catch (error) {
|
||
|
|
console.error('Error:', error);
|
||
|
|
submitBtn.disabled = false;
|
||
|
|
submitBtn.innerHTML = originalText;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<!-- Modal Edit Aset -->
|
||
|
|
<div id="editAssetModal" class="fixed inset-0 z-[60] hidden flex items-center justify-center overflow-y-auto">
|
||
|
|
<div class="fixed inset-0 bg-gray-900/40 backdrop-blur-sm" onclick="closeEditAssetModal()"></div>
|
||
|
|
<div class="bg-white rounded-2xl shadow-2xl w-11/12 max-w-2xl relative mx-auto z-10 my-8">
|
||
|
|
<div class="p-6 border-b border-gray-100 flex justify-between items-center">
|
||
|
|
<h3 class="text-xl font-bold text-gray-900">Edit Aset: <span id="editAssetTitle" class="text-kerinci"></span></h3>
|
||
|
|
<button onclick="closeEditAssetModal()" class="text-gray-400 hover:text-gray-600 transition-colors">
|
||
|
|
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
<form id="editAssetForm" method="POST" class="p-6 space-y-6" onsubmit="submitEditAsset(event)">
|
||
|
|
{% csrf_token %}
|
||
|
|
|
||
|
|
<div id="editAssetError" class="hidden bg-red-50 border border-red-200 text-red-600 px-4 py-3 rounded-xl text-sm font-bold flex items-center space-x-2">
|
||
|
|
<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 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg>
|
||
|
|
<span id="editAssetErrorText"></span>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">Kategori Aset <span class="text-red-500">*</span></label>
|
||
|
|
<select id="editAssetCat" name="category" required class="w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci focus:ring-2 focus:ring-kerinci-light bg-gray-50">
|
||
|
|
<option value="">-- Pilih Kategori --</option>
|
||
|
|
{% for cat in categories %}
|
||
|
|
<option value="{{ cat.id }}">{{ cat.name }}</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">Kode Aset <span class="text-red-500">*</span></label>
|
||
|
|
<input type="text" id="editAssetCode" name="asset_code" required class="w-full px-4 py-3 rounded-xl border border-gray-200 text-sm text-gray-900 focus:outline-none focus:border-kerinci focus:ring-2 focus:ring-kerinci-light bg-white uppercase">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">Nama Aset <span class="text-red-500">*</span></label>
|
||
|
|
<input type="text" id="editAssetName" name="name" required class="w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci focus:ring-2 focus:ring-kerinci-light bg-gray-50">
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">Merek (Brand) <span class="text-red-500">*</span></label>
|
||
|
|
<input type="text" id="editAssetBrand" name="brand" required class="w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci focus:ring-2 focus:ring-kerinci-light bg-gray-50">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">Satuan (UoM) <span class="text-red-500">*</span></label>
|
||
|
|
<input type="text" id="editAssetUom" name="uom" required class="w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci focus:ring-2 focus:ring-kerinci-light bg-gray-50">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="pt-4 border-t border-gray-100 flex justify-end space-x-3">
|
||
|
|
<button type="button" onclick="closeEditAssetModal()" class="px-6 py-3 border border-gray-300 text-gray-700 font-bold rounded-xl text-sm hover:bg-gray-50 transition-colors">Batal</button>
|
||
|
|
<button type="submit" class="px-6 py-3 bg-amber-500 text-white font-bold rounded-xl text-sm shadow-sm shadow-amber-500/30 hover:bg-amber-600 transition-colors flex items-center justify-center">
|
||
|
|
<span>Simpan Perubahan</span>
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
function openEditModalFromCurrent() {
|
||
|
|
closeModal(); // close the info modal first
|
||
|
|
if(!window.currentAssetData) return;
|
||
|
|
|
||
|
|
const data = window.currentAssetData;
|
||
|
|
|
||
|
|
document.getElementById('editAssetTitle').innerText = data.code;
|
||
|
|
document.getElementById('editAssetCat').value = data.cat_id;
|
||
|
|
document.getElementById('editAssetCode').value = data.code;
|
||
|
|
document.getElementById('editAssetName').value = data.name;
|
||
|
|
document.getElementById('editAssetBrand').value = data.brand;
|
||
|
|
document.getElementById('editAssetUom').value = data.uom;
|
||
|
|
|
||
|
|
document.getElementById('editAssetForm').action = '/aset/' + data.id + '/edit/';
|
||
|
|
|
||
|
|
document.getElementById('editAssetModal').classList.remove('hidden');
|
||
|
|
document.body.style.overflow = 'hidden';
|
||
|
|
}
|
||
|
|
|
||
|
|
function closeEditAssetModal() {
|
||
|
|
document.getElementById('editAssetModal').classList.add('hidden');
|
||
|
|
document.body.style.overflow = '';
|
||
|
|
document.getElementById('editAssetError').classList.add('hidden');
|
||
|
|
document.getElementById('editAssetCode').classList.remove('border-red-300', 'ring-1', 'ring-red-300');
|
||
|
|
}
|
||
|
|
|
||
|
|
async function submitEditAsset(event) {
|
||
|
|
event.preventDefault();
|
||
|
|
const form = event.target;
|
||
|
|
const formData = new FormData(form);
|
||
|
|
const submitBtn = form.querySelector('button[type="submit"]');
|
||
|
|
|
||
|
|
submitBtn.disabled = true;
|
||
|
|
const originalText = submitBtn.innerHTML;
|
||
|
|
submitBtn.innerHTML = '<svg class="animate-spin h-5 w-5 mr-3 text-white" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" fill="none"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> Menyimpan...';
|
||
|
|
|
||
|
|
try {
|
||
|
|
const response = await fetch(form.action, {
|
||
|
|
method: 'POST',
|
||
|
|
body: formData,
|
||
|
|
headers: {
|
||
|
|
'X-Requested-With': 'XMLHttpRequest'
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
const data = await response.json();
|
||
|
|
|
||
|
|
if (data.success) {
|
||
|
|
window.location.reload();
|
||
|
|
} else {
|
||
|
|
const errorDiv = document.getElementById('editAssetError');
|
||
|
|
const errorText = document.getElementById('editAssetErrorText');
|
||
|
|
const inputField = document.getElementById('editAssetCode');
|
||
|
|
|
||
|
|
errorText.textContent = data.error;
|
||
|
|
errorDiv.classList.remove('hidden');
|
||
|
|
|
||
|
|
inputField.classList.add('border-red-300', 'ring-1', 'ring-red-300');
|
||
|
|
|
||
|
|
submitBtn.disabled = false;
|
||
|
|
submitBtn.innerHTML = originalText;
|
||
|
|
}
|
||
|
|
} catch (error) {
|
||
|
|
console.error('Error:', error);
|
||
|
|
submitBtn.disabled = false;
|
||
|
|
submitBtn.innerHTML = originalText;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
{% endblock %}
|
||
|
|
|
||
|
|
{% block page_title_guide %}Manajemen Daftar Aset{% endblock %}
|
||
|
|
|
||
|
|
{% block page_guide_content %}
|
||
|
|
<div class="space-y-4">
|
||
|
|
<p>Halaman <strong>Daftar Aset</strong> digunakan untuk mendata seluruh inventaris induk perangkat IT. 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="M12 4v16m8-8H4"></path></svg>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<h4 class="font-bold text-gray-900 mb-1">Menambah dan Mengedit Aset</h4>
|
||
|
|
<p>Gunakan tombol "Tambah Aset" untuk memasukkan tipe perangkat baru. Anda juga dapat mengedit informasi aset dengan mengklik tombol pensil (edit) di kolom Aksi pada masing-masing baris.</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="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"></path></svg>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<h4 class="font-bold text-gray-900 mb-1">Melihat Detail Unit (Jumlah)</h4>
|
||
|
|
<p>Klik tombol berwarna hijau berbentuk kapsul (contoh: "5 Unit >") pada kolom Jumlah untuk masuk ke halaman detail unit. Di sana Anda dapat mendaftarkan nomor seri, mencetak QR code, dan melihat status masing-masing fisik barang.</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="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"></path></svg>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<h4 class="font-bold text-gray-900 mb-1">Kategori & Ekspor Data</h4>
|
||
|
|
<p>Terdapat tab untuk memfilter kategori (Aset Karyawan vs Network). Anda juga bisa langsung mengekspor daftar yang sedang tampil ke bentuk laporan PDF.</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
{% endblock %}
|
||
|
|
|
||
|
|
<script>
|
||
|
|
document.addEventListener('click', function() {
|
||
|
|
var menu = document.getElementById('exportMenuAsset');
|
||
|
|
if (menu) menu.style.display = 'none';
|
||
|
|
});
|
||
|
|
</script>
|