Skip to content

Commit

Permalink
Early arrival period (Midburn#911)
Browse files Browse the repository at this point in the history
* fixing the adding none existan member bug.

* Showing only on the correct dates.
  • Loading branch information
Demikulu authored and amotenko committed May 19, 2018
1 parent 1672662 commit 0c26000
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions public/scripts/controllers/camp_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,15 @@ app.controller("campEditController", ($scope, $http, $filter, $q) => {
return allocationPeriod.start < now && now < allocationPeriod.end;
};

$scope.earlyArrivalPeriodIsActive = () => {
const now = new Date();
const earlyArrivalPeriod = {
start : new Date(controllDates.early_arrivals_start),
end : new Date(controllDates.early_arrivals_end),
};
return earlyArrivalPeriod.start < now && now < earlyArrivalPeriod.end;
};

$scope.updateEarlyArrival = (user_name, user_id, action_type) => {
var camp_id = $scope.current_camp_id;
var user_rec = {
Expand Down
4 changes: 2 additions & 2 deletions views/pages/camps/partials/members_table.jade
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ table.table.table-striped.table-hover
button.btn.btn-xs
span(class='glyphicon glyphicon-remove' )
=t('camps:members.group_sale_ticket_remove')
a.cursor-p(ng-show='1' ng-click='updateEarlyArrival(member.name, member.user_id, "early_arrival")' ng-if="!member.early_arrival") &nbsp;
a.cursor-p(ng-show='earlyArrivalPeriodIsActive()' ng-click='updateEarlyArrival(member.name, member.user_id, "early_arrival")' ng-if="!member.early_arrival") &nbsp;
button.btn.btn-xs
span(class='glyphicon glyphicon-ok' )
=t('camps:members.set_early_arrival')
a.cursor-p(ng-show='1' ng-click='updateEarlyArrival(member.name, member.user_id, "early_arrival")' ng-if="member.early_arrival")
a.cursor-p(ng-show='earlyArrivalPeriodIsActive()' ng-click='updateEarlyArrival(member.name, member.user_id, "early_arrival")' ng-if="member.early_arrival")
button.btn.btn-xs
span(class='glyphicon glyphicon-remove' )
=t('camps:members.remove_early_arrival')

0 comments on commit 0c26000

Please sign in to comment.