From fbf6c41c7e03dd07f96a03f084a11b4b8c8ffb83 Mon Sep 17 00:00:00 2001 From: Sylvain Jermini Date: Fri, 29 Mar 2019 13:02:28 +0100 Subject: [PATCH] improvement in reservation import, disable upload button if there are 0 attendees to import --- .../admin/partials/form/control-buttons.html | 2 +- .../resources/js/admin/directive/admin-directive.js | 3 ++- .../reservation/import/reservation-import.html | 2 +- .../feature/reservation/import/reservation-import.js | 12 ++++++++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/resources/angular-templates/admin/partials/form/control-buttons.html b/src/main/webapp/resources/angular-templates/admin/partials/form/control-buttons.html index 192d1e4cc1..fac97297d1 100644 --- a/src/main/webapp/resources/angular-templates/admin/partials/form/control-buttons.html +++ b/src/main/webapp/resources/angular-templates/admin/partials/form/control-buttons.html @@ -1,6 +1,6 @@
- +
diff --git a/src/main/webapp/resources/js/admin/directive/admin-directive.js b/src/main/webapp/resources/js/admin/directive/admin-directive.js index e84accebcd..c0f3406d7f 100644 --- a/src/main/webapp/resources/js/admin/directive/admin-directive.js +++ b/src/main/webapp/resources/js/admin/directive/admin-directive.js @@ -248,7 +248,8 @@ templateUrl: '/resources/angular-templates/admin/partials/form/control-buttons.html', scope: { formObj: '=', - cancelHandler: '=' + cancelHandler: '=', + disableSubmit:'<' }, link: function(scope, element, attrs) { scope.successText = angular.isDefined(attrs.successText) ? attrs.successText : "Save"; diff --git a/src/main/webapp/resources/js/admin/feature/reservation/import/reservation-import.html b/src/main/webapp/resources/js/admin/feature/reservation/import/reservation-import.html index 6a19ae3459..40d29ef0a0 100644 --- a/src/main/webapp/resources/js/admin/feature/reservation/import/reservation-import.html +++ b/src/main/webapp/resources/js/admin/feature/reservation/import/reservation-import.html @@ -182,6 +182,6 @@

{{::attendee.firstName}} {{::attendee.lastNa
- +

\ No newline at end of file diff --git a/src/main/webapp/resources/js/admin/feature/reservation/import/reservation-import.js b/src/main/webapp/resources/js/admin/feature/reservation/import/reservation-import.js index 72c09732fe..f011313e9a 100644 --- a/src/main/webapp/resources/js/admin/feature/reservation/import/reservation-import.js +++ b/src/main/webapp/resources/js/admin/feature/reservation/import/reservation-import.js @@ -197,6 +197,18 @@ delete ctrl.errorMessage; }; + ctrl.countParsedAttendees = function(ticketsInfo) { + var count = 0; + if(ticketsInfo) { + for(var i = 0; i < ticketsInfo.length; i++) { + if(ticketsInfo[i] && ticketsInfo[i].attendees) { + count += ticketsInfo[i].attendees.length; + } + } + } + return count; + } + var internalParseFileContent = function(content) { var self = this; self.attendees = [];