diff --git a/src/lib/utils/conversion.ts b/src/lib/utils/conversion.ts
index b6e99b5..88448b6 100644
--- a/src/lib/utils/conversion.ts
+++ b/src/lib/utils/conversion.ts
@@ -19,4 +19,14 @@ export function timestampToDate(timestamp: number): string {
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
+}
+
+export function formatCurrency(value: number | string): string {
+ if (typeof value === 'string') {
+ value = parseFloat(value);
+ }
+ return new Intl.NumberFormat('id-ID', {
+ style: 'currency',
+ currency: 'IDR',
+ }).format(value);
}
\ No newline at end of file
diff --git a/src/routes/backoffice/villa/+page.svelte b/src/routes/backoffice/villa/+page.svelte
index 9299732..75fceaf 100644
--- a/src/routes/backoffice/villa/+page.svelte
+++ b/src/routes/backoffice/villa/+page.svelte
@@ -1,5 +1,6 @@
@@ -307,10 +371,16 @@
placeholder="🔍 Search by name..."
class="border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:outline-none px-4 py-2 rounded-xl text-sm w-64 transition"
on:input={(e) => {
- const searchTerm = (
+ searchTerm = (
e.target as HTMLInputElement
).value.toLowerCase();
- fetchVillas(searchTerm, "created_at", "desc", limit, 0);
+ fetchVillas(
+ searchTerm,
+ "created_at",
+ "desc",
+ rowsPerPage,
+ 0,
+ );
}}
/>
@@ -339,7 +409,7 @@
@@ -499,31 +569,31 @@
{:else if col.key === "season_1_rate"}
- {row[col.key] || "N/A"}
+ {formatCurrency(row[col.key]) || "N/A"}
|
{:else if col.key === "season_2_rate"}
- {row[col.key] || "N/A"}
+ {formatCurrency(row[col.key]) || "N/A"}
|
{:else if col.key === "season_3_rate"}
- {row[col.key] || "N/A"}
+ {formatCurrency(row[col.key]) || "N/A"}
|
{:else if col.key === "season_4_rate"}
- {row[col.key] || "N/A"}
+ {formatCurrency(row[col.key]) || "N/A"}
|
{:else if col.key === "season_5_rate"}
- {row[col.key] || "N/A"}
+ {formatCurrency(row[col.key]) || "N/A"}
|
{:else if col.key === "season_6_rate"}
- {row[col.key] || "N/A"}
+ {formatCurrency(row[col.key]) || "N/A"}
|
{:else if col.key === "season_7_rate"}
- {row[col.key] || "N/A"}
+ {formatCurrency(row[col.key]) || "N/A"}
|
{:else if col.key === "actions"}
@@ -612,11 +682,9 @@
)}"
bind:value={newVilla[col.key]}
>
-
-
-
+
+
+
@@ -637,13 +705,12 @@
)}"
bind:value={newVilla[col.key]}
>
-
-
-
- SELECT CONDITION
+
+
+
+
@@ -664,9 +731,7 @@
)}"
bind:value={newVilla[col.key]}
>
-
+
@@ -688,9 +753,7 @@
)}"
bind:value={newVilla[col.key]}
>
-
+
@@ -712,9 +775,7 @@
)}"
bind:value={newVilla[col.key]}
>
-
+
@@ -736,9 +797,7 @@
)}"
bind:value={newVilla[col.key]}
>
-
+
@@ -748,7 +807,7 @@
{$formErrors.pet_allowed_pre_approval_status}
{/if}
- {:else if col.key === "session_1_rate" || col.key === "session_2_rate" || col.key === "session_3_rate" || col.key === "session_4_rate" || col.key === "session_5_rate" || col.key === "session_6_rate" || col.key === "session_7_rate"}
+ {:else if col.key === "season_1_rate" || col.key === "season_2_rate" || col.key === "season_3_rate" || col.key === "season_4_rate" || col.key === "season_5_rate" || col.key === "season_6_rate" || col.key === "season_7_rate"}
|