style: standardize UI layout on Configuration Item and Consumable Item pages to match Daftar Aset
This commit is contained in:
@@ -66,6 +66,8 @@ from .ci_views import (
|
||||
ci_remove,
|
||||
ci_replace,
|
||||
ci_report_damage,
|
||||
ci_export_excel,
|
||||
ci_export_pdf,
|
||||
)
|
||||
|
||||
# Consumable Item (Barang Habis Pakai)
|
||||
@@ -159,6 +161,8 @@ __all__ = [
|
||||
'ci_remove',
|
||||
'ci_replace',
|
||||
'ci_report_damage',
|
||||
'ci_export_excel',
|
||||
'ci_export_pdf',
|
||||
# Consumable Items
|
||||
'consumable_list',
|
||||
'consumable_detail',
|
||||
|
||||
+256
-1
@@ -3,7 +3,7 @@ from datetime import datetime
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib import messages
|
||||
from django.http import JsonResponse
|
||||
from django.http import HttpResponse, JsonResponse
|
||||
from django.db import transaction
|
||||
from django.db.models import Count, Q
|
||||
from django.core.paginator import Paginator
|
||||
@@ -496,3 +496,258 @@ def ci_report_damage(request, ci_id):
|
||||
messages.success(request, f'Komponen {ci.ci_code} selesai diperbaiki dan siap digunakan.')
|
||||
|
||||
return redirect(request.META.get('HTTP_REFERER', 'ci_list'))
|
||||
|
||||
|
||||
@login_required
|
||||
def ci_export_excel(request):
|
||||
"""Menghasilkan laporan Excel profesional untuk katalog Configuration Item."""
|
||||
from openpyxl import Workbook
|
||||
from openpyxl.styles import Font, Alignment, PatternFill, Border, Side
|
||||
|
||||
search_query = request.GET.get('q', '').strip()
|
||||
status_filter = request.GET.get('status', '').strip()
|
||||
category_filter = request.GET.get('category', '').strip()
|
||||
condition_filter = request.GET.get('condition', '').strip()
|
||||
|
||||
ci_qs = ConfigurationItem.objects.select_related(
|
||||
'installed_on', 'installed_on__asset', 'installed_on__assigned_to', 'assigned_to'
|
||||
).order_by('category', 'ci_code')
|
||||
|
||||
if status_filter:
|
||||
if status_filter == 'repair':
|
||||
ci_qs = ci_qs.filter(status__in=['under_inspection', 'under_repair'])
|
||||
else:
|
||||
ci_qs = ci_qs.filter(status=status_filter)
|
||||
|
||||
if category_filter:
|
||||
ci_qs = ci_qs.filter(category=category_filter)
|
||||
|
||||
if condition_filter:
|
||||
ci_qs = ci_qs.filter(condition=condition_filter)
|
||||
|
||||
if search_query:
|
||||
ci_qs = ci_qs.filter(
|
||||
Q(ci_code__icontains=search_query) |
|
||||
Q(name__icontains=search_query) |
|
||||
Q(brand__icontains=search_query) |
|
||||
Q(model_series__icontains=search_query) |
|
||||
Q(serial_number__icontains=search_query) |
|
||||
Q(specifications__icontains=search_query) |
|
||||
Q(installed_on__unit_code__icontains=search_query) |
|
||||
Q(assigned_to__name__icontains=search_query)
|
||||
)
|
||||
|
||||
wb = Workbook()
|
||||
ws = wb.active
|
||||
ws.title = "Katalog CI"
|
||||
|
||||
title_font = Font(size=14, bold=True, color="002060")
|
||||
subtitle_font = Font(size=10, italic=True, color="555555")
|
||||
header_font = Font(bold=True, color="FFFFFF")
|
||||
header_fill = PatternFill(start_color="002060", end_color="002060", fill_type="solid")
|
||||
center_align = Alignment(horizontal="center", vertical="center")
|
||||
left_align = Alignment(horizontal="left", vertical="center")
|
||||
thin_border = Border(
|
||||
left=Side(style='thin', color='CCCCCC'),
|
||||
right=Side(style='thin', color='CCCCCC'),
|
||||
top=Side(style='thin', color='CCCCCC'),
|
||||
bottom=Side(style='thin', color='CCCCCC')
|
||||
)
|
||||
|
||||
ws.merge_cells('A1:J1')
|
||||
ws['A1'] = "LAPORAN CONFIGURATION ITEM (CI) - PT. KERINCI HYDROPOWER"
|
||||
ws['A1'].font = title_font
|
||||
ws['A1'].alignment = left_align
|
||||
|
||||
ws.merge_cells('A2:J2')
|
||||
ws['A2'] = f"Tanggal Ekspor: {datetime.now().strftime('%d %B %Y %H:%M')} WIB | Dicetak oleh: {request.user.get_full_name() or request.user.username}"
|
||||
ws['A2'].font = subtitle_font
|
||||
ws['A2'].alignment = left_align
|
||||
|
||||
headers = [
|
||||
"No", "Kode CI", "Nama Komponen", "Kategori", "Merek & Model",
|
||||
"Nomor Seri (S/N)", "Status", "Kondisi", "Perangkat Terpasang", "PIC / Pengguna"
|
||||
]
|
||||
ws.append([])
|
||||
ws.append(headers)
|
||||
|
||||
for col_idx in range(1, len(headers) + 1):
|
||||
cell = ws.cell(row=4, column=col_idx)
|
||||
cell.font = header_font
|
||||
cell.fill = header_fill
|
||||
cell.alignment = center_align
|
||||
|
||||
for idx, ci in enumerate(ci_qs, 1):
|
||||
installed = f"{ci.installed_on.unit_code} ({ci.installed_on.asset.name})" if ci.installed_on else "-"
|
||||
pic = ci.assigned_to.name if ci.assigned_to else (ci.installed_on.assigned_to.name if ci.installed_on and ci.installed_on.assigned_to else "-")
|
||||
row = [
|
||||
idx,
|
||||
ci.ci_code,
|
||||
ci.name,
|
||||
ci.get_category_display(),
|
||||
f"{ci.brand or ''} {ci.model_series or ''}".strip() or "-",
|
||||
ci.serial_number or "-",
|
||||
ci.get_status_display(),
|
||||
ci.get_condition_display(),
|
||||
installed,
|
||||
pic
|
||||
]
|
||||
ws.append(row)
|
||||
curr_row = ws.max_row
|
||||
for col_idx in range(1, len(headers) + 1):
|
||||
c = ws.cell(row=curr_row, column=col_idx)
|
||||
c.border = thin_border
|
||||
if col_idx in [1, 2, 7, 8]:
|
||||
c.alignment = center_align
|
||||
else:
|
||||
c.alignment = left_align
|
||||
|
||||
col_widths = {'A': 6, 'B': 18, 'C': 26, 'D': 16, 'E': 20, 'F': 20, 'G': 16, 'H': 14, 'I': 24, 'J': 22}
|
||||
for col, width in col_widths.items():
|
||||
ws.column_dimensions[col].width = width
|
||||
|
||||
response = HttpResponse(content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
|
||||
filename = f"laporan_configuration_item_{datetime.now().strftime('%Y%m%d_%H%M%S')}.xlsx"
|
||||
response['Content-Disposition'] = f'attachment; filename="{filename}"'
|
||||
wb.save(response)
|
||||
return response
|
||||
|
||||
|
||||
@login_required
|
||||
def ci_export_pdf(request):
|
||||
"""Menghasilkan laporan PDF ringkasan status Configuration Item."""
|
||||
from reportlab.lib.pagesizes import A4, landscape
|
||||
from reportlab.lib.units import mm
|
||||
from reportlab.lib.colors import HexColor, white
|
||||
from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Paragraph, Spacer
|
||||
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
|
||||
from reportlab.lib.enums import TA_CENTER, TA_LEFT
|
||||
from io import BytesIO
|
||||
|
||||
search_query = request.GET.get('q', '').strip()
|
||||
status_filter = request.GET.get('status', '').strip()
|
||||
category_filter = request.GET.get('category', '').strip()
|
||||
condition_filter = request.GET.get('condition', '').strip()
|
||||
|
||||
ci_qs = ConfigurationItem.objects.select_related(
|
||||
'installed_on', 'installed_on__asset', 'installed_on__assigned_to', 'assigned_to'
|
||||
).order_by('category', 'ci_code')
|
||||
|
||||
if status_filter:
|
||||
if status_filter == 'repair':
|
||||
ci_qs = ci_qs.filter(status__in=['under_inspection', 'under_repair'])
|
||||
else:
|
||||
ci_qs = ci_qs.filter(status=status_filter)
|
||||
|
||||
if category_filter:
|
||||
ci_qs = ci_qs.filter(category=category_filter)
|
||||
|
||||
if condition_filter:
|
||||
ci_qs = ci_qs.filter(condition=condition_filter)
|
||||
|
||||
if search_query:
|
||||
ci_qs = ci_qs.filter(
|
||||
Q(ci_code__icontains=search_query) |
|
||||
Q(name__icontains=search_query) |
|
||||
Q(brand__icontains=search_query) |
|
||||
Q(model_series__icontains=search_query) |
|
||||
Q(serial_number__icontains=search_query) |
|
||||
Q(specifications__icontains=search_query) |
|
||||
Q(installed_on__unit_code__icontains=search_query) |
|
||||
Q(assigned_to__name__icontains=search_query)
|
||||
)
|
||||
|
||||
buffer = BytesIO()
|
||||
doc = SimpleDocTemplate(
|
||||
buffer,
|
||||
pagesize=landscape(A4),
|
||||
leftMargin=10 * mm,
|
||||
rightMargin=10 * mm,
|
||||
topMargin=10 * mm,
|
||||
bottomMargin=10 * mm
|
||||
)
|
||||
|
||||
styles = getSampleStyleSheet()
|
||||
title_style = ParagraphStyle(
|
||||
'CITitle',
|
||||
parent=styles['Normal'],
|
||||
fontName='Helvetica-Bold',
|
||||
fontSize=14,
|
||||
leading=16,
|
||||
textColor=HexColor('#002060'),
|
||||
alignment=TA_LEFT
|
||||
)
|
||||
meta_style = ParagraphStyle(
|
||||
'CIMeta',
|
||||
parent=styles['Normal'],
|
||||
fontName='Helvetica-Oblique',
|
||||
fontSize=8,
|
||||
leading=10,
|
||||
textColor=HexColor('#555555'),
|
||||
alignment=TA_LEFT
|
||||
)
|
||||
cell_style = ParagraphStyle(
|
||||
'CICell',
|
||||
parent=styles['Normal'],
|
||||
fontName='Helvetica',
|
||||
fontSize=7.5,
|
||||
leading=9,
|
||||
alignment=TA_LEFT
|
||||
)
|
||||
cell_center = ParagraphStyle(
|
||||
'CICellCenter',
|
||||
parent=cell_style,
|
||||
alignment=TA_CENTER
|
||||
)
|
||||
|
||||
elements = [
|
||||
Paragraph("<b>LAPORAN CONFIGURATION ITEM (CI) - PT. KERINCI HYDROPOWER</b>", title_style),
|
||||
Spacer(1, 2 * mm),
|
||||
Paragraph(f"Dicetak pada: {datetime.now().strftime('%d %B %Y %H:%M')} WIB | Oleh: {request.user.get_full_name() or request.user.username} | Total: {ci_qs.count()} item", meta_style),
|
||||
Spacer(1, 4 * mm)
|
||||
]
|
||||
|
||||
table_data = [
|
||||
["No", "Kode CI", "Nama Komponen", "Kategori", "Merek/Model", "S/N", "Status", "Kondisi", "Terpasang", "PIC"]
|
||||
]
|
||||
|
||||
for idx, ci in enumerate(ci_qs, 1):
|
||||
installed = ci.installed_on.unit_code if ci.installed_on else "-"
|
||||
pic = ci.assigned_to.name if ci.assigned_to else (ci.installed_on.assigned_to.name if ci.installed_on and ci.installed_on.assigned_to else "-")
|
||||
table_data.append([
|
||||
str(idx),
|
||||
Paragraph(ci.ci_code, cell_center),
|
||||
Paragraph(ci.name, cell_style),
|
||||
Paragraph(ci.get_category_display(), cell_style),
|
||||
Paragraph(f"{ci.brand or ''} {ci.model_series or ''}".strip() or "-", cell_style),
|
||||
Paragraph(ci.serial_number or "-", cell_style),
|
||||
Paragraph(ci.get_status_display(), cell_center),
|
||||
Paragraph(ci.get_condition_display(), cell_center),
|
||||
Paragraph(installed, cell_style),
|
||||
Paragraph(pic, cell_style),
|
||||
])
|
||||
|
||||
col_widths = [10*mm, 28*mm, 45*mm, 26*mm, 35*mm, 30*mm, 25*mm, 23*mm, 28*mm, 27*mm]
|
||||
t = Table(table_data, colWidths=col_widths, repeatRows=1)
|
||||
t.setStyle(TableStyle([
|
||||
('BACKGROUND', (0, 0), (-1, 0), HexColor('#002060')),
|
||||
('TEXTCOLOR', (0, 0), (-1, 0), white),
|
||||
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
|
||||
('FONTSIZE', (0, 0), (-1, 0), 8),
|
||||
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
|
||||
('ALIGN', (0, 0), (0, -1), 'CENTER'),
|
||||
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
|
||||
('TOPPADDING', (0, 0), (-1, -1), 3),
|
||||
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
|
||||
('GRID', (0, 0), (-1, -1), 0.5, HexColor('#DDDDDD')),
|
||||
('ROWBACKGROUNDS', (0, 1), (-1, -1), [white, HexColor('#F9FAFB')]),
|
||||
]))
|
||||
|
||||
elements.append(t)
|
||||
doc.build(elements)
|
||||
|
||||
buffer.seek(0)
|
||||
response = HttpResponse(buffer.getvalue(), content_type='application/pdf')
|
||||
filename = f"laporan_configuration_item_{datetime.now().strftime('%Y%m%d_%H%M%S')}.pdf"
|
||||
response['Content-Disposition'] = f'inline; filename="{filename}"'
|
||||
return response
|
||||
|
||||
@@ -11,6 +11,7 @@ from assets.views import (
|
||||
employee_list, employee_export_pdf, employee_detail, employee_detail_export_pdf,
|
||||
employee_create, employee_edit, employee_delete, employee_activate,
|
||||
ci_list, ci_detail, ci_create, ci_edit, ci_assign, ci_remove, ci_replace, ci_report_damage,
|
||||
ci_export_excel, ci_export_pdf,
|
||||
asset_export_pdf, asset_export_excel, backup_database_view, asset_units_export_excel,
|
||||
unit_history_export_excel, status_aset_export_excel, distribusi_export_excel,
|
||||
employee_export_excel, employee_detail_export_excel,
|
||||
@@ -72,6 +73,8 @@ urlpatterns = [
|
||||
path('karyawan/<int:emp_id>/activate/', employee_activate, name='employee_activate'),
|
||||
# Configuration Items (CI / CMDB)
|
||||
path('ci/', ci_list, name='ci_list'),
|
||||
path('ci/export/', ci_export_pdf, name='ci_export_pdf'),
|
||||
path('ci/export-excel/', ci_export_excel, name='ci_export_excel'),
|
||||
path('ci/create/', ci_create, name='ci_create'),
|
||||
path('ci/<int:ci_id>/', ci_detail, name='ci_detail'),
|
||||
path('ci/<int:ci_id>/edit/', ci_edit, name='ci_edit'),
|
||||
|
||||
+117
-134
@@ -1,204 +1,183 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block page_title %}Configuration Item (CI / CMDB){% endblock %}
|
||||
{% block page_title %}Configuration Item{% endblock %}
|
||||
|
||||
{% block page_title_guide %}Panduan Configuration Item (CMDB){% endblock %}
|
||||
{% block page_guide_content %}
|
||||
<div class="space-y-4">
|
||||
<p>Modul <b>Configuration Item (CI)</b> digunakan untuk melacak dan mengelola komponen hardware modular, peripheral, dan modul pendukung perangkat IT (misalnya: RAM, SSD/HDD, kartu grafis, adaptor, monitor eksternal, mouse, keyboard).</p>
|
||||
<div class="p-3 bg-blue-50 border border-blue-200 rounded-xl">
|
||||
<h4 class="font-bold text-blue-800 text-xs uppercase tracking-wider mb-1">Hubungan Perangkat & Karyawan</h4>
|
||||
<p class="text-xs text-blue-700">Setiap CI dapat berdiri sendiri di gudang (Tersedia), terpasang pada Unit Aset induk (misal: SSD di dalam laptop ACR-GEN11-001), atau dipegang langsung oleh PIC Karyawan.</p>
|
||||
</div>
|
||||
<ul class="list-disc pl-5 space-y-1 text-xs text-gray-600">
|
||||
<li><b>Tersedia:</b> Komponen berada di gudang/workshop IT dan siap dialokasikan.</li>
|
||||
<li><b>Digunakan:</b> Terpasang pada unit perangkat aktif atau dipegang karyawan.</li>
|
||||
<li><b>Maintenance:</b> Sedang dalam proses pengecekan atau servis teknis.</li>
|
||||
<li><b>Pensiun / Bricked:</b> Komponen telah rusak total atau tidak dapat digunakan kembali.</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% 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 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 • CMDB</p>
|
||||
<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">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>
|
||||
<h2 class="text-3xl font-extrabold text-gray-900">Configuration Item</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>
|
||||
<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">
|
||||
<div class="relative inline-block w-full sm:w-auto flex-1 sm:flex-none">
|
||||
<button onclick="var d = document.getElementById('exportMenuCI'); 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 CI</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="exportMenuCI" 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 'ci_export_pdf' %}?status={{ status_filter }}&category={{ category_filter }}&condition={{ condition_filter }}&q={{ search_query }}" 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 'ci_export_excel' %}?status={{ status_filter }}&category={{ category_filter }}&condition={{ condition_filter }}&q={{ search_query }}" 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="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 onclick="openCreateCIModal()" 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 CI</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 %}">
|
||||
<!-- Category Tabs -->
|
||||
<div class="flex space-x-2 mb-6 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 %}{% if condition_filter %}&condition={{ condition_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)
|
||||
<a href="?status=available{% if search_query %}&q={{ search_query }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}{% if condition_filter %}&condition={{ condition_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
|
||||
<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 %}">
|
||||
<a href="?status=in_use{% if search_query %}&q={{ search_query }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}{% if condition_filter %}&condition={{ condition_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
|
||||
<a href="?status=repair{% if search_query %}&q={{ search_query }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}{% if condition_filter %}&condition={{ condition_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 %}">
|
||||
Maintenance
|
||||
<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
|
||||
<a href="?status=retired{% if search_query %}&q={{ search_query }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}{% if condition_filter %}&condition={{ condition_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 %}">
|
||||
Pensiun / 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">
|
||||
<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="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">
|
||||
{% if category_filter %}<input type="hidden" name="category" value="{{ category_filter }}">{% endif %}
|
||||
{% if condition_filter %}<input type="hidden" name="condition" value="{{ condition_filter }}">{% endif %}
|
||||
<input type="text" id="searchInput" name="q" value="{{ search_query }}" placeholder="Cari kode item, nama, S/N, 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>
|
||||
</form>
|
||||
|
||||
<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>
|
||||
<div class="flex items-center space-x-2 w-full sm:w-auto">
|
||||
<select onchange="location = this.value;" class="px-3 py-2 rounded-xl border border-gray-200 text-xs font-semibold focus:outline-none focus:border-kerinci focus:ring-1 focus:ring-kerinci bg-white text-gray-700 shadow-sm">
|
||||
<option value="?status={{ status_filter }}&q={{ search_query }}{% if condition_filter %}&condition={{ condition_filter }}{% endif %}">Semua Kategori</option>
|
||||
{% for cat_val, cat_label in categories %}
|
||||
<option value="{{ cat_val }}" {% if category_filter == cat_val %}selected{% endif %}>{{ cat_label }}</option>
|
||||
<option value="?status={{ status_filter }}&category={{ cat_val }}&q={{ search_query }}{% if condition_filter %}&condition={{ condition_filter }}{% endif %}" {% 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>
|
||||
<select onchange="location = this.value;" class="px-3 py-2 rounded-xl border border-gray-200 text-xs font-semibold focus:outline-none focus:border-kerinci focus:ring-1 focus:ring-kerinci bg-white text-gray-700 shadow-sm">
|
||||
<option value="?status={{ status_filter }}&category={{ category_filter }}&q={{ search_query }}">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>
|
||||
<option value="?status={{ status_filter }}&category={{ category_filter }}&condition={{ cond_val }}&q={{ search_query }}" {% 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">
|
||||
<a href="{% url 'ci_list' %}" class="px-3 py-2 text-xs font-bold text-gray-500 hover:text-red-600 border border-gray-200 hover:border-red-200 rounded-xl bg-white transition-colors shadow-sm" title="Reset Filter">
|
||||
Reset
|
||||
</a>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</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="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-12">No</th>
|
||||
<th class="p-4 font-bold min-w-[130px]">Kode Item</th>
|
||||
<th class="p-4 font-bold text-center w-16">No</th>
|
||||
<th class="p-4 font-bold w-36">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">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>
|
||||
<th class="p-4 font-bold text-center w-36">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-sm divide-y divide-gray-50">
|
||||
<tbody class="text-sm divide-y divide-gray-200">
|
||||
{% 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>
|
||||
<tr class="hover:bg-gray-50 transition-colors">
|
||||
<td class="p-4 text-center text-gray-500">{{ forloop.counter }}</td>
|
||||
<td class="p-4 font-bold text-gray-700 font-mono text-xs">
|
||||
<a href="{% url 'ci_detail' item.id %}" class="hover:text-kerinci transition-colors">
|
||||
{{ item.ci_code }}
|
||||
</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 href="{% url 'ci_detail' item.id %}" class="font-bold text-gray-900 hover:text-kerinci transition-colors block">
|
||||
{{ item.name }}
|
||||
</a>
|
||||
<p class="text-xs text-gray-500 mt-0.5">{{ item.brand|default:"-" }}{% if item.model_series %} • {{ item.model_series }}{% endif %}</p>
|
||||
{% if item.brand or item.model_series %}
|
||||
<p class="text-xs text-gray-500 font-normal mt-0.5">{{ item.brand|default:"" }} {{ item.model_series|default:"" }}</p>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="p-4">
|
||||
<span class="text-xs font-semibold text-gray-700 bg-gray-100 px-2 py-1 rounded-md">
|
||||
<td class="p-4 text-gray-600 font-medium text-xs">
|
||||
{{ 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 class="p-4 text-gray-600 font-mono text-xs">
|
||||
{{ item.serial_number|default:"-" }}
|
||||
</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>
|
||||
<div class="flex items-center space-x-1.5 text-xs text-gray-800">
|
||||
<span class="font-bold text-blue-700 font-mono">{{ item.installed_on.unit_code }}</span>
|
||||
</div>
|
||||
<p class="text-[11px] text-gray-500 truncate" title="{{ item.installed_on.asset.name }}">{{ item.installed_on.asset.name }}</p>
|
||||
{% if item.installed_on.assigned_to %}
|
||||
<p class="text-[11px] text-gray-500">PIC: {{ item.installed_on.assigned_to.name }}</p>
|
||||
<p class="text-[10px] text-gray-400 font-medium">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>
|
||||
<p class="font-bold text-xs text-gray-800">{{ item.assigned_to.name }}</p>
|
||||
<p class="text-[11px] text-gray-500">Pegang Langsung</p>
|
||||
{% else %}
|
||||
<span class="text-xs text-gray-400 italic">-</span>
|
||||
<span class="text-xs text-gray-400 italic">Gudang / Tidak terpasang</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>
|
||||
{% if item.condition == 'new' or 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">{{ item.get_condition_display }}</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>
|
||||
<span class="px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-blue-50 text-blue-700 border border-blue-200">{{ item.get_condition_display }}</span>
|
||||
{% elif item.condition == 'poor' %}
|
||||
<span class="px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-amber-50 text-amber-700 border border-amber-200">{{ item.get_condition_display }}</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>
|
||||
<span class="px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-red-50 text-red-700 border border-red-200">{{ item.get_condition_display }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="p-4 text-center">
|
||||
@@ -207,34 +186,34 @@
|
||||
{% 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>
|
||||
<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">Maintenance</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">
|
||||
<a href="{% url 'ci_detail' item.id %}" class="p-2 bg-gray-50 text-gray-600 hover:bg-gray-100 rounded-lg transition-colors border border-gray-200" title="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)">
|
||||
<button onclick="openAssignModal('{{ item.id }}', '{{ item.ci_code }}', '{{ item.name|escapejs }}')" class="p-2 bg-emerald-50 text-emerald-600 hover:bg-emerald-100 rounded-lg transition-colors border border-emerald-100" title="Pasang / Alokasikan">
|
||||
<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">
|
||||
<button onclick="openReplaceModal('{{ item.id }}', '{{ item.ci_code }}', '{{ item.name|escapejs }}', '{{ item.installed_on.unit_code }}')" class="p-2 bg-blue-50 text-blue-600 hover:bg-blue-100 rounded-lg transition-colors border border-blue-100" 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">
|
||||
<button onclick="openRemoveModal('{{ item.id }}', '{{ item.ci_code }}', '{{ item.name|escapejs }}')" class="p-2 bg-amber-50 text-amber-600 hover:bg-amber-100 rounded-lg transition-colors border border-amber-100" title="Lepas 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="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">
|
||||
<button onclick="openDamageModal('{{ item.id }}', '{{ item.ci_code }}', '{{ item.name|escapejs }}')" class="p-2 bg-red-50 text-red-600 hover:bg-red-100 rounded-lg transition-colors border border-red-100" title="Lapor Kerusakan">
|
||||
<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 %}
|
||||
@@ -243,11 +222,8 @@
|
||||
</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 colspan="9" class="p-8 text-center text-gray-400 text-sm">
|
||||
Belum ada data Configuration Item untuk kategori ini.
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -257,7 +233,6 @@
|
||||
{% 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">
|
||||
@@ -600,5 +575,13 @@
|
||||
function closeDamageModal() {
|
||||
document.getElementById('damageModal').classList.add('hidden');
|
||||
}
|
||||
|
||||
// Close export dropdown when clicking outside
|
||||
window.addEventListener('click', function(e) {
|
||||
const exportMenu = document.getElementById('exportMenuCI');
|
||||
if (exportMenu && !e.target.closest('#exportMenuCI') && !e.target.closest('button')) {
|
||||
exportMenu.style.display = 'none';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
+125
-218
@@ -1,6 +1,6 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block page_title %}Consumable Item & Persediaan IT{% endblock %}
|
||||
{% block page_title %}Consumable Item{% endblock %}
|
||||
|
||||
{% block page_title_guide %}Panduan Modul Consumable Item{% endblock %}
|
||||
{% block page_guide_content %}
|
||||
@@ -11,128 +11,81 @@
|
||||
<p class="text-xs text-emerald-700">Saldo stok tidak dapat diedit sembarangan. Setiap perubahan stok dicatat secara mutlak melalui transaksi atomik: <b>Barang Masuk</b>, <b>Barang Keluar</b>, atau <b>Stock Opname</b> pada buku besar transaksi (stock ledger).</p>
|
||||
</div>
|
||||
<ul class="list-disc pl-5 space-y-1 text-xs text-gray-600">
|
||||
<li><b>Barang Masuk:</b> Mencatat penambahan stok dari pengadaan/pembelian, transfer, atau retur sisa teknisi.</li>
|
||||
<li><b>Barang Keluar:</b> Mencatat konsumsi material oleh teknisi dengan keterkaitan ke tiket support, work order, atau unit aset terkait.</li>
|
||||
<li><b>Barang Masuk:</b> Penambahan stok dari pengadaan/pembelian, transfer, atau retur sisa teknisi.</li>
|
||||
<li><b>Barang Keluar:</b> Konsumsi material oleh teknisi dengan keterkaitan ke tiket support, work order, atau unit aset.</li>
|
||||
<li><b>Stock Opname:</b> Penyesuaian fisik berkala dengan alasan audit yang wajib diisi.</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Top Header & Action Buttons -->
|
||||
<div class="mb-6 flex flex-col sm:flex-row sm:justify-between sm:items-end space-y-4 sm:space-y-0">
|
||||
<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 • Logistik Habis Pakai</p>
|
||||
<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">Consumable Item</h2>
|
||||
<span class="px-2.5 py-0.5 rounded-full text-xs font-extrabold bg-emerald-50 text-emerald-700 border border-emerald-200">
|
||||
Network & Support
|
||||
</span>
|
||||
<button onclick="openGuideModal()" class="text-gray-400 hover:text-kerinci p-1 rounded-lg hover:bg-gray-100 transition-colors" title="Buka Panduan Modul">
|
||||
<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="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
||||
<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>
|
||||
|
||||
<!-- Header Actions -->
|
||||
<div class="flex items-center space-x-3 w-full sm:w-auto">
|
||||
<!-- Ekspor Dropdown -->
|
||||
<div class="relative inline-block w-full sm:w-auto flex-1 sm:flex-none">
|
||||
<button onclick="var d = document.getElementById('exportMenuConsumable'); 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 Consumable</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="exportMenuConsumable" 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 'consumable_export_pdf' %}?q={{ search_query }}&category={{ category_filter }}&status={{ status_filter }}" 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 'consumable_export_excel' %}?q={{ search_query }}&category={{ category_filter }}&status={{ status_filter }}" 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>
|
||||
<p class="text-xs text-gray-500 mt-1">Pengelolaan persediaan kabel, konektor RJ45, thermal paste, cable ties, fastener, dan perlengkapan teknisi IT.</p>
|
||||
</div>
|
||||
|
||||
<!-- Quick Action Buttons -->
|
||||
<div class="flex flex-wrap items-center gap-2 w-full sm:w-auto">
|
||||
{% if not is_read_only %}
|
||||
<button onclick="openModalBarangMasuk()" class="bg-blue-600 text-white px-3.5 py-2.5 rounded-xl text-xs font-bold shadow-sm shadow-blue-500/20 hover:bg-blue-700 transition-colors flex items-center space-x-1.5">
|
||||
<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 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"></path></svg>
|
||||
<span>Barang Masuk</span>
|
||||
<!-- Transaksi Stok Dropdown -->
|
||||
<div class="relative inline-block w-full sm:w-auto flex-1 sm:flex-none">
|
||||
<button onclick="var d = document.getElementById('trxMenuConsumable'); d.style.display = d.style.display === 'block' ? 'none' : 'block'; event.stopPropagation();" class="w-full border border-gray-300 bg-white text-gray-700 rounded-xl px-4 py-2 text-sm font-bold hover:bg-gray-50 transition-colors flex items-center space-x-2 justify-center shadow-sm">
|
||||
<svg class="w-4 h-4 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"></path></svg>
|
||||
<span>Transaksi Stok</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>
|
||||
<button onclick="openModalBarangKeluar()" class="bg-amber-600 text-white px-3.5 py-2.5 rounded-xl text-xs font-bold shadow-sm shadow-amber-500/20 hover:bg-amber-700 transition-colors flex items-center space-x-1.5">
|
||||
<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 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"></path></svg>
|
||||
<span>Barang Keluar</span>
|
||||
<div id="trxMenuConsumable" style="display: none;" class="absolute right-0 mt-2 w-52 bg-white rounded-xl shadow-[0_8px_30px_rgb(0,0,0,0.12)] border border-gray-100 z-50 py-1">
|
||||
<button onclick="document.getElementById('trxMenuConsumable').style.display='none'; openModalBarangMasuk();" class="w-full flex items-center px-4 py-2.5 text-sm text-gray-700 hover:bg-blue-50 hover:text-blue-700 font-bold transition-colors text-left">
|
||||
<svg class="w-4 h-4 mr-2.5 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"></path></svg>
|
||||
Barang Masuk
|
||||
</button>
|
||||
<button onclick="openModalOpname()" class="bg-purple-600 text-white px-3.5 py-2.5 rounded-xl text-xs font-bold shadow-sm shadow-purple-500/20 hover:bg-purple-700 transition-colors flex items-center space-x-1.5">
|
||||
<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 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path></svg>
|
||||
<span>Stock Opname</span>
|
||||
<button onclick="document.getElementById('trxMenuConsumable').style.display='none'; openModalBarangKeluar();" class="w-full flex items-center px-4 py-2.5 text-sm text-gray-700 hover:bg-amber-50 hover:text-amber-700 font-bold transition-colors text-left">
|
||||
<svg class="w-4 h-4 mr-2.5 text-amber-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"></path></svg>
|
||||
Barang Keluar
|
||||
</button>
|
||||
<button onclick="openCreateItemModal()" class="bg-kerinci text-white px-4 py-2.5 rounded-xl text-xs font-bold shadow-sm shadow-kerinci/30 hover:bg-kerinci/90 transition-colors flex items-center space-x-1.5">
|
||||
<div class="h-px bg-gray-100 mx-2"></div>
|
||||
<button onclick="document.getElementById('trxMenuConsumable').style.display='none'; openModalOpname();" class="w-full flex items-center px-4 py-2.5 text-sm text-gray-700 hover:bg-purple-50 hover:text-purple-700 font-bold transition-colors text-left">
|
||||
<svg class="w-4 h-4 mr-2.5 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path></svg>
|
||||
Stock Opname
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tambah Item Button -->
|
||||
<button onclick="openCreateItemModal()" 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 Item</span>
|
||||
<span>Tambah Item</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
|
||||
<!-- Export Dropdown / Buttons -->
|
||||
<div class="flex items-center space-x-1 pl-1">
|
||||
<a href="{% url 'consumable_export_excel' %}?q={{ search_query }}&category={{ category_filter }}&status={{ status_filter }}" class="p-2.5 rounded-xl border border-gray-200 bg-white hover:bg-gray-50 text-emerald-700 transition-colors shadow-sm" title="Ekspor Excel">
|
||||
<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>
|
||||
</a>
|
||||
<a href="{% url 'consumable_export_pdf' %}?q={{ search_query }}&category={{ category_filter }}&status={{ status_filter }}" target="_blank" class="p-2.5 rounded-xl border border-gray-200 bg-white hover:bg-gray-50 text-red-600 transition-colors shadow-sm" title="Ekspor PDF">
|
||||
<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="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>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- KPI Summary Cards -->
|
||||
<div class="grid grid-cols-2 lg:grid-cols-5 gap-3.5 mb-6">
|
||||
<!-- Total Jenis Item -->
|
||||
<div class="bg-white p-4 rounded-2xl border border-gray-100 shadow-sm flex items-center justify-between">
|
||||
<div>
|
||||
<p class="text-[11px] font-bold text-gray-400 uppercase tracking-wider mb-0.5">Total Jenis</p>
|
||||
<h3 class="text-2xl font-black text-gray-900">{{ counts.total }}</h3>
|
||||
<p class="text-[10px] text-gray-400">Item Terdaftar</p>
|
||||
</div>
|
||||
<div class="w-10 h-10 bg-emerald-50 text-kerinci rounded-xl flex items-center justify-center font-bold">
|
||||
<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="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"></path></svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Akumulasi Stok Fisik -->
|
||||
<div class="bg-white p-4 rounded-2xl border border-gray-100 shadow-sm flex items-center justify-between">
|
||||
<div>
|
||||
<p class="text-[11px] font-bold text-blue-600 uppercase tracking-wider mb-0.5" title="Jumlah agregat kuantitas seluruh item">Akumulasi Stok</p>
|
||||
<h3 class="text-2xl font-black text-blue-900">{{ counts.total_qty|floatformat:0 }}</h3>
|
||||
<p class="text-[10px] text-blue-500" title="Agregat lintas satuan (pcs, meter, roll, dsb)">*Agregat kuantitas</p>
|
||||
</div>
|
||||
<div class="w-10 h-10 bg-blue-50 text-blue-600 rounded-xl flex items-center justify-center font-bold">
|
||||
<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="M7 12l3-3 3 3 4-4M8 21l4-4 4 4M3 4h18M4 4h16v12a1 1 0 01-1 1H5a1 1 0 01-1-1V4z"></path></svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stok Tersedia Aman -->
|
||||
<div class="bg-white p-4 rounded-2xl border border-gray-100 shadow-sm flex items-center justify-between">
|
||||
<div>
|
||||
<p class="text-[11px] font-bold text-emerald-600 uppercase tracking-wider mb-0.5">Stok Normal</p>
|
||||
<h3 class="text-2xl font-black text-emerald-900">{{ counts.available }}</h3>
|
||||
<p class="text-[10px] text-emerald-500">Di atas batas min</p>
|
||||
</div>
|
||||
<div class="w-10 h-10 bg-emerald-50 text-emerald-600 rounded-xl flex items-center justify-center font-bold">
|
||||
<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>
|
||||
|
||||
<!-- Stok Menipis -->
|
||||
<div class="bg-white p-4 rounded-2xl border border-gray-100 shadow-sm flex items-center justify-between">
|
||||
<div>
|
||||
<p class="text-[11px] font-bold text-amber-600 uppercase tracking-wider mb-0.5">Stok Menipis</p>
|
||||
<h3 class="text-2xl font-black text-amber-900">{{ counts.low_stock }}</h3>
|
||||
<p class="text-[10px] text-amber-500">Perlu reorder</p>
|
||||
</div>
|
||||
<div class="w-10 h-10 bg-amber-50 text-amber-600 rounded-xl flex items-center justify-center font-bold">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stok Habis -->
|
||||
<div class="bg-white p-4 rounded-2xl border border-gray-100 shadow-sm flex items-center justify-between col-span-2 lg:col-span-1">
|
||||
<div>
|
||||
<p class="text-[11px] font-bold text-red-600 uppercase tracking-wider mb-0.5">Stok Habis</p>
|
||||
<h3 class="text-2xl font-black text-red-900">{{ counts.out_of_stock }}</h3>
|
||||
<p class="text-[10px] text-red-500">Saldo 0</p>
|
||||
</div>
|
||||
<div class="w-10 h-10 bg-red-50 text-red-600 rounded-xl flex items-center justify-center font-bold">
|
||||
<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="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"></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">
|
||||
<!-- Category Tabs -->
|
||||
<div class="flex space-x-2 mb-6 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 %}{% if location_filter %}&location={{ location_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 Item
|
||||
<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>
|
||||
@@ -141,161 +94,118 @@
|
||||
Stok Aman
|
||||
<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=low_stock{% if search_query %}&q={{ search_query }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}{% if location_filter %}&location={{ location_filter }}{% endif %}" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if status_filter == 'low_stock' %}border-amber-600 text-amber-600{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||||
<a href="?status=low_stock{% if search_query %}&q={{ search_query }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}{% if location_filter %}&location={{ location_filter }}{% endif %}" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if status_filter == 'low_stock' %}border-kerinci text-kerinci{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||||
Stok Menipis
|
||||
<span class="ml-2 {% if status_filter == 'low_stock' %}bg-amber-100 text-amber-700{% else %}bg-gray-100 text-gray-500{% endif %} text-[10px] px-2 py-0.5 rounded-full font-extrabold">{{ counts.low_stock }}</span>
|
||||
</a>
|
||||
<a href="?status=out_of_stock{% if search_query %}&q={{ search_query }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}{% if location_filter %}&location={{ location_filter }}{% endif %}" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if status_filter == 'out_of_stock' %}border-red-600 text-red-600{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||||
<a href="?status=out_of_stock{% if search_query %}&q={{ search_query }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}{% if location_filter %}&location={{ location_filter }}{% endif %}" class="px-5 py-3 text-sm font-bold border-b-2 transition-colors flex items-center {% if status_filter == 'out_of_stock' %}border-kerinci text-kerinci{% else %}border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300{% endif %}">
|
||||
Stok Habis
|
||||
<span class="ml-2 {% if status_filter == 'out_of_stock' %}bg-red-100 text-red-700{% else %}bg-gray-100 text-gray-500{% endif %} text-[10px] px-2 py-0.5 rounded-full font-extrabold">{{ counts.out_of_stock }}</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Filters & Search Bar -->
|
||||
<div class="mb-5 flex flex-col md:flex-row md:items-center justify-between gap-3">
|
||||
<form id="filterForm" method="GET" class="flex flex-wrap items-center gap-2 w-full">
|
||||
<!-- Filters & Search -->
|
||||
<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="status" value="{{ status_filter }}">
|
||||
<div class="relative flex-1 min-w-[240px]">
|
||||
<input type="text" name="q" value="{{ search_query }}" placeholder="Cari kode barang, nama, merek, spesifikasi, lokasi..." 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">
|
||||
{% if category_filter %}<input type="hidden" name="category" value="{{ category_filter }}">{% endif %}
|
||||
{% if location_filter %}<input type="hidden" name="location" value="{{ location_filter }}">{% endif %}
|
||||
<input type="text" id="searchInput" name="q" value="{{ search_query }}" placeholder="Cari kode barang, nama, merek, atau spesifikasi..." 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>
|
||||
</form>
|
||||
|
||||
<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>
|
||||
<div class="flex items-center space-x-2 w-full sm:w-auto">
|
||||
<select onchange="location = this.value;" class="px-3 py-2 rounded-xl border border-gray-200 text-xs font-semibold focus:outline-none focus:border-kerinci focus:ring-1 focus:ring-kerinci bg-white text-gray-700 shadow-sm">
|
||||
<option value="?status={{ status_filter }}&q={{ search_query }}{% if location_filter %}&location={{ location_filter }}{% endif %}">Semua Kategori</option>
|
||||
{% for cat_val, cat_label in categories %}
|
||||
<option value="{{ cat_val }}" {% if category_filter == cat_val %}selected{% endif %}>{{ cat_label }}</option>
|
||||
<option value="?status={{ status_filter }}&category={{ cat_val }}&q={{ search_query }}{% if location_filter %}&location={{ location_filter }}{% endif %}" {% if category_filter == cat_val %}selected{% endif %}>{{ cat_label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<select name="location" 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 Lokasi</option>
|
||||
<select onchange="location = this.value;" class="px-3 py-2 rounded-xl border border-gray-200 text-xs font-semibold focus:outline-none focus:border-kerinci focus:ring-1 focus:ring-kerinci bg-white text-gray-700 shadow-sm">
|
||||
<option value="?status={{ status_filter }}&category={{ category_filter }}&q={{ search_query }}">Semua Lokasi</option>
|
||||
{% for loc in locations %}
|
||||
<option value="{{ loc }}" {% if location_filter == loc %}selected{% endif %}>{{ loc }}</option>
|
||||
<option value="?status={{ status_filter }}&category={{ category_filter }}&location={{ loc }}&q={{ search_query }}" {% if location_filter == loc %}selected{% endif %}>{{ loc }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
{% if search_query or category_filter or location_filter or status_filter %}
|
||||
<a href="{% url 'consumable_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 Semua Filter">
|
||||
<a href="{% url 'consumable_list' %}" class="px-3 py-2 text-xs font-bold text-gray-500 hover:text-red-600 border border-gray-200 hover:border-red-200 rounded-xl bg-white transition-colors shadow-sm" title="Reset Filter">
|
||||
Reset
|
||||
</a>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Consumable Item Table Card -->
|
||||
<div class="bg-white rounded-2xl shadow-sm border border-gray-200 overflow-hidden">
|
||||
<!-- Main Data 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 min-w-[900px]">
|
||||
<table class="w-full text-left border-collapse">
|
||||
<thead>
|
||||
<tr class="bg-gray-50/75 border-b border-gray-200 text-[11px] font-bold text-gray-500 uppercase tracking-wider">
|
||||
<th class="py-3.5 px-4">Kode Item</th>
|
||||
<th class="py-3.5 px-4">Nama Barang & Merek</th>
|
||||
<th class="py-3.5 px-4">Kategori</th>
|
||||
<th class="py-3.5 px-4">Spesifikasi</th>
|
||||
<th class="py-3.5 px-4 text-center">Satuan</th>
|
||||
<th class="py-3.5 px-4 text-right">Stok Tersedia</th>
|
||||
<th class="py-3.5 px-4 text-right">Stok Min</th>
|
||||
<th class="py-3.5 px-4">Lokasi</th>
|
||||
<th class="py-3.5 px-4 text-center">Status</th>
|
||||
<th class="py-3.5 px-4 text-center">Aksi</th>
|
||||
<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-36">Kode Item</th>
|
||||
<th class="p-4 font-bold min-w-[200px]">Nama Barang & Merek</th>
|
||||
<th class="p-4 font-bold">Kategori</th>
|
||||
<th class="p-4 font-bold min-w-[160px]">Spesifikasi</th>
|
||||
<th class="p-4 font-bold text-center">Satuan</th>
|
||||
<th class="p-4 font-bold text-center">Stok</th>
|
||||
<th class="p-4 font-bold">Lokasi</th>
|
||||
<th class="p-4 font-bold text-center">Status</th>
|
||||
<th class="p-4 font-bold text-center w-28">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100 text-sm">
|
||||
<tbody class="text-sm divide-y divide-gray-200">
|
||||
{% for item in page_obj %}
|
||||
<tr class="hover:bg-gray-50/80 transition-colors">
|
||||
<!-- Kode Item -->
|
||||
<td class="py-3.5 px-4 whitespace-nowrap">
|
||||
<a href="{% url 'consumable_detail' item.id %}" class="font-mono text-xs font-bold text-kerinci hover:underline">
|
||||
<tr class="hover:bg-gray-50 transition-colors">
|
||||
<td class="p-4 text-center text-gray-500">{{ forloop.counter }}</td>
|
||||
<td class="p-4 font-bold text-gray-700 font-mono text-xs">
|
||||
<a href="{% url 'consumable_detail' item.id %}" class="hover:text-kerinci transition-colors">
|
||||
{{ item.item_code }}
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<!-- Nama Barang & Merek -->
|
||||
<td class="py-3.5 px-4">
|
||||
<div class="font-bold text-gray-900 leading-snug">
|
||||
<a href="{% url 'consumable_detail' item.id %}" class="hover:text-kerinci">
|
||||
<td class="p-4">
|
||||
<a href="{% url 'consumable_detail' item.id %}" class="font-bold text-gray-900 hover:text-kerinci transition-colors block">
|
||||
{{ item.name }}
|
||||
</a>
|
||||
</div>
|
||||
{% if item.brand %}
|
||||
<div class="text-[11px] text-gray-400 font-medium">Merek: {{ item.brand }}</div>
|
||||
<p class="text-xs text-gray-500 font-normal mt-0.5">Merek: {{ item.brand }}</p>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<!-- Kategori -->
|
||||
<td class="py-3.5 px-4 whitespace-nowrap">
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded-lg text-xs font-medium bg-gray-100 text-gray-700">
|
||||
{{ item.get_category_display|truncatewords:2 }}
|
||||
</span>
|
||||
<td class="p-4 text-gray-600 font-medium text-xs">
|
||||
{{ item.get_category_display }}
|
||||
</td>
|
||||
|
||||
<!-- Spesifikasi -->
|
||||
<td class="py-3.5 px-4 text-xs text-gray-600 max-w-[220px]">
|
||||
<td class="p-4 text-xs text-gray-500 max-w-[220px]">
|
||||
<span class="line-clamp-2" title="{{ item.specification }}">{{ item.specification|default:"-" }}</span>
|
||||
</td>
|
||||
|
||||
<!-- Satuan & Konversi -->
|
||||
<td class="py-3.5 px-4 text-center whitespace-nowrap">
|
||||
<span class="font-semibold text-gray-700 text-xs">{{ item.base_unit }}</span>
|
||||
{% if item.purchase_unit %}
|
||||
<div class="text-[10px] text-gray-400" title="1 {{ item.purchase_unit }} = {{ item.conversion_rate }} {{ item.base_unit }}">
|
||||
1 {{ item.purchase_unit }} = {{ item.conversion_rate|floatformat:0 }} {{ item.base_unit }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<td class="p-4 text-center text-gray-700 font-semibold text-xs">
|
||||
{{ item.base_unit }}
|
||||
</td>
|
||||
|
||||
<!-- Stok Tersedia -->
|
||||
<td class="py-3.5 px-4 text-right whitespace-nowrap">
|
||||
<span class="text-base font-extrabold {% if item.stock_status == 'out_of_stock' %}text-red-600{% elif item.stock_status == 'low_stock' %}text-amber-600{% else %}text-emerald-700{% endif %}">
|
||||
{{ item.formatted_stock }}
|
||||
</span>
|
||||
<td class="p-4 text-center">
|
||||
<span class="font-extrabold {% if item.stock_status == 'out_of_stock' %}text-red-600{% elif item.stock_status == 'low_stock' %}text-amber-600{% else %}text-emerald-600{% endif %}">{{ item.formatted_stock }}</span>
|
||||
<span class="text-gray-300 mx-1">/</span>
|
||||
<span class="text-gray-400 text-xs" title="Batas Minimum Stok">{{ item.minimum_stock|floatformat:0 }}</span>
|
||||
</td>
|
||||
|
||||
<!-- Stok Minimum -->
|
||||
<td class="py-3.5 px-4 text-right whitespace-nowrap text-xs text-gray-500 font-medium">
|
||||
{{ item.formatted_minimum_stock }}
|
||||
</td>
|
||||
|
||||
<!-- Lokasi -->
|
||||
<td class="py-3.5 px-4 whitespace-nowrap text-xs text-gray-600">
|
||||
<span class="inline-flex items-center gap-1">
|
||||
<svg class="w-3.5 h-3.5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"></path></svg>
|
||||
<td class="p-4 text-gray-600 text-xs font-medium">
|
||||
{{ item.location }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<!-- Status Stok Badge -->
|
||||
<td class="py-3.5 px-4 text-center whitespace-nowrap">
|
||||
<td class="p-4 text-center">
|
||||
{% if item.stock_status == 'out_of_stock' %}
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-red-100 text-red-700 border border-red-200">
|
||||
<span class="w-1.5 h-1.5 rounded-full bg-red-500 mr-1.5"></span>
|
||||
Habis
|
||||
</span>
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold bg-red-50 text-red-700 border border-red-200">Habis</span>
|
||||
{% elif item.stock_status == 'low_stock' %}
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-amber-100 text-amber-800 border border-amber-200">
|
||||
<span class="w-1.5 h-1.5 rounded-full bg-amber-500 mr-1.5"></span>
|
||||
Menipis
|
||||
</span>
|
||||
<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">Menipis</span>
|
||||
{% else %}
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-emerald-100 text-emerald-800 border border-emerald-200">
|
||||
<span class="w-1.5 h-1.5 rounded-full bg-emerald-500 mr-1.5"></span>
|
||||
Tersedia
|
||||
</span>
|
||||
<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">Aman</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<!-- Aksi -->
|
||||
<td class="py-3.5 px-4 text-center whitespace-nowrap">
|
||||
<td class="p-4 text-center">
|
||||
<div class="flex items-center justify-center space-x-1.5">
|
||||
<a href="{% url 'consumable_detail' item.id %}" class="p-1.5 text-gray-500 hover:text-kerinci hover:bg-gray-100 rounded-lg transition-colors" title="Buku Besar & Riwayat Lengkap">
|
||||
<a href="{% url 'consumable_detail' item.id %}" class="p-2 bg-gray-50 text-gray-600 hover:bg-gray-100 rounded-lg transition-colors border border-gray-200" title="Buku Besar & Detail">
|
||||
<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 %}
|
||||
<button onclick="openModalBarangMasukItem('{{ item.id }}', '{{ item.name|escapejs }}', '{{ item.base_unit }}', '{{ item.purchase_unit|default:'' }}')" class="p-1.5 text-blue-600 hover:text-blue-800 hover:bg-blue-50 rounded-lg transition-colors" title="Tambah Stok (Barang Masuk)">
|
||||
<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>
|
||||
<button onclick="openModalBarangKeluarItem('{{ item.id }}', '{{ item.name|escapejs }}', '{{ item.base_unit }}', '{{ item.stock_available }}')" class="p-1.5 text-amber-600 hover:text-amber-800 hover:bg-amber-50 rounded-lg transition-colors" title="Gunakan / Keluarkan Barang">
|
||||
<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="M20 12H4"></path></svg>
|
||||
<button onclick="openEditModal('{{ item.id }}', '{{ item.item_code }}', '{{ item.name|escapejs }}', '{{ item.category }}', '{{ item.brand|default:''|escapejs }}', '{{ item.specification|default:''|escapejs }}', '{{ item.base_unit|escapejs }}', '{{ item.purchase_unit|default:''|escapejs }}', '{{ item.conversion_rate|default:1 }}', '{{ item.minimum_stock|default:0 }}', '{{ item.unit_price|default:0 }}', '{{ item.location|escapejs }}')" class="p-2 bg-amber-50 text-amber-600 hover:bg-amber-100 rounded-lg transition-colors border border-amber-100" title="Edit Item">
|
||||
<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>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -303,32 +213,17 @@
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="10" class="py-12 text-center text-gray-500">
|
||||
<div class="flex flex-col items-center justify-center">
|
||||
<div class="w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center text-gray-400 mb-3">
|
||||
<svg class="w-8 h-8" 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>
|
||||
<h4 class="text-base font-bold text-gray-800">Tidak ada consumable item ditemukan</h4>
|
||||
<p class="text-xs text-gray-400 mt-1 max-w-sm">
|
||||
{% if search_query or category_filter or location_filter or status_filter %}
|
||||
Tidak ada data yang cocok dengan kriteria pencarian atau filter yang diterapkan.
|
||||
{% else %}
|
||||
Belum ada data barang habis pakai. Klik tombol "+ Tambah Item" di atas untuk mendaftarkan barang baru.
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
<td colspan="10" class="p-8 text-center text-gray-400 text-sm">
|
||||
Belum ada data Consumable Item untuk kategori ini.
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Paginasi -->
|
||||
{% include 'components/pagination.html' %}
|
||||
</div>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<!-- MODAL 1: Tambah Consumable Item Baru -->
|
||||
<!-- ========================================================================= -->
|
||||
<div id="modalCreateItem" class="fixed inset-0 z-50 hidden overflow-y-auto bg-gray-900/50 backdrop-blur-sm flex items-center justify-center p-4">
|
||||
@@ -901,5 +796,17 @@
|
||||
diffDisplay.className = 'text-lg font-black text-gray-500';
|
||||
}
|
||||
}
|
||||
|
||||
// Close dropdowns when clicking outside
|
||||
window.addEventListener('click', function(e) {
|
||||
const exportMenu = document.getElementById('exportMenuConsumable');
|
||||
if (exportMenu && !e.target.closest('#exportMenuConsumable') && !e.target.closest('button')) {
|
||||
exportMenu.style.display = 'none';
|
||||
}
|
||||
const trxMenu = document.getElementById('trxMenuConsumable');
|
||||
if (trxMenu && !e.target.closest('#trxMenuConsumable') && !e.target.closest('button')) {
|
||||
trxMenu.style.display = 'none';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user