Compare commits
11
Commits
9a5079e5f6
...
cd6a1e6034
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd6a1e6034 | ||
|
|
4d09fe29bd | ||
|
|
2713e89543 | ||
|
|
d3dfe4be3c | ||
|
|
78161aed01 | ||
|
|
5593bd9ccc | ||
|
|
1b645deff7 | ||
|
|
4bfeb96c4c | ||
|
|
08fecbc437 | ||
|
|
10a4c83f3b | ||
|
|
fc7abb013f |
@@ -0,0 +1,519 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.contrib.auth.models import User
|
||||
from assets.models import ConfigurationItem, CIHistory, AssetUnit, Employee
|
||||
from datetime import date, timedelta
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Mengisi sampel data dummy Configuration Item (CI) dan riwayatnya untuk IT Asset Management'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
self.stdout.write(self.style.NOTICE("Memeriksa dan mengisi data dummy Configuration Item (CI)..."))
|
||||
|
||||
admin_user = User.objects.filter(is_superuser=True).first()
|
||||
today = date.today()
|
||||
|
||||
# Dapatkan referensi unit dan karyawan yang ada di sistem
|
||||
unit_thinkpad = AssetUnit.objects.filter(unit_code='LNV-GEN12-001').first()
|
||||
unit_router = AssetUnit.objects.filter(unit_code='TPL-01-001').first()
|
||||
unit_acer2 = AssetUnit.objects.filter(unit_code='ACR-GEN11-002').first()
|
||||
unit_acer3 = AssetUnit.objects.filter(unit_code='ACR-GEN11-003').first()
|
||||
|
||||
emp_rayyan = Employee.objects.filter(name__icontains='Rayyan').first()
|
||||
emp_budi = Employee.objects.filter(name__icontains='Budi').first()
|
||||
emp_fallback = Employee.objects.first()
|
||||
|
||||
sample_cis = [
|
||||
# 1. STORAGE
|
||||
{
|
||||
'ci_code': 'CI-SSD-001',
|
||||
'name': 'Samsung SSD 980 PRO 1TB NVMe M.2 PCIe 4.0',
|
||||
'category': 'storage',
|
||||
'brand': 'Samsung',
|
||||
'model_series': '980 PRO 1TB (MZ-V8P1T0BW)',
|
||||
'serial_number': 'S6B1NF0R102938A',
|
||||
'specifications': 'Read up to 7,000 MB/s, Write up to 5,000 MB/s, V-NAND 3-bit MLC, PCIe Gen 4.0 x4',
|
||||
'status': 'in_use',
|
||||
'condition': 'good',
|
||||
'installed_on': unit_thinkpad,
|
||||
'assigned_to': None,
|
||||
'location': 'Terpasang di Laptop Rayyan Adam',
|
||||
'purchase_date': today - timedelta(days=240),
|
||||
'warranty_expiry': today + timedelta(days=850),
|
||||
'price': Decimal('2150000.00'),
|
||||
'notes': 'Upgrade storage utama workstation dev.',
|
||||
'history_action': 'installed',
|
||||
'history_notes': 'Dipasang sebagai upgrade SSD internal ThinkPad LNV-GEN12-001.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-SSD-002',
|
||||
'name': 'Kingston NV2 SSD 500GB NVMe PCIe 4.0 M.2',
|
||||
'category': 'storage',
|
||||
'brand': 'Kingston',
|
||||
'model_series': 'NV2 500G (SNV2S/500G)',
|
||||
'serial_number': '50026B7685930211',
|
||||
'specifications': 'Read 3,500 MB/s, Write 2,100 MB/s, Form Factor M.2 2280',
|
||||
'status': 'available',
|
||||
'condition': 'new',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Gudang IT - Lemari Sparepart Rak 2',
|
||||
'purchase_date': today - timedelta(days=45),
|
||||
'warranty_expiry': today + timedelta(days=1050),
|
||||
'price': Decimal('620000.00'),
|
||||
'notes': 'Stok cadangan untuk penggantian darurat laptop operasional.',
|
||||
'history_action': 'created',
|
||||
'history_notes': 'Penerimaan barang pengadaan sparepart Q4.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-HDD-001',
|
||||
'name': 'Seagate IronWolf 4TB NAS Internal Hard Drive 3.5"',
|
||||
'category': 'storage',
|
||||
'brand': 'Seagate',
|
||||
'model_series': 'IronWolf ST4000VN006',
|
||||
'serial_number': 'WSD389102377',
|
||||
'specifications': '5400 RPM, 256MB Cache, SATA 6.0Gb/s 3.5", AgileArray Technology',
|
||||
'status': 'available',
|
||||
'condition': 'good',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Ruang Server - Rak Storage Backup',
|
||||
'purchase_date': today - timedelta(days=180),
|
||||
'warranty_expiry': today + timedelta(days=550),
|
||||
'price': Decimal('1750000.00'),
|
||||
'notes': 'HDD spare untuk array Synology NAS Ruang Server.',
|
||||
'history_action': 'created',
|
||||
'history_notes': 'Penyimpanan cadangan cold spare NAS server.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-SSD-003',
|
||||
'name': 'Western Digital Blue 2.5" SATA SSD 500GB',
|
||||
'category': 'storage',
|
||||
'brand': 'Western Digital',
|
||||
'model_series': 'WD Blue SA510',
|
||||
'serial_number': 'WD-WCC4N728190',
|
||||
'specifications': 'SATA III 6 Gb/s 2.5 Inch 7mm, Read up to 560 MB/s',
|
||||
'status': 'under_inspection',
|
||||
'condition': 'fair',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Workshop IT - Meja Diagnostic',
|
||||
'purchase_date': today - timedelta(days=400),
|
||||
'warranty_expiry': today + timedelta(days=300),
|
||||
'price': Decimal('750000.00'),
|
||||
'notes': 'Dilepas dari PC Administrasi karena ada laporan I/O error sporadis.',
|
||||
'history_action': 'status_change',
|
||||
'history_notes': 'Sedang dilakukan health test SMART diagnostic sektor.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-HDD-002',
|
||||
'name': 'WD Black 1TB 2.5" HDD SATA 7200 RPM',
|
||||
'category': 'storage',
|
||||
'brand': 'Western Digital',
|
||||
'model_series': 'WD10SPSX',
|
||||
'serial_number': 'WX31A6729012',
|
||||
'specifications': '7200 RPM, 64MB Cache, SATA 6Gb/s',
|
||||
'status': 'retired',
|
||||
'condition': 'damaged',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Gudang Limbah IT - Kotak Scrap',
|
||||
'purchase_date': today - timedelta(days=1200),
|
||||
'warranty_expiry': today - timedelta(days=100),
|
||||
'price': Decimal('950000.00'),
|
||||
'notes': 'Mengalami bad sector parah dan unrecoverable read error. Selesai diaudit scrap.',
|
||||
'history_action': 'retired',
|
||||
'history_notes': 'Dipensiunkan dan didekripsikan untuk dimusnahkan sesuai SOP IT security.'
|
||||
},
|
||||
|
||||
# 2. MEMORY (RAM)
|
||||
{
|
||||
'ci_code': 'CI-RAM-001',
|
||||
'name': 'Corsair Vengeance SODIMM DDR4 16GB 3200MHz',
|
||||
'category': 'memory',
|
||||
'brand': 'Corsair',
|
||||
'model_series': 'CMSX16GX4M1A3200C22',
|
||||
'serial_number': 'CRS-16GB-829103',
|
||||
'specifications': '16GB DDR4 SODIMM 3200MHz CL22 1.2V Non-ECC',
|
||||
'status': 'in_use',
|
||||
'condition': 'good',
|
||||
'installed_on': unit_acer2,
|
||||
'assigned_to': None,
|
||||
'location': 'Terpasang di Laptop Acer Legion ACR-GEN11-002',
|
||||
'purchase_date': today - timedelta(days=190),
|
||||
'warranty_expiry': today + timedelta(days=900),
|
||||
'price': Decimal('750000.00'),
|
||||
'notes': 'Penambahan RAM laptop grafis Rayyan Adam.',
|
||||
'history_action': 'installed',
|
||||
'history_notes': 'Pemasangan ekspansi RAM di slot kedua laptop.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-RAM-002',
|
||||
'name': 'Kingston Fury Beast DDR4 16GB (2x8GB) 3200MHz',
|
||||
'category': 'memory',
|
||||
'brand': 'Kingston',
|
||||
'model_series': 'KF432C16BBK2/16',
|
||||
'serial_number': 'KF-DDR4-992101',
|
||||
'specifications': 'Dual Channel Kit 2x8GB DDR4-3200 CL16-18-18 1.35V Black Heatsink',
|
||||
'status': 'available',
|
||||
'condition': 'new',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Gudang IT - Laci RAM & Storage',
|
||||
'purchase_date': today - timedelta(days=30),
|
||||
'warranty_expiry': today + timedelta(days=1400),
|
||||
'price': Decimal('890000.00'),
|
||||
'notes': 'Stok cadangan untuk PC engineering GIS.',
|
||||
'history_action': 'created',
|
||||
'history_notes': 'Registrasi item komponen baru di gudang.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-RAM-003',
|
||||
'name': 'Samsung DDR4 8GB 2666MHz SODIMM Original',
|
||||
'category': 'memory',
|
||||
'brand': 'Samsung',
|
||||
'model_series': 'M471A1K43CB1-CTD',
|
||||
'serial_number': 'SAM-D4-738192',
|
||||
'specifications': '8GB DDR4 2666V SODIMM 1Rx8 CL19 1.2V',
|
||||
'status': 'available',
|
||||
'condition': 'fair',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Gudang IT - Laci RAM Bekas Pakai',
|
||||
'purchase_date': today - timedelta(days=500),
|
||||
'warranty_expiry': today + timedelta(days=200),
|
||||
'price': Decimal('420000.00'),
|
||||
'notes': 'RAM copotan laptop Lenovo lama, kondisi normal 100% lulus MemTest86.',
|
||||
'history_action': 'returned',
|
||||
'history_notes': 'Dikembalikan ke inventaris gudang setelah laptop donor diganti.'
|
||||
},
|
||||
|
||||
# 3. PROCESSOR & MOTHERBOARD
|
||||
{
|
||||
'ci_code': 'CI-CPU-001',
|
||||
'name': 'Intel Core i7-12700K Processor 25M Cache up to 5.00 GHz',
|
||||
'category': 'processor',
|
||||
'brand': 'Intel',
|
||||
'model_series': 'Core i7 12th Gen (BX8071512700K)',
|
||||
'serial_number': 'V219B82918231',
|
||||
'specifications': '12 Cores (8P + 4E), 20 Threads, LGA1700, Intel UHD Graphics 770',
|
||||
'status': 'available',
|
||||
'condition': 'good',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Ruang Server - Brankas Sparepart IT',
|
||||
'purchase_date': today - timedelta(days=150),
|
||||
'warranty_expiry': today + timedelta(days=950),
|
||||
'price': Decimal('5200000.00'),
|
||||
'notes': 'CPU cadangan workstation server SCADA monitoring.',
|
||||
'history_action': 'created',
|
||||
'history_notes': 'Barang pengadaan darurat server SCADA.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-MBD-001',
|
||||
'name': 'ASUS TUF GAMING B660M-PLUS WIFI D4',
|
||||
'category': 'motherboard',
|
||||
'brand': 'ASUS',
|
||||
'model_series': 'TUF B660M-PLUS D4',
|
||||
'serial_number': 'M5N0CX1928371',
|
||||
'specifications': 'LGA 1700, 4x DDR4, 2x M.2 PCIe 4.0, Realtek 2.5Gb LAN, Intel WiFi 6',
|
||||
'status': 'available',
|
||||
'condition': 'good',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Gudang IT - Rak Motherboard',
|
||||
'purchase_date': today - timedelta(days=150),
|
||||
'warranty_expiry': today + timedelta(days=950),
|
||||
'price': Decimal('2650000.00'),
|
||||
'notes': 'Pasangan sparepart motherboard untuk workstation SCADA.',
|
||||
'history_action': 'created',
|
||||
'history_notes': 'Disimpan sebagai unit hot-swap motherboard.'
|
||||
},
|
||||
|
||||
# 4. GPU & GRAPHIC CARD
|
||||
{
|
||||
'ci_code': 'CI-GPU-001',
|
||||
'name': 'ASUS Dual GeForce RTX 3060 V2 OC Edition 12GB GDDR6',
|
||||
'category': 'gpu',
|
||||
'brand': 'ASUS',
|
||||
'model_series': 'DUAL-RTX3060-O12G-V2',
|
||||
'serial_number': '21098471029381',
|
||||
'specifications': '12GB GDDR6, 192-bit, PCIe 4.0, 3x DisplayPort 1.4a, 1x HDMI 2.1',
|
||||
'status': 'available',
|
||||
'condition': 'good',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Ruang Server - Rak Sparepart Hardware',
|
||||
'purchase_date': today - timedelta(days=220),
|
||||
'warranty_expiry': today + timedelta(days=500),
|
||||
'price': Decimal('4850000.00'),
|
||||
'notes': 'GPU untuk kebutuhan rendering 3D model DAM & Turbin Hydro.',
|
||||
'history_action': 'created',
|
||||
'history_notes': 'Disiapkan untuk workstation sipil engineering.'
|
||||
},
|
||||
|
||||
# 5. PERIPHERALS (Monitor, Keyboard, Mouse, Scanner, etc.)
|
||||
{
|
||||
'ci_code': 'CI-PER-001',
|
||||
'name': 'Monitor Dell 24" P2422H FHD IPS Ultra-Thin Bezel',
|
||||
'category': 'peripheral',
|
||||
'brand': 'Dell',
|
||||
'model_series': 'P2422H',
|
||||
'serial_number': 'CN-08W91-72872-91A',
|
||||
'specifications': '23.8" IPS 1920x1080 @60Hz, Pivot/Tilt/Swivel Height-Adjustable, VGA, HDMI, DP, USB Hub',
|
||||
'status': 'in_use',
|
||||
'condition': 'good',
|
||||
'installed_on': None,
|
||||
'assigned_to': emp_rayyan or emp_fallback,
|
||||
'location': 'Ruang IT Development / Workstation Rayyan',
|
||||
'purchase_date': today - timedelta(days=320),
|
||||
'warranty_expiry': today + timedelta(days=750),
|
||||
'price': Decimal('2850000.00'),
|
||||
'notes': 'Monitor sekunder dual-display untuk pemantauan sistem dan coding.',
|
||||
'history_action': 'assigned',
|
||||
'history_notes': 'Dialokasikan langsung ke Rayyan Adam sebagai monitor sekunder.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-PER-002',
|
||||
'name': 'Logitech MK270 Wireless Keyboard & Mouse Combo',
|
||||
'category': 'peripheral',
|
||||
'brand': 'Logitech',
|
||||
'model_series': 'MK270 Wireless Combo',
|
||||
'serial_number': '2142LZ028190',
|
||||
'specifications': '2.4GHz Wireless with Nano USB Receiver, Spill-resistant keyboard, 3-button optical mouse',
|
||||
'status': 'in_use',
|
||||
'condition': 'good',
|
||||
'installed_on': None,
|
||||
'assigned_to': emp_budi or emp_fallback,
|
||||
'location': 'Ruang Finance & Accounting',
|
||||
'purchase_date': today - timedelta(days=120),
|
||||
'warranty_expiry': today + timedelta(days=240),
|
||||
'price': Decimal('325000.00'),
|
||||
'notes': 'Perangkat input wireless operasional.',
|
||||
'history_action': 'assigned',
|
||||
'history_notes': 'Dialokasikan kepada Budi Santoso untuk laptop kerja.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-PER-003',
|
||||
'name': 'Monitor LG 27" UltraGear 27GP850-B Nano IPS QHD 165Hz',
|
||||
'category': 'peripheral',
|
||||
'brand': 'LG',
|
||||
'model_series': '27GP850-B',
|
||||
'serial_number': '208NTPW928173',
|
||||
'specifications': '27" Nano IPS 2560x1440 165Hz (O/C 180Hz) 1ms GtG, HDR400, G-Sync Compatible',
|
||||
'status': 'available',
|
||||
'condition': 'new',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Gudang IT - Rak Monitor Box Original',
|
||||
'purchase_date': today - timedelta(days=14),
|
||||
'warranty_expiry': today + timedelta(days=1080),
|
||||
'price': Decimal('5400000.00'),
|
||||
'notes': 'Monitor baru untuk workstation simulator dispatch PLTA Kerinci.',
|
||||
'history_action': 'created',
|
||||
'history_notes': 'Penerimaan unit monitor baru dari vendor LG.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-PER-004',
|
||||
'name': 'Headset Jabra Evolve 20 Stereo USB & 3.5mm Noise Cancelling',
|
||||
'category': 'peripheral',
|
||||
'brand': 'Jabra',
|
||||
'model_series': 'Evolve 20 MS Stereo',
|
||||
'serial_number': 'JBR-EV20-19284',
|
||||
'specifications': 'Noise-cancelling microphone, USB-A and 3.5mm jack connectivity, In-line call controller',
|
||||
'status': 'available',
|
||||
'condition': 'new',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Gudang IT - Lemari Aksesori & Audio',
|
||||
'purchase_date': today - timedelta(days=40),
|
||||
'warranty_expiry': today + timedelta(days=690),
|
||||
'price': Decimal('680000.00'),
|
||||
'notes': 'Headset standar untuk video conference manajemen.',
|
||||
'history_action': 'created',
|
||||
'history_notes': 'Stok baru pengadaan fasilitas meeting online.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-PER-005',
|
||||
'name': 'Honeywell Voyager 1472g Wireless 2D Barcode Scanner',
|
||||
'category': 'peripheral',
|
||||
'brand': 'Honeywell',
|
||||
'model_series': 'Voyager 1472g 2D',
|
||||
'serial_number': '21289B00192',
|
||||
'specifications': 'Area Image 2D (QR Code & Barcode), Bluetooth Range up to 30m, Cradle USB Base',
|
||||
'status': 'under_inspection',
|
||||
'condition': 'good',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Workshop IT - Meja Service',
|
||||
'purchase_date': today - timedelta(days=360),
|
||||
'warranty_expiry': today + timedelta(days=370),
|
||||
'price': Decimal('3200000.00'),
|
||||
'notes': 'Scanner barcode gudang logistik, sedang diuji sinkronisasi Bluetooth dan daya baterai.',
|
||||
'history_action': 'status_change',
|
||||
'history_notes': 'Pemeriksaan performa baterai dan pembacaan barcode damaged.'
|
||||
},
|
||||
|
||||
# 6. NETWORK COMPONENTS (SFP, NIC, Adapter)
|
||||
{
|
||||
'ci_code': 'CI-NET-001',
|
||||
'name': 'Cisco 10GBASE-SR SFP+ Transceiver Module',
|
||||
'category': 'network',
|
||||
'brand': 'Cisco',
|
||||
'model_series': 'SFP-10G-SR',
|
||||
'serial_number': 'FNS22190A2B',
|
||||
'specifications': '10GBASE-SR 850nm Multimode Fiber LC Duplex up to 300m DOM support',
|
||||
'status': 'available',
|
||||
'condition': 'new',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Ruang Server - Laci Fiber Transceiver',
|
||||
'purchase_date': today - timedelta(days=90),
|
||||
'warranty_expiry': today + timedelta(days=1000),
|
||||
'price': Decimal('1450000.00'),
|
||||
'notes': 'Modul SFP+ 10Gbps untuk interkoneksi switch core Cisco Catalyst.',
|
||||
'history_action': 'created',
|
||||
'history_notes': 'Stok modul optik cadangan link switch backbone.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-NET-002',
|
||||
'name': 'TP-Link UE300 USB 3.0 to Gigabit Ethernet Adapter',
|
||||
'category': 'network',
|
||||
'brand': 'TP-Link',
|
||||
'model_series': 'UE300 Foldable',
|
||||
'serial_number': '221B8910293',
|
||||
'specifications': 'USB 3.0 to RJ45 Gigabit Ethernet 10/100/1000Mbps, Plug and Play Windows/macOS',
|
||||
'status': 'available',
|
||||
'condition': 'good',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Gudang IT - Laci Adapter & Converter',
|
||||
'purchase_date': today - timedelta(days=60),
|
||||
'warranty_expiry': today + timedelta(days=300),
|
||||
'price': Decimal('165000.00'),
|
||||
'notes': 'Adapter LAN eksternal untuk laptop tipis yang tidak memiliki port RJ45 bawaan.',
|
||||
'history_action': 'created',
|
||||
'history_notes': 'Penerimaan inventaris toolkit teknisi.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-NET-003',
|
||||
'name': 'MikroTik S-85DLC05D SFP Transceiver 1.25G 850nm MultiMode',
|
||||
'category': 'network',
|
||||
'brand': 'MikroTik',
|
||||
'model_series': 'S-85DLC05D',
|
||||
'serial_number': 'MT-SFP-091823',
|
||||
'specifications': '1.25G SFP, 850nm Dual LC connector, up to 550m, DDM',
|
||||
'status': 'in_use',
|
||||
'condition': 'good',
|
||||
'installed_on': unit_router,
|
||||
'assigned_to': None,
|
||||
'location': 'Terpasang pada Router TPL-01-001',
|
||||
'purchase_date': today - timedelta(days=210),
|
||||
'warranty_expiry': today + timedelta(days=155),
|
||||
'price': Decimal('320000.00'),
|
||||
'notes': 'Modul uplink fiber optik menuju switch intake.',
|
||||
'history_action': 'installed',
|
||||
'history_notes': 'Dipasang pada port SFP router jaringan.'
|
||||
},
|
||||
|
||||
# 7. POWER & UPS
|
||||
{
|
||||
'ci_code': 'CI-PWR-001',
|
||||
'name': 'UPS APC Back-UPS Pro BR1500GI 1500VA / 865W AVR LCD',
|
||||
'category': 'power',
|
||||
'brand': 'APC / Schneider Electric',
|
||||
'model_series': 'BR1500GI',
|
||||
'serial_number': '3B1928X01928',
|
||||
'specifications': '1500VA/865Watts, Line Interactive, AVR, LCD Interface, 6x IEC Battery Backup, Data line surge protection',
|
||||
'status': 'in_use',
|
||||
'condition': 'good',
|
||||
'installed_on': None,
|
||||
'assigned_to': emp_rayyan or emp_fallback,
|
||||
'location': 'Ruang Control Room & SCADA IT',
|
||||
'purchase_date': today - timedelta(days=300),
|
||||
'warranty_expiry': today + timedelta(days=430),
|
||||
'price': Decimal('5650000.00'),
|
||||
'notes': 'Pencatu daya darurat workstation monitor utama PLTA.',
|
||||
'history_action': 'assigned',
|
||||
'history_notes': 'Ditempatkan di workstation SCADA untuk backup listrik darurat.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-PWR-002',
|
||||
'name': 'Corsair RM750e 750W 80 Plus Gold Fully Modular Power Supply',
|
||||
'category': 'power',
|
||||
'brand': 'Corsair',
|
||||
'model_series': 'CP-9020262-NA (RMe Series)',
|
||||
'serial_number': 'CRS-PSU-750E-9102',
|
||||
'specifications': '750 Watt, 80 PLUS Gold Certified, ATX 3.0 & PCIe 5.0 Ready, Zero RPM Fan Mode, 105°C Capacitors',
|
||||
'status': 'available',
|
||||
'condition': 'new',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Gudang IT - Rak Power Supply',
|
||||
'purchase_date': today - timedelta(days=50),
|
||||
'warranty_expiry': today + timedelta(days=1770),
|
||||
'price': Decimal('1850000.00'),
|
||||
'notes': 'PSU cadangan untuk PC rendering teknik dan PC server lokal.',
|
||||
'history_action': 'created',
|
||||
'history_notes': 'Penerimaan stok unit PSU high-efficiency.'
|
||||
},
|
||||
{
|
||||
'ci_code': 'CI-PWR-003',
|
||||
'name': 'APC Replacement Battery Cartridge RBC17 12V 9Ah',
|
||||
'category': 'power',
|
||||
'brand': 'APC',
|
||||
'model_series': 'APCRBC17',
|
||||
'serial_number': 'RBC17-202610-098',
|
||||
'specifications': '12V 9Ah VRLA Maintenance-Free Sealed Lead-Acid battery with suspended electrolyte',
|
||||
'status': 'under_repair',
|
||||
'condition': 'fair',
|
||||
'installed_on': None,
|
||||
'assigned_to': None,
|
||||
'location': 'Workshop IT - Lemari Charger & Baterai',
|
||||
'purchase_date': today - timedelta(days=420),
|
||||
'warranty_expiry': today - timedelta(days=55),
|
||||
'price': Decimal('650000.00'),
|
||||
'notes': 'Sedang dilakukan conditioning & re-charging cycle sebelum dipasang kembali.',
|
||||
'history_action': 'repair_in',
|
||||
'history_notes': 'Baterai mengalami penurunan kapasitas retensi daya; dalam perbaikan uji voltase.'
|
||||
},
|
||||
]
|
||||
|
||||
created_count = 0
|
||||
updated_count = 0
|
||||
|
||||
for item_data in sample_cis:
|
||||
history_action = item_data.pop('history_action')
|
||||
history_notes = item_data.pop('history_notes')
|
||||
|
||||
ci, created = ConfigurationItem.objects.get_or_create(
|
||||
ci_code=item_data['ci_code'],
|
||||
defaults=item_data
|
||||
)
|
||||
|
||||
if not created:
|
||||
# Perbarui data jika sudah ada agar tetap up-to-date
|
||||
for key, val in item_data.items():
|
||||
setattr(ci, key, val)
|
||||
ci.save()
|
||||
updated_count += 1
|
||||
self.stdout.write(f"[DIPERBARUI] CI: {ci.ci_code} - {ci.name}")
|
||||
else:
|
||||
created_count += 1
|
||||
self.stdout.write(self.style.SUCCESS(f"[BARU] CI: {ci.ci_code} - {ci.name}"))
|
||||
|
||||
# Buat entri riwayat jika belum ada riwayat untuk aksi ini
|
||||
if not ci.history.filter(action=history_action).exists():
|
||||
CIHistory.objects.create(
|
||||
ci=ci,
|
||||
action=history_action,
|
||||
related_unit=ci.installed_on,
|
||||
related_employee=ci.assigned_to,
|
||||
performed_by=admin_user,
|
||||
notes=history_notes
|
||||
)
|
||||
|
||||
self.stdout.write(self.style.SUCCESS(
|
||||
f"\nSelesai! Berhasil memproses Configuration Items: {created_count} baru, {updated_count} diperbarui."
|
||||
))
|
||||
@@ -1,7 +1,8 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.contrib.auth.models import User
|
||||
from assets.models import ConsumableItem, ConsumableTransaction
|
||||
from assets.models import ConsumableItem, ConsumableTransaction, Employee, AssetUnit
|
||||
from datetime import date
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@@ -22,11 +23,11 @@ class Command(BaseCommand):
|
||||
'description': 'Kabel jaringan utama untuk instalasi backbone dan drop point lokal.',
|
||||
'base_unit': 'meter',
|
||||
'purchase_unit': 'roll',
|
||||
'conversion_rate': 305.00,
|
||||
'initial_stock': 610.00, # 2 roll
|
||||
'minimum_stock': 100.00,
|
||||
'conversion_rate': Decimal('305.00'),
|
||||
'initial_stock': Decimal('610.00'), # 2 roll
|
||||
'minimum_stock': Decimal('100.00'),
|
||||
'location': 'Gudang Induk (GI)',
|
||||
'last_purchase_price': 1850000,
|
||||
'last_purchase_price': Decimal('1850000.00'),
|
||||
'notes': 'Stok pengadaan proyek Q3'
|
||||
},
|
||||
{
|
||||
@@ -38,11 +39,11 @@ class Command(BaseCommand):
|
||||
'description': 'Kabel fiber optik outdoor untuk interkoneksi bangunan dan intake.',
|
||||
'base_unit': 'meter',
|
||||
'purchase_unit': 'roll',
|
||||
'conversion_rate': 1000.00,
|
||||
'initial_stock': 1000.00, # 1 roll
|
||||
'minimum_stock': 200.00,
|
||||
'conversion_rate': Decimal('1000.00'),
|
||||
'initial_stock': Decimal('1000.00'), # 1 roll
|
||||
'minimum_stock': Decimal('200.00'),
|
||||
'location': 'Gudang Induk (GI)',
|
||||
'last_purchase_price': 1200000,
|
||||
'last_purchase_price': Decimal('1200000.00'),
|
||||
'notes': 'Jalur fiber optik area DAM & Power House'
|
||||
},
|
||||
{
|
||||
@@ -54,11 +55,11 @@ class Command(BaseCommand):
|
||||
'description': 'Konektor RJ45 crimping untuk terminasi kabel LAN.',
|
||||
'base_unit': 'pcs',
|
||||
'purchase_unit': 'box',
|
||||
'conversion_rate': 100.00,
|
||||
'initial_stock': 150.00,
|
||||
'minimum_stock': 30.00,
|
||||
'conversion_rate': Decimal('100.00'),
|
||||
'initial_stock': Decimal('150.00'),
|
||||
'minimum_stock': Decimal('30.00'),
|
||||
'location': 'Ruang Server / IT',
|
||||
'last_purchase_price': 250000,
|
||||
'last_purchase_price': Decimal('250000.00'),
|
||||
'notes': 'Sering digunakan teknisi lapangan'
|
||||
},
|
||||
{
|
||||
@@ -70,11 +71,11 @@ class Command(BaseCommand):
|
||||
'description': 'Konektor cepat fiber optik tanpa splicing fusion.',
|
||||
'base_unit': 'pcs',
|
||||
'purchase_unit': 'pack',
|
||||
'conversion_rate': 50.00,
|
||||
'initial_stock': 50.00,
|
||||
'minimum_stock': 15.00,
|
||||
'conversion_rate': Decimal('50.00'),
|
||||
'initial_stock': Decimal('50.00'),
|
||||
'minimum_stock': Decimal('15.00'),
|
||||
'location': 'Ruang Server / IT',
|
||||
'last_purchase_price': 175000,
|
||||
'last_purchase_price': Decimal('175000.00'),
|
||||
'notes': 'Untuk terminasi kabel drop optik'
|
||||
},
|
||||
{
|
||||
@@ -86,11 +87,11 @@ class Command(BaseCommand):
|
||||
'description': 'Pasta pendingin CPU/GPU server, PC workstation, dan laptop.',
|
||||
'base_unit': 'tube',
|
||||
'purchase_unit': None,
|
||||
'conversion_rate': 1.00,
|
||||
'initial_stock': 8.00,
|
||||
'minimum_stock': 2.00,
|
||||
'conversion_rate': Decimal('1.00'),
|
||||
'initial_stock': Decimal('8.00'),
|
||||
'minimum_stock': Decimal('2.00'),
|
||||
'location': 'Workshop IT',
|
||||
'last_purchase_price': 115000,
|
||||
'last_purchase_price': Decimal('115000.00'),
|
||||
'notes': 'Pemakaian preventive maintenance PC berkala'
|
||||
},
|
||||
{
|
||||
@@ -102,11 +103,11 @@ class Command(BaseCommand):
|
||||
'description': 'Pengikat kabel manajemen pada rak server dan jalur kabel tray.',
|
||||
'base_unit': 'pcs',
|
||||
'purchase_unit': 'pack',
|
||||
'conversion_rate': 100.00,
|
||||
'initial_stock': 400.00, # 4 pack
|
||||
'minimum_stock': 100.00,
|
||||
'conversion_rate': Decimal('100.00'),
|
||||
'initial_stock': Decimal('400.00'), # 4 pack
|
||||
'minimum_stock': Decimal('100.00'),
|
||||
'location': 'Ruang Server / IT',
|
||||
'last_purchase_price': 35000,
|
||||
'last_purchase_price': Decimal('35000.00'),
|
||||
'notes': 'Manajemen kabel rak & instalasi'
|
||||
},
|
||||
{
|
||||
@@ -118,11 +119,11 @@ class Command(BaseCommand):
|
||||
'description': 'Baut pemasangan switch, router, server, dan patch panel pada rak 19 inci.',
|
||||
'base_unit': 'set',
|
||||
'purchase_unit': 'pack',
|
||||
'conversion_rate': 50.00,
|
||||
'initial_stock': 100.00, # 2 pack
|
||||
'minimum_stock': 20.00,
|
||||
'conversion_rate': Decimal('50.00'),
|
||||
'initial_stock': Decimal('100.00'), # 2 pack
|
||||
'minimum_stock': Decimal('20.00'),
|
||||
'location': 'Ruang Server / IT',
|
||||
'last_purchase_price': 90000,
|
||||
'last_purchase_price': Decimal('90000.00'),
|
||||
'notes': 'Mounting rack unit'
|
||||
},
|
||||
{
|
||||
@@ -134,11 +135,11 @@ class Command(BaseCommand):
|
||||
'description': 'Isolasi listrik tahan panas dan cuaca untuk penyambungan kabel.',
|
||||
'base_unit': 'roll',
|
||||
'purchase_unit': None,
|
||||
'conversion_rate': 1.00,
|
||||
'initial_stock': 12.00,
|
||||
'minimum_stock': 3.00,
|
||||
'conversion_rate': Decimal('1.00'),
|
||||
'initial_stock': Decimal('12.00'),
|
||||
'minimum_stock': Decimal('3.00'),
|
||||
'location': 'Workshop IT',
|
||||
'last_purchase_price': 45000,
|
||||
'last_purchase_price': Decimal('45000.00'),
|
||||
'notes': 'Keperluan isolasi kabel listrik dan jaringan outdoor'
|
||||
},
|
||||
{
|
||||
@@ -150,11 +151,11 @@ class Command(BaseCommand):
|
||||
'description': 'Kabel patch cord pabrikan untuk koneksi dari patch panel ke switch.',
|
||||
'base_unit': 'pcs',
|
||||
'purchase_unit': None,
|
||||
'conversion_rate': 1.00,
|
||||
'initial_stock': 25.00,
|
||||
'minimum_stock': 10.00,
|
||||
'conversion_rate': Decimal('1.00'),
|
||||
'initial_stock': Decimal('25.00'),
|
||||
'minimum_stock': Decimal('10.00'),
|
||||
'location': 'Ruang Server / IT',
|
||||
'last_purchase_price': 35000,
|
||||
'last_purchase_price': Decimal('35000.00'),
|
||||
'notes': 'Kabel patching rak distribusi'
|
||||
},
|
||||
{
|
||||
@@ -166,11 +167,11 @@ class Command(BaseCommand):
|
||||
'description': 'Kabel display HDMI untuk ruang meeting, CCTV monitor, dan presentasi.',
|
||||
'base_unit': 'pcs',
|
||||
'purchase_unit': None,
|
||||
'conversion_rate': 1.00,
|
||||
'initial_stock': 6.00,
|
||||
'minimum_stock': 2.00,
|
||||
'conversion_rate': Decimal('1.00'),
|
||||
'initial_stock': Decimal('6.00'),
|
||||
'minimum_stock': Decimal('2.00'),
|
||||
'location': 'Ruang Server / IT',
|
||||
'last_purchase_price': 85000,
|
||||
'last_purchase_price': Decimal('85000.00'),
|
||||
'notes': 'Kabel display operasional kantor & meeting'
|
||||
},
|
||||
{
|
||||
@@ -182,13 +183,79 @@ class Command(BaseCommand):
|
||||
'description': 'Pembersih kontak soket RAM, PCIe, port switch, dan PCB.',
|
||||
'base_unit': 'can',
|
||||
'purchase_unit': None,
|
||||
'conversion_rate': 1.00,
|
||||
'initial_stock': 4.00,
|
||||
'minimum_stock': 2.00,
|
||||
'conversion_rate': Decimal('1.00'),
|
||||
'initial_stock': Decimal('4.00'),
|
||||
'minimum_stock': Decimal('2.00'),
|
||||
'location': 'Workshop IT',
|
||||
'last_purchase_price': 95000,
|
||||
'last_purchase_price': Decimal('95000.00'),
|
||||
'notes': 'Kimia pembersih maintenance hardware'
|
||||
},
|
||||
# Item Stok Menipis (Low Stock)
|
||||
{
|
||||
'item_code': 'CNS-CAB-005',
|
||||
'name': 'Kabel Power AC C13 Heavy Duty 1.8m 3x1.5mm',
|
||||
'category': 'cable',
|
||||
'brand': 'APC / Schneider',
|
||||
'specification': 'AC Power Cord C13 to Schuko Plug 250V 16A 1.8 Meter',
|
||||
'description': 'Kabel power standar untuk server, switch, PDU, dan monitor kerja.',
|
||||
'base_unit': 'pcs',
|
||||
'purchase_unit': None,
|
||||
'conversion_rate': Decimal('1.00'),
|
||||
'initial_stock': Decimal('2.00'),
|
||||
'minimum_stock': Decimal('5.00'),
|
||||
'location': 'Ruang Server / IT',
|
||||
'last_purchase_price': Decimal('45000.00'),
|
||||
'notes': 'Stok menipis, perlu pengadaan ulang untuk rak server.'
|
||||
},
|
||||
{
|
||||
'item_code': 'CNS-BAT-001',
|
||||
'name': 'Baterai Kancing CMOS CR2032 3V Lithium Coin',
|
||||
'category': 'tools_acc',
|
||||
'brand': 'Panasonic',
|
||||
'specification': 'Lithium Coin Cell 3V CR2032 DL2032 225mAh',
|
||||
'description': 'Baterai backup BIOS/CMOS motherboard PC, laptop, dan kontroler PLC.',
|
||||
'base_unit': 'pcs',
|
||||
'purchase_unit': 'strip',
|
||||
'conversion_rate': Decimal('5.00'),
|
||||
'initial_stock': Decimal('3.00'),
|
||||
'minimum_stock': Decimal('10.00'),
|
||||
'location': 'Workshop IT - Laci Baterai',
|
||||
'last_purchase_price': Decimal('15000.00'),
|
||||
'notes': 'Sering digunakan untuk pergantian baterai motherboard lama.'
|
||||
},
|
||||
# Item Stok Habis (Out of Stock)
|
||||
{
|
||||
'item_code': 'CNS-CON-003',
|
||||
'name': 'RJ45 Modular Inline Coupler Barrel Female-to-Female Cat6',
|
||||
'category': 'connector',
|
||||
'brand': 'D-Link / Vention',
|
||||
'specification': 'Cat6 Shielded RJ45 Female to Female Keystone Coupler Adapter',
|
||||
'description': 'Penyambung barrel darurat untuk ekstensi kabel LAN tanpa crimping ulang.',
|
||||
'base_unit': 'pcs',
|
||||
'purchase_unit': 'pack',
|
||||
'conversion_rate': Decimal('10.00'),
|
||||
'initial_stock': Decimal('0.00'),
|
||||
'minimum_stock': Decimal('5.00'),
|
||||
'location': 'Workshop IT',
|
||||
'last_purchase_price': Decimal('25000.00'),
|
||||
'notes': 'Stok habis total, sedang diajukan pembelian ke vendor.'
|
||||
},
|
||||
{
|
||||
'item_code': 'CNS-CLN-002',
|
||||
'name': 'Compressed Air Duster Cleaner Can 400ml',
|
||||
'category': 'cleaning',
|
||||
'brand': 'Falcon Dust-Off',
|
||||
'specification': 'Gas aerosol pembersih debu bertekanan tinggi 400ml non-CFC',
|
||||
'description': 'Pembersih debu kipas heatsink, power supply, dan kisi-kisi radiator server.',
|
||||
'base_unit': 'can',
|
||||
'purchase_unit': None,
|
||||
'conversion_rate': Decimal('1.00'),
|
||||
'initial_stock': Decimal('0.00'),
|
||||
'minimum_stock': Decimal('4.00'),
|
||||
'location': 'Workshop IT',
|
||||
'last_purchase_price': Decimal('75000.00'),
|
||||
'notes': 'Stok habis, pending approval pengadaan logistik.'
|
||||
},
|
||||
]
|
||||
|
||||
created_count = 0
|
||||
@@ -222,9 +289,9 @@ class Command(BaseCommand):
|
||||
item=item,
|
||||
quantity=data['initial_stock'],
|
||||
unit=data['base_unit'],
|
||||
conversion_rate=1.00,
|
||||
conversion_rate=Decimal('1.00'),
|
||||
quantity_base=data['initial_stock'],
|
||||
stock_before=0.00,
|
||||
stock_before=Decimal('0.00'),
|
||||
stock_after=data['initial_stock'],
|
||||
source_destination='Stok Awal Terotorisasi',
|
||||
performed_by=admin_user,
|
||||
@@ -235,4 +302,93 @@ class Command(BaseCommand):
|
||||
else:
|
||||
self.stdout.write(f"[ADA] Consumable Item: {item.item_code} - {item.name}")
|
||||
|
||||
# Tambahkan transaksi mutasi keluar (pemakaian teknisi) sebagai sampel realistis
|
||||
emp_rayyan = Employee.objects.filter(name__icontains='Rayyan').first()
|
||||
unit_thinkpad = AssetUnit.objects.filter(unit_code='LNV-GEN12-001').first()
|
||||
|
||||
# 1. Transaksi keluar Kabel Belden
|
||||
item_kabel = ConsumableItem.objects.filter(item_code='CNS-CAB-001').first()
|
||||
if item_kabel and not ConsumableTransaction.objects.filter(transaction_code='TRX-OUT-CNS-CAB-001-DEMO').exists():
|
||||
qty_out = Decimal('35.00')
|
||||
stock_before = item_kabel.stock_available
|
||||
stock_after = max(Decimal('0.00'), stock_before - qty_out)
|
||||
item_kabel.stock_available = stock_after
|
||||
item_kabel.save()
|
||||
|
||||
ConsumableTransaction.objects.create(
|
||||
transaction_code='TRX-OUT-CNS-CAB-001-DEMO',
|
||||
transaction_type='out',
|
||||
item=item_kabel,
|
||||
quantity=qty_out,
|
||||
unit=item_kabel.base_unit,
|
||||
conversion_rate=Decimal('1.00'),
|
||||
quantity_base=qty_out,
|
||||
stock_before=stock_before,
|
||||
stock_after=stock_after,
|
||||
source_destination='Lantai 2 Kantor Administrasi & Finance',
|
||||
recipient_employee=emp_rayyan,
|
||||
ticket_number='WO-NET-202610-014',
|
||||
performed_by=admin_user,
|
||||
transaction_date=date.today(),
|
||||
notes='Penarikan kabel LAN drop point baru ruang meeting dan finance.'
|
||||
)
|
||||
self.stdout.write(self.style.SUCCESS("[BARU] Transaksi Keluar: 35 meter Kabel Cat6 Belden."))
|
||||
|
||||
# 2. Transaksi keluar Konektor RJ45
|
||||
item_rj45 = ConsumableItem.objects.filter(item_code='CNS-CON-001').first()
|
||||
if item_rj45 and not ConsumableTransaction.objects.filter(transaction_code='TRX-OUT-CNS-CON-001-DEMO').exists():
|
||||
qty_out = Decimal('12.00')
|
||||
stock_before = item_rj45.stock_available
|
||||
stock_after = max(Decimal('0.00'), stock_before - qty_out)
|
||||
item_rj45.stock_available = stock_after
|
||||
item_rj45.save()
|
||||
|
||||
ConsumableTransaction.objects.create(
|
||||
transaction_code='TRX-OUT-CNS-CON-001-DEMO',
|
||||
transaction_type='out',
|
||||
item=item_rj45,
|
||||
quantity=qty_out,
|
||||
unit=item_rj45.base_unit,
|
||||
conversion_rate=Decimal('1.00'),
|
||||
quantity_base=qty_out,
|
||||
stock_before=stock_before,
|
||||
stock_after=stock_after,
|
||||
source_destination='Workshop IT - Crimping Patch Cable',
|
||||
recipient_employee=emp_rayyan,
|
||||
ticket_number='WO-NET-202610-015',
|
||||
performed_by=admin_user,
|
||||
transaction_date=date.today(),
|
||||
notes='Crimping 6 buah patch cord custom untuk rack distribution switch.'
|
||||
)
|
||||
self.stdout.write(self.style.SUCCESS("[BARU] Transaksi Keluar: 12 pcs RJ45 Cat6."))
|
||||
|
||||
# 3. Transaksi keluar Thermal Paste
|
||||
item_pasta = ConsumableItem.objects.filter(item_code='CNS-MNT-001').first()
|
||||
if item_pasta and not ConsumableTransaction.objects.filter(transaction_code='TRX-OUT-CNS-MNT-001-DEMO').exists():
|
||||
qty_out = Decimal('1.00')
|
||||
stock_before = item_pasta.stock_available
|
||||
stock_after = max(Decimal('0.00'), stock_before - qty_out)
|
||||
item_pasta.stock_available = stock_after
|
||||
item_pasta.save()
|
||||
|
||||
ConsumableTransaction.objects.create(
|
||||
transaction_code='TRX-OUT-CNS-MNT-001-DEMO',
|
||||
transaction_type='out',
|
||||
item=item_pasta,
|
||||
quantity=qty_out,
|
||||
unit=item_pasta.base_unit,
|
||||
conversion_rate=Decimal('1.00'),
|
||||
quantity_base=qty_out,
|
||||
stock_before=stock_before,
|
||||
stock_after=stock_after,
|
||||
source_destination='Maintenance Laptop Karyawan',
|
||||
recipient_employee=emp_rayyan,
|
||||
related_unit=unit_thinkpad,
|
||||
ticket_number='WO-HW-202610-008',
|
||||
performed_by=admin_user,
|
||||
transaction_date=date.today(),
|
||||
notes='Repasting CPU dan GPU laptop operasional ThinkPad T14.'
|
||||
)
|
||||
self.stdout.write(self.style.SUCCESS("[BARU] Transaksi Keluar: 1 tube Thermal Paste MX-4."))
|
||||
|
||||
self.stdout.write(self.style.SUCCESS(f"Selesai! Berhasil menambahkan {created_count} item consumable baru."))
|
||||
|
||||
@@ -65,7 +65,7 @@ echo [2] Jalankan Automated Test Suite (python manage.py test assets)
|
||||
echo [3] Jalankan Test dengan Output Terperinci (Verbose -v 2)
|
||||
echo [4] Jalankan Migrasi Database (python manage.py migrate)
|
||||
echo [5] Buat Migrasi Baru (python manage.py makemigrations)
|
||||
echo [6] Seed Data Awal ('Aset Karyawan', 'Aset Network', & Consumables)
|
||||
echo [6] Seed Data Awal (Aset, Consumables, & Configuration Items)
|
||||
echo [7] Setup Akun Superuser Administrator (setup_superuser)
|
||||
echo [8] Build Aset Frontend / TailwindCSS (npm run build)
|
||||
echo [9] Install / Update Dependensi Python (pip install -r requirements.txt)
|
||||
@@ -224,6 +224,7 @@ echo ===========================================================================
|
||||
echo.
|
||||
python manage.py seed_initial_data
|
||||
python manage.py seed_consumables
|
||||
python manage.py seed_cis
|
||||
echo.
|
||||
pause
|
||||
goto main_menu
|
||||
|
||||
+14
-10
@@ -13,15 +13,12 @@
|
||||
<p class="text-sm text-gray-500 mt-1">Kode: <strong>{{ asset.asset_code }}</strong> · Total: <strong>{{ asset.qty }} {{ asset.uom }}</strong></p>
|
||||
</div>
|
||||
<div class="flex flex-wrap sm:flex-nowrap items-center gap-3 w-full sm:w-auto">
|
||||
<a href="{% url 'asset_list' %}" class="order-1 sm:order-1 bg-white border border-gray-200 rounded-xl shadow-sm px-4 py-2.5 text-sm font-bold text-gray-700 hover:bg-gray-50 transition-colors flex-1 sm:flex-none text-center">
|
||||
Kembali
|
||||
</a>
|
||||
|
||||
<div class="relative inline-block w-full sm:w-auto flex-1 sm:flex-none">
|
||||
<button onclick="var d = document.getElementById('exportMenuUnits'); 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>
|
||||
<!-- 1. Fitur Ekspor: Mobile baris atas kiri (flex-1), Desktop tengah (sm:order-2 sm:flex-none) -->
|
||||
<div class="order-1 sm:order-2 relative inline-block flex-1 sm:flex-none w-auto">
|
||||
<button onclick="var d = document.getElementById('exportMenuUnits'); d.style.display = d.style.display === 'block' ? 'none' : 'block'; event.stopPropagation();" class="w-full border border-kerinci text-kerinci rounded-xl px-3.5 sm:px-4 py-2 text-xs sm:text-sm font-bold hover:bg-kerinci/10 transition-colors flex items-center space-x-1.5 sm:space-x-2 justify-center whitespace-nowrap shadow-sm">
|
||||
<svg class="w-4 h-4 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
|
||||
<span>Ekspor Data</span>
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
|
||||
<svg class="w-4 h-4 shrink-0" 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="exportMenuUnits" style="display: none;" class="absolute right-0 mt-2 w-48 bg-white rounded-xl shadow-[0_8px_30px_rgb(0,0,0,0.12)] border border-gray-100 z-50">
|
||||
<a href="{% url 'asset_units_export_pdf' asset.id %}" 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">
|
||||
@@ -36,10 +33,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button onclick="openAddUnitModal()" class="order-2 sm:order-3 bg-kerinci text-white border border-kerinci rounded-xl shadow-sm px-4 py-2.5 text-sm font-bold hover:bg-kerinci/90 transition-colors flex items-center justify-center space-x-2 flex-1 sm:flex-none">
|
||||
<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>
|
||||
<!-- 2. Tombol Tambah Unit: Mobile baris atas kanan (flex-1), Desktop paling kanan (sm:order-3 sm:flex-none) -->
|
||||
<button onclick="openAddUnitModal()" class="order-2 sm:order-3 bg-kerinci text-white border border-kerinci rounded-xl shadow-sm px-3.5 sm:px-4 py-2 text-xs sm:text-sm font-bold hover:bg-kerinci/90 transition-colors flex items-center justify-center space-x-1.5 sm:space-x-2 flex-1 sm:flex-none whitespace-nowrap">
|
||||
<svg class="w-5 h-5 shrink-0" 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 Unit</span>
|
||||
</button>
|
||||
|
||||
<!-- 3. Tombol Kembali: Mobile baris bawah (w-full), Desktop paling kiri (sm:order-1 sm:w-auto) -->
|
||||
<a href="{% url 'asset_list' %}" class="order-3 sm:order-1 bg-white border border-gray-200 rounded-xl shadow-sm px-4 py-2 text-sm font-bold text-gray-700 hover:bg-gray-50 hover:text-kerinci transition-colors flex items-center space-x-2 justify-center text-center w-full sm:w-auto flex-none">
|
||||
<svg class="w-4 h-4 text-gray-500 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg>
|
||||
<span>Kembali</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
<title>Manajemen Aset IT - Kerinci Hydropower</title>
|
||||
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{% static 'dist/style.css' %}?v=2.1">
|
||||
<link rel="stylesheet" href="{% static 'dist/style.css' %}?v=2.4">
|
||||
|
||||
<style>
|
||||
body { background-color: #F8F9FA; }
|
||||
|
||||
@@ -28,8 +28,9 @@
|
||||
|
||||
<!-- Header Actions -->
|
||||
<div class="flex items-center space-x-2">
|
||||
<a href="{% url 'ci_list' %}" class="px-4 py-2 border border-gray-200 rounded-xl text-sm font-bold text-gray-600 hover:bg-gray-50 transition-colors">
|
||||
← Kembali
|
||||
<a href="{% url 'ci_list' %}" class="bg-white border border-gray-200 rounded-xl shadow-sm px-4 py-2 text-sm font-bold text-gray-700 hover:bg-gray-50 hover:text-kerinci transition-colors flex items-center space-x-2 justify-center">
|
||||
<svg class="w-4 h-4 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg>
|
||||
<span>Kembali</span>
|
||||
</a>
|
||||
{% if not is_read_only %}
|
||||
<button onclick="openEditModal()" class="px-4 py-2 bg-amber-50 text-amber-700 hover:bg-amber-100 border border-amber-200 rounded-xl text-sm font-bold transition-colors flex items-center space-x-1.5">
|
||||
|
||||
+61
-44
@@ -81,8 +81,8 @@
|
||||
</div>
|
||||
|
||||
<!-- 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">
|
||||
<div class="mb-4 flex flex-col md:flex-row md:items-center md:justify-between gap-3">
|
||||
<form id="searchForm" method="GET" class="relative w-full md:w-96 min-w-0">
|
||||
<input type="hidden" name="status" value="{{ status_filter }}">
|
||||
{% if category_filter %}<input type="hidden" name="category" value="{{ category_filter }}">{% endif %}
|
||||
{% if condition_filter %}<input type="hidden" name="condition" value="{{ condition_filter }}">{% endif %}
|
||||
@@ -90,23 +90,29 @@
|
||||
<svg class="w-5 h-5 text-gray-400 absolute left-3 top-2.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
|
||||
</form>
|
||||
|
||||
<div class="flex 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">
|
||||
<div class="flex items-center gap-2 w-full md:w-auto min-w-0">
|
||||
<div class="grid grid-cols-2 gap-2 flex-1 md:flex-none w-full md:w-auto min-w-0">
|
||||
<div class="min-w-0">
|
||||
<select onchange="location = this.value;" class="w-full md:w-48 truncate 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 cursor-pointer" style="min-width: 0; max-width: 100%;">
|
||||
<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="?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>
|
||||
</div>
|
||||
|
||||
<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">
|
||||
<div class="min-w-0">
|
||||
<select onchange="location = this.value;" class="w-full md:w-44 truncate 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 cursor-pointer" style="min-width: 0; max-width: 100%;">
|
||||
<option value="?status={{ status_filter }}&category={{ category_filter }}&q={{ search_query }}">Semua Kondisi</option>
|
||||
{% for cond_val, cond_label in condition_choices %}
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if search_query or category_filter or condition_filter or status_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">
|
||||
<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 shrink-0 whitespace-nowrap" title="Reset Filter">
|
||||
Reset
|
||||
</a>
|
||||
{% endif %}
|
||||
@@ -116,30 +122,30 @@
|
||||
<!-- 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">
|
||||
<table class="w-full text-left border-collapse min-w-[1050px]">
|
||||
<thead>
|
||||
<tr class="bg-[#002060] text-white text-[11px] uppercase tracking-widest">
|
||||
<th class="p-4 font-bold text-center w-16">No</th>
|
||||
<th class="p-4 font-bold w-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">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 w-36">Aksi</th>
|
||||
<tr class="bg-[#002060] text-white text-[11px] uppercase tracking-wider">
|
||||
<th class="p-4 font-bold text-center w-14 whitespace-nowrap">No</th>
|
||||
<th class="p-4 font-bold whitespace-nowrap">Kode Item</th>
|
||||
<th class="p-4 font-bold min-w-[200px]">Nama & Komponen</th>
|
||||
<th class="p-4 font-bold whitespace-nowrap">Kategori</th>
|
||||
<th class="p-4 font-bold whitespace-nowrap">Nomor Seri (S/N)</th>
|
||||
<th class="p-4 font-bold min-w-[180px]">Perangkat / Pengguna</th>
|
||||
<th class="p-4 font-bold text-center whitespace-nowrap">Kondisi</th>
|
||||
<th class="p-4 font-bold text-center whitespace-nowrap">Status</th>
|
||||
<th class="p-4 font-bold text-left w-28 whitespace-nowrap">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-sm divide-y divide-gray-200">
|
||||
{% for item in items %}
|
||||
<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">
|
||||
<td class="p-4 text-center text-gray-500 whitespace-nowrap">{{ forloop.counter }}</td>
|
||||
<td class="p-4 font-bold text-gray-700 font-mono text-xs whitespace-nowrap">
|
||||
<a href="{% url 'ci_detail' item.id %}" class="hover:text-kerinci transition-colors">
|
||||
{{ item.ci_code }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="p-4">
|
||||
<td class="p-4 min-w-[200px]">
|
||||
<a href="{% url 'ci_detail' item.id %}" class="font-bold text-gray-900 hover:text-kerinci transition-colors block">
|
||||
{{ item.name }}
|
||||
</a>
|
||||
@@ -147,52 +153,63 @@
|
||||
<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 text-gray-600 font-medium text-xs">
|
||||
{{ item.get_category_display }}
|
||||
<td class="p-4 text-gray-600 font-medium text-xs whitespace-nowrap">
|
||||
{% if item.category == 'storage' %}Storage
|
||||
{% elif item.category == 'memory' %}Memory (RAM)
|
||||
{% elif item.category == 'processor' %}Processor (CPU)
|
||||
{% elif item.category == 'motherboard' %}Motherboard
|
||||
{% elif item.category == 'gpu' %}GPU / VGA
|
||||
{% elif item.category == 'peripheral' %}Peripheral
|
||||
{% elif item.category == 'network' %}Network Component
|
||||
{% elif item.category == 'power' %}Power Supply & UPS
|
||||
{% else %}{{ item.get_category_display }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="p-4 text-gray-600 font-mono text-xs">
|
||||
<td class="p-4 text-gray-600 font-mono text-xs whitespace-nowrap">
|
||||
{{ item.serial_number|default:"-" }}
|
||||
</td>
|
||||
<td class="p-4">
|
||||
<td class="p-4 min-w-[180px]">
|
||||
{% if item.installed_on %}
|
||||
<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>
|
||||
<span class="font-bold text-blue-700 font-mono whitespace-nowrap">{{ 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>
|
||||
<p class="text-[11px] text-gray-500 truncate max-w-[200px]" title="{{ item.installed_on.asset.name }}">{{ item.installed_on.asset.name }}</p>
|
||||
{% if item.installed_on.assigned_to %}
|
||||
<p class="text-[10px] text-gray-400 font-medium">PIC: {{ item.installed_on.assigned_to.name }}</p>
|
||||
<p class="text-[10px] text-gray-400 font-medium whitespace-nowrap">PIC: {{ item.installed_on.assigned_to.name }}</p>
|
||||
{% endif %}
|
||||
{% elif item.assigned_to %}
|
||||
<p class="font-bold text-xs text-gray-800">{{ item.assigned_to.name }}</p>
|
||||
<p class="text-[11px] text-gray-500">Pegang Langsung</p>
|
||||
<p class="font-bold text-xs text-gray-800 whitespace-nowrap">{{ item.assigned_to.name }}</p>
|
||||
<p class="text-[11px] text-gray-500 whitespace-nowrap">Pegang Langsung</p>
|
||||
{% else %}
|
||||
<span class="text-xs text-gray-400 italic">Gudang / Tidak terpasang</span>
|
||||
<span class="text-xs text-gray-400 italic whitespace-nowrap">Gudang / Tidak terpasang</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="p-4 text-center">
|
||||
{% 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>
|
||||
<td class="p-4 text-center whitespace-nowrap">
|
||||
{% if item.condition == 'new' %}
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-emerald-50 text-emerald-700 border border-emerald-200 whitespace-nowrap">Baru</span>
|
||||
{% elif item.condition == 'good' %}
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-emerald-50 text-emerald-700 border border-emerald-200 whitespace-nowrap">Bagus / Normal</span>
|
||||
{% elif item.condition == 'fair' %}
|
||||
<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>
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-blue-50 text-blue-700 border border-blue-200 whitespace-nowrap">Cukup / Bekas</span>
|
||||
{% elif item.condition == 'damaged' %}
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-red-50 text-red-700 border border-red-200 whitespace-nowrap">Rusak</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">{{ item.get_condition_display }}</span>
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-gray-50 text-gray-700 border border-gray-200 whitespace-nowrap">{{ item.get_condition_display }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="p-4 text-center">
|
||||
<td class="p-4 text-center whitespace-nowrap">
|
||||
{% 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>
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-emerald-50 text-emerald-700 border border-emerald-200 whitespace-nowrap">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>
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-blue-50 text-blue-700 border border-blue-200 whitespace-nowrap">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">Maintenance</span>
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-amber-50 text-amber-700 border border-amber-200 whitespace-nowrap">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>
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-gray-100 text-gray-500 border border-gray-200 whitespace-nowrap">Pensiun</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="p-4 text-center">
|
||||
<div class="flex items-center justify-center space-x-1.5">
|
||||
<td class="p-4 text-left whitespace-nowrap">
|
||||
<div class="flex items-center justify-start space-x-1.5">
|
||||
<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>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block page_title %}{{ item.item_code }} - {{ item.name }}{% endblock %}
|
||||
{% block page_title %}{{ item.item_code }}{% endblock %}
|
||||
|
||||
{% block page_title_guide %}Buku Besar & Riwayat Stok Consumable{% endblock %}
|
||||
{% block page_guide_content %}
|
||||
@@ -15,59 +15,73 @@
|
||||
|
||||
{% block content %}
|
||||
<!-- Header Navigation & Actions -->
|
||||
<div class="mb-6 flex flex-col sm:flex-row sm:justify-between sm:items-end space-y-4 sm:space-y-0">
|
||||
<div>
|
||||
<div class="flex items-center space-x-2 text-xs font-bold text-gray-400 mb-1">
|
||||
<a href="{% url 'consumable_list' %}" class="hover:text-kerinci transition-colors">Consumable Item</a>
|
||||
<span>•</span>
|
||||
<span class="text-kerinci font-mono">{{ item.item_code }}</span>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<h2 class="text-2xl sm:text-3xl font-extrabold text-gray-900">{{ item.name }}</h2>
|
||||
<!-- Status Badge -->
|
||||
{% if item.stock_status == 'out_of_stock' %}
|
||||
<span class="px-3 py-1 rounded-full text-xs font-bold bg-red-100 text-red-700 border border-red-200 flex items-center gap-1.5">
|
||||
<span class="w-2 h-2 rounded-full bg-red-500"></span>
|
||||
Stok Habis
|
||||
</span>
|
||||
{% elif item.stock_status == 'low_stock' %}
|
||||
<span class="px-3 py-1 rounded-full text-xs font-bold bg-amber-100 text-amber-800 border border-amber-200 flex items-center gap-1.5">
|
||||
<span class="w-2 h-2 rounded-full bg-amber-500"></span>
|
||||
Stok Menipis
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="px-3 py-1 rounded-full text-xs font-bold bg-emerald-100 text-emerald-800 border border-emerald-200 flex items-center gap-1.5">
|
||||
<span class="w-2 h-2 rounded-full bg-emerald-500"></span>
|
||||
Stok Tersedia
|
||||
</span>
|
||||
{% endif %}
|
||||
<span class="px-2.5 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-700">
|
||||
{{ item.get_category_display }}
|
||||
</span>
|
||||
</div>
|
||||
<p class="text-xs text-gray-500 mt-1">{{ item.brand|default:"Tanpa Merek" }} • {{ item.specification|default:"Tidak ada spesifikasi khusus" }}</p>
|
||||
<div class="mb-6 flex flex-col md:flex-row md:justify-between md:items-start gap-4">
|
||||
<!-- Kiri: Breadcrumb, Judul, Badges & Spesifikasi -->
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="flex items-center space-x-2 text-xs font-bold text-kerinci uppercase tracking-widest mb-1.5">
|
||||
<a href="{% url 'consumable_list' %}" class="hover:underline flex items-center gap-1">
|
||||
<span>Consumable Item</span>
|
||||
</a>
|
||||
<span class="text-gray-300">•</span>
|
||||
<span class="font-mono text-gray-500 font-semibold">{{ item.item_code }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div class="flex flex-wrap items-center gap-2 w-full sm:w-auto">
|
||||
<a href="{% url 'consumable_list' %}" class="px-3.5 py-2 rounded-xl border border-gray-200 text-xs font-bold text-gray-600 hover:bg-gray-50 transition-colors flex items-center space-x-1.5 bg-white shadow-sm">
|
||||
<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="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg>
|
||||
<span>Katalog</span>
|
||||
</a>
|
||||
{% if not is_read_only %}
|
||||
<button onclick="openModalBarangMasuk()" class="bg-blue-600 text-white px-3.5 py-2 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>
|
||||
</button>
|
||||
<button onclick="openModalBarangKeluar()" class="bg-amber-600 text-white px-3.5 py-2 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>
|
||||
</button>
|
||||
<button onclick="openModalEditItem()" class="px-3.5 py-2 rounded-xl border border-gray-200 text-xs font-bold text-gray-700 hover:bg-gray-50 transition-colors flex items-center space-x-1.5 bg-white shadow-sm">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path></svg>
|
||||
<span>Edit Master</span>
|
||||
</button>
|
||||
<h2 class="text-2xl sm:text-3xl font-extrabold text-gray-900 tracking-tight leading-tight">{{ item.name }}</h2>
|
||||
|
||||
<p class="text-xs text-gray-500 mt-2 flex flex-wrap items-center gap-x-2 gap-y-1">
|
||||
<span class="font-semibold text-gray-700">{{ item.brand|default:"Tanpa Merek" }}</span>
|
||||
{% if item.specification %}
|
||||
<span class="text-gray-300">•</span>
|
||||
<span>{{ item.specification }}</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Kanan: Action Buttons Rapih & Teratur (Tidak Menumpuk) -->
|
||||
<div class="flex flex-wrap sm:flex-nowrap items-center gap-3 w-full sm:w-auto shrink-0 self-start">
|
||||
{% if not is_read_only %}
|
||||
<!-- 1. Tombol Edit Item: Mobile baris atas kiri (flex-1), Desktop tengah (sm:order-2 sm:flex-none) -->
|
||||
<button onclick="openModalEditItem()" class="order-1 sm:order-2 bg-white border border-gray-200 rounded-xl shadow-sm px-3.5 sm:px-4 py-2 text-xs sm:text-sm font-bold text-gray-700 hover:bg-gray-50 transition-colors flex items-center space-x-1.5 sm:space-x-2 justify-center flex-1 sm:flex-none whitespace-nowrap">
|
||||
<svg class="w-4 h-4 text-amber-500 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path></svg>
|
||||
<span>Edit Item</span>
|
||||
</button>
|
||||
|
||||
<!-- 2. Dropdown Transaksi Stok: Mobile baris atas kanan (flex-1), Desktop kanan (sm:order-3 sm:flex-none) -->
|
||||
<div class="order-2 sm:order-3 relative inline-block flex-1 sm:flex-none w-auto" id="trxDropdownContainer">
|
||||
<button onclick="var d = document.getElementById('trxActionDropdown'); d.style.display = d.style.display === 'block' ? 'none' : 'block'; event.stopPropagation();" class="w-full bg-kerinci hover:bg-kerinci/90 text-white rounded-xl shadow-sm px-3.5 sm:px-4 py-2 text-xs sm:text-sm font-bold transition-all flex items-center space-x-1.5 sm:space-x-2 justify-center whitespace-nowrap">
|
||||
<svg class="w-4 h-4 shrink-0" 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 shrink-0" 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="trxActionDropdown" style="display: none;" class="absolute right-0 mt-2 w-56 bg-white rounded-2xl shadow-[0_10px_35px_rgba(0,0,0,0.15)] border border-gray-100 p-1.5 z-50">
|
||||
<button onclick="openModalBarangMasuk(); document.getElementById('trxActionDropdown').style.display='none';" class="w-full text-left px-3.5 py-2.5 rounded-xl hover:bg-blue-50 text-blue-700 font-bold text-xs flex items-center space-x-2.5 transition-colors">
|
||||
<div class="w-7 h-7 rounded-lg bg-blue-100 flex items-center justify-center text-blue-600 shrink-0">
|
||||
<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>
|
||||
</div>
|
||||
<div>
|
||||
<div class="font-extrabold">+ Barang Masuk</div>
|
||||
<div class="text-[10px] text-gray-500 font-normal">Penerimaan / Pengadaan</div>
|
||||
</div>
|
||||
</button>
|
||||
<div class="h-px bg-gray-100 my-1"></div>
|
||||
<button onclick="openModalBarangKeluar(); document.getElementById('trxActionDropdown').style.display='none';" class="w-full text-left px-3.5 py-2.5 rounded-xl hover:bg-amber-50 text-amber-700 font-bold text-xs flex items-center space-x-2.5 transition-colors">
|
||||
<div class="w-7 h-7 rounded-lg bg-amber-100 flex items-center justify-center text-amber-600 shrink-0">
|
||||
<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>
|
||||
</div>
|
||||
<div>
|
||||
<div class="font-extrabold">- Barang Keluar</div>
|
||||
<div class="text-[10px] text-gray-500 font-normal">Pemakaian Teknisi / Unit</div>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- 3. Tombol Kembali: Mobile baris bawah (w-full), Desktop paling kiri (sm:order-1 sm:w-auto) -->
|
||||
<a href="{% url 'consumable_list' %}" class="order-3 sm:order-1 bg-white border border-gray-200 rounded-xl shadow-sm px-4 py-2 text-sm font-bold text-gray-700 hover:bg-gray-50 hover:text-kerinci transition-colors flex items-center space-x-2 justify-center w-full sm:w-auto flex-none">
|
||||
<svg class="w-4 h-4 text-gray-500 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg>
|
||||
<span>Kembali</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -120,18 +134,31 @@
|
||||
|
||||
<!-- Stock Ledger Table (Buku Besar Mutasi) -->
|
||||
<div class="bg-white rounded-2xl shadow-sm border border-gray-200 overflow-hidden mb-6">
|
||||
<div class="p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/50">
|
||||
<div class="p-4 border-b border-gray-100 flex flex-col sm:flex-row sm:items-center justify-between gap-3 bg-gray-50/50">
|
||||
<div class="flex items-center space-x-2">
|
||||
<svg class="w-5 h-5 text-kerinci" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
|
||||
<h3 class="font-extrabold text-gray-900 text-sm">Buku Besar Persediaan (Stock Ledger)</h3>
|
||||
</div>
|
||||
{% if not is_read_only %}
|
||||
<div class="flex items-center space-x-2 self-start sm:self-auto">
|
||||
<button onclick="openModalBarangMasuk()" class="text-xs font-bold text-blue-700 bg-blue-50 hover:bg-blue-100 border border-blue-200 px-3 py-1.5 rounded-lg transition-colors flex items-center space-x-1 shadow-xs">
|
||||
<svg class="w-3.5 h-3.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>+ Barang Masuk</span>
|
||||
</button>
|
||||
<button onclick="openModalBarangKeluar()" class="text-xs font-bold text-amber-700 bg-amber-50 hover:bg-amber-100 border border-amber-200 px-3 py-1.5 rounded-lg transition-colors flex items-center space-x-1 shadow-xs">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 12H4"></path></svg>
|
||||
<span>- Barang Keluar</span>
|
||||
</button>
|
||||
</div>
|
||||
{% else %}
|
||||
<span class="text-xs text-gray-500 font-medium">Audit Trail Mutasi Stok</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-left border-collapse min-w-[1000px]">
|
||||
<thead>
|
||||
<tr class="bg-gray-50/75 border-b border-gray-200 text-[11px] font-bold text-gray-500 uppercase tracking-wider">
|
||||
<thead class="bg-[#002060] text-white">
|
||||
<tr class="text-[11px] font-bold uppercase tracking-wider">
|
||||
<th class="py-3 px-4">Tanggal & Ref</th>
|
||||
<th class="py-3 px-4 text-center">Tipe Transaksi</th>
|
||||
<th class="py-3 px-4 text-right">Kuantitas Transaksi</th>
|
||||
@@ -654,5 +681,13 @@
|
||||
function closeModalReversal() {
|
||||
document.getElementById('modalReversal').classList.add('hidden');
|
||||
}
|
||||
|
||||
// Tutup dropdown saat klik di luar
|
||||
window.addEventListener('click', function(e) {
|
||||
var trxDropdown = document.getElementById('trxActionDropdown');
|
||||
if (trxDropdown && !trxDropdown.contains(e.target)) {
|
||||
trxDropdown.style.display = 'none';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -29,15 +29,15 @@
|
||||
</div>
|
||||
|
||||
<!-- Header Actions -->
|
||||
<div class="flex items-center space-x-3 w-full sm:w-auto">
|
||||
<div class="flex flex-wrap sm:flex-nowrap items-center gap-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>
|
||||
<div class="relative inline-block flex-1 sm:flex-none w-auto">
|
||||
<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 whitespace-nowrap shadow-sm">
|
||||
<svg class="w-4 h-4 shrink-0" 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>
|
||||
<svg class="w-4 h-4 shrink-0" 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">
|
||||
<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 py-1">
|
||||
<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
|
||||
@@ -52,11 +52,11 @@
|
||||
|
||||
{% if not is_read_only %}
|
||||
<!-- 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>
|
||||
<div class="relative inline-block flex-1 sm:flex-none w-auto">
|
||||
<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 whitespace-nowrap">
|
||||
<svg class="w-4 h-4 text-blue-600 shrink-0" 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>
|
||||
<svg class="w-4 h-4 shrink-0" 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="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">
|
||||
@@ -76,8 +76,8 @@
|
||||
</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>
|
||||
<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 sm:flex-none whitespace-nowrap">
|
||||
<svg class="w-4 h-4 shrink-0" 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>
|
||||
</button>
|
||||
{% endif %}
|
||||
@@ -105,8 +105,8 @@
|
||||
</div>
|
||||
|
||||
<!-- 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">
|
||||
<div class="mb-4 flex flex-col md:flex-row md:items-center md:justify-between gap-3">
|
||||
<form id="searchForm" method="GET" class="relative w-full md:w-96 min-w-0">
|
||||
<input type="hidden" name="status" value="{{ status_filter }}">
|
||||
{% if category_filter %}<input type="hidden" name="category" value="{{ category_filter }}">{% endif %}
|
||||
{% if location_filter %}<input type="hidden" name="location" value="{{ location_filter }}">{% endif %}
|
||||
@@ -114,23 +114,29 @@
|
||||
<svg class="w-5 h-5 text-gray-400 absolute left-3 top-2.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
|
||||
</form>
|
||||
|
||||
<div class="flex 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">
|
||||
<div class="flex items-center gap-2 w-full md:w-auto min-w-0">
|
||||
<div class="grid grid-cols-2 gap-2 flex-1 md:flex-none w-full md:w-auto min-w-0">
|
||||
<div class="min-w-0">
|
||||
<select onchange="location = this.value;" class="w-full md:w-48 truncate 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 cursor-pointer" style="min-width: 0; max-width: 100%;">
|
||||
<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="?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>
|
||||
</div>
|
||||
|
||||
<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">
|
||||
<div class="min-w-0">
|
||||
<select onchange="location = this.value;" class="w-full md:w-44 truncate 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 cursor-pointer" style="min-width: 0; max-width: 100%;">
|
||||
<option value="?status={{ status_filter }}&category={{ category_filter }}&q={{ search_query }}">Semua Lokasi</option>
|
||||
{% for loc in locations %}
|
||||
<option value="?status={{ status_filter }}&category={{ category_filter }}&location={{ loc }}&q={{ search_query }}" {% if location_filter == loc %}selected{% endif %}>{{ loc }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if search_query or category_filter or location_filter or status_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">
|
||||
<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 shrink-0 whitespace-nowrap" title="Reset Filter">
|
||||
Reset
|
||||
</a>
|
||||
{% endif %}
|
||||
@@ -140,31 +146,31 @@
|
||||
<!-- 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">
|
||||
<table class="w-full text-left border-collapse min-w-[1100px]">
|
||||
<thead>
|
||||
<tr class="bg-[#002060] text-white text-[11px] uppercase tracking-widest">
|
||||
<th class="p-4 font-bold text-center w-16">No</th>
|
||||
<th class="p-4 font-bold w-36">Kode Item</th>
|
||||
<tr class="bg-[#002060] text-white text-[11px] uppercase tracking-wider">
|
||||
<th class="p-4 font-bold text-center w-14 whitespace-nowrap">No</th>
|
||||
<th class="p-4 font-bold whitespace-nowrap">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 whitespace-nowrap">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>
|
||||
<th class="p-4 font-bold text-center whitespace-nowrap">Satuan</th>
|
||||
<th class="p-4 font-bold text-center whitespace-nowrap min-w-[120px]">Stok</th>
|
||||
<th class="p-4 font-bold whitespace-nowrap min-w-[160px]">Lokasi</th>
|
||||
<th class="p-4 font-bold text-center whitespace-nowrap">Status</th>
|
||||
<th class="p-4 font-bold text-center w-28 whitespace-nowrap">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-sm divide-y divide-gray-200">
|
||||
{% for item in page_obj %}
|
||||
<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">
|
||||
<td class="p-4 text-center text-gray-500 whitespace-nowrap">{{ forloop.counter }}</td>
|
||||
<td class="p-4 font-bold text-gray-700 font-mono text-xs whitespace-nowrap">
|
||||
<a href="{% url 'consumable_detail' item.id %}" class="hover:text-kerinci transition-colors">
|
||||
{{ item.item_code }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="p-4">
|
||||
<td class="p-4 min-w-[200px]">
|
||||
<a href="{% url 'consumable_detail' item.id %}" class="font-bold text-gray-900 hover:text-kerinci transition-colors block">
|
||||
{{ item.name }}
|
||||
</a>
|
||||
@@ -172,33 +178,47 @@
|
||||
<p class="text-xs text-gray-500 font-normal mt-0.5">Merek: {{ item.brand }}</p>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="p-4 text-gray-600 font-medium text-xs">
|
||||
{{ item.get_category_display }}
|
||||
<td class="p-4 text-gray-600 font-medium text-xs whitespace-nowrap">
|
||||
{% if item.category == 'cable' %}Kabel (UTP & FO)
|
||||
{% elif item.category == 'connector' %}Konektor & Barrel
|
||||
{% elif item.category == 'maintenance' %}Bahan Perawatan
|
||||
{% elif item.category == 'fastener' %}Baut, Mur & Ties
|
||||
{% elif item.category == 'electrical' %}Kelistrikan & Isolasi
|
||||
{% elif item.category == 'cleaning' %}Cleaning Supplies
|
||||
{% elif item.category == 'tools_acc' %}Aksesori & Tools
|
||||
{% else %}{{ item.get_category_display }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<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>
|
||||
<td class="p-4 text-center text-gray-700 font-semibold text-xs">
|
||||
<td class="p-4 text-center text-gray-700 font-semibold text-xs whitespace-nowrap">
|
||||
{{ item.base_unit }}
|
||||
</td>
|
||||
<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 class="p-4 text-center whitespace-nowrap">
|
||||
<div class="font-black text-sm {% 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 }}
|
||||
</div>
|
||||
<div class="text-[11px] text-gray-400 font-medium">
|
||||
Min: {{ item.minimum_stock|floatformat:0 }} {{ item.base_unit }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="p-4 text-gray-600 text-xs font-medium">
|
||||
{{ item.location }}
|
||||
<td class="p-4 text-gray-700 text-xs font-medium whitespace-nowrap min-w-[160px]">
|
||||
<div class="flex items-center space-x-1.5">
|
||||
<svg class="w-3.5 h-3.5 text-gray-400 shrink-0" 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><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"></path></svg>
|
||||
<span>{{ item.location }}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="p-4 text-center">
|
||||
<td class="p-4 text-center whitespace-nowrap">
|
||||
{% if item.stock_status == 'out_of_stock' %}
|
||||
<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>
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-red-50 text-red-700 border border-red-200 whitespace-nowrap">Habis</span>
|
||||
{% elif item.stock_status == 'low_stock' %}
|
||||
<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>
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-amber-50 text-amber-700 border border-amber-200 whitespace-nowrap">Menipis</span>
|
||||
{% else %}
|
||||
<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>
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-bold bg-emerald-50 text-emerald-700 border border-emerald-200 whitespace-nowrap">Aman</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="p-4 text-center">
|
||||
<td class="p-4 text-center whitespace-nowrap">
|
||||
<div class="flex items-center justify-center space-x-1.5">
|
||||
<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>
|
||||
|
||||
@@ -12,7 +12,12 @@
|
||||
</div>
|
||||
<p class="text-gray-500 mt-1 font-medium">NIK: {{ employee.nik }} <span class="mx-2">•</span> Jabatan: {{ employee.position|default:"-" }}</p>
|
||||
</div>
|
||||
<div class="flex items-center space-x-3 w-full sm:w-auto">
|
||||
<div class="flex flex-wrap sm:flex-nowrap items-center gap-3 w-full sm:w-auto">
|
||||
<a href="{% url 'employee_list' %}" class="bg-white border border-gray-200 rounded-xl shadow-sm px-4 py-2 text-sm font-bold text-gray-700 hover:bg-gray-50 hover:text-kerinci transition-colors flex items-center space-x-2 justify-center text-center w-full sm:w-auto flex-1 sm:flex-none">
|
||||
<svg class="w-4 h-4 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg>
|
||||
<span>Kembali</span>
|
||||
</a>
|
||||
|
||||
<div class="relative inline-block w-full sm:w-auto flex-1 sm:flex-none">
|
||||
<button onclick="var d = document.getElementById('exportMenuEmployeeDetail'); 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>
|
||||
@@ -31,9 +36,6 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<a href="{% url 'employee_list' %}" class="bg-white border border-gray-200 rounded-xl shadow-sm px-4 py-2 text-sm font-bold text-gray-700 hover:bg-gray-50 transition-colors flex items-center space-x-2 justify-center text-center w-full sm:w-auto flex-1 sm:flex-none">
|
||||
<span>Kembali</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -11,7 +11,12 @@
|
||||
Dari Aset: <a href="{% url 'asset_units' unit.asset.id %}" class="font-bold text-blue-600 hover:underline">{{ unit.asset.name }}</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center space-x-3 w-full sm:w-auto">
|
||||
<div class="flex flex-wrap sm:flex-nowrap items-center gap-3 w-full sm:w-auto">
|
||||
<a href="{% url 'asset_units' unit.asset.id %}" class="bg-white border border-gray-200 rounded-xl shadow-sm px-4 py-2 text-sm font-bold text-gray-700 hover:bg-gray-50 hover:text-kerinci transition-colors flex items-center space-x-2 justify-center text-center w-full sm:w-auto flex-1 sm:flex-none">
|
||||
<svg class="w-4 h-4 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg>
|
||||
<span>Kembali</span>
|
||||
</a>
|
||||
|
||||
<div class="relative inline-block w-full sm:w-auto flex-1 sm:flex-none">
|
||||
<button onclick="var d = document.getElementById('exportMenuHistory'); 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>
|
||||
@@ -30,9 +35,6 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<a href="{% url 'asset_units' unit.asset.id %}" class="bg-white border border-gray-200 rounded-xl shadow-sm px-4 py-2 text-sm font-bold text-gray-700 hover:bg-gray-50 transition-colors flex items-center space-x-2 justify-center text-center w-full sm:w-auto flex-1 sm:flex-none">
|
||||
<span>Kembali</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user