From 41883df6043fe412b14bcf28384cfcbe14fce112 Mon Sep 17 00:00:00 2001 From: ArdyZ <45757560+ArdyZ@users.noreply.github.com> Date: Wed, 22 Dec 2021 23:00:59 +0100 Subject: [PATCH] Feature delete types, options, tickets and orders (#110) * Update packafe.json and run the site * Make a delete button (only button, it does the change buy-able atm) * Adding a delete function to delete a type * Update options for tickets Add a delete (working) delete function, redesign it that it works the same as the types. * Fix "Add ticket option to type" Removed some lines that were necessarily to add options to ticket types * Update Tickets more like Tickets/types and Tickets/options * Add deleting an order * Delete a Ticket * Adding delete an Order * Update lancie-dialog dependency errors * Update all style based on Martijn Feedback * Add refreshing the page after deletion --- .../lancie-admin-page-layout.html | 3 + .../lancie-admin-orders.html | 65 ++++++++++++++-- .../lancie-admin-tickets.html | 65 ++++++++++++++-- .../lancie-admin-ticket-options.html | 77 ++++++++++--------- .../lancie-admin-ticket-types.html | 77 +++++++++++++------ 5 files changed, 217 insertions(+), 70 deletions(-) diff --git a/src/lancie-admin-endpoint/lancie-admin-page-layout.html b/src/lancie-admin-endpoint/lancie-admin-page-layout.html index 880d5fd..9dfafc9 100644 --- a/src/lancie-admin-endpoint/lancie-admin-page-layout.html +++ b/src/lancie-admin-endpoint/lancie-admin-page-layout.html @@ -26,6 +26,9 @@
+
+ +
diff --git a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-orders.html b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-orders.html index 9e8369b..c805b2f 100644 --- a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-orders.html +++ b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-orders.html @@ -1,6 +1,6 @@ - + @@ -15,13 +15,37 @@ - -

Here is where the orders will be.

-

Requests will be on /api/v1/orders

+ > + + +
+

Here is where the orders will be.

+

Requests will be on /api/v1/orders

- + +
+
+ + + Delete +
+ +

Delete Order

+
+

Delete the following Orders (cannot be undone!):

+ +
+ +
+ Cancel + Confirm +
+
+ diff --git a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-tickets.html b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-tickets.html index c2eb0a9..92eec0e 100644 --- a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-tickets.html +++ b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-tickets.html @@ -1,6 +1,6 @@ - + @@ -15,13 +15,37 @@ - -

Here is where the [[endpoint]] will be.

-

Requests will be on /api/v1/tickets

+ + + +
+

Here is where the tickets will be.

+

Requests will be on /api/v1/tickets

- + + +
+ + + Delete +
+ +

Delete Ticket

+
+

Delete the following Tickets (cannot be undone!):

+ +
+ +
+ Cancel + Confirm +
+
+ diff --git a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types/lancie-admin-ticket-options.html b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types/lancie-admin-ticket-options.html index 8e87dad..b733936 100644 --- a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types/lancie-admin-ticket-options.html +++ b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types/lancie-admin-ticket-options.html @@ -20,43 +20,29 @@ :host { display: block; } - - paper-card { - width: calc(100% - 32px); - margin: 16px; - } - - [hidden] { - display: none !important; - } - - @media (max-width: 640px) { - paper-card { - width: 100%; - margin: 0; - } - } - + - -
- - + +
+

Here is where the options will be.

+

Requests will be on /api/v1/tickets/options

+
-
+
+ Add Ticket Option -
+ Delete Ticket Option +
+

Add Ticket Option

- + @@ -68,15 +54,17 @@

Add Ticket Option

-

Confirm deletion

+

Delete Option

- -

Are you certain you want to delete this ticket option?

-

[[deleteOption.name]]

+

Deleting a Option can only be done when there are no more tickets with this Option. Delete the following Option (cannot be undone!):

+
+
Cancel - Delete + Delete
@@ -127,17 +115,30 @@

Are you certain you want to delete this ticket option?

} this.$.addTicketOptionDialog.close(); - this.$.getOptionAjax.generateRequest(); + this.$.getOptionAjax.generateRequest(); }, - deleteTicketOptionDialog: function(event) { - this.deleteOption = this.options.find(option => { - return option.id === event.detail.id; - }); + openDeleteOptionDialog: function() { + if (!this.$.table.selected().length > 0) { + this.$.noOptionSelectedError.setError('Please select a option first.'); + return; + } + this.selectedTypes = this.$.table.selected(); + this.$.noOptionSelectedError.clear(); + this.$.typeSelected.render(); this.$.deleteTicketOptionDialog.open(); }, - tryDeleteOption: function() { + tryDeleteOptions: function() { + this.selectedTypes.forEach(t => this.tryDeleteOption(t)) + this.$.table.clearSelection(); + this.$.deleteTicketOptionDialog.close(); + this.$.getTypeAjax.generateRequest(); + }, + + tryDeleteOption: function(t) { + this.selectedType = t; + this.selectedId = t.id; this.$.ajaxDeleteTicketOption.generateRequest(); }, @@ -157,8 +158,10 @@

Are you certain you want to delete this ticket option?

return; } + this.$.table.setData(request.response); this.fire('set-options', {'options': request.response}); this.options = request.response; + } }); })(); diff --git a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types/lancie-admin-ticket-types.html b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types/lancie-admin-ticket-types.html index c8de6a3..382ce30 100644 --- a/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types/lancie-admin-ticket-types.html +++ b/src/lancie-admin-endpoint/lancie-admin-pages/lancie-admin-types/lancie-admin-ticket-types.html @@ -18,45 +18,30 @@ :host { display: block; } - - paper-card { - width: calc(100% - 32px); - margin: 16px; - } - - [hidden] { - display: none !important; - } - - @media (max-width: 640px) { - paper-card { - width: 100%; - margin: 0; - } - } - + - -
+ +

Here is where the types will be.

Requests will be on /api/v1/tickets/types

-
+
Add Ticket Type Add Ticket Option To Type(s) Change Buyable + Delete Type
- +

Add Ticket Type

@@ -119,6 +104,21 @@

Buyable will be changed for the following Types:

+ +

Delete Type

+
+

Deleting a Type can only be done when there are no more tickets with this type. Delete the following Types (cannot be undone!):

+ +
+ +
+ Cancel + Confirm +
+
+