diff --git a/erpnext/projects/doctype/timesheet/timesheet.css b/erpnext/projects/doctype/timesheet/timesheet.css index 3bf4533ca2..3a38415e6c 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.css +++ b/erpnext/projects/doctype/timesheet/timesheet.css @@ -1,5 +1,3 @@ -@import 'https://fonts.googleapis.com/css?family=Open+Sans:300,600,800'; - .stopwatch { text-align: center; padding: 1em; @@ -22,18 +20,4 @@ .playpause { border-right: 1px dashed #fff; border-bottom: 1px dashed #fff; -} - -.playpause .play { - display: inline-block; - border-top: 19px solid transparent; - border-left: 28px solid #000; - border-bottom: 19px solid transparent; -} - -.playpause .pause { - display: inline-block; - border-right: 3px solid #000; - border-left: 3px solid #000; - padding: 20px 11px; } \ No newline at end of file diff --git a/erpnext/projects/doctype/timesheet/timesheet.html b/erpnext/projects/doctype/timesheet/timesheet.html index 73f8d14b96..5aab517c55 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.html +++ b/erpnext/projects/doctype/timesheet/timesheet.html @@ -6,5 +6,6 @@ 00
- + +
diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js index 40c0af969f..678c01639f 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.js +++ b/erpnext/projects/doctype/timesheet/timesheet.js @@ -155,7 +155,7 @@ frappe.ui.form.on("Timesheet Detail", { $('.form-grid') .find('[data-fieldname="timer"]') .append(frappe.render_template("timesheet")); - frm.trigger("control_timer"); + frm.trigger("control_timer"); }) }, hours: function(frm, cdt, cdn) { diff --git a/erpnext/public/js/projects/timer.js b/erpnext/public/js/projects/timer.js index dd8f210fca..c97c7d1391 100644 --- a/erpnext/public/js/projects/timer.js +++ b/erpnext/public/js/projects/timer.js @@ -1,4 +1,4 @@ -frappe.provide("erpnext.timesheet") +frappe.provide("erpnext.timesheet"); erpnext.timesheet.timer = function(frm, row, timestamp=0) { let dialog = new frappe.ui.Dialog({ @@ -24,17 +24,15 @@ erpnext.timesheet.timer = function(frm, row, timestamp=0) { dialog.get_field("timer_html").$wrapper.append(frappe.render_template("timesheet")); control_timer(frm, dialog, row, timestamp); dialog.show(); -} +}; var control_timer = function(frm, dialog, row, timestamp=0) { var $btn_start = $(".playpause .btn-start"); var $btn_complete = $(".playpause .btn-complete"); var interval = null; - var currentIncrement = timestamp - var isPaused = false; + var currentIncrement = timestamp; var initialised = row ? true : false; var clicked = false; - var paused_time = 0; // If row with not completed status, initialize timer with the time elapsed on click of 'Start Timer'. if (row) { @@ -59,7 +57,7 @@ var control_timer = function(frm, dialog, row, timestamp=0) { row.from_time = frappe.datetime.get_datetime_as_string(); row.expected_hours = args.expected_hours; row.completed = 0; - let d = moment(row.from_time) + let d = moment(row.from_time); if(row.expected_hours) { d.add(row.expected_hours, "hours"); row.to_time = d.format(moment.defaultDatetimeFormat); @@ -75,7 +73,6 @@ var control_timer = function(frm, dialog, row, timestamp=0) { if (!initialised) { initialised = true; - isPaused = false; $btn_start.hide(); $btn_complete.show(); initialiseTimer(); @@ -96,10 +93,9 @@ var control_timer = function(frm, dialog, row, timestamp=0) { frm.save(); reset(); dialog.hide(); - }) + }); function initialiseTimer() { interval = setInterval(function() { - if (isPaused) return; var current = setCurrentIncrement(); updateStopwatch(current); }, 1000); @@ -115,7 +111,7 @@ var control_timer = function(frm, dialog, row, timestamp=0) { reset(); } if(hours > 99) - reset(); + reset(); $(".hours").text(hours < 10 ? ("0" + hours.toString()) : hours.toString()); $(".minutes").text(minutes < 10 ? ("0" + minutes.toString()) : minutes.toString()); $(".seconds").text(seconds < 10 ? ("0" + seconds.toString()) : seconds.toString()); @@ -128,7 +124,6 @@ var control_timer = function(frm, dialog, row, timestamp=0) { function reset() { currentIncrement = 0; - isPaused = true; initialised = false; clearInterval(interval); $(".hours").text("00"); @@ -137,4 +132,4 @@ var control_timer = function(frm, dialog, row, timestamp=0) { $btn_complete.hide(); $btn_start.show(); } -} \ No newline at end of file +}; \ No newline at end of file