605 lines
43 KiB
HTML
605 lines
43 KiB
HTML
{% extends 'base.html' %}
|
|||
|
|
|
||
|
|
{% block page_title %}Configuration Item (CI / CMDB){% endblock %}
|
||
|
|
|
||
|
|
{% block content %}
|
||
|
|
<div class="mb-6 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 text-kerinci uppercase tracking-widest mb-1">Manajemen Aset • CMDB</p>
|
||
|
|
<div class="flex items-center space-x-3">
|
||
|
|
<h2 class="text-3xl font-extrabold text-gray-900">Configuration Item (CI)</h2>
|
||
|
|
<span class="px-2.5 py-0.5 rounded-full text-xs font-extrabold bg-blue-50 text-blue-700 border border-blue-200">
|
||
|
|
CMDB & Komponen
|
||
|
|
</span>
|
||
|
|
</div>
|
||
|
|
<p class="text-xs text-gray-500 mt-1">Pelacakan komponen internal, peripheral, dan modul pendukung perangkat IT.</p>
|
||
|
|
</div>
|
||
|
|
<div class="flex items-center space-x-3 w-full sm:w-auto">
|
||
|
|
{% if not is_read_only %}
|
||
|
|
<button onclick="openCreateCIModal()" class="bg-kerinci text-white px-5 py-2.5 rounded-xl text-sm font-bold shadow-sm shadow-kerinci/30 hover:bg-kerinci/90 transition-colors flex items-center space-x-2 justify-center w-full sm:w-auto">
|
||
|
|
<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>
|
||
|
|
<span>Tambah CI Baru</span>
|
||
|
|
</button>
|
||
|
|
{% endif %}
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- KPI Summary Cards -->
|
||
|
|
<div class="grid grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
|
||
|
|
<div class="bg-white p-5 rounded-2xl border border-gray-100 shadow-sm flex items-center justify-between">
|
||
|
|
<div>
|
||
|
|
<p class="text-xs font-bold text-gray-400 uppercase tracking-wider mb-1">Total Komponen</p>
|
||
|
|
<h3 class="text-2xl font-black text-gray-900">{{ counts.total }}</h3>
|
||
|
|
<p class="text-[11px] text-gray-400 mt-1">Terdaftar di CMDB</p>
|
||
|
|
</div>
|
||
|
|
<div class="w-12 h-12 bg-blue-50 text-kerinci rounded-xl flex items-center justify-center font-bold">
|
||
|
|
<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="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path></svg>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="bg-white p-5 rounded-2xl border border-gray-100 shadow-sm flex items-center justify-between">
|
||
|
|
<div>
|
||
|
|
<p class="text-xs font-bold text-blue-600 uppercase tracking-wider mb-1">Sedang Digunakan</p>
|
||
|
|
<h3 class="text-2xl font-black text-blue-900">{{ counts.in_use }}</h3>
|
||
|
|
<p class="text-[11px] text-blue-500 mt-1">Terpasang / Dipegang</p>
|
||
|
|
</div>
|
||
|
|
<div class="w-12 h-12 bg-blue-50 text-blue-600 rounded-xl flex items-center justify-center font-bold">
|
||
|
|
<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="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="bg-white p-5 rounded-2xl border border-gray-100 shadow-sm flex items-center justify-between">
|
||
|
|
<div>
|
||
|
|
<p class="text-xs font-bold text-emerald-600 uppercase tracking-wider mb-1">Tersedia (Gudang)</p>
|
||
|
|
<h3 class="text-2xl font-black text-emerald-900">{{ counts.available }}</h3>
|
||
|
|
<p class="text-[11px] text-emerald-500 mt-1">Siap dialokasikan</p>
|
||
|
|
</div>
|
||
|
|
<div class="w-12 h-12 bg-emerald-50 text-emerald-600 rounded-xl flex items-center justify-center font-bold">
|
||
|
|
<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="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"></path></svg>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="bg-white p-5 rounded-2xl border border-gray-100 shadow-sm flex items-center justify-between">
|
||
|
|
<div>
|
||
|
|
<p class="text-xs font-bold text-amber-600 uppercase tracking-wider mb-1">Dalam Perbaikan</p>
|
||
|
|
<h3 class="text-2xl font-black text-amber-900">{{ counts.under_repair }}</h3>
|
||
|
|
<p class="text-[11px] text-amber-500 mt-1">Inspeksi / Maintenance</p>
|
||
|
|
</div>
|
||
|
|
<div class="w-12 h-12 bg-amber-50 text-amber-600 rounded-xl flex items-center justify-center font-bold">
|
||
|
|
<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="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>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Status Tabs -->
|
||
|
|
<div class="flex space-x-2 mb-4 border-b border-gray-200 overflow-x-auto whitespace-nowrap scrollbar-hide">
|
||
|
|
<a href="?status={% if search_query %}&q={{ search_query }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if not status_filter %}border-kerinci text-kerinci{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||
|
|
Semua Komponen
|
||
|
|
<span class="ml-2 {% if not status_filter %}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.total }}</span>
|
||
|
|
</a>
|
||
|
|
<a href="?status=available{% if search_query %}&q={{ search_query }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if status_filter == 'available' %}border-kerinci text-kerinci{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||
|
|
Tersedia (Gudang)
|
||
|
|
<span class="ml-2 {% if status_filter == 'available' %}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.available }}</span>
|
||
|
|
</a>
|
||
|
|
<a href="?status=in_use{% if search_query %}&q={{ search_query }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if status_filter == 'in_use' %}border-kerinci text-kerinci{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||
|
|
Sedang Digunakan
|
||
|
|
<span class="ml-2 {% if status_filter == 'in_use' %}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.in_use }}</span>
|
||
|
|
</a>
|
||
|
|
<a href="?status=repair{% if search_query %}&q={{ search_query }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if status_filter == 'repair' %}border-kerinci text-kerinci{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||
|
|
Perbaikan / Rusak
|
||
|
|
<span class="ml-2 {% if status_filter == 'repair' %}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.under_repair }}</span>
|
||
|
|
</a>
|
||
|
|
<a href="?status=retired{% if search_query %}&q={{ search_query }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if status_filter == 'retired' %}border-kerinci text-kerinci{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||
|
|
Bricked
|
||
|
|
<span class="ml-2 {% if status_filter == 'retired' %}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.retired }}</span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Filters & Search -->
|
||
|
|
<div class="mb-4 flex flex-col md:flex-row md:items-center justify-between gap-3">
|
||
|
|
<form id="searchForm" method="GET" class="flex flex-wrap items-center gap-2 w-full">
|
||
|
|
<input type="hidden" name="status" value="{{ status_filter }}">
|
||
|
|
<div class="relative flex-1 min-w-[240px]">
|
||
|
|
<input type="text" id="searchInput" name="q" value="{{ search_query }}" placeholder="Cari Kode Item, nama, S/N, perangkat, atau PIC..." 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>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<select name="category" onchange="this.form.submit()" class="px-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 text-gray-700 shadow-sm">
|
||
|
|
<option value="">Semua Kategori</option>
|
||
|
|
{% for cat_val, cat_label in categories %}
|
||
|
|
<option value="{{ cat_val }}" {% if category_filter == cat_val %}selected{% endif %}>{{ cat_label }}</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select name="condition" onchange="this.form.submit()" class="px-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 text-gray-700 shadow-sm">
|
||
|
|
<option value="">Semua Kondisi</option>
|
||
|
|
{% for cond_val, cond_label in condition_choices %}
|
||
|
|
<option value="{{ cond_val }}" {% if condition_filter == cond_val %}selected{% endif %}>{{ cond_label }}</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
{% if search_query or category_filter or condition_filter or status_filter %}
|
||
|
|
<a href="{% url 'ci_list' %}" class="px-3.5 py-2.5 text-xs font-bold text-gray-500 hover:text-red-500 border border-gray-200 hover:border-red-200 rounded-xl bg-white transition-colors" title="Reset Filter">
|
||
|
|
Reset
|
||
|
|
</a>
|
||
|
|
{% endif %}
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Main Data Table -->
|
||
|
|
<div class="bg-white rounded-none sm:rounded-2xl shadow-sm border border-gray-100 overflow-hidden w-full">
|
||
|
|
<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-12">No</th>
|
||
|
|
<th class="p-4 font-bold min-w-[130px]">Kode Item</th>
|
||
|
|
<th class="p-4 font-bold min-w-[220px]">Nama & Komponen</th>
|
||
|
|
<th class="p-4 font-bold">Kategori</th>
|
||
|
|
<th class="p-4 font-bold min-w-[140px]">Nomor Seri (S/N)</th>
|
||
|
|
<th class="p-4 font-bold min-w-[200px]">Perangkat / Pengguna</th>
|
||
|
|
<th class="p-4 font-bold text-center">Kondisi</th>
|
||
|
|
<th class="p-4 font-bold text-center">Status</th>
|
||
|
|
<th class="p-4 font-bold text-center min-w-[140px]">Aksi</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody class="text-sm divide-y divide-gray-50">
|
||
|
|
{% for item in items %}
|
||
|
|
<tr class="hover:bg-gray-50/50 transition-colors">
|
||
|
|
<td class="p-4 text-gray-400 font-medium text-center text-xs">{{ forloop.counter }}</td>
|
||
|
|
<td class="p-4">
|
||
|
|
<a href="{% url 'ci_detail' item.id %}" class="block group">
|
||
|
|
<span class="font-extrabold text-gray-900 group-hover:text-kerinci transition-colors font-mono text-xs">{{ item.ci_code }}</span>
|
||
|
|
</a>
|
||
|
|
</td>
|
||
|
|
<td class="p-4">
|
||
|
|
<a href="{% url 'ci_detail' item.id %}" class="block group">
|
||
|
|
<span class="font-bold text-gray-900 group-hover:text-kerinci transition-colors">{{ item.name }}</span>
|
||
|
|
</a>
|
||
|
|
<p class="text-xs text-gray-500 mt-0.5">{{ item.brand|default:"-" }}{% if item.model_series %} • {{ item.model_series }}{% endif %}</p>
|
||
|
|
</td>
|
||
|
|
<td class="p-4">
|
||
|
|
<span class="text-xs font-semibold text-gray-700 bg-gray-100 px-2 py-1 rounded-md">
|
||
|
|
{{ item.get_category_display }}
|
||
|
|
</span>
|
||
|
|
</td>
|
||
|
|
<td class="p-4">
|
||
|
|
<span class="font-mono text-xs text-gray-700">{{ item.serial_number|default:"-" }}</span>
|
||
|
|
</td>
|
||
|
|
<td class="p-4">
|
||
|
|
{% if item.installed_on %}
|
||
|
|
<div class="flex items-center space-x-1.5">
|
||
|
|
<span class="w-2 h-2 rounded-full bg-blue-500"></span>
|
||
|
|
<div>
|
||
|
|
<span class="font-bold text-xs text-blue-700">Terpasang: {{ item.installed_on.unit_code }}</span>
|
||
|
|
{% if item.installed_on.assigned_to %}
|
||
|
|
<p class="text-[11px] text-gray-500">PIC: {{ item.installed_on.assigned_to.name }}</p>
|
||
|
|
{% endif %}
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
{% elif item.assigned_to %}
|
||
|
|
<div class="flex items-center space-x-1.5">
|
||
|
|
<span class="w-2 h-2 rounded-full bg-purple-500"></span>
|
||
|
|
<div>
|
||
|
|
<span class="font-bold text-xs text-purple-700">Dipegang: {{ item.assigned_to.name }}</span>
|
||
|
|
<p class="text-[11px] text-gray-400">NIK: {{ item.assigned_to.nik }}</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
{% elif item.status == 'available' %}
|
||
|
|
<span class="text-xs text-emerald-700 font-medium bg-emerald-50 px-2 py-0.5 rounded border border-emerald-100">
|
||
|
|
{{ item.location|default:"Gudang IT" }}
|
||
|
|
</span>
|
||
|
|
{% else %}
|
||
|
|
<span class="text-xs text-gray-400 italic">-</span>
|
||
|
|
{% endif %}
|
||
|
|
</td>
|
||
|
|
<td class="p-4 text-center">
|
||
|
|
{% if item.condition == 'new' %}
|
||
|
|
<span class="px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-blue-50 text-blue-700 border border-blue-200">Baru</span>
|
||
|
|
{% elif item.condition == 'good' %}
|
||
|
|
<span class="px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-emerald-50 text-emerald-700 border border-emerald-200">Bagus</span>
|
||
|
|
{% elif item.condition == 'fair' %}
|
||
|
|
<span class="px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-amber-50 text-amber-700 border border-amber-200">Bekas</span>
|
||
|
|
{% else %}
|
||
|
|
<span class="px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-red-50 text-red-700 border border-red-200">Rusak</span>
|
||
|
|
{% endif %}
|
||
|
|
</td>
|
||
|
|
<td class="p-4 text-center">
|
||
|
|
{% if item.status == 'available' %}
|
||
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold bg-emerald-50 text-emerald-700 border border-emerald-200">Tersedia</span>
|
||
|
|
{% elif item.status == 'in_use' %}
|
||
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold bg-blue-50 text-blue-700 border border-blue-200">Digunakan</span>
|
||
|
|
{% elif item.status == 'under_repair' or item.status == 'under_inspection' %}
|
||
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold bg-amber-50 text-amber-700 border border-amber-200">Perbaikan</span>
|
||
|
|
{% else %}
|
||
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold bg-gray-100 text-gray-500 border border-gray-200">Pensiun</span>
|
||
|
|
{% endif %}
|
||
|
|
</td>
|
||
|
|
<td class="p-4 text-center">
|
||
|
|
<div class="flex items-center justify-center space-x-1.5">
|
||
|
|
<a href="{% url 'ci_detail' item.id %}" class="p-1.5 text-gray-500 hover:text-kerinci hover:bg-gray-100 rounded-lg transition-colors" title="Lihat Detail & Riwayat">
|
||
|
|
<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="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"></path></svg>
|
||
|
|
</a>
|
||
|
|
|
||
|
|
{% if not is_read_only %}
|
||
|
|
{% if item.status == 'available' %}
|
||
|
|
<button onclick="openAssignModal('{{ item.id }}', '{{ item.ci_code }}', '{{ item.name|escapejs }}')" class="p-1.5 text-emerald-600 hover:bg-emerald-50 rounded-lg transition-colors" title="Gunakan Untuk (Pasang/Alokasi)">
|
||
|
|
<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>
|
||
|
|
</button>
|
||
|
|
{% elif item.status == 'in_use' %}
|
||
|
|
{% if item.installed_on %}
|
||
|
|
<button onclick="openReplaceModal('{{ item.id }}', '{{ item.ci_code }}', '{{ item.name|escapejs }}', '{{ item.installed_on.unit_code }}')" class="p-1.5 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors" title="Ganti / Upgrade Komponen">
|
||
|
|
<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="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path></svg>
|
||
|
|
</button>
|
||
|
|
{% endif %}
|
||
|
|
<button onclick="openRemoveModal('{{ item.id }}', '{{ item.ci_code }}', '{{ item.name|escapejs }}')" class="p-1.5 text-amber-600 hover:bg-amber-50 rounded-lg transition-colors" title="Lepas dari Perangkat/Pengguna">
|
||
|
|
<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="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"></path></svg>
|
||
|
|
</button>
|
||
|
|
{% endif %}
|
||
|
|
|
||
|
|
<button onclick="openDamageModal('{{ item.id }}', '{{ item.ci_code }}', '{{ item.name|escapejs }}')" class="p-1.5 text-red-500 hover:bg-red-50 rounded-lg transition-colors" title="Laporkan Kerusakan / Perbaikan">
|
||
|
|
<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 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>
|
||
|
|
</button>
|
||
|
|
{% endif %}
|
||
|
|
</div>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
{% empty %}
|
||
|
|
<tr>
|
||
|
|
<td colspan="9" class="p-12 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-300" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path></svg>
|
||
|
|
<p class="font-medium text-gray-500">Belum ada Configuration Item yang cocok dengan kriteria pencarian.</p>
|
||
|
|
</div>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
{% endfor %}
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
{% include 'components/pagination.html' %}
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- ============================================================== -->
|
||
|
|
<!-- MODAL: Tambah Configuration Item Baru -->
|
||
|
|
<!-- ============================================================== -->
|
||
|
|
<div id="createCIModal" 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="closeCreateCIModal()"></div>
|
||
|
|
<div class="bg-white rounded-2xl shadow-2xl w-[90%] max-w-2xl max-h-[90vh] overflow-y-auto relative z-10 p-6 sm:p-8">
|
||
|
|
<div class="flex justify-between items-center mb-6 pb-4 border-b border-gray-100">
|
||
|
|
<div>
|
||
|
|
<h3 class="text-xl font-extrabold text-gray-900">Tambah Configuration Item (CI)</h3>
|
||
|
|
<p class="text-xs text-gray-500 mt-0.5">Daftarkan komponen atau peripheral baru ke dalam CMDB.</p>
|
||
|
|
</div>
|
||
|
|
<button onclick="closeCreateCIModal()" class="text-gray-400 hover:text-gray-600 p-2 rounded-lg hover:bg-gray-100">
|
||
|
|
<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>
|
||
|
|
|
||
|
|
<form action="{% url 'ci_create' %}" method="POST" class="space-y-4">
|
||
|
|
{% csrf_token %}
|
||
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Kode Item (Opsional)</label>
|
||
|
|
<input type="text" name="ci_code" placeholder="Auto-generate jika dikosongkan" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci font-mono bg-white">
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Kategori Komponen <span class="text-red-500">*</span></label>
|
||
|
|
<select name="category" required class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
{% for cat_val, cat_label in categories %}
|
||
|
|
<option value="{{ cat_val }}">{{ cat_label }}</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Nama Item / Komponen <span class="text-red-500">*</span></label>
|
||
|
|
<input type="text" name="name" required placeholder="Contoh: SSD Samsung 980 NVMe 1TB / Logitech B100 Mouse" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="grid grid-cols-1 sm:grid-cols-3 gap-4">
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Merek</label>
|
||
|
|
<input type="text" name="brand" placeholder="Samsung / Kingston / dll" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Model / Seri</label>
|
||
|
|
<input type="text" name="model_series" placeholder="980 Pro / DDR4 3200MHz" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Nomor Seri (S/N)</label>
|
||
|
|
<input type="text" name="serial_number" placeholder="S/N fisik item" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci font-mono bg-white">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Kondisi Fisik Awal</label>
|
||
|
|
<select name="condition" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
{% for cond_val, cond_label in condition_choices %}
|
||
|
|
<option value="{{ cond_val }}">{{ cond_label }}</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Lokasi Penyimpanan</label>
|
||
|
|
<input type="text" name="location" value="Gudang IT" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Spesifikasi Teknis</label>
|
||
|
|
<textarea name="specifications" rows="2" placeholder="Detail kapasitas, interface, form factor, speed, dsb..." class="w-full px-3.5 py-2 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white"></textarea>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="mt-6 flex justify-end space-x-3 pt-4 border-t border-gray-100">
|
||
|
|
<button type="button" onclick="closeCreateCIModal()" class="px-5 py-2.5 border border-gray-300 text-gray-700 font-bold rounded-xl text-sm hover:bg-gray-50">Batal</button>
|
||
|
|
<button type="submit" class="px-6 py-2.5 bg-kerinci text-white font-bold rounded-xl text-sm hover:bg-kerinci/90 shadow-sm shadow-kerinci/30">Simpan Komponen</button>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- ============================================================== -->
|
||
|
|
<!-- MODAL: Gunakan Untuk (Assignment) -->
|
||
|
|
<!-- ============================================================== -->
|
||
|
|
<div id="assignModal" 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="closeAssignModal()"></div>
|
||
|
|
<div class="bg-white rounded-2xl shadow-2xl w-[90%] max-w-lg relative z-10 p-6 sm:p-8">
|
||
|
|
<h3 class="text-xl font-extrabold text-gray-900 mb-1">Gunakan / Alokasikan Komponen</h3>
|
||
|
|
<p class="text-xs text-gray-500 mb-4">Pilih apakah komponen akan dipasang ke unit perangkat atau dialokasikan langsung ke karyawan.</p>
|
||
|
|
|
||
|
|
<div class="bg-gray-50 p-3 rounded-xl border border-gray-100 mb-4 text-xs">
|
||
|
|
<span class="text-gray-400 font-bold">Item:</span> <strong id="assign_ci_text" class="text-gray-800"></strong>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<form id="assignForm" method="POST" class="space-y-4">
|
||
|
|
{% csrf_token %}
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Tujuan Penggunaan</label>
|
||
|
|
<div class="grid grid-cols-2 gap-3">
|
||
|
|
<label class="flex items-center p-3 border rounded-xl cursor-pointer hover:bg-blue-50/50 has-[:checked]:border-kerinci has-[:checked]:bg-blue-50/30">
|
||
|
|
<input type="radio" name="usage_type" value="asset" checked onchange="toggleUsageType('asset')" class="text-kerinci focus:ring-kerinci">
|
||
|
|
<span class="ml-2 text-xs font-bold text-gray-800">Pasang ke Perangkat</span>
|
||
|
|
</label>
|
||
|
|
<label class="flex items-center p-3 border rounded-xl cursor-pointer hover:bg-blue-50/50 has-[:checked]:border-kerinci has-[:checked]:bg-blue-50/30">
|
||
|
|
<input type="radio" name="usage_type" value="employee" onchange="toggleUsageType('employee')" class="text-kerinci focus:ring-kerinci">
|
||
|
|
<span class="ml-2 text-xs font-bold text-gray-800">Alokasikan ke Karyawan</span>
|
||
|
|
</label>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Target: Perangkat (AssetUnit) -->
|
||
|
|
<div id="target_asset_container">
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Pilih Perangkat Tujuan <span class="text-red-500">*</span></label>
|
||
|
|
<select id="target_unit_select" name="target_id" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
<option value="">-- Pilih Unit Perangkat --</option>
|
||
|
|
{% for u in available_units %}
|
||
|
|
<option value="{{ u.id }}">{{ u.unit_code }} • {{ u.asset.name }}{% if u.assigned_to %} (PIC: {{ u.assigned_to.name }}){% endif %}</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Target: Karyawan (Employee) -->
|
||
|
|
<div id="target_employee_container" class="hidden">
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Pilih Karyawan Penerima <span class="text-red-500">*</span></label>
|
||
|
|
<select id="target_employee_select" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
<option value="">-- Pilih Karyawan Aktif --</option>
|
||
|
|
{% for emp in available_employees %}
|
||
|
|
<option value="{{ emp.id }}">{{ emp.nik }} • {{ emp.name }} ({{ emp.position|default:"Staff" }})</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Catatan Pemasangan / Work Order</label>
|
||
|
|
<textarea name="notes" rows="2" placeholder="No tiket, teknisi pelaksana, atau alasan pemasangan..." class="w-full px-3.5 py-2 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white"></textarea>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="mt-6 flex justify-end space-x-3 pt-4 border-t border-gray-100">
|
||
|
|
<button type="button" onclick="closeAssignModal()" class="px-5 py-2.5 border border-gray-300 text-gray-700 font-bold rounded-xl text-sm hover:bg-gray-50">Batal</button>
|
||
|
|
<button type="submit" class="px-6 py-2.5 bg-emerald-600 text-white font-bold rounded-xl text-sm hover:bg-emerald-700 shadow-sm shadow-emerald-600/30">Proses Pemasangan</button>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- ============================================================== -->
|
||
|
|
<!-- MODAL: Ganti / Upgrade Komponen (Replacement) -->
|
||
|
|
<!-- ============================================================== -->
|
||
|
|
<div id="replaceModal" 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="closeReplaceModal()"></div>
|
||
|
|
<div class="bg-white rounded-2xl shadow-2xl w-[90%] max-w-lg relative z-10 p-6 sm:p-8">
|
||
|
|
<h3 class="text-xl font-extrabold text-gray-900 mb-1">Ganti / Upgrade Komponen</h3>
|
||
|
|
<p class="text-xs text-gray-500 mb-4">Gantikan komponen yang sedang terpasang dengan komponen baru/cadangan dari gudang.</p>
|
||
|
|
|
||
|
|
<div class="bg-amber-50 p-3 rounded-xl border border-amber-200 mb-4 text-xs">
|
||
|
|
<p><span class="text-amber-800 font-bold">Komponen Lama:</span> <strong id="rep_old_ci_text"></strong></p>
|
||
|
|
<p class="mt-1"><span class="text-amber-800 font-bold">Perangkat Induk:</span> <strong id="rep_unit_text"></strong></p>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<form id="replaceForm" method="POST" class="space-y-4">
|
||
|
|
{% csrf_token %}
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Komponen Pengganti (Dari Gudang) <span class="text-red-500">*</span></label>
|
||
|
|
<select name="replacement_ci_id" required class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
<option value="">-- Pilih Komponen Tersedia --</option>
|
||
|
|
{% for sp in spare_cis %}
|
||
|
|
<option value="{{ sp.id }}">{{ sp.ci_code }} • {{ sp.name }} ({{ sp.get_category_display }})</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Alasan Penggantian</label>
|
||
|
|
<select name="reason" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
<option value="Replacement Kerusakan">Replacement (Komponen Lama Rusak)</option>
|
||
|
|
<option value="Peningkatan Kapasitas / Performa">Upgrade (Peningkatan Kapasitas / Performa)</option>
|
||
|
|
<option value="Preventive Maintenance">Preventive Maintenance Berkala</option>
|
||
|
|
<option value="Standardisasi Perangkat">Standardisasi Perangkat IT</option>
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="grid grid-cols-2 gap-3">
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Status Komponen Lama</label>
|
||
|
|
<select name="old_ci_status" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
<option value="under_repair">Masuk Perbaikan</option>
|
||
|
|
<option value="available">Tersedia (Masih Bagus)</option>
|
||
|
|
<option value="retired">Bricked</option>
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Kondisi Komponen Lama</label>
|
||
|
|
<select name="old_ci_condition" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
<option value="damaged">Rusak (Damaged)</option>
|
||
|
|
<option value="good">Bagus / Normal</option>
|
||
|
|
<option value="fair">Cukup / Bekas</option>
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Catatan Penggantian</label>
|
||
|
|
<textarea name="notes" rows="2" placeholder="Catatan hasil pengujian komponen baru, nomor tiket, teknisi..." class="w-full px-3.5 py-2 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white"></textarea>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="mt-6 flex justify-end space-x-3 pt-4 border-t border-gray-100">
|
||
|
|
<button type="button" onclick="closeReplaceModal()" class="px-5 py-2.5 border border-gray-300 text-gray-700 font-bold rounded-xl text-sm hover:bg-gray-50">Batal</button>
|
||
|
|
<button type="submit" class="px-6 py-2.5 bg-blue-600 text-white font-bold rounded-xl text-sm hover:bg-blue-700 shadow-sm shadow-blue-600/30">Lakukan Penggantian</button>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- ============================================================== -->
|
||
|
|
<!-- MODAL: Lepas dari Perangkat (Remove) -->
|
||
|
|
<!-- ============================================================== -->
|
||
|
|
<div id="removeModal" 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="closeRemoveModal()"></div>
|
||
|
|
<div class="bg-white rounded-2xl shadow-2xl w-[90%] max-w-md relative z-10 p-6 sm:p-8">
|
||
|
|
<h3 class="text-xl font-extrabold text-gray-900 mb-1">Lepas Komponen</h3>
|
||
|
|
<p class="text-xs text-gray-500 mb-4">Putuskan relasi komponen dari perangkat/pengguna dan simpan kembali ke inventaris.</p>
|
||
|
|
|
||
|
|
<form id="removeForm" method="POST" class="space-y-4">
|
||
|
|
{% csrf_token %}
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Status Komponen Setelah Dilepas</label>
|
||
|
|
<select name="new_status" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
<option value="available">Tersedia di Gudang (Bagus)</option>
|
||
|
|
<option value="under_inspection">Masuk Pemeriksaan</option>
|
||
|
|
<option value="under_repair">Masuk Perbaikan (Rusak)</option>
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Lokasi Penyimpanan</label>
|
||
|
|
<input type="text" name="location" value="Gudang IT" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Alasan Pelepasan</label>
|
||
|
|
<textarea name="notes" rows="2" placeholder="Alasan pelepasan..." class="w-full px-3.5 py-2 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white"></textarea>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="mt-6 flex justify-end space-x-3 pt-4 border-t border-gray-100">
|
||
|
|
<button type="button" onclick="closeRemoveModal()" class="px-5 py-2.5 border border-gray-300 text-gray-700 font-bold rounded-xl text-sm hover:bg-gray-50">Batal</button>
|
||
|
|
<button type="submit" class="px-6 py-2.5 bg-amber-500 text-white font-bold rounded-xl text-sm hover:bg-amber-600 shadow-sm shadow-amber-500/30">Ya, Lepas Komponen</button>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- ============================================================== -->
|
||
|
|
<!-- MODAL: Laporkan Kerusakan / Perbaikan -->
|
||
|
|
<!-- ============================================================== -->
|
||
|
|
<div id="damageModal" 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="closeDamageModal()"></div>
|
||
|
|
<div class="bg-white rounded-2xl shadow-2xl w-[90%] max-w-md relative z-10 p-6 sm:p-8">
|
||
|
|
<h3 class="text-xl font-extrabold text-gray-900 mb-1">Lapor Status Perbaikan</h3>
|
||
|
|
<p class="text-xs text-gray-500 mb-4">Update status pemeliharaan atau laporkan keluhan kerusakan teknis.</p>
|
||
|
|
|
||
|
|
<form id="damageForm" method="POST" class="space-y-4">
|
||
|
|
{% csrf_token %}
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Tindakan Maintenance</label>
|
||
|
|
<select name="action_type" class="w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white">
|
||
|
|
<option value="repair_in">Masuk Perbaikan (Unit Mengalami Gangguan)</option>
|
||
|
|
<option value="repair_out">Selesai Perbaikan (Unit Sudah Normal)</option>
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<label class="block text-xs font-bold text-gray-700 uppercase mb-1">Keterangan Kerusakan / Solusi</label>
|
||
|
|
<textarea name="notes" rows="3" required placeholder="Jelaskan detail kerusakan, error, atau tindakan perbaikan yang dilakukan..." class="w-full px-3.5 py-2 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-kerinci bg-white"></textarea>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="mt-6 flex justify-end space-x-3 pt-4 border-t border-gray-100">
|
||
|
|
<button type="button" onclick="closeDamageModal()" class="px-5 py-2.5 border border-gray-300 text-gray-700 font-bold rounded-xl text-sm hover:bg-gray-50">Batal</button>
|
||
|
|
<button type="submit" class="px-6 py-2.5 bg-red-600 text-white font-bold rounded-xl text-sm hover:bg-red-700 shadow-sm shadow-red-600/30">Simpan Laporan</button>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
function openCreateCIModal() {
|
||
|
|
document.getElementById('createCIModal').classList.remove('hidden');
|
||
|
|
}
|
||
|
|
function closeCreateCIModal() {
|
||
|
|
document.getElementById('createCIModal').classList.add('hidden');
|
||
|
|
}
|
||
|
|
|
||
|
|
function openAssignModal(id, code, name) {
|
||
|
|
document.getElementById('assign_ci_text').innerText = code + ' - ' + name;
|
||
|
|
document.getElementById('assignForm').action = '/ci/' + id + '/assign/';
|
||
|
|
document.getElementById('assignModal').classList.remove('hidden');
|
||
|
|
}
|
||
|
|
function closeAssignModal() {
|
||
|
|
document.getElementById('assignModal').classList.add('hidden');
|
||
|
|
}
|
||
|
|
function toggleUsageType(type) {
|
||
|
|
const assetCont = document.getElementById('target_asset_container');
|
||
|
|
const empCont = document.getElementById('target_employee_container');
|
||
|
|
const unitSelect = document.getElementById('target_unit_select');
|
||
|
|
const empSelect = document.getElementById('target_employee_select');
|
||
|
|
|
||
|
|
if (type === 'asset') {
|
||
|
|
assetCont.classList.remove('hidden');
|
||
|
|
empCont.classList.add('hidden');
|
||
|
|
unitSelect.name = 'target_id';
|
||
|
|
empSelect.name = '';
|
||
|
|
} else {
|
||
|
|
assetCont.classList.add('hidden');
|
||
|
|
empCont.classList.remove('hidden');
|
||
|
|
unitSelect.name = '';
|
||
|
|
empSelect.name = 'target_id';
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
function openReplaceModal(id, code, name, unitCode) {
|
||
|
|
document.getElementById('rep_old_ci_text').innerText = code + ' (' + name + ')';
|
||
|
|
document.getElementById('rep_unit_text').innerText = unitCode;
|
||
|
|
document.getElementById('replaceForm').action = '/ci/' + id + '/replace/';
|
||
|
|
document.getElementById('replaceModal').classList.remove('hidden');
|
||
|
|
}
|
||
|
|
function closeReplaceModal() {
|
||
|
|
document.getElementById('replaceModal').classList.add('hidden');
|
||
|
|
}
|
||
|
|
|
||
|
|
function openRemoveModal(id, code, name) {
|
||
|
|
document.getElementById('removeForm').action = '/ci/' + id + '/remove/';
|
||
|
|
document.getElementById('removeModal').classList.remove('hidden');
|
||
|
|
}
|
||
|
|
function closeRemoveModal() {
|
||
|
|
document.getElementById('removeModal').classList.add('hidden');
|
||
|
|
}
|
||
|
|
|
||
|
|
function openDamageModal(id, code, name) {
|
||
|
|
document.getElementById('damageForm').action = '/ci/' + id + '/report-damage/';
|
||
|
|
document.getElementById('damageModal').classList.remove('hidden');
|
||
|
|
}
|
||
|
|
function closeDamageModal() {
|
||
|
|
document.getElementById('damageModal').classList.add('hidden');
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
{% endblock %}
|