@@ -27,7 +27,7 @@ function() {
2727 $ ( function ( ) {
2828 $ ( '#work-input-form' ) . on ( 'submit' , function ( e ) {
2929 e . preventDefault ( ) ;
30- createWorkItem ( ) ;
30+ createWorkItem ( $ ( this ) ) ;
3131 } ) ;
3232 var days = '30' ;
3333 var start = moment ( ) . startOf ( 'day' ) . subtract ( 29 , 'days' ) ;
@@ -282,7 +282,7 @@ function() {
282282 "</div>" +
283283 "<div class='wi-child-duration'>" + ( ( child . running == 1 ) ?'running...' :secondsToTimer ( child . duration ) ) + "</div>" +
284284 "<div class='wi-play-space'>" +
285- "<span class='fas clickable fa-play wi-play ' id=" + child . id + " data-work-name='" + child . name + "' data-projectid=" + child . projectId + " data-tagids='" + child . tags . map ( function ( tag ) { return tag . id } ) . join ( ',' ) + "' ></span>" +
285+ "<span class='fas clickable fa-play wi-resume ' id=" + child . id + " data-work-name='" + child . name + "' data-projectid=" + child . projectId + " data-tagids='" + child . tags . map ( function ( tag ) { return tag . id } ) . join ( ',' ) + "' ></span>" +
286286 "</div>" +
287287 "</div>" +
288288 "</div>" +
@@ -386,8 +386,13 @@ function() {
386386 } )
387387 $ ( '.wi-play' ) . click ( function ( e ) {
388388 e . preventDefault ( ) ;
389- createWorkItem ( ) ;
390- } )
389+ createWorkItem ( $ ( this ) ) ;
390+ } ) ;
391+
392+ $ ( '.wi-resume' ) . click ( function ( e ) {
393+ e . preventDefault ( ) ;
394+ resumeWorkItem ( $ ( this ) ) ;
395+ } ) ;
391396 $ ( '.wi-trash' ) . click ( function ( e ) {
392397 $ ( "#dialog-confirm" ) . dialog ( {
393398 buttons : {
@@ -579,15 +584,18 @@ function() {
579584 } ) ;
580585 }
581586
582- function createWorkItem ( ) {
583- var wiPlay = $ ( '.wi-play' ) ;
587+ function createWorkItem ( wiPlay ) {
584588 var workName = $ ( '#work-input' ) . val ( ) ;
585-
586589 $ ( '#work-input' ) . val ( wiPlay . data ( 'work-name' ) ) ;
587590 startTimer ( wiPlay . data ( 'projectid' ) , wiPlay . data ( 'tagids' ) , workName ) ;
588591 return false ;
589592 }
590593
594+ function resumeWorkItem ( wiResume ) {
595+ startTimer ( wiResume . data ( 'projectid' ) , wiResume . data ( 'tagids' ) , wiResume . data ( 'work-name' ) ) ;
596+ return false ;
597+ }
598+
591599 function startTimer ( projectId = null , tags = "" , inputWorkName = null ) {
592600 if ( localStorage . getItem ( 'isTimerStarted' ) === 'true' ) {
593601 stopTimer ( startTimer , [ projectId , tags , inputWorkName ] ) ;
@@ -600,7 +608,7 @@ function() {
600608 var baseUrl = OC . generateUrl ( '/apps/timetracker/ajax/start-timer/' + encodeURIComponent ( encodeURIComponent ( workName ) ) ) ;
601609 var jqxhr = $ . post ( baseUrl , { projectId : projectId , tags : tags } , function ( ) {
602610 } )
603- . done ( function ( data , status , jqXHR ) {
611+ . done ( function ( data , status , jqxhr ) {
604612 var response = data ;
605613 if ( 'Error' in response ) {
606614 alert ( response . Error ) ;
0 commit comments