alert sound when timer exceeds the given hours

This commit is contained in:
Shreya 2018-03-19 11:09:11 +05:30
parent 1cfd28d50d
commit 6a1bf70627
2 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,5 @@
@import 'https://fonts.googleapis.com/css?family=Open+Sans:300,600,800'; @import 'https://fonts.googleapis.com/css?family=Open+Sans:300,600,800';
/*html, /* html,
body { body {
background-color: #000; background-color: #000;
color: #fff; color: #fff;
@ -13,7 +13,7 @@ body {
-o-user-select: none; -o-user-select: none;
user-select: none; user-select: none;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
}*/ } */
.stopwatch { .stopwatch {
height: 50%; height: 50%;

View File

@ -50,7 +50,7 @@ frappe.ui.form.on("Timesheet", {
} }
} }
if (frm.doc.total_hours) { if (frm.doc.total_hours && frm.doc.docstatus < 2) {
frm.add_custom_button(__('Start Timer'), function() { frm.add_custom_button(__('Start Timer'), function() {
frm.trigger("timer") frm.trigger("timer")
}).addClass("btn-primary"); }).addClass("btn-primary");
@ -78,7 +78,6 @@ frappe.ui.form.on("Timesheet", {
"options": frm.doc.time_logs.map(d => d.hours)} "options": frm.doc.time_logs.map(d => d.hours)}
] ]
}); });
dialog.wrapper.append(frappe.render_template("timesheet")); dialog.wrapper.append(frappe.render_template("timesheet"));
frm.trigger("control_timer"); frm.trigger("control_timer");
dialog.show(); dialog.show();
@ -93,6 +92,10 @@ frappe.ui.form.on("Timesheet", {
var paused_time = 0; var paused_time = 0;
$(".playpause").click(function(e) { $(".playpause").click(function(e) {
if (!cur_dialog.get_value('activity')) {
frappe.msgprint(__("Please select Activity"));
return false;
}
if (clicked) { if (clicked) {
e.preventDefault(); e.preventDefault();
return false; return false;
@ -120,6 +123,7 @@ frappe.ui.form.on("Timesheet", {
}); });
$(".stop").click(function() { $(".stop").click(function() {
console.log(currentIncrement);
reset(); reset();
}); });
@ -146,6 +150,7 @@ frappe.ui.form.on("Timesheet", {
if(cur_dialog && cur_dialog.get_value('hours') == hours) { if(cur_dialog && cur_dialog.get_value('hours') == hours) {
isPaused = true; isPaused = true;
initialised = false; initialised = false;
frappe.utils.play_sound("alert");
frappe.msgprint(__("Timer exceeded the given hours")); frappe.msgprint(__("Timer exceeded the given hours"));
} }
$(".hours").text(hours < 10 ? ("0" + hours.toString()) : hours.toString()); $(".hours").text(hours < 10 ? ("0" + hours.toString()) : hours.toString());