From 0d04281b1c50a22075fdbc1536ab5efc98d1a2ce Mon Sep 17 00:00:00 2001 From: bramvankooten Date: Thu, 12 Dec 2019 14:15:21 +0100 Subject: [PATCH 1/9] functionality for creating ticket options and ticket types --- .../lancie-admin-ticket-option.html | 67 ++++++++ .../lancie-admin-types.html | 145 +++++++++++++++++- 2 files changed, 206 insertions(+), 6 deletions(-) create mode 100644 src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html diff --git a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html new file mode 100644 index 0000000..fde006a --- /dev/null +++ b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html @@ -0,0 +1,67 @@ + + + + + + + + diff --git a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html index dc44a80..9dc0820 100644 --- a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html +++ b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html @@ -1,27 +1,106 @@ + + + + + + + + + From cf15b12035e1c2c2047a4817f3278e752ddc195e Mon Sep 17 00:00:00 2001 From: bramvankooten Date: Sun, 15 Dec 2019 15:02:17 +0100 Subject: [PATCH 2/9] Started adding options to tickets + deletion of options --- .../lancie-admin-ticket-option.html | 13 ++ .../lancie-admin-types.html | 137 +++++++++++++++--- .../lancie-admin-table.html | 9 ++ 3 files changed, 136 insertions(+), 23 deletions(-) diff --git a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html index fde006a..2c4c69e 100644 --- a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html +++ b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html @@ -42,6 +42,9 @@
[[option.name]]
Price: [[option.price]]
+
+ +
@@ -59,6 +62,16 @@ option: Object } } + + deleteTicketOptionDialog() { + this.dispatchEvent(new CustomEvent('delete-ticket-option-dialog', { + detail: { + id: this.option.id + }, + bubbles: true, + composed: true + })); + } } customElements.define(LancieAdminTicketOption.is, LancieAdminTicketOption); diff --git a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html index 9dc0820..5ae37d7 100644 --- a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html +++ b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html @@ -42,6 +42,10 @@ + + + +

Here is where the types will be.

@@ -50,37 +54,62 @@
+ Add Ticket Type + Add Ticket Option(s) To Type
-

Add Ticket Type

-
- - - - - - - - - - true - false - - - -
-
- Add -
-
+

Add Ticket Type

+
+ + + + + + + + + + true + false + + + +
+
+ Add +
+ + + +

Add Options to Type

+
+

Options will be added to the following Ticket Types

+ +

What Option do you want to add?

+ + + + + +
+ +
+ Cancel + Add Option +
+
-
+
- diff --git a/src/lancie-admin-table/lancie-admin-table.html b/src/lancie-admin-table/lancie-admin-table.html index 1e56a7a..92a287f 100644 --- a/src/lancie-admin-table/lancie-admin-table.html +++ b/src/lancie-admin-table/lancie-admin-table.html @@ -227,7 +227,16 @@ } } return false; + }, + + selected: function() { + return this.$.grid.selectedItems + }, + + clearSelection: function () { + this.$.grid.selectedItems = []; } + }); })(); From 2a4b4bd09dcf9adcdef24b34ac8bf88b9e6c4575 Mon Sep 17 00:00:00 2001 From: bramvankooten Date: Sun, 15 Dec 2019 16:14:47 +0100 Subject: [PATCH 3/9] Added table refresh after adding option to type --- .../lancie-admin-types.html | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html index 5ae37d7..dc87ca1 100644 --- a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html +++ b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html @@ -44,7 +44,7 @@ - +
@@ -174,7 +174,7 @@

Are you certain you want to delete this ticket option?

} }, - onResponse: function (e, request) { + onResponse: function(e, request) { if (request.succeeded) { this.$.table.setData(request.response); } @@ -189,7 +189,7 @@

Are you certain you want to delete this ticket option?

} }, - onTypeResponse: function (e, request) { + onTypeResponse: function(e, request) { if (request.succeeded) { this.$.table.setData(request.response); } else { @@ -197,7 +197,7 @@

Are you certain you want to delete this ticket option?

} }, - openAddTypeDialog: function () { + openAddTypeDialog: function() { this.$.addTicketTypeForm.reset(); this.$.addTicketTypeDialog.open(); }, @@ -212,7 +212,7 @@

Are you certain you want to delete this ticket option?

this.$.addTicketOptionForm.reset(); }, - openAddOptionDialog: function () { + openAddOptionDialog: function() { this.$.addTicketOptionForm.reset(); this.$.addTicketOptionDialog.open(); }, @@ -226,7 +226,7 @@

Are you certain you want to delete this ticket option?

} }, - onOptionResponse: function (e, request) { + onOptionResponse: function(e, request) { if (request.succeeded) { this.options = request.response; } else { @@ -234,7 +234,7 @@

Are you certain you want to delete this ticket option?

} }, - deleteTicketOptionDialog: function (event) { + deleteTicketOptionDialog: function(event) { console.log("Test") this.deleteOption = this.options.filter(option => { return option.id === event.detail.id; @@ -242,11 +242,11 @@

Are you certain you want to delete this ticket option?

this.$.deleteTicketOptionDialog.open(); }, - tryOptionDelete: function () { + tryOptionDelete: function() { this.$.ajaxDeleteTicketOption.generateRequest(); }, - onOptionDeleteResponse: function (e, request) { + onOptionDeleteResponse: function(e, request) { if (request.succeeded) { this.$.deleteCommitteeMemberDialog.close(); this.$.getOptionAjax.generateRequest(); // Ensures we have a mirror of the latest server state @@ -255,10 +255,9 @@

Are you certain you want to delete this ticket option?

} }, - openAddOptionToTypeDialog: function () { + openAddOptionToTypeDialog: function() { if (this.$.table.selected().length > 0) { this.selectedTypes = this.$.table.selected(); - console.log(this.selectedTypes) this.$.noTypeSelectedError.clear(); this.$.typeSelected.render(); this.$.addOptionToTypeDialog.open(); @@ -267,17 +266,18 @@

Are you certain you want to delete this ticket option?

} }, - optionSelected: function (e) { + optionSelected: function(e) { this.selectedOption = e.target.selectedItem.innerText }, - tryAddOptionToTypes: function () { + tryAddOptionToTypes: function() { this.selectedTypes.forEach(t => this.tryAddOptionToType(t)) this.$.table.clearSelection(); this.$.addOptionToTypeDialog.close(); + this.$.getTypeAjax.generateRequest(); }, - tryAddOptionToType: function (t) { + tryAddOptionToType: function(t) { this.selectedId = t.id; this.$.ajaxAddOptionToType.generateRequest(); } From 1309b9065302aea46941f88fe80cb61090b55fd0 Mon Sep 17 00:00:00 2001 From: bramvankooten Date: Sun, 15 Dec 2019 17:51:20 +0100 Subject: [PATCH 4/9] Added option to change the buyable attribute of a TicketType --- .../lancie-admin-types.html | 49 +++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html index dc87ca1..96ba288 100644 --- a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html +++ b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html @@ -46,6 +46,8 @@ + +

Here is where the types will be.

@@ -56,7 +58,8 @@
Add Ticket Type - Add Ticket Option(s) To Type + Add Ticket Option To Type(s) + Change Buyable
@@ -106,6 +109,22 @@

What Option do you want to add?

+ +

Change Buyable Of Type

+
+

Buyable will be changed for the following Types:

+ +
+ +
+ Cancel + Confirm +
+
+ +
@@ -185,7 +204,7 @@

Are you certain you want to delete this ticket option?

this.$.addTicketTypeDialog.close(); this.$.getTypeAjax.generateRequest(); } else { - this.$.addDialogError.setError("Could not add ticket type. Please refresh and try again.") + this.$.addDialogError.setError("Could not add ticket type. Please refresh and try again."); } }, @@ -193,7 +212,7 @@

Are you certain you want to delete this ticket option?

if (request.succeeded) { this.$.table.setData(request.response); } else { - this.$.optionError.setError('Could not retrieve ticket types. Please refresh and try again.') + this.$.optionError.setError('Could not retrieve ticket types. Please refresh and try again.'); } }, @@ -280,6 +299,30 @@

Are you certain you want to delete this ticket option?

tryAddOptionToType: function(t) { this.selectedId = t.id; this.$.ajaxAddOptionToType.generateRequest(); + }, + + openChangeBuyableDialog: function() { + if (this.$.table.selected().length > 0) { + this.selectedTypes = this.$.table.selected(); + this.$.noTypeSelectedError.clear(); + this.$.typeSelected.render(); + this.$.changeBuyableOfTypeDialog.open(); + } else { + this.$.noTypeSelectedError.setError('Please select a type first.') + } + }, + + tryChangeBuyableOfTypes: function() { + this.selectedTypes.forEach(t => this.tryChangeBuyableOfType(t)) + this.$.table.clearSelection(); + this.$.changeBuyableOfTypeDialog.close(); + this.$.getTypeAjax.generateRequest(); + }, + + tryChangeBuyableOfType: function(t) { + this.selectedId = t.id; + this.buyableBool = !t.buyable + this.$.ajaxChangeBuyableOfType.generateRequest(); } }); From ffa9f3aaf5cec3305a6d19eaa7c1456b9ff63cb3 Mon Sep 17 00:00:00 2001 From: bramvankooten Date: Tue, 17 Dec 2019 13:01:28 +0100 Subject: [PATCH 5/9] Adjusted for API changes + removed custom-style elements --- .../lancie-admin-ticket-option.html | 33 +++++++++---------- .../lancie-admin-types.html | 16 +++++++-- .../lancie-admin-committee-member.html | 33 +++++++++---------- .../lancie-admin-faq-item.html | 30 +++++++++-------- .../lancie-admin-sponsor.html | 30 +++++++++-------- 5 files changed, 77 insertions(+), 65 deletions(-) diff --git a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html index 2c4c69e..979e0cf 100644 --- a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html +++ b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html @@ -20,24 +20,23 @@ .align-right { text-align: right; } - - - - + .flex-horizontal-with-ratios { + @apply (--layout-horizontal); + } + + .flexchild { + @apply (--layout-flex); + } + + .flex2child { + @apply (--layout-flex-4); + } + + .flex3child { + @apply (--layout-flex-9); + } +
[[option.name]]
diff --git a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html index 96ba288..aeb5573 100644 --- a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html +++ b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types.html @@ -44,9 +44,9 @@ - + - +
@@ -286,7 +286,9 @@

Are you certain you want to delete this ticket option?

}, optionSelected: function(e) { - this.selectedOption = e.target.selectedItem.innerText + this.selectedOption = this.options.filter(option => { + return option.name === e.target.selectedItem.innerText; + })[0]; }, tryAddOptionToTypes: function() { @@ -323,6 +325,14 @@

Are you certain you want to delete this ticket option?

this.selectedId = t.id; this.buyableBool = !t.buyable this.$.ajaxChangeBuyableOfType.generateRequest(); + }, + + getOptionBody: function(selected) { + return '{"option": ' + JSON.stringify(selected) + '}'; + }, + + getBuyableBody: function(buyable) { + return '{"buyable": ' + buyable + '}' } }); diff --git a/src/lancie-admin-web/lancie-admin-committee-member.html b/src/lancie-admin-web/lancie-admin-committee-member.html index 768c948..b84c80f 100644 --- a/src/lancie-admin-web/lancie-admin-committee-member.html +++ b/src/lancie-admin-web/lancie-admin-committee-member.html @@ -22,25 +22,24 @@ .align-right { text-align: right; } - - - - + .flex-horizontal-with-ratios { + @apply (--layout-horizontal); + } + + .flexchild { + @apply (--layout-flex); + } + + .flex2child { + @apply (--layout-flex-4); + } + .flex3child { + @apply (--layout-flex-9); + } + +
[[member.name]]
diff --git a/src/lancie-admin-web/lancie-admin-faq-item.html b/src/lancie-admin-web/lancie-admin-faq-item.html index 26ef61d..252b652 100644 --- a/src/lancie-admin-web/lancie-admin-faq-item.html +++ b/src/lancie-admin-web/lancie-admin-faq-item.html @@ -21,21 +21,23 @@ .align-right { text-align: right; } - - - - + .flex-horizontal-with-ratios { + @apply (--layout-horizontal); + } + + .flexchild { + @apply (--layout-flex); + } + + .flex2child { + @apply (--layout-flex-4); + } + + .flex3child { + @apply (--layout-flex-9); + } +
[[item.id]]
diff --git a/src/lancie-admin-web/lancie-admin-sponsor.html b/src/lancie-admin-web/lancie-admin-sponsor.html index 6fc5604..7730523 100644 --- a/src/lancie-admin-web/lancie-admin-sponsor.html +++ b/src/lancie-admin-web/lancie-admin-sponsor.html @@ -22,21 +22,23 @@ .align-right { text-align: right; } - - - - + .flex-horizontal-with-ratios { + @apply (--layout-horizontal); + } + + .flexchild { + @apply (--layout-flex); + } + + .flex2child { + @apply (--layout-flex-4); + } + + .flex3child { + @apply (--layout-flex-9); + } +
[[item.id]]
From 1c5a6b89256d76c4b9df5e7d4061ffd4d8231b07 Mon Sep 17 00:00:00 2001 From: bramvankooten Date: Tue, 17 Dec 2019 14:47:41 +0100 Subject: [PATCH 6/9] Split up lancie-admin-types.html --- src/lancie-admin-content.html | 2 +- .../lancie-admin-ticket-option.html | 6 +- .../lancie-admin-ticket-options.html | 164 ++++++++++++++++++ .../lancie-admin-ticket-types.html} | 128 ++------------ .../lancie-admin-types.html | 46 +++++ 5 files changed, 230 insertions(+), 116 deletions(-) rename src/lancie-admin-endpoint/lancie-admin-pages/{ => lancie-admin-types}/lancie-admin-ticket-option.html (86%) create mode 100644 src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types/lancie-admin-ticket-options.html rename src/lancie-admin-endpoint/lancie-admin-pages/{lancie-admin-types.html => lancie-admin-types/lancie-admin-ticket-types.html} (62%) create mode 100644 src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types/lancie-admin-types.html diff --git a/src/lancie-admin-content.html b/src/lancie-admin-content.html index fefa102..069a45c 100644 --- a/src/lancie-admin-content.html +++ b/src/lancie-admin-content.html @@ -28,7 +28,7 @@ - + diff --git a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types/lancie-admin-ticket-option.html similarity index 86% rename from src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html rename to src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types/lancie-admin-ticket-option.html index 979e0cf..4189617 100644 --- a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-ticket-option.html +++ b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types/lancie-admin-ticket-option.html @@ -1,6 +1,6 @@ - - - + + +