1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-26 20:54:21 +01:00

handle dates default values and limits in close period modal

This commit is contained in:
Sylvain 2019-01-08 11:19:07 +01:00
parent 12c25389fa
commit ccff40b226
3 changed files with 9 additions and 1 deletions

View File

@ -637,6 +637,8 @@ Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$ui
// default: datePicker are not shown
startOpened: false,
endOpened: false,
minDate: LAST_CLOSING,
maxDate: YESTERDAY,
options: {
startingDay: Fablab.weekStartingDay
}

View File

@ -14,6 +14,9 @@
uib-datepicker-popup="{{datePicker.format}}"
datepicker-options="datePicker.options"
is-open="datePicker.startOpened"
min-date="datePicker.minDate"
max-date="datePicker.maxDate"
init-date="period.start_at"
placeholder="{{datePicker.format}}"
ng-click="openDatePicker($event, 'start')"
required/>
@ -31,6 +34,9 @@
uib-datepicker-popup="{{datePicker.format}}"
datepicker-options="datePicker.options"
is-open="datePicker.endOpened"
min-date="datePicker.minDate"
max-date="datePicker.maxDate"
init-date="period.end_at"
placeholder="{{datePicker.format}}"
ng-click="openDatePicker($event, 'end')"
required/>

View File

@ -29,7 +29,7 @@ class API::AccountingPeriodsController < API::ApiController
invoice = Invoice.order(:created_at).first
@last_end = invoice.created_at if invoice
else
@last_end = last_period.end_at
@last_end = last_period.end_at + 1.day
end
end