@@ -220,6 +220,23 @@ require('select2/dist/css/select2.css');
220220 } ) ;
221221 return false ;
222222 } ) ;
223+ $ ( "#timeline-csv-email" ) . off ( ) . click ( function ( ) {
224+ var baseUrl = OC . generateUrl ( '/apps/timetracker/ajax/email-timeline' ) ;
225+ $ . post ( baseUrl , // url
226+ {
227+ from : start . unix ( ) ,
228+ to : end . unix ( ) ,
229+ group1 : group1 ,
230+ group2 : group2 ,
231+ timegroup : group3 ,
232+ filterProjectId : filterProjectId ,
233+ filterClientId : filterClientId
234+ } , // data to be submit
235+ function ( data , status , jqXHR ) { // success callback
236+ getTimelines ( ) ;
237+ } ) ;
238+ return false ;
239+ } ) ;
223240
224241 }
225242
@@ -277,38 +294,87 @@ require('select2/dist/css/select2.css');
277294 return '<a href="' + baseUrl + '">' + "Download" + '</a>' ;
278295
279296 } } ,
297+ { title :"Email" , field :"" , formatter :"rownum" , formatter :function ( cell , formatterParams , onRendered ) {
298+ //cell - the cell component
299+ //formatterParams - parameters set for the column
300+ //onRendered - function to call when the formatter has been rendered
301+
302+
303+ return '<a href=# data-id="' + cell . getRow ( ) . getData ( ) [ "id" ] + '">Email</a>' ;
304+
305+ } , cellClick :function ( e , cell ) {
306+ $ ( "#dialog-send-email-form" ) . dialog ( {
307+ buttons : {
308+ "Confirm" : {
309+ click : function ( ) {
310+ var baseUrl = OC . generateUrl ( '/apps/timetracker/ajax/email-timeline/' + cell . getRow ( ) . getData ( ) . id ) ;
311+
312+ var jqxhr = $ . post ( baseUrl , {
313+ email :$ ( '#email-address' ) . val ( ) ,
314+ subject :$ ( '#email-subject' ) . val ( ) ,
315+ content :$ ( '#email-content' ) . val ( ) ,
316+ } , function ( ) {
317+ $ ( "#dialog-send-email-form" ) . dialog ( "close" ) ;
318+ debugger ;
319+ } )
320+ . done ( function ( data , status , jqXHR ) {
321+ var response = data ;
322+ if ( 'Error' in response ) {
323+ alert ( response . Error ) ;
324+ }
325+ } )
326+ . fail ( function ( ) {
327+ alert ( "error" ) ;
328+ } )
329+ return false ;
330+ } ,
331+ text : 'Confirm' ,
332+ class :'primary'
333+ } ,
334+ "Cancel" : function ( ) {
335+ $ ( this ) . dialog ( "close" ) ;
336+ }
337+ }
338+ } ) ;
339+ $ ( "#dialog-send-email-form" ) . dialog ( 'open' ) ;
340+
341+ //cell.getRow().delete();
342+ }
343+ } ,
280344 { formatter :"buttonCross" , width :40 , align :"center" , cellClick :function ( e , cell ) {
281- $ ( "#dialog-confirm" ) . dialog ( {
282- buttons : {
283- "Confirm" : { click : function ( ) {
284- var baseUrl = OC . generateUrl ( '/apps/timetracker/ajax/delete-timeline/' + cell . getRow ( ) . getData ( ) . id ) ;
285- var jqxhr = $ . post ( baseUrl , function ( ) {
345+ $ ( "#dialog-confirm" ) . dialog ( {
346+ buttons : {
347+ "Confirm" : {
348+ click : function ( ) {
349+ var baseUrl = OC . generateUrl ( '/apps/timetracker/ajax/delete-timeline/' + cell . getRow ( ) . getData ( ) . id ) ;
350+ var jqxhr = $ . post ( baseUrl , function ( ) {
286351 getTimelines ( ) ;
287352 $ ( "#dialog-confirm" ) . dialog ( "close" ) ;
288- } )
289- . done ( function ( data , status , jqXHR ) {
290- var response = data ;
291- if ( 'Error' in response ) {
292- alert ( response . Error ) ;
293- }
294- } )
295- . fail ( function ( ) {
296- alert ( "error" ) ;
297- } )
298- return false ;
299- } ,
300- text : 'Confirm' ,
301- class :'primary'
302- } ,
303- "Cancel" : function ( ) {
304- $ ( this ) . dialog ( "close" ) ;
305- }
306- }
307- } ) ;
308- $ ( "#dialog-confirm" ) . dialog ( 'open' ) ;
353+ } )
354+ . done ( function ( data , status , jqXHR ) {
355+ var response = data ;
356+ if ( 'Error' in response ) {
357+ alert ( response . Error ) ;
358+ }
359+ } )
360+ . fail ( function ( ) {
361+ alert ( "error" ) ;
362+ } )
363+ return false ;
364+ } ,
365+ text : 'Confirm' ,
366+ class :'primary'
367+ } ,
368+ "Cancel" : function ( ) {
369+ $ ( this ) . dialog ( "close" ) ;
370+ }
371+ }
372+ } ) ;
373+ $ ( "#dialog-confirm" ) . dialog ( 'open' ) ;
309374
310375 //cell.getRow().delete();
311- } } ,
376+ }
377+ } ,
312378
313379 ] ,
314380 ajaxResponse :function ( url , params , response ) {
0 commit comments