scheduling.html 25.5 KB
Newer Older
Prosper De Laure's avatar
Prosper De Laure committed
1
2
3
4
5
6
7
8
9
10
11
<!--#
    This file is part of the auth package.
    (c) Maarch Prospre DE LAURE <prosper.delaure@maarch.org>

    For the full copyright and license information, please view the LICENSE
    file that was distributed with this source code.
#-->
<div class="container-fluid" data-translate-catalog="batchProcessing/messages">
    <div class="page-header">
        <h1>
            <i class="fa fa-calendar-o"></i>
Dylan's avatar
Dylan committed
12
            Batch processing
Prosper De Laure's avatar
Prosper De Laure committed
13
14
15
16
17
18
        </h1>
    </div>
</div>

<div class="container-fluid" data-translate-catalog="batchProcessing/messages">
    <div class="col-md-6">
19
20
21
22
23
24
        <div class="row">
            <div class="col-xs-12">
                <button id="scheduleNewTask" class="btn btn-success" title="Schedule a new task"><i class="fa fa-clock-o">&nbsp;</i>New scheduling</button>
            </div>
        </div>
        <br/>
Prosper De Laure's avatar
Prosper De Laure committed
25
26
27
28
        <div class="row">
            <div class="col-xs-12">
                <div id="taskList" class="list-group">
                    <?merge scheduledTasks ?>
Dylan's avatar
6419    
Dylan committed
29
                    <a class="list-group-item clearfix" data-json="[?merge .json ?]">
30
                        <span class="col-xs-9">
Prosper De Laure's avatar
Prosper De Laure committed
31
                            <h4 class="list-group-item-heading schedulingName"><?merge .name ?></h4>
32
                            <h4 class="text-danger [?merge .status.ifeq('error').then('', 'hide') ?]" name="displayError"><code><i class="fa fa-warning">&nbsp;</i>Execution error</code></h4>
Prosper De Laure's avatar
Prosper De Laure committed
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
                            <p class="list-group-item-text">
                                <span class="row-fluid"><i class="fa fa-clock-o"/> <span class="startTime"><?merge .startHours ?><b>:</b><?merge .startMinutes ?></span></span>
                                <?merge .weekDays.count().bool() ?>
                                <span class="pull-right weekDays ">
                                    <b class="[?merge .weekDays.inarray('MON').then('text-primary', 'text-muted')?]" data-value="MON" data-translate-context="monday">M</b>
                                    <b class="[?merge .weekDays.inarray('TUE').then('text-primary', 'text-muted')?]" data-value="TUE" data-translate-context="tuesday">T</b>
                                    <b class="[?merge .weekDays.inarray('WED').then('text-primary', 'text-muted')?]" data-value="WED" data-translate-context="wednesday">W</b>
                                    <b class="[?merge .weekDays.inarray('THU').then('text-primary', 'text-muted')?]" data-value="THU" data-translate-context="thursday">T</b>
                                    <b class="[?merge .weekDays.inarray('FRI').then('text-primary', 'text-muted')?]" data-value="FRI" data-translate-context="friday">F</b>
                                    <b class="[?merge .weekDays.inarray('SAT').then('text-primary', 'text-muted')?]" data-value="SAT" data-translate-context="saturday">S</b>
                                    <b class="[?merge .weekDays.inarray('SUN').then('text-primary', 'text-muted')?]" data-value="SUN" data-translate-context="sunday">S</b>
                                </span>
                                <?merge .monthDays.count().bool() ?>
                                <span class="pull-right monthDays">
                                    <i class="fa fa-calendar-o"/>
                                    <small class="text-primary">
                                        <b><?merge .monthText ?></b>
                                        <?merge .month.count().bool() ?>
                                        <br/>
                                        <span><?merge .monthDaysText ?></span>
                                    </small>
                                </span>
                                <br/>
                                <span class="taskName">
                                    <?merge .taskName ?>
                                </span>
                                <br/>
                                <?merge .parameters.bool() ?>
                                <span class="taskParameters">
                                	<span><span>Parameters</span> : </span>
                                    <span class='parametersList'><?merge .parameters ?></span>
                                </span>
                                <br/>
                                <?merge .frequencyNumber.bool() ?>
                                <small class="repetitionFrequency">
                                    Every 
                                    <span class="row-fluid repetition">
                                        <?merge .frequencyNumber ?>
                                        <?merge .frequencyUnit.ifeq('M') ?><span> minute(s)</span>
                                        <?merge .frequencyUnit.ifeq('H') ?><span> hour(s)</span>
                                    </span>
                                    <?merge .endMinutes.bool() ?>
                                    <span class="repetitionEndTime">
                                        <span>until<span> 
                                        <span class="row-fluid endTime"><?merge .endHours ?><b>:</b><?merge .endMinutes ?></span>
                                    </span>
                                </small>
                                <br/>
                                <small>
                                    <span>Last execution</span> : <span class="lastExecution"><?merge .lastExecution ?></span><br/>
                                    <span>Next execution</span> : <span class="nextExecution"><?merge .nextExecution ?></span>
                                </small>

                            	<span class="showHistory text-muted pull-right" title="History" style="font-size: 18px">&nbsp; <i class="fa fa-history"/></span>
                                <button class="btn btn-xs btn-default executeNow pull-right" title="Execute"><i class="fa fa-chevron-right">&nbsp;</i>Execute</button>
                            </p>
                        </span>
90
                        <span class="col-xs-2 text-right statusSpan">
91
                            <input type="checkbox" class="status" name="status" data-toggle="toggle" checked="[?merge .status.ifne('paused').then('checked') ?]">
Prosper De Laure's avatar
Prosper De Laure committed
92
93
94
95
96
97
98
99
100
101
                        </span>
                        <span class="col-xs-1 text-right">
                            <div class="deleteTask" title="Remove"><i class="fa fa-times"></i></div>
                        </span>
                    </a>
                </div>
            </div>

            <div id="scheduleTemplate" class="hide">
                <a href="#" class="list-group-item clearfix" data-json="">
102
                    <span class="col-xs-9">
Prosper De Laure's avatar
Prosper De Laure committed
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
                        <h4 class="list-group-item-heading schedulingName"></h4>
                        <h4 class="text-danger hide"><code><i class="fa fa-warning">&nbsp;</i>Execution error</code></h4>
                        <p class="list-group-item-text">
                            <span class="row-fluid"><i class="fa fa-clock-o"/> <span class="startTime"></span></span>
                            <span class="pull-right weekDays">
                                <b class="text-muted" data-value="MON" data-translate-context="monday">M</b>
                                <b class="text-muted" data-value="TUE" data-translate-context="tuesday">T</b>
                                <b class="text-muted" data-value="WED" data-translate-context="wednesday">W</b>
                                <b class="text-muted" data-value="THU" data-translate-context="thursday">T</b>
                                <b class="text-muted" data-value="FRI" data-translate-context="friday">F</b>
                                <b class="text-muted" data-value="SAT" data-translate-context="saturday">S</b>
                                <b class="text-muted" data-value="SUN" data-translate-context="sunday">S</b>
                            </span>
                            <span class="pull-right monthDays">
                                <i class="fa fa-calendar-o"/>
                                <small class="text-primary">
                                </small>
                            </span>
                            <br/>
                            <small class="repetitionFrequency">
                                Every 
                                <span class="row-fluid repetition">
                                </span>
                                <span class="repetitionEndTime">
                                    <span>until<span> 
                                    <span class="row-fluid endTime"></span>
                                </span>
                            </small>
                            <span class="taskName">
                            </span>
                            <br/>
                            <span class="taskParameters hide">
                            	<span><span>Parameters</span> : </span>
                                <span class='parametersList'></span>
                            </span>
                            <br/>
                            <br/>
                            <small>
                                <span>Last execution</span> : <span class="lastExecution"></span><br/>
                                <span>Next execution</span> : <span class="nextExecution"></span>
                            </small>
                            <span class="showHistory pull-right" title="History" style="font-size: 18px">&nbsp; <i class="fa fa-history"/></span>
                            <button class="btn btn-xs btn-default executeNow pull-right" title="Execute"><i class="fa fa-chevron-right" /> Execute</button>
                        </p>
                    </span>
148
                    <span class="col-xs-2 text-right statusSpan">
Prosper De Laure's avatar
Prosper De Laure committed
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
                    </span>
                    <span class="col-xs-1 text-right">
                        <div class="deleteTask" title="delete"><i class="fa fa-times"></i></div>
                    </span>
                </a>
            </div>
        </div>
    </div>

    <div class="col-md-6">
        <?hinclude batchProcessing/scheduling/schedulingForm.html ?>
    </div>

    <div class="modal fade" id="deleteConfirmationModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">Delete a scheduled task</h4>
                </div>
                <div class="modal-body">
                    <p>
                        <span>Are you sur to delete this scheduled task ?</span>
                    </p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" title="Close">No</button>
                    <button type="button" class="btn btn-primary" id="confirmDelete" data-dismiss="modal" title="Yes">Yes</button>
                </div>
            </div>
        </div>
    </div>
    
    <div class="modal fade" id="logSchedulingListModal">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">Logs scheduling list</h4>
                </div>
                <div class="modal-body">
Alexis Ragot's avatar
Alexis Ragot committed
190
191
                    <div class="form">
                        <div class="input-group col-md-3">
192
193
194
195
196
                            <div class="input-group-btn">
                                <button type="button" class="btn btn-warning" id="searchDayMinusOne">
                                    <spans class="fa fa-angle-double-left"></spans>
                                </button>
                            </div>
Alexis Ragot's avatar
Alexis Ragot committed
197
198
                            <input type="text" class="datePicker form-control" id="dateLogHistory">
                            <div class="input-group-btn">
199
200
201
202
203
204
                                <button type="button" class="btn btn-warning" id="searchDayPlusOne">
                                    <spans class="fa fa-angle-double-right"></spans>
                                </button>
                            </div>
                            <div class="input-group-btn">
                                <button type="button" class="btn btn-primary" style="margin-left: 5px;" id="searchLogHistory">
Alexis Ragot's avatar
Alexis Ragot committed
205
206
207
208
209
210
211
212
213
                                    <spans class="fa fa-search"></spans>
                                </button>
                            </div>
                        </div>
                    </div>
                    <br/>

                    <div id="modalTableList">
                    </div>
Prosper De Laure's avatar
Prosper De Laure committed
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="logSchedulingModal">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-body">
                </div>
            </div>
        </div>
    </div>
    
    <div class='hide'>
        <span data-translate-context="monday">M</span>
        <span data-translate-context="tuesday">T</span>
        <span data-translate-context="wednesday">W</span>
        <span data-translate-context="tursday">T</span>
        <span data-translate-context="friday">F</span>
        <span data-translate-context="saturday">S</span>
        <span data-translate-context="sunday">S</span>
    </div>

</div>
239
<script type="text/javascript" src="/public/js/bootstrap-toggle/bootstrap-toggle.js"></script>
Prosper De Laure's avatar
Prosper De Laure committed
240
241
242

<script type="text/javascript">

243
244
    var d = new Date();

Prosper De Laure's avatar
Prosper De Laure committed
245
246
247
248
249
250
251
252
253
254
255
256
257
    // Task list delete button
    $('#taskList').on('mouseenter', '.deleteTask', function() {
        $(this).addClass('text-danger');
    })

    $('#taskList').on('mouseleave', '.deleteTask', function() {
        $(this).removeClass('text-danger');
    })

    // Task list history button
    $('#taskList').on('mouseenter', '.showHistory', function() {
        $(this).css('color', 'orange');
    })
Dylan's avatar
6419    
Dylan committed
258
259
260
    $('#taskList').on('mouseenter', function() {
        $(this).css( 'cursor', 'pointer' );
    })
Prosper De Laure's avatar
Prosper De Laure committed
261
262
263
264
265

    $('#taskList').on('mouseleave', '.showHistory', function() {
        $(this).css('color', '');
    })

266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
    $('#searchDayMinusOne').on('click', function() {
        if(!$('#dateLogHistory').data('datepicker').getFormattedDate('yyyy-mm-dd')){
            $('#dateLogHistory').datepicker('setDate', d);
        }
        var date = new Date($('#dateLogHistory').data('datepicker').getFormattedDate('yyyy-mm-dd'));
        date.setDate(date.getDate()-1);
        $('#dateLogHistory').datepicker('setDate', date);
        $('#searchLogHistory').click();
    })

    $('#searchDayPlusOne').on('click', function() {
        if(!$('#dateLogHistory').data('datepicker').getFormattedDate('yyyy-mm-dd')){
            $('#dateLogHistory').datepicker('setDate', d);
            $('#searchLogHistory').click();
            return;
        }
        var date = new Date($('#dateLogHistory').data('datepicker').getFormattedDate('yyyy-mm-dd'));
        date.setDate(date.getDate()+1);
        if(date < d) {
            $('#dateLogHistory').datepicker('setDate', date);
            $('#searchLogHistory').click();
        }else{
            $("#searchDayPlusOne").attr('disabled','disabled')
        }
    })

Alexis Ragot's avatar
Alexis Ragot committed
292
293
    $('#searchLogHistory').on('click', function() {
        if (!$('#dateLogHistory').data('datepicker').getFormattedDate('yyyy-mm-dd')) {
294
            $('#dateLogHistory').datepicker('setDate', d);
Alexis Ragot's avatar
Alexis Ragot committed
295
296
        }

297
298
299
300
301
        if($('#dateLogHistory').val() == ('0' + d.getDate()).slice(-2) + '-' + ('0' + (d.getMonth()+1)).slice(-2) + '-' + d.getFullYear()) {
            $("#searchDayPlusOne").attr('disabled','disabled')
        }else{
            $("#searchDayPlusOne").removeAttr('disabled');
        }
Alexis Ragot's avatar
Alexis Ragot committed
302
303
304
        TaskList.showHistory($('#searchLogHistory').data("schedulingid"));
    })

Prosper De Laure's avatar
Prosper De Laure committed
305
306
    // New schedule
    $('#scheduleNewTask').on('click', function() {
307
        TaskList.unselect();
Prosper De Laure's avatar
Prosper De Laure committed
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
        TaskSchedulingForm.newTask();
    })

    // Modify task
    $('#taskList').on('click', 'a', function() {
        TaskList.select($(this));
    })

    // Delete task
    $('#taskList').on('click', '.deleteTask', function(e) {
        var a = $(this).closest('a');
        e.stopPropagation();

        $('#deleteConfirmationModal').modal();

        $('#confirmDelete').one('click', function(){
            TaskList.remove(a);
        })
    });

    $('#deleteConfirmationModal').on('hide.bs.modal', function() {
        $('#confirmDelete').off();
    });

    // Execute task
    $('#taskList').on('click', '.executeNow', function(e) {
        var a = $(this).closest('a');
    
        TaskList.execute(a);
        e.stopPropagation();
    });

    // play task
341
    $('#taskList').on('click', "[name=status]", function(e) {
342
343
        var task = $(this).closest('a');

344
        if ($(this).prop('checked')) {
345
346
347
348
            TaskList.enable(task);
        } else {
            TaskList.disable(task);
        }
Prosper De Laure's avatar
Prosper De Laure committed
349
350
351
    });

    // pause task
352
353
    /*$('#taskList').on('click', '[name=status]', function(e) {
        TaskList.disable($(this).closest('a'));
Prosper De Laure's avatar
Prosper De Laure committed
354
        e.stopPropagation();
355
    });*/
Prosper De Laure's avatar
Prosper De Laure committed
356
357
358

    // task history
    $('#taskList').on('click', '.showHistory', function(e) {
Alexis Ragot's avatar
Alexis Ragot committed
359
360
361
        $('#searchLogHistory').data("schedulingid", $(this).closest('a').data('json').schedulingId);
        $("#dateLogHistory").data("datepicker").setDate("yyyy-mm-dd");
        TaskList.showHistory($(this).closest('a').data('json').schedulingId);
Prosper De Laure's avatar
Prosper De Laure committed
362
        e.stopPropagation();
363
364
365
        if($('#dateLogHistory').val() == ('0' + d.getDate()).slice(-2) + '-' + ('0' + (d.getMonth()+1)).slice(-2) + '-' + d.getFullYear()) {
            $("#searchDayPlusOne").attr('disabled','disabled');
        }
Prosper De Laure's avatar
Prosper De Laure committed
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
    });

    var TaskList = {
        select: function(a) {
            this.unselect();
            a.addClass("active").find(".text-primary, .text-success").css('color', 'white');
            a.find('.executeNow').addClass('btn-info').removeClass('btn-default');
            TaskSchedulingForm.showTask(a.data('json'));
        },
        unselect: function() {
            var active = $('#taskList').find('.active');
            active.find(".text-primary, .text-success").css('color', '');
            active.find('.executeNow').addClass('btn-default').removeClass('btn-info');
            active.removeClass('active');
        },

        add: function(task) {
            this.mergeValues(task).appendTo($('#taskList'));
        },

        update: function(task) {
            $('#taskList').find('.active').replaceWith(this.mergeValues(task));
        },

        mergeValues: function(task) {
            a = $('#scheduleTemplate')
                    .find('a')
                    .clone()
                    .removeClass('hide')
                    .data('json', task);
396
397
398

            a.find('.statusSpan')
             .append("<input type='checkbox' class='status' name='status' data-toggle='toggle'>");
399
            if (task.status!='paused') {
400
401
402
403
404
                a.find('.statusSpan').find('.status').bootstrapToggle('on');
            } else {
                a.find('.statusSpan').find('.status').bootstrapToggle('off');
            }

Prosper De Laure's avatar
Prosper De Laure committed
405
406
407
408
409
410
411
            a.find('.schedulingName')
             .text(task.name);
            a.find('.taskName')
             .text(task.taskName);
            a.find('.startTime')
             .html('')
             .append(task.startHours)
412
             .append($('<b/>').text(':'))
Prosper De Laure's avatar
Prosper De Laure committed
413
414
             .append(task.startMinutes);
            a.find('.lastExecution')
415
             .text(task.lastExecution);
Prosper De Laure's avatar
Prosper De Laure committed
416
            a.find('.nextExecution')
417
             .text(task.nextExecution);
Prosper De Laure's avatar
Prosper De Laure committed
418
419
420
421
422
423
            a.find('.executeNow').prop('disabled', false);

            // Repetition 
            if (task.frequencyNumber) {
                repetition = a.find('.repetition'); 
                if (task.frequencyUnit == "M") {
424
                    repetition.text(task.frequencyNumber +' '+$('#minutes_text').html());
Prosper De Laure's avatar
Prosper De Laure committed
425
                } else {
426
                    repetition.text(task.frequencyNumber +' '+$('#hours_text').html());
Prosper De Laure's avatar
Prosper De Laure committed
427
428
429
430
431
432
                }

                if(task.endMinutes) {
                    a.find('.endTime')
                     .html('')
                     .append(task.endHours)
433
                     .append($('<b/>').text(':'))
Prosper De Laure's avatar
Prosper De Laure committed
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
                     .append(task.endMinutes);

                } else {
                    a.find('.repetitionEndTime').remove();
                }

            } else {
                a.find('.repetitionFrequency').remove();
            }

            // WeekDays
            if (task.weekDays.length) {
                $.each(task.weekDays, function(key, value){
                    a.find('.weekDays [data-value="'+ value +'"]').addClass('text-primary').removeClass('text-muted');
                    a.find('.weekDays').css('display', '');
                })
            } else {
                a.find('.weekDays').css('display', 'none');
            }

            // Month
            if (task.monthDays.length) {
                var monthDays = a.find('.monthDays small');
                if (task.month.length) {
458
                    b = $('<b/>').text(task.month.join(', '));
Prosper De Laure's avatar
Prosper De Laure committed
459
460
461
                    monthDays.append(b).append($('<br/>'));
                }

462
                span = $('<span/>').text(task.monthDays.join(', '));
Prosper De Laure's avatar
Prosper De Laure committed
463
464
465
466
467
468
469
470
471
472
                monthDays.append(span);
                a.find('.monthDays').css('display', '');

            } else {
                a.find('.monthDays').css('display', 'none');

            }

            if (task.parameters) {
            	a.find('.taskParameters').removeClass('hide');
473
            	a.find('.parametersList').text(task.parameters.join(' '));
Prosper De Laure's avatar
Prosper De Laure committed
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
            }
            return a;
        },
 
        remove: function(task) {
            $.ajax({
                type        : 'DELETE',
                url         : '/batchProcessing/scheduling/'+task.data('json').schedulingId,
                dataType    : 'json',
                contentType : 'application/json',
                success     : function (response) {
                    gritter.show(response.message, response.status, response.errors);
                    if (response.status == true) {
                        task.remove();
                        TaskSchedulingForm.clear();
                    }
                },
                error       : function(response) {
                    gritter.show(response.responseJSON.message, response.responseJSON.status, response.responseJSON.errors);
                }
            });

        },

        execute : function(a) {
            a.find('.running').removeClass('hide');
            $.ajax({
                type        : 'GET',
                url         : '/batchProcessing/'+a.data('json').schedulingId+ '/execute',
                dataType    : 'json',
                contentType : 'application/json',
                success     : function (response) {
                    gritter.show(response.message, response.status, response.errors);
507
                    a.find('.status').bootstrapToggle('on');
508
509
                    a.find('.nextExecution').text(response.object.nextExecution);
                    a.find('.lastExecution').text(response.object.lastExecution);
Prosper De Laure's avatar
Prosper De Laure committed
510
                    if (response.status == true) {
511
512
513
                        a.find("[name=displayError]").hide();
                    } else {
                        a.find("[name=displayError]").show();
Prosper De Laure's avatar
Prosper De Laure committed
514
515
516
517
518
519
520
521
                    }
                },
                error       : function(response) {
                    gritter.show(response.responseJSON.message, response.responseJSON.status, response.responseJSON.errors);
                }
            });
        },

522
        disable : function(a) {
Prosper De Laure's avatar
Prosper De Laure committed
523
524
525
526
527
528
529
530
531
            $.ajax({
                type        : 'PUT',
                url         : '/batchProcessing/changeStatus',
                data        : JSON.stringify({schedulingId : a.data('json').schedulingId, status : 'paused'}),
                dataType    : 'json',
                contentType : 'application/json',
                success     : function (response) {
                    gritter.show(response.message, response.status, response.errors);
                    if (response.status == true) {
532
                          a.find('.nextExecution').text("");
Prosper De Laure's avatar
Prosper De Laure committed
533
534
535
536
537
538
539
540
                    }
                },
                error       : function(response) {
                    gritter.show(response.responseJSON.message, response.responseJSON.status, response.responseJSON.errors);
                }
            });
        },

541
        enable : function(a) {
Prosper De Laure's avatar
Prosper De Laure committed
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
            $.ajax({
                type        : 'PUT',
                url         : '/batchProcessing/changeStatus',
                data        : JSON.stringify({schedulingId : a.data('json').schedulingId, status : 'scheduled'}),
                dataType    : 'json',
                contentType : 'application/json',
                success     : function (response) {
                    gritter.show(response.message, response.status, response.errors);
                },
                error       : function(response) {
                    gritter.show(response.responseJSON.message, response.responseJSON.status, response.responseJSON.errors);
                }
            });
        },

Alexis Ragot's avatar
Alexis Ragot committed
557
        showHistory : function(schedulingId) {
Prosper De Laure's avatar
Prosper De Laure committed
558
559
            $.ajax({
                type        : 'GET',
Alexis Ragot's avatar
Alexis Ragot committed
560
                url         : '/batchProcessing/logSchedulings/'+ schedulingId + "/" +  $('#dateLogHistory').data('datepicker').getFormattedDate('yyyy-mm-dd'),
Prosper De Laure's avatar
Prosper De Laure committed
561
562
                contentType : 'application/json',
                success     : function (response) {
Alexis Ragot's avatar
Alexis Ragot committed
563
                    $('#logSchedulingListModal').modal().find('#modalTableList').html(response);
Prosper De Laure's avatar
Prosper De Laure committed
564
565
566
567
568
569
                }
            });
        }
    };

</script>