Skip to content

Commit 81587ee

Browse files
authored
Allow enforcing users explicitly to pick up type of leave when booking (#530)
1 parent 10cc4c9 commit 81587ee

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ respect the alphabet while sorting customer entered content.
141141
For that purpose the application config file has `locale_code_for_sorting` entry.
142142
By default the value is `en` (English). One can override it with other locales such as `cs`, `fr`, `de` etc.
143143

144+
### Force employees to pick type each time new leave is booked
145+
146+
Some organizations require employees to explicitly pick the type of leave when booking time off. So employee makes a choice rather than relying on default settings.
147+
That reduce number of "mistaken" leaves, which are cancelled after.
148+
149+
In order to force employee to explicitly pick the leave type of the booked time off, change `is_force_to_explicitly_select_type_when_requesting_new_leave`
150+
flag to be `true` in the `config/app.json` file.
151+
144152
## Use Redis as a sessions storage
145153

146154
Follow instructions on [this page](docs/SessionStoreInRedis.md).

config/app.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
"crypto_secret" : "!2~`HswpPPLa22+=±§sdq qwe,appp qwwokDF_",
2222
"application_domain" : "http://app.timeoff.management",
2323
"promotion_website_domain" : "http://timeoff.management",
24-
"locale_code_for_sorting": "en"
24+
"locale_code_for_sorting": "en",
25+
"force_to_explicitly_select_type_when_requesting_new_leave": false
2526
}

lib/view/helpers.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,13 @@ module.exports = function(){
152152
return options.inverse(this);
153153
},
154154

155+
is_force_to_explicitly_select_type_when_requesting_new_leave: function (options) {
156+
if (!!config.get('force_to_explicitly_select_type_when_requesting_new_leave')) {
157+
return options.fn(this);
158+
}
159+
160+
return options.inverse(this);
161+
},
162+
155163
};
156164
};

views/partials/book_leave_modal.hbs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
<div class="form-group">
2424
<label for="leave_type" class="control-label">Leave type:</label>
2525
<select class="form-control" id="leave_type" name="leave_type">
26+
{{# is_force_to_explicitly_select_type_when_requesting_new_leave}}
27+
<option disabled selected value>-- select an option --</option>
28+
{{/ is_force_to_explicitly_select_type_when_requesting_new_leave}}
2629
{{#each logged_user.company.leave_types }}
2730
<option value={{this.id}} data-tom="{{this.name}}" data-tom-index={{@index}}>{{this.name}}</option>
2831
{{/each}}

0 commit comments

Comments
 (0)