From 1ab7435bf19385adb470f1e7210371d09bbd3777 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Tue, 6 Sep 2022 10:32:13 -0800 Subject: [PATCH] lots of stuff --- frontend/components/Base/ActionsDivider.vue | 4 - frontend/components/Base/Button.vue | 54 +++++++- frontend/components/Base/Details.vue | 8 +- frontend/components/Item/Card.vue | 9 +- frontend/components/Location/Card.vue | 14 ++- frontend/composables/use-preferences.ts | 2 + frontend/composables/use-strings.ts | 7 ++ frontend/pages/home.vue | 59 ++++++++- frontend/pages/index.vue | 4 +- frontend/pages/item/[id]/edit.vue | 11 ++ frontend/pages/item/[id]/index.vue | 130 ++++++++++++++++++++ frontend/pages/label/[id].vue | 9 +- frontend/pages/location/[id].vue | 1 - 13 files changed, 289 insertions(+), 23 deletions(-) create mode 100644 frontend/composables/use-strings.ts create mode 100644 frontend/pages/item/[id]/edit.vue create mode 100644 frontend/pages/item/[id]/index.vue diff --git a/frontend/components/Base/ActionsDivider.vue b/frontend/components/Base/ActionsDivider.vue index a6ab6df..e943c05 100644 --- a/frontend/components/Base/ActionsDivider.vue +++ b/frontend/components/Base/ActionsDivider.vue @@ -12,7 +12,3 @@ - - diff --git a/frontend/components/Base/Button.vue b/frontend/components/Base/Button.vue index 1a48cc6..f0b1cd3 100644 --- a/frontend/components/Base/Button.vue +++ b/frontend/components/Base/Button.vue @@ -1,10 +1,30 @@ - - diff --git a/frontend/components/Location/Card.vue b/frontend/components/Location/Card.vue index e13be66..1948354 100644 --- a/frontend/components/Location/Card.vue +++ b/frontend/components/Location/Card.vue @@ -4,14 +4,20 @@ :to="`/location/${location.id}`" class="card bg-primary text-primary-content transition duration-300" > -
+

{{ location.name }} - + {{ location.itemCount }}

@@ -27,6 +33,10 @@ type: Object as () => Location, required: true, }, + dense: { + type: Boolean, + default: false, + }, }); const card = ref(null); diff --git a/frontend/composables/use-preferences.ts b/frontend/composables/use-preferences.ts index 3e38682..3a01789 100644 --- a/frontend/composables/use-preferences.ts +++ b/frontend/composables/use-preferences.ts @@ -2,6 +2,7 @@ import { Ref } from 'vue'; export type LocationViewPreferences = { showDetails: boolean; + showEmpty: boolean; }; /** @@ -13,6 +14,7 @@ export function useViewPreferences(): Ref { 'homebox/preferences/location', { showDetails: true, + showEmpty: true, }, { mergeDefaults: true } ); diff --git a/frontend/composables/use-strings.ts b/frontend/composables/use-strings.ts new file mode 100644 index 0000000..9d179e9 --- /dev/null +++ b/frontend/composables/use-strings.ts @@ -0,0 +1,7 @@ +export function truncate(str: string, length: number) { + return str.length > length ? str.substring(0, length) + '...' : str; +} + +export function capitalize(str: string) { + return str.charAt(0).toUpperCase() + str.slice(1); +} diff --git a/frontend/pages/home.vue b/frontend/pages/home.vue index 640249c..f1d3671 100644 --- a/frontend/pages/home.vue +++ b/frontend/pages/home.vue @@ -41,10 +41,57 @@ value: totalLabels, }, ]; + + const importDialog = ref(false); + const importCsv = ref(null); + const importRef = ref(null); + whenever( + () => !importDialog.value, + () => { + importCsv.value = null; + } + ); + + function setFile(e: Event & { target: HTMLInputElement }) { + console.log(e); + importCsv.value = e.target.files[0]; + } + + function openDialog() { + importDialog.value = true; + } + + function uploadCsv() { + importRef.value.click(); + } diff --git a/frontend/pages/location/[id].vue b/frontend/pages/location/[id].vue index b625cf1..2c8c5ee 100644 --- a/frontend/pages/location/[id].vue +++ b/frontend/pages/location/[id].vue @@ -1,5 +1,4 @@