Skip to content

Commit

Permalink
minDate property of datepicker is not set to undefined anymore
Browse files Browse the repository at this point in the history
Added loader to template and a min-height to loader screens
Added API documentation of the new get available dates method
  • Loading branch information
hmartos committed Nov 12, 2017
1 parent 1a212d5 commit a1053e4
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 11 deletions.
34 changes: 33 additions & 1 deletion APIDocs.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
REST API SPECIFICATION
===

**Get available dates**
----
_If the module is configured to load available dates from an API (see the [docs](https://hmartos.github.io/angular-reservation/#!#docs)),
this method is called._

* **URL**
_/availableDates_

* **Method:**
`GET`

* **URL Params**

* **No params**

* **Success Response:**
_Returns an array with available dates, a SUCCESS status and a message. <br/>**IMPORTANT**: Available dates should be in [ISO 8601](https://www.w3.org/TR/NOTE-datetime)
format to work with an out of the box install of angular-reservation<br/>
You can use status to return a 200 code response with an error and an optional message to explain what has happened._
* **Code:** 200 <br />
**Content:**
```json
{
"availableDates": [
"2017-11-24",
"2017-11-27"
],
"status": "SUCCESS",
"message": ""
}
```

**Get available hours for selected date**
----
_Called on select date, return the list of available hours for selected date._
_Called on date select, return the list of available hours for selected date._

* **URL**
_/availableHours_
Expand Down
5 changes: 2 additions & 3 deletions dist/angular-reservation.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/angular-reservation.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/angular-reservation.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@
.angular-reservation-clientForm {
margin-top: 2em;
margin-bottom: 2em;
}

.angular-reservation-loader-min-height {
min-height: 500px;
}
3 changes: 1 addition & 2 deletions src/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@
if (vm.getAvailableDatesFromAPI) {
vm.availableDates = [];
getAvailableDates();
//Disable not available dates in datepicker and clean minDate option
//Disable not available dates in datepicker
vm.datepickerOptions.dateDisabled = disableDates;
vm.datepickerOptions.minDate = undefined;
}


Expand Down
8 changes: 5 additions & 3 deletions src/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ <h5 ng-if="reservationCtrl.secondTabLocked">{{"date" | translate}}</h5>
<h5 ng-if="!reservationCtrl.secondTabLocked">{{reservationCtrl.selectedDate | date: reservationCtrl.dateFormat}}</h5>
</uib-tab-heading>

<div ng-include="reservationCtrl.datepickerTemplate"></div>
<div ng-include="'loader.html'" class="text-center" style="min-height: 250px" ng-if="reservationCtrl.loader"></div>

<div ng-include="reservationCtrl.datepickerTemplate" ng-if="!reservationCtrl.loader"></div>
</uib-tab>

<uib-tab index="1" disable="reservationCtrl.secondTabLocked">
Expand All @@ -17,7 +19,7 @@ <h5 ng-if="reservationCtrl.thirdTabLocked">{{"time" | translate}}</h5>
<h5 ng-if="!reservationCtrl.thirdTabLocked">{{reservationCtrl.selectedHour}}</h5>
</uib-tab-heading>

<div ng-include="'loader.html'" class="text-center" ng-if="reservationCtrl.loader"></div>
<div ng-include="'loader.html'" class="text-center" style="min-height: 250px" ng-if="reservationCtrl.loader"></div>

<div class="angular-reservation-availableHour" ng-if="!reservationCtrl.loader && reservationCtrl.availableHours.length > 0">
<div ng-include="reservationCtrl.availableHoursTemplate"></div>
Expand All @@ -36,7 +38,7 @@ <h5>{{"client" | translate}}</h5>

<form class="form-horizontal" name="reserveForm" novalidate
ng-submit="reserveForm.$valid && reservationCtrl.reserve(reservationCtrl.selectedDate, reservationCtrl.selectedHour, reservationCtrl.userData)">
<div ng-include="'loader.html'" class="text-center" ng-if="reservationCtrl.loader"></div>
<div ng-include="'loader.html'" class="text-center" style="min-height: 250px" ng-if="reservationCtrl.loader"></div>

<fieldset ng-if="!reservationCtrl.loader">
<div ng-include="reservationCtrl.clientFormTemplate"></div>
Expand Down

0 comments on commit a1053e4

Please sign in to comment.