Skip to content

Commit

Permalink
Fix thamara#240: waiver using electron dialog instead of js alert
Browse files Browse the repository at this point in the history
  • Loading branch information
araujoarthur0 committed May 31, 2020
1 parent cdd339d commit 0d2a476
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/workday-waiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,26 @@ function addWaiver() {

var diff = diffDays(start_date, end_date);
if (diff < 0) {
alert('End date cannot be less than start date.');
return;
dialog.showMessageBox(BrowserWindow.getFocusedWindow(),
{
message: 'End date cannot be less than start date.'
}
).then(() => {
return;
});
}

var temp_date = new Date(start_date);
for (var i = 0; i <= diff; i++) {
var temp_date_str = getDateStr(temp_date);
if (store.has(temp_date_str)) {
alert(`You already have a waiver on ${temp_date_str}. Remove it before adding a new one.`);
return;
dialog.showMessageBox(BrowserWindow.getFocusedWindow(),
{
message: `You already have a waiver on ${temp_date_str}. Remove it before adding a new one.`
}
).then(() => {
return;
});
}

temp_date.setDate(temp_date.getDate() + 1);
Expand Down

0 comments on commit 0d2a476

Please sign in to comment.