diff --git a/src/routes/backoffice/vendor/+page.svelte b/src/routes/backoffice/vendor/+page.svelte index 15de0a4..c185e82 100644 --- a/src/routes/backoffice/vendor/+page.svelte +++ b/src/routes/backoffice/vendor/+page.svelte @@ -1,667 +1,286 @@ - -
-
-
-

🏡 Vendor List

-

- Manage your vendors and their contact information here. -

-
-
- { - const searchTerm = ( - e.target as HTMLInputElement - ).value.toLowerCase(); - fetchVendor(searchTerm, "created_at", "desc", limit, 0); - }} - /> - - - - - -
-
+ +
+ { + searchTerm = (e.target as HTMLInputElement).value; + fetchVendor(searchTerm, true); + }} + /> +
- -
- - - - {#each columns as col (col.key)} - - {/each} - - - - - - {#each allRowsVendor as vendor} - handleVendorClick(vendor.id)} - > - {#each columns as col} - - {/each} - - - - + +
{col.title}ContactsActions
{vendor[col.key as keyof Vendor]} - - - - -
+ + + {#each columns as col} + {/each} - -
{col.title}
-
+ Actions + + + + {#each allRowsVendor as row} + + {#each columns as col} + {row[col.key]} + {/each} + + + + + + {/each} + + -
+
- Showing {(currentPage - 1) * itemsPerPage + 1}–{Math.min( - currentPage * itemsPerPage, - allRowsVendor.length, - )} of {allRowsVendor.length} + Showing {(currentPage - 1) * itemsPerPage + 1}– + {Math.min(currentPage * itemsPerPage, totalItems)} of {totalItems}
-
- - + +
+ + {#each pageRange(totalPages, currentPage) as page} + {#if page === '...'} + ... + {:else} + + {/if} + {/each} +
- - - - + {#if showModal} -
-
-

- {isEditing ? "Edit Vendor" : "Add New Vendor"} -

- {#each formColumns as col} -
- - -
- {/each} -
- - +
+
+

{isEditing ? "Edit Vendor" : "Add Vendor"}

+ {#each formColumns as col} +
+ + {#if col.key === 'vendor_unique'} + + {:else} + + {/if}
+ {/each} +
+ +
-{/if} - - -{#if showModalAddEditContact} -
-
-

- {isEditingContact - ? "Edit Contact Vendor" - : "Add New Contact Vendor"} -

- {#each formColumnsContact as col} -
- - -
- {/each} -
- - -
-
-
-{/if} - -{#if showModalContact} -
-
- -
-

- 📇 Contact List -

-
- - -
-
- - - {#if allRowsContactVendor.length > 0} -
- - - - {#each columnsContact as col (col.key)} - - {/each} - - - - - {#each allRowsContactVendor as contact} - - {#each columnsContact as col} - - {/each} - - - {/each} - -
{col.title}Actions
- {contact[ - col.key as keyof ContactVendor - ]} - -
- - -
-
-
- {:else} -
-

- No Contacts Available -

-

- There are no contacts available for this vendor. -

-
- {/if} -
-
+
{/if} diff --git a/yarn.lock b/yarn.lock index a2f046f..1a6f7fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -61,14 +61,6 @@ resolved "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz" integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== -"@jridgewell/source-map@^0.3.3": - version "0.3.6" - resolved "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz" - integrity sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ== - dependencies: - "@jridgewell/gen-mapping" "^0.3.5" - "@jridgewell/trace-mapping" "^0.3.25" - "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.4.15", "@jridgewell/sourcemap-codec@^1.5.0": version "1.5.0" resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz" @@ -335,7 +327,7 @@ dependencies: "@types/node" "*" -acorn@^8.12.1, acorn@^8.14.0, acorn@^8.14.1, acorn@^8.9.0: +acorn@^8.12.1, acorn@^8.14.1, acorn@^8.9.0: version "8.14.1" resolved "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz" integrity sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg== @@ -350,11 +342,6 @@ axobject-query@^4.1.0: resolved "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz" integrity sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ== -buffer-from@^1.0.0: - version "1.1.2" - resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" - integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== - chokidar@^4.0.1: version "4.0.3" resolved "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz" @@ -372,11 +359,6 @@ clsx@^2.1.1: resolved "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz" integrity sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA== -commander@^2.20.0: - version "2.20.3" - resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - commondir@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz" @@ -693,19 +675,6 @@ source-map-js@^1.2.1: resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz" integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== -source-map-support@~0.5.20: - version "0.5.21" - resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz" - integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map@^0.6.0: - version "0.6.1" - resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz" @@ -784,16 +753,6 @@ tar@^7.4.3: mkdirp "^3.0.1" yallist "^5.0.0" -terser@^5.16.0: - version "5.40.0" - resolved "https://registry.npmjs.org/terser/-/terser-5.40.0.tgz" - integrity sha512-cfeKl/jjwSR5ar7d0FGmave9hFGJT8obyo0z+CrQOylLDbk7X81nPU6vq9VORa5jU30SkDnT2FXjLbR8HLP+xA== - dependencies: - "@jridgewell/source-map" "^0.3.3" - acorn "^8.14.0" - commander "^2.20.0" - source-map-support "~0.5.20" - tinyglobby@^0.2.13: version "0.2.13" resolved "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.13.tgz"