📝 Issue List

Manage and view all issues reported in the system.

{ const searchTerm = ( e.target as HTMLInputElement ).value.toLowerCase(); fetchIssues(null, searchTerm, "created_at", "desc"); }} />
{#each formColumnsDisplay as col} {#if col.key === "name"} {:else} {/if} {/each} {#each allRows as row} {#each formColumnsDisplay as col} {#if col.key === "name"} {:else if col.key === "actions"} {:else if col.key === "move_issue"} {#if row[col.key as keyof Issue] === "PROJECT"} {:else if row[col.key as keyof Issue] === "PURCHASE_ORDER"} {:else} {/if} {:else if col.key === "guest_has_aggreed_issue_has_been_resolved"} {:else if col.key === "issue_related_image"} {:else if col.key === "reported_date"} {:else if col.key === "need_approval"} {:else if col.key === "follow_up"} {:else if col.key === "created_at"} {:else if col.key === "updated_at"} {:else} {/if} {/each} {/each}
{col.title} {col.title}
{row[col.key]} {#if row[col.key as keyof Issue]} ✅ {:else} ❌ {/if} {#if typeof row[col.key as keyof Issue] === "string" && row[col.key as keyof Issue]} {#await getPublicUrl(row[col.key as keyof Issue] as string) then publicUrl} View Picture {:catch} Error loading image {/await} {:else} No Picture {/if} {typeof row[col.key as keyof Issue] === "string" || typeof row[col.key as keyof Issue] === "number" ? new Date( row[col.key as keyof Issue] as | string | number, ).toLocaleString("en-US") : ""} {#if row[col.key as keyof Issue]} ✅ {:else} ❌ {/if} {#if row[col.key as keyof Issue]} ✅ {:else} ❌ {/if} {new Date( row[col.key as keyof Issue] as string, ).toLocaleString("en-US")} {row[col.key as keyof Issue] ? new Date( row[ col.key as keyof Issue ] as string, ).toLocaleString("en-US") : ""} {row[col.key as keyof Issue]}
Showing {(currentPage - 1) * rowsPerPage + 1}– {Math.min(currentPage * rowsPerPage, allRows.length)} of {allRows.length}
{#each Array(totalPages) .fill(0) .map((_, i) => i + 1) as page} {/each}
{#if showModal}

{isEditing ? "Edit Issue" : "Add New Issue"}

{#each formColumns as col} {#if col.key === "name"}
{#if $formErrors.name}

{$formErrors.name}

{/if}
{:else if col.key === "guest_has_aggreed_issue_has_been_resolved"}
{:else if col.key === "follow_up"}
{:else if col.key === "issue_related_image"}

Upload an image related to the issue.

{#if imagePreviewUrl} Preview {:else if newIssue.issue_related_image} {#await getPublicUrl(newIssue.issue_related_image) then url} Preview {/await} {/if}
{:else if col.key === "reported_date"}
{#if $formErrors.reported_date}

{$formErrors.reported_date}

{/if}
{:else if col.key === "need_approval"}
{:else if col.key === "issue_source"}
{#if $formErrors.issue_source}

{$formErrors.issue_source}

{/if}
{:else if col.key === "reported_by"}
{#if $formErrors.reported_by}

{$formErrors.reported_by}

{/if}
{:else if col.key === "input_by"}
{#if $formErrors.input_by}

{$formErrors.input_by}

{/if}
{:else if col.key === "area_of_villa"}
{#if $formErrors.area_of_villa}

{$formErrors.area_of_villa}

{/if}
{:else if col.key === "issue_type"}
{#if $formErrors.issue_type}

{$formErrors.issue_type}

{/if}
{:else if col.key === "priority"}
{#if $formErrors.priority}

{$formErrors.priority}

{/if}
{:else if col.key === "villa_id"}
{#if $formErrors.villa_id}

{$formErrors.villa_id}

{/if}
{:else if col.key === "description_of_the_issue"}
{#if $formErrors.description_of_the_issue}

{$formErrors.description_of_the_issue}

{/if}
{:else}
{/if} {/each}
{/if}