Skip to content

Commit

Permalink
improvement in reservation import, disable upload button if there are…
Browse files Browse the repository at this point in the history
… 0 attendees to import
  • Loading branch information
syjer committed Mar 29, 2019
1 parent dc35e62 commit fbf6c41
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="row">
<div class="col-md-4 col-md-push-8 col-xs-12">
<button class="btn btn-lg btn-warning btn-block" data-ng-disabled="formObj.$waiting" data-ng-click="ok(formObj)" style="margin-bottom: 10px">{{successText}}</button>
<button class="btn btn-lg btn-warning btn-block" data-ng-disabled="formObj.$waiting || disableSubmit" data-ng-click="ok(formObj)" style="margin-bottom: 10px">{{successText}}</button>
</div>
<div class="col-md-4 col-md-pull-4 col-xs-12">
<button type="button" class="btn btn-lg btn-default btn-block" data-ng-disabled="formObj.$waiting" data-ng-click="cancel()" style="margin-bottom: 10px">Cancel</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,6 @@ <h4 class="list-group-item-heading">{{::attendee.firstName}} {{::attendee.lastNa

<hr>

<control-buttons data-form-obj="newReservation" cancel-handler="$ctrl.reinit" success-text="Upload" ng-if="!$ctrl.loading"></control-buttons>
<control-buttons data-form-obj="newReservation" cancel-handler="$ctrl.reinit" disable-submit="$ctrl.countParsedAttendees($ctrl.reservation.ticketsInfo) === 0" success-text="Upload" ng-if="!$ctrl.loading"></control-buttons>
</form>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down

0 comments on commit fbf6c41

Please sign in to comment.