mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-18 07:52:23 +01:00
(bug) unable to update availability slot end time for training
This commit is contained in:
parent
53b5b36b68
commit
a1469f0337
@ -1008,6 +1008,13 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
|
|||||||
// update availability object
|
// update availability object
|
||||||
$scope.availability.start_at = $scope.start;
|
$scope.availability.start_at = $scope.start;
|
||||||
});
|
});
|
||||||
|
// Maintain consistency between the end time and the date object in the availability object
|
||||||
|
$scope.$watch('end', function (newValue, oldValue, scope) {
|
||||||
|
if (newValue.valueOf() !== oldValue.valueOf()) {
|
||||||
|
// update availability object
|
||||||
|
$scope.availability.end_at = $scope.end;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$scope.$watch('startTime', function (newValue, oldValue, scope) {
|
$scope.$watch('startTime', function (newValue, oldValue, scope) {
|
||||||
// adjust the start/endTime
|
// adjust the start/endTime
|
||||||
@ -1020,14 +1027,9 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
|
|||||||
$scope.endTime = endTime.toDate();
|
$scope.endTime = endTime.toDate();
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$watch('endTime', function (newValue, oldValue, scope) {
|
$scope.endTimeChanged = function () {
|
||||||
// adjust the start/endTime
|
$scope.end = moment.tz($scope.endTime, moment.tz.guess()).toDate();
|
||||||
const end = moment($scope.end);
|
};
|
||||||
const diff = moment.tz(newValue, moment.tz.guess()).diff(moment.tz(oldValue, moment.tz.guess()));
|
|
||||||
end.add(diff, 'milliseconds');
|
|
||||||
$scope.end = end.toDate();
|
|
||||||
$scope.availability.end_at = $scope.end;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<span class="col-md-1 m-t-xl m-l" translate>{{ 'app.admin.calendar.to_time' }}</span>
|
<span class="col-md-1 m-t-xl m-l" translate>{{ 'app.admin.calendar.to_time' }}</span>
|
||||||
<fieldset ng-disabled="endDateReadOnly" class="col-md-5">
|
<fieldset ng-disabled="endDateReadOnly" class="col-md-5">
|
||||||
<uib-timepicker ng-model="endTime" hour-step="timepickers.end.hstep" readonly-input="true" minute-step="timepickers.end.mstep" show-meridian="false"></uib-timepicker>
|
<uib-timepicker ng-model="endTime" hour-step="timepickers.end.hstep" readonly-input="true" minute-step="timepickers.end.mstep" show-meridian="false" ng-change="endTimeChanged()"></uib-timepicker>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user