Skip to content

Commit

Permalink
Allow enforcing users explicitly to pick up type of leave when booking (
Browse files Browse the repository at this point in the history
  • Loading branch information
vpp authored Sep 12, 2022
1 parent 10cc4c9 commit 81587ee
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ respect the alphabet while sorting customer entered content.
For that purpose the application config file has `locale_code_for_sorting` entry.
By default the value is `en` (English). One can override it with other locales such as `cs`, `fr`, `de` etc.

### Force employees to pick type each time new leave is booked

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.
That reduce number of "mistaken" leaves, which are cancelled after.

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`
flag to be `true` in the `config/app.json` file.

## Use Redis as a sessions storage

Follow instructions on [this page](docs/SessionStoreInRedis.md).
Expand Down
3 changes: 2 additions & 1 deletion config/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
"crypto_secret" : "!2~`HswpPPLa22+=±§sdq qwe,appp qwwokDF_",
"application_domain" : "http://app.timeoff.management",
"promotion_website_domain" : "http://timeoff.management",
"locale_code_for_sorting": "en"
"locale_code_for_sorting": "en",
"force_to_explicitly_select_type_when_requesting_new_leave": false
}
8 changes: 8 additions & 0 deletions lib/view/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,13 @@ module.exports = function(){
return options.inverse(this);
},

is_force_to_explicitly_select_type_when_requesting_new_leave: function (options) {
if (!!config.get('force_to_explicitly_select_type_when_requesting_new_leave')) {
return options.fn(this);
}

return options.inverse(this);
},

};
};
3 changes: 3 additions & 0 deletions views/partials/book_leave_modal.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<div class="form-group">
<label for="leave_type" class="control-label">Leave type:</label>
<select class="form-control" id="leave_type" name="leave_type">
{{# is_force_to_explicitly_select_type_when_requesting_new_leave}}
<option disabled selected value>-- select an option --</option>
{{/ is_force_to_explicitly_select_type_when_requesting_new_leave}}
{{#each logged_user.company.leave_types }}
<option value={{this.id}} data-tom="{{this.name}}" data-tom-index={{@index}}>{{this.name}}</option>
{{/each}}
Expand Down

0 comments on commit 81587ee

Please sign in to comment.