diff --git a/package.json b/package.json index ff90d2a..2c0e40f 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "@rollup/plugin-commonjs": "^14.0.0", "@rollup/plugin-node-resolve": "^8.0.0", "@rollup/plugin-replace": "^2.2.0", + "@zerodevx/svelte-toast": "^0.6.2", "depcheck": "^1.4.2", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", diff --git a/src/components/AdminPanelTable.svelte b/src/components/AdminPanelTable.svelte new file mode 100644 index 0000000..3962968 --- /dev/null +++ b/src/components/AdminPanelTable.svelte @@ -0,0 +1,268 @@ + + + +
+ {#if !advancedSearch} +

{simpleFilterOptions.title}

+ + {:else} + {#each filters as filter} + {#if filter.isDate} + +

{filter.title} før:

+ +
+ +

{filter.title} etter:

+ +
+ {:else if filter.isBoolean} + +

{filter.title}:

+ + + + +
+ {:else} + +

{filter.title}:

+ {#if filter.filterValues} + + {:else} + + {/if} +
+ {/if} + {/each} + {/if} +
+ + +
+ + + + {#each columns as col} + + {/each} + + + + + {#each c_rows.slice((page - 1) * maxPerPage, page * maxPerPage) as row, n} + handleClickExpand(e, row)} class="expand pointer"> + {#each columns as col} + + {/each} + + + {#if row.$expanded} + + + + {/if} + {/each} + +
handleClickCol(e, col)} class="pointer header"> + {col.title} + + {#if sortBy === col.key} + {#if sortOrder === 1} + + {:else} + + {/if} + {:else} + + {/if} + + +
{col.value(row)}{@html row.$expanded ? iconExpand : iconExpanded}
+
+

+

{(page - 1) * maxPerPage + (c_rows.length != 0 ? 1 : 0)}-{Math.min(page * maxPerPage, c_rows.length)} av {c_rows.length}

+ +

+ +

Resultater per side:

+ +
+
+ + diff --git a/src/components/EditUserPopup.svelte b/src/components/EditUserPopup.svelte new file mode 100644 index 0000000..8f3766c --- /dev/null +++ b/src/components/EditUserPopup.svelte @@ -0,0 +1,127 @@ + + + +

{typeText()} {attributeToEdit?.title?.toLocaleLowerCase()} for {row?.fullName}

+ {#if editType == 'edit'} +

Eksisterende verdi: {attributeToEdit?.value(row)}

+ {#if Array.isArray(changeOptions)} + + {:else} + + {/if} + {:else if editType == 'add' || editType == 'delete'} + {#if attributeToEdit?.value(row).length != 0} + Med i følgende {attributeToEdit?.title_plural}: + + {:else} +

Ikke medlem av noen {attributeToEdit?.title_plural}

+ {/if} + {#if changeOptions?.length != 0} +
+

{attributeToEdit?.title}:

+ + +
+ {:else if editType == 'add'} +

Brukeren er med i alle {attributeToEdit?.title_plural}

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

Er du sikker på at du vil {typeText()?.toLocaleLowerCase()} denne verdien?

+
+ + +
+
+ + diff --git a/src/components/MultiSelect.svelte b/src/components/MultiSelect.svelte new file mode 100644 index 0000000..2b1e9f8 --- /dev/null +++ b/src/components/MultiSelect.svelte @@ -0,0 +1,263 @@ + + + +
setOptionsVisible(!showOptions)}> + + + + + + + {#key showOptions} + + {/key} +
+ + diff --git a/src/components/Nav.svelte b/src/components/Nav.svelte index fa78a0b..bc65be8 100644 --- a/src/components/Nav.svelte +++ b/src/components/Nav.svelte @@ -26,6 +26,11 @@ {side.replace(/-|_/g, '_')} {/each} + {#if $user?.roles?.includes('Styret')} +
  • + {'/admin-panel/'.replace(/-|_/g, '_')} +
  • + {/if}