📦 Purchase Order List

Manage your purchase orders efficiently. You can add, edit, or delete purchase orders as needed.

{ const searchTerm = ( e.target as HTMLInputElement ).value.toLowerCase(); fetchPurchaseOrder(null, searchTerm, "created_at", "desc"); }} />
{#each columns as col} {#if col.key === "name"} {:else} {/if} {/each} {#each paginatedRows as row} {#each columns as col} {#if col.key === "name"} {:else if col.key === "approval"} {:else if col.key === "acknowledged"} {:else if col.key === "actions"} {:else if col.key === "move_issue"} {:else if col.key === "updated_at"} {:else if col.key === "created_at"} {:else if col.key === "po_price"} {:else if col.key === "po_total_price"} {:else} {/if} {/each} {/each}
{col.title} {col.title}
{row[col.key as keyof PurchaseOrderDisplay]} { const isChecked = ( e.target as HTMLInputElement ).checked; row.acknowledged = isChecked; if (isChecked) { // map to project await acknowledgedOk( row.id, isChecked, ); } }} /> {timestampToDateTime( row[ col.key as keyof PurchaseOrderDisplay ] as string, )}{timestampToDateTime( row[ col.key as keyof PurchaseOrderDisplay ] as string, )}{row.approved_price.toLocaleString( "en-US", { style: "currency", currency: "USD", }, )}{( row.approved_quantity * row.approved_price ).toLocaleString("en-US", { style: "currency", currency: "USD", })}{row[ col.key as keyof PurchaseOrderDisplay ]}
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 Project" : "Add Project"}

{#each formColumns as col} {#if col.key === "po_status"}
{:else if col.key === "po_type"}
{:else if col.key === "po_quantity"}
{:else if col.key === "approved_price"}
{:else if col.key === "approved_quantity"}
{:else if col.key === "total_approved_order_amount"}
{:else if col.key === "approved_vendor"}
{:else if col.key === "approved_by"}
{:else}
{/if} {/each}
{/if}