From 2d21a71c4fac11df21aefc3293aec5901abda2f5 Mon Sep 17 00:00:00 2001 From: Marlen Brunner Date: Fri, 12 May 2023 13:18:44 -0700 Subject: [PATCH 01/20] :construction: Basic toggle switch plus entry card selection. currently cards are the same, but now I have room to edit. --- .../centre/components/BulkDataEntryCard.vue | 186 ++++++++++++++++ .../modules/centre/components/DataEntry.vue | 206 +++--------------- .../components/IncrementalDataEntryCard.vue | 186 ++++++++++++++++ 3 files changed, 404 insertions(+), 174 deletions(-) create mode 100644 src/web/src/modules/centre/components/BulkDataEntryCard.vue create mode 100644 src/web/src/modules/centre/components/IncrementalDataEntryCard.vue diff --git a/src/web/src/modules/centre/components/BulkDataEntryCard.vue b/src/web/src/modules/centre/components/BulkDataEntryCard.vue new file mode 100644 index 0000000..59abb27 --- /dev/null +++ b/src/web/src/modules/centre/components/BulkDataEntryCard.vue @@ -0,0 +1,186 @@ + + + + + diff --git a/src/web/src/modules/centre/components/DataEntry.vue b/src/web/src/modules/centre/components/DataEntry.vue index 29a0209..da6ae62 100644 --- a/src/web/src/modules/centre/components/DataEntry.vue +++ b/src/web/src/modules/centre/components/DataEntry.vue @@ -1,187 +1,45 @@ + - diff --git a/src/web/src/modules/centre/components/IncrementalDataEntryCard.vue b/src/web/src/modules/centre/components/IncrementalDataEntryCard.vue new file mode 100644 index 0000000..0375f32 --- /dev/null +++ b/src/web/src/modules/centre/components/IncrementalDataEntryCard.vue @@ -0,0 +1,186 @@ + + + + + From 79543282e3aade9cf269a8eb8d0fef76a6704db6 Mon Sep 17 00:00:00 2001 From: Marlen Brunner Date: Fri, 12 May 2023 18:14:21 -0700 Subject: [PATCH 02/20] :construction: Begin building out distribution interface. Looks of broken work in progress code. --- .../centre/components/BulkDataEntryCard.vue | 143 ++++++++---------- .../modules/centre/components/DataEntry.vue | 8 +- 2 files changed, 70 insertions(+), 81 deletions(-) diff --git a/src/web/src/modules/centre/components/BulkDataEntryCard.vue b/src/web/src/modules/centre/components/BulkDataEntryCard.vue index 59abb27..3ecf0c7 100644 --- a/src/web/src/modules/centre/components/BulkDataEntryCard.vue +++ b/src/web/src/modules/centre/components/BulkDataEntryCard.vue @@ -36,50 +36,48 @@
Visitor Origin - - Daily Totals - + + + + + Daily Totals by Location +
{{ location.name }}
- -
- +1 - +5 - -1 - -5 -
+ + + + - - -
{{ location.daily_total }}
-
-
Not site selected
@@ -96,45 +94,39 @@ export default { name: "BulkDataEntryCard", components: {}, data: () => ({ - total: 0, isDirty: false, + dailyTotalVisitors: 0, }), - async mounted() { - //if (this.user.primary_site && this.user.primary_site != -1) this.site = this.user.primary_site; - let r = window.setInterval(async () => { - if (!this.isDirty) return; - - await this.save(); - this.isDirty = false; - }, 2000); - + mounted() { if (this.loadFor.length > 0) { - await this.loadDailyStats(this.loadFor); - this.selectFirstToManage(); - } - }, - async beforeUnmount() { - if (this.selectedDate && this.isDirty) { - await this.save(); + this.loadDailyStats(this.loadFor).then(() => { + return this.selectFirstToManage(); + }) } }, computed: { ...mapState(useUserStore, ["user"]), ...mapState(useCentreStore, ["dateOptions", "manageSites"]), ...mapWritableState(useCentreStore, ["selectedDate", "selectedSite"]), - loadFor() { return this.user.scopes .filter((s: any) => s.name.startsWith("VIC.INPUT")) .map((s: any) => parseInt(s.name.replace("VIC.INPUT_", ""))); }, totalCountHeader() { + if (this.totalVistorsForDay > 0) { + return `${this.totalVistorsForDay} visitors`; + } + return ""; + }, + totalVistorsForDay() { if (this.selectedDate && this.selectedDate.origins) { let counts = this.selectedDate.origins.flatMap((i: any) => i.daily_total); let total = counts.reduce((t: number, i: any) => t + i, 0); - return `${total} visitors`; + return total; } - return ""; + + return 0 }, dateHeader() { if (this.selectedSite && this.selectedDate) { @@ -143,31 +135,30 @@ export default { return ""; }, + unknownLocation() { + if (this.selectedSite && this.selectedDate) { + return this.selectedDate.origins.find(location => location.name == "Unknown") + } + + return {} + }, + unallocatedVistors() { + return this.unknownLocation.daily_total || 0 + } }, methods: { ...mapActions(useUserStore, ["canDo"]), ...mapActions(useCentreStore, ["save", "loadDailyStats", "selectFirstToManage"]), - - changed() { - this.selectedDate = (this.selectedSite as any).days[0]; - }, - - plusOne(location: any) { - this.isDirty = true; - location.delta++; + siteChanged() { + this.selectedDate = this.selectedSite.days[0]; }, - plusFive(location: any) { - this.isDirty = true; - location.delta += 5; - }, - minusOne(location: any) { - this.isDirty = true; - location.delta--; - }, - minusFive(location: any) { - this.isDirty = true; - location.delta -= 5; + updateLocationCategoryTotal(location: any, value: Number) { + this.isDirty = true + location.daily_total = parseInt(value); }, + updateFullTotal(value) { + // get total of all + } }, }; diff --git a/src/web/src/modules/centre/components/DataEntry.vue b/src/web/src/modules/centre/components/DataEntry.vue index da6ae62..3ed9e0b 100644 --- a/src/web/src/modules/centre/components/DataEntry.vue +++ b/src/web/src/modules/centre/components/DataEntry.vue @@ -13,12 +13,10 @@ @@ -34,7 +32,7 @@ export default { }, data () { return { - entryMode: false, + entryMode: true, } }, } From a4b631906c66a124c01495810aff2bf94443f4a9 Mon Sep 17 00:00:00 2001 From: Marlen Brunner Date: Sun, 14 May 2023 12:15:45 -0700 Subject: [PATCH 03/20] :cherry_blossom: Basic UI mockup for manual visitor entry. --- .../centre/components/BulkDataEntryCard.vue | 147 +++++++++++------- 1 file changed, 89 insertions(+), 58 deletions(-) diff --git a/src/web/src/modules/centre/components/BulkDataEntryCard.vue b/src/web/src/modules/centre/components/BulkDataEntryCard.vue index 3ecf0c7..8a0a9e3 100644 --- a/src/web/src/modules/centre/components/BulkDataEntryCard.vue +++ b/src/web/src/modules/centre/components/BulkDataEntryCard.vue @@ -10,13 +10,16 @@ style="max-width: 250px" item-title="name" :disabled="isDirty" - @update:modelValue="changed" - item-value="id"> + @update:modelValue="selectTodaysDate" + item-value="id" + > @@ -30,22 +33,27 @@ return-object hide-details :disabled="isDirty" - style="max-width: 250px"> + style="max-width: 250px" + >
- Visitor Origin - + + + + + Visitor Origin + Daily Totals by Location @@ -55,28 +63,35 @@
{{ location.name }}
- - - - + + + +
@@ -85,6 +100,8 @@ From 04843483018a068215936cda19a79906fddbd8ff Mon Sep 17 00:00:00 2001 From: Marlen Brunner Date: Sun, 14 May 2023 12:30:54 -0700 Subject: [PATCH 04/20] :beetle: Tweak some logic and naming. --- .../centre/components/BulkDataEntryCard.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/web/src/modules/centre/components/BulkDataEntryCard.vue b/src/web/src/modules/centre/components/BulkDataEntryCard.vue index 8a0a9e3..6ef5d8c 100644 --- a/src/web/src/modules/centre/components/BulkDataEntryCard.vue +++ b/src/web/src/modules/centre/components/BulkDataEntryCard.vue @@ -46,7 +46,7 @@ @update:modelValue="updateTotalVistors" type="number" min="0" - label="Daily Total" + label="Total Vistors for Day" hide-details /> @@ -55,7 +55,7 @@ Visitor Origin - Daily Totals by Location + Vistors per Location @@ -176,9 +176,13 @@ export default { selectTodaysDate() { this.selectedDate = this.selectedSite.days[0]; }, + updateUncategorizedVistors() { + this.uncategorizedLocation.daily_total = this.totalVistorsForDay - this.categorizedVistors + }, updateLocationCategoryTotal(location, value) { - location.daily_total = parseInt(value); - this.uncategorizedLocation.daily_total -= parseInt(value) + const valueAsInt = parseInt(value) || 0 + location.daily_total = valueAsInt; + this.updateUncategorizedVistors() }, updateTotalVistors(value) { if (value < this.totalVistorsForDay) { @@ -186,8 +190,8 @@ export default { // successively remove 1 from each other category // until total vistors is 0 } else { - this.totalVistorsForDay = parseInt(value); - this.uncategorizedLocation.daily_total = this.totalVistorsForDay - this.categorizedVistors; + this.totalVistorsForDay = parseInt(value) || 0; + this.updateUncategorizedVistors() } }, }, From e76929ea9dad0db4dcb314720172075bbbd6f8e8 Mon Sep 17 00:00:00 2001 From: Marlen Brunner Date: Sun, 14 May 2023 17:26:46 -0700 Subject: [PATCH 05/20] :sparkles: Add save button. Why? Given the limitations of the back-end, it's more convenient to commit all changes at once, manually. This is still a mock-up. --- .../modules/centre/components/BulkDataEntryCard.vue | 11 +++++++++++ src/web/src/modules/centre/components/DataEntry.vue | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/web/src/modules/centre/components/BulkDataEntryCard.vue b/src/web/src/modules/centre/components/BulkDataEntryCard.vue index 6ef5d8c..291d5f0 100644 --- a/src/web/src/modules/centre/components/BulkDataEntryCard.vue +++ b/src/web/src/modules/centre/components/BulkDataEntryCard.vue @@ -94,6 +94,17 @@ + + + + Save + +
Not site selected
diff --git a/src/web/src/modules/centre/components/DataEntry.vue b/src/web/src/modules/centre/components/DataEntry.vue index 3ed9e0b..b193e15 100644 --- a/src/web/src/modules/centre/components/DataEntry.vue +++ b/src/web/src/modules/centre/components/DataEntry.vue @@ -5,7 +5,7 @@
From 833c98613801de512848c1fe0d2e8a2886cdd230 Mon Sep 17 00:00:00 2001 From: Marlen Brunner Date: Mon, 15 May 2023 13:05:32 -0700 Subject: [PATCH 06/20] :ok_hand: Switch wording to use Daily Visitors for both interfaces. --- src/web/src/modules/centre/components/BulkDataEntryCard.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web/src/modules/centre/components/BulkDataEntryCard.vue b/src/web/src/modules/centre/components/BulkDataEntryCard.vue index 291d5f0..913ffda 100644 --- a/src/web/src/modules/centre/components/BulkDataEntryCard.vue +++ b/src/web/src/modules/centre/components/BulkDataEntryCard.vue @@ -55,7 +55,7 @@ Visitor Origin - Vistors per Location + Daily Visitors From 3a805f3c421a10b895c94816dfc376d451225413 Mon Sep 17 00:00:00 2001 From: Marlen Brunner Date: Mon, 15 May 2023 13:24:19 -0700 Subject: [PATCH 07/20] :cherry_blossom: Make bulk data entry pretty down to table sizing. --- .../centre/components/BulkDataEntryCard.vue | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/web/src/modules/centre/components/BulkDataEntryCard.vue b/src/web/src/modules/centre/components/BulkDataEntryCard.vue index 913ffda..3c1d51c 100644 --- a/src/web/src/modules/centre/components/BulkDataEntryCard.vue +++ b/src/web/src/modules/centre/components/BulkDataEntryCard.vue @@ -40,7 +40,7 @@
- + - Visitor Origin - - + Visitor Origin + Daily Visitors - +
{{ location.name }}
- - + @@ -53,9 +51,7 @@
Visitor Origin - - Daily Visitors - + Daily Visitors @@ -66,7 +62,10 @@