select box
This commit is contained in:
@@ -44,11 +44,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-4 bg-slate-50 border border-slate-100 rounded-2xl p-4 relative z-10 min-w-[200px] shadow-sm">
|
||||
<div class="flex items-center gap-4 bg-slate-50 border border-slate-100 rounded-2xl p-4 relative z-10 min-w-[220px] shadow-sm">
|
||||
<div class="w-11 h-11 bg-white rounded-xl shadow-sm flex items-center justify-center text-xl">
|
||||
🎫
|
||||
</div>
|
||||
<div>
|
||||
<div class="flex-1">
|
||||
<span class="text-[10px] font-bold text-gray-500 uppercase tracking-wider block">Số thẻ hiện có</span>
|
||||
<span id="user-card-balance" class="text-xl font-black text-[#1a2b49]">{{ $user->card }}</span>
|
||||
</div>
|
||||
@@ -82,10 +82,10 @@
|
||||
<table class="min-w-full divide-y divide-gray-100 text-sm">
|
||||
<thead class="bg-gray-50/50 sticky top-0 z-10">
|
||||
<tr>
|
||||
<th class="px-6 py-4 text-center text-xs font-bold text-text-light uppercase tracking-wider w-24">Hành động</th>
|
||||
<th class="px-6 py-4 text-left text-xs font-bold text-text-light uppercase tracking-wider">Ngày cấp</th>
|
||||
<th class="px-6 py-4 text-left text-xs font-bold text-text-light uppercase tracking-wider">Người cấp (Admin)</th>
|
||||
<th class="px-6 py-4 text-left text-xs font-bold text-text-light uppercase tracking-wider">Số lượng thẻ</th>
|
||||
<th class="px-6 py-4 text-center text-xs font-bold text-text-light uppercase tracking-wider w-24">Hành động</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-100">
|
||||
@@ -94,6 +94,16 @@
|
||||
$isCurrentMonth = Carbon\Carbon::parse($addCard->date)->format('Y-m') === Carbon\Carbon::now()->format('Y-m');
|
||||
@endphp
|
||||
<tr class="hover:bg-slate-50/60 transition-colors">
|
||||
<td class="px-6 py-3.5 whitespace-nowrap text-center">
|
||||
@if($isCurrentMonth)
|
||||
<div class="flex items-center justify-center gap-3">
|
||||
<button type="button" onclick="openEditAddCardModal({{ json_encode($addCard) }})" class="text-blue-600 hover:text-blue-900 font-bold transition-colors">Sửa</button>
|
||||
<button type="button" onclick="confirmDeleteAddCard({{ $addCard->id }})" class="text-red-600 hover:text-red-900 font-bold transition-colors">Xóa</button>
|
||||
</div>
|
||||
@else
|
||||
<span class="text-gray-400 font-semibold text-xs cursor-not-allowed" title="Không thể chỉnh sửa giao dịch tháng trước">Tháng trước</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-6 py-3.5 whitespace-nowrap text-text-medium font-medium">{{ Carbon\Carbon::parse($addCard->date)->format('d/m/Y') }}</td>
|
||||
<td class="px-6 py-3.5 whitespace-nowrap font-bold text-[#1a2b49]">
|
||||
@if($addCard->sellerUser)
|
||||
@@ -106,13 +116,6 @@
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-6 py-3.5 whitespace-nowrap font-extrabold text-base text-green-600">+{{ $addCard->num_card }}</td>
|
||||
<td class="px-6 py-3.5 whitespace-nowrap text-center">
|
||||
@if($isCurrentMonth)
|
||||
<button type="button" onclick="openEditAddCardModal({{ json_encode($addCard) }})" class="text-blue-600 hover:text-blue-900 font-bold transition-colors">Sửa</button>
|
||||
@else
|
||||
<span class="text-gray-400 font-semibold text-xs cursor-not-allowed" title="Không thể chỉnh sửa giao dịch tháng trước">Tháng trước</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
@@ -124,9 +127,12 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@php
|
||||
$isCurrentMonthFilter = $selectedMonth === Carbon\Carbon::now()->format('Y-m');
|
||||
@endphp
|
||||
<div class="px-6 py-4 bg-slate-50 border-t border-gray-100 flex justify-end">
|
||||
<button type="button" onclick="openAddCardModal()" class="inline-flex items-center gap-2 bg-[#3462f7] hover:bg-blue-700 text-white font-bold text-sm px-5 py-2.5 rounded-xl shadow-md shadow-blue-500/10 transition-all">
|
||||
➕ Thêm thẻ
|
||||
<button type="button" onclick="openAddCardModal()" {{ !$isCurrentMonthFilter ? 'disabled' : '' }} class="inline-flex items-center justify-center bg-[#3462f7] hover:bg-blue-700 disabled:bg-gray-300 disabled:text-gray-500 disabled:cursor-not-allowed disabled:shadow-none text-white font-bold text-sm px-5 py-2.5 rounded-xl shadow-md shadow-blue-500/10 transition-all">
|
||||
Thêm thẻ
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -171,10 +177,10 @@
|
||||
<table class="min-w-full divide-y divide-gray-100 text-sm">
|
||||
<thead class="bg-gray-50/50 sticky top-0">
|
||||
<tr>
|
||||
<th class="px-6 py-4 text-center text-xs font-bold text-text-light uppercase tracking-wider w-24">Hành động</th>
|
||||
<th class="px-6 py-4 text-left text-xs font-bold text-text-light uppercase tracking-wider">Ngày cấp</th>
|
||||
<th class="px-6 py-4 text-left text-xs font-bold text-text-light uppercase tracking-wider">Người cấp (Admin)</th>
|
||||
<th class="px-6 py-4 text-left text-xs font-bold text-text-light uppercase tracking-wider">Số lượng thẻ</th>
|
||||
<th class="px-6 py-4 text-center text-xs font-bold text-text-light uppercase tracking-wider w-24">Hành động</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-100">
|
||||
@@ -183,6 +189,16 @@
|
||||
$isCurrentMonth = Carbon\Carbon::parse($addCard->date)->format('Y-m') === Carbon\Carbon::now()->format('Y-m');
|
||||
@endphp
|
||||
<tr class="hover:bg-slate-50/60 transition-colors">
|
||||
<td class="px-6 py-3.5 whitespace-nowrap text-center">
|
||||
@if($isCurrentMonth)
|
||||
<div class="flex items-center justify-center gap-3">
|
||||
<button type="button" onclick="openEditAddCardModal({{ json_encode($addCard) }})" class="text-blue-600 hover:text-blue-900 font-bold transition-colors">Sửa</button>
|
||||
<button type="button" onclick="confirmDeleteAddCard({{ $addCard->id }})" class="text-red-600 hover:text-red-900 font-bold transition-colors">Xóa</button>
|
||||
</div>
|
||||
@else
|
||||
<span class="text-gray-400 font-semibold text-xs cursor-not-allowed" title="Không thể chỉnh sửa giao dịch tháng trước">Tháng trước</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-6 py-3.5 whitespace-nowrap text-text-medium font-medium">{{ Carbon\Carbon::parse($addCard->date)->format('d/m/Y') }}</td>
|
||||
<td class="px-6 py-3.5 whitespace-nowrap font-bold text-[#1a2b49]">
|
||||
@if($addCard->sellerUser)
|
||||
@@ -195,13 +211,6 @@
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-6 py-3.5 whitespace-nowrap font-extrabold text-base text-green-600">+{{ $addCard->num_card }}</td>
|
||||
<td class="px-6 py-3.5 whitespace-nowrap text-center">
|
||||
@if($isCurrentMonth)
|
||||
<button type="button" onclick="openEditAddCardModal({{ json_encode($addCard) }})" class="text-blue-600 hover:text-blue-900 font-bold transition-colors">Sửa</button>
|
||||
@else
|
||||
<span class="text-gray-400 font-semibold text-xs cursor-not-allowed" title="Không thể chỉnh sửa giao dịch tháng trước">Tháng trước</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
@@ -213,9 +222,12 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@php
|
||||
$isCurrentMonthFilter = $selectedMonth === Carbon\Carbon::now()->format('Y-m');
|
||||
@endphp
|
||||
<div class="px-6 py-4 bg-slate-50 border-t border-gray-100 flex justify-end">
|
||||
<button type="button" onclick="openAddCardModal()" class="inline-flex items-center gap-2 bg-[#3462f7] hover:bg-blue-700 text-white font-bold text-sm px-5 py-2.5 rounded-xl shadow-md shadow-blue-500/10 transition-all">
|
||||
➕ Thêm thẻ
|
||||
<button type="button" onclick="openAddCardModal()" {{ !$isCurrentMonthFilter ? 'disabled' : '' }} class="inline-flex items-center justify-center bg-[#3462f7] hover:bg-blue-700 disabled:bg-gray-300 disabled:text-gray-500 disabled:cursor-not-allowed disabled:shadow-none text-white font-bold text-sm px-5 py-2.5 rounded-xl shadow-md shadow-blue-500/10 transition-all">
|
||||
Thêm thẻ
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -275,6 +287,8 @@
|
||||
</form>
|
||||
</x-modal>
|
||||
|
||||
<x-confirm-modal id="deleteAddCardModal" title="Xác nhận xóa giao dịch" confirmText="Xác nhận xóa" />
|
||||
|
||||
<script>
|
||||
function openEditAddCardModal(record) {
|
||||
const form = document.getElementById('editAddCardForm');
|
||||
@@ -340,6 +354,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
function confirmDeleteAddCard(id) {
|
||||
const messageEl = document.getElementById('deleteAddCardModal-message');
|
||||
if (messageEl) {
|
||||
messageEl.innerHTML = 'Bạn có chắc chắn muốn xóa giao dịch cấp phát thẻ này không? Thao tác này sẽ trừ số thẻ tương ứng của user.';
|
||||
}
|
||||
|
||||
const formEl = document.getElementById('deleteAddCardModal-form');
|
||||
if (formEl) {
|
||||
formEl.action = `/admin/add-cards/${id}`;
|
||||
}
|
||||
|
||||
openModal('deleteAddCardModal');
|
||||
}
|
||||
|
||||
async function reloadListsSection() {
|
||||
try {
|
||||
const response = await fetch(window.location.href, {
|
||||
@@ -379,6 +407,11 @@
|
||||
if (editForm) {
|
||||
editForm.addEventListener('submit', (e) => submitModalForm(e, 'editAddCardForm', 'editAddCardModal'));
|
||||
}
|
||||
|
||||
const deleteForm = document.getElementById('deleteAddCardModal-form');
|
||||
if (deleteForm) {
|
||||
deleteForm.addEventListener('submit', (e) => submitModalForm(e, 'deleteAddCardModal-form', 'deleteAddCardModal'));
|
||||
}
|
||||
}
|
||||
|
||||
if (document.readyState !== 'loading') {
|
||||
|
||||
Reference in New Issue
Block a user