ItEr56S13AdaptacionServiciosRESTItEr55S07: Allowing from calendar UI to create, modify and delete exceptions in the past.
This commit is contained in:
parent
629887ab07
commit
c73d5af641
2 changed files with 3 additions and 39 deletions
|
|
@ -474,19 +474,6 @@ public abstract class BaseCalendarEditionController extends
|
|||
return baseCalendarModel.getHoursOfDay();
|
||||
}
|
||||
|
||||
public boolean isSelectedDateFromPast() {
|
||||
Date selectedDay = baseCalendarModel.getSelectedDay();
|
||||
if (selectedDay != null) {
|
||||
return isPast(selectedDay);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isNotSelectedDateFromPast() {
|
||||
return !isSelectedDateFromPast();
|
||||
}
|
||||
|
||||
public void createException() {
|
||||
Combobox exceptionTypes = (Combobox) window.getFellow("exceptionTypes");
|
||||
CalendarExceptionType type = (CalendarExceptionType) exceptionTypes
|
||||
|
|
@ -515,13 +502,6 @@ public abstract class BaseCalendarEditionController extends
|
|||
} else {
|
||||
Clients.closeErrorBox(dateboxEndDate);
|
||||
}
|
||||
if (startDate.compareTo(new Date()) <= 0) {
|
||||
throw new WrongValueException(
|
||||
dateboxStartDate,
|
||||
_("Exception start date should be greater than current date"));
|
||||
} else {
|
||||
Clients.closeErrorBox(dateboxStartDate);
|
||||
}
|
||||
if (startDate.compareTo(endDate) > 0) {
|
||||
throw new WrongValueException(
|
||||
dateboxEndDate,
|
||||
|
|
@ -903,9 +883,6 @@ public abstract class BaseCalendarEditionController extends
|
|||
reloadDayInformation();
|
||||
}
|
||||
});
|
||||
if (isSelectedDateFromPast()) {
|
||||
result.setDisabled(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -956,13 +933,6 @@ public abstract class BaseCalendarEditionController extends
|
|||
} else {
|
||||
Clients.closeErrorBox(dateboxEndDate);
|
||||
}
|
||||
if (startDate.compareTo(new Date()) <= 0) {
|
||||
throw new WrongValueException(
|
||||
dateboxStartDate,
|
||||
_("Exception start date should be greater than current date"));
|
||||
} else {
|
||||
Clients.closeErrorBox(dateboxStartDate);
|
||||
}
|
||||
if (startDate.compareTo(endDate) > 0) {
|
||||
throw new WrongValueException(
|
||||
dateboxEndDate,
|
||||
|
|
|
|||
|
|
@ -91,8 +91,7 @@
|
|||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Exception Type')}" />
|
||||
<combobox id="exceptionTypes"
|
||||
disabled="@{calendarController.editionController.isSelectedDateFromPast}">
|
||||
<combobox id="exceptionTypes">
|
||||
<comboitem self="@{each='calendarExceptionType'}"
|
||||
value="@{calendarExceptionType}"
|
||||
label="@{calendarExceptionType.name}" />
|
||||
|
|
@ -101,18 +100,15 @@
|
|||
<row>
|
||||
<label value="${i18n:_('Start Date')}" />
|
||||
<datebox id="exceptionStartDate"
|
||||
disabled="@{calendarController.editionController.isSelectedDateFromPast}"
|
||||
value="@{calendarController.editionController.selectedDay}" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('End Date')}" />
|
||||
<datebox id="exceptionEndDate"
|
||||
disabled="@{calendarController.editionController.isSelectedDateFromPast}"/>
|
||||
<datebox id="exceptionEndDate" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Hours')}" />
|
||||
<intbox id="exceptionHours"
|
||||
disabled="@{calendarController.editionController.isSelectedDateFromPast}" />
|
||||
<intbox id="exceptionHours" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
|
@ -132,11 +128,9 @@
|
|||
|
||||
<hbox>
|
||||
<button label="${i18n:_('Create exception')}"
|
||||
disabled="@{calendarController.editionController.isSelectedDateFromPast}"
|
||||
onClick="calendarController.editionController.createException();"
|
||||
visible="@{calendarController.editionController.isNotOwnExceptionDay}" />
|
||||
<button label="${i18n:_('Update exception')}"
|
||||
disabled="@{calendarController.editionController.isSelectedDateFromPast}"
|
||||
onClick="calendarController.editionController.updateException();"
|
||||
visible="@{calendarController.editionController.isOwnExceptionDay}" />
|
||||
</hbox>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue