From 86576802615580fe5041477dc944dabf12763a04 Mon Sep 17 00:00:00 2001 From: Aji Setiaji Date: Fri, 11 Jul 2025 10:43:16 +0700 Subject: [PATCH] penambahan menu inventory --- src/routes/backoffice/inventory/+page.svelte | 783 ++++++++++++++++++- 1 file changed, 777 insertions(+), 6 deletions(-) diff --git a/src/routes/backoffice/inventory/+page.svelte b/src/routes/backoffice/inventory/+page.svelte index 5670b6a..da4a2a5 100644 --- a/src/routes/backoffice/inventory/+page.svelte +++ b/src/routes/backoffice/inventory/+page.svelte @@ -1,7 +1,778 @@ -
-
🔒🔨
-

Halaman sedang dalam tahap development

-

Mohon maaf, halaman ini belum tersedia.

+ + +
+
+
+

+ 📋 + Inventory Management +

+

+ Manage your inventory items, track stock levels, and ensure + everything is in order. +

+
+
+ { + const searchTerm = ( + e.target as HTMLInputElement + ).value.toLowerCase(); + fetchInventory(null, "created_at", "desc", 0, 10); + }} + /> + + + + + +
+
+
+ + + + {#each columns as col} + {#if col.key === "guest_name"} + + {:else} + + {/if} + {/each} + + + + {#each inventoryItems as item} + + {#each columns as col} + + {:else if col.key === "actions"} +
+ + +
+ {:else} + {item[col.key as keyof Inventory]} + {/if} + + {/each} + + {:else} + + + + {/each} + +
+ {col.title} + + {col.title} +
+ {#if +col.key >= 1 && +col.key <= 12} + { + const target = + e.target as HTMLInputElement | null; + if (!target) return; + const value = Number(target.value); + updateQtyMonth( + item.id, + +col.key, + selectedYear || + new Date().getFullYear(), + value, + ).then((success) => { + if (success) { + alert( + `Quantity for ${item.item_name} in month ${col.key} updated successfully.`, + ); + } else { + alert( + `Failed to update quantity for ${item.item_name} in month ${col.key}.`, + ); + } + }); + }} + /> + {:else if col.key === "created_at" || col.key === "updated_at"} + + {item[col.key] !== undefined + ? new Date( + item[col.key] as + | string + | number + | Date, + ).toLocaleString() + : "N/A"} +
+ No items found. +
+
+ +
+
+ Showing {(currentPage - 1) * rowsPerPage + 1}– + {Math.min(currentPage * rowsPerPage, totalItems)} of {totalItems} items +
+
+
+ + +
+ + {#each pageRange(totalPages, currentPage) as page} + {#if page === "..."} + ... + {:else} + + {/if} + {/each} + +
+
+

+ Tekan tombol Enter untuk menyimpan. +

+ + +{#if showModal} +
+
+
+

+ {isEditing ? "Edit Item" : "New Item"} +

+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+
+{/if}