style: fix text stacking in Stok and Lokasi columns on Consumable Item table

This commit is contained in:
Wahyudin
2026-10-27 14:12:28 +07:00
parent 4bfeb96c4c
commit 1b645deff7
+41 -27
View File
@@ -140,31 +140,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 +172,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>