~jlungo/zhris/trunk

« back to all changes in this revision

Viewing changes to interface/html5/views/attendance/timesheet/UserDateTotalViewController.js

  • Committer: Juma Lungo
  • Date: 2017-11-16 08:54:53 UTC
  • Revision ID: juma.lungo@zalongwa.com-20171116085453-q3jxht0gcab8jbya
codebase commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
UserDateTotalViewController = BaseViewController.extend( {
 
2
 
 
3
        el: '#user_date_total_view_container', //Must set el here and can only set string, so events can work
 
4
 
 
5
        initialize: function( options ) {
 
6
                this._super( 'initialize', options );
 
7
                this.edit_view_tpl = 'UserDateTotalEditView.html';
 
8
                this.permission_id = 'user_date_total';
 
9
                this.script_name = 'UserDateTotalView';
 
10
                this.viewId = 'UserDateTotal';
 
11
                this.table_name_key = 'user_date_total';
 
12
                this.context_menu_name = $.i18n._( 'Accumulated Time' );
 
13
                this.navigation_label = $.i18n._( 'Accumulated Time' ) + ':';
 
14
                this.api = new (APIFactory.getAPIClass( 'APIUserDateTotal' ))();
 
15
                this.currency_api = new (APIFactory.getAPIClass( 'APICurrency' ))();
 
16
 
 
17
                if ( PermissionManager.validate( this.permission_id, 'add' ) || PermissionManager.validate( this.permission_id, 'edit' ) ) {
 
18
                        $(this.el).find('.warning-message').text($.i18n._('WARNING: Manually modifying Accumulated Time records may prevent policies from being calculated properly and should only be done as a last resort when instructed to do so by a support representative.'));
 
19
                } else {
 
20
                        $(this.el).find('.warning-message').hide();
 
21
                }
 
22
 
 
23
                this.initPermission();
 
24
                this.render();
 
25
 
 
26
                if ( this.sub_view_mode ) {
 
27
                        this.buildContextMenu( true );
 
28
                } else {
 
29
                        this.buildContextMenu();
 
30
                }
 
31
 
 
32
                //call init data in parent view
 
33
                if ( !this.sub_view_mode ) {
 
34
                        this.initData();
 
35
                }
 
36
 
 
37
                this.setSelectRibbonMenuIfNecessary();
 
38
 
 
39
        },
 
40
 
 
41
        setGridSize: function() {
 
42
                if ( (!this.grid || !this.grid.is( ':visible' )) ) {
 
43
                        return;
 
44
                }
 
45
                this.grid.setGridWidth( $( this.el ).parent().width() - 2 );
 
46
                this.grid.setGridHeight( $( this.el ).parent().parent().parent().height() - 100 );
 
47
        },
 
48
 
 
49
        setGridCellBackGround: function() {
 
50
 
 
51
                var data = this.grid.getGridParam( 'data' );
 
52
 
 
53
                //Error: TypeError: data is undefined in /interface/html5/framework/jquery.min.js?v=7.4.6-20141027-074127 line 2 > eval line 70
 
54
                if ( !data ) {
 
55
                        return;
 
56
                }
 
57
 
 
58
                var len = data.length;
 
59
 
 
60
                for ( var i = 0; i < len; i++ ) {
 
61
                        var item = data[i];
 
62
 
 
63
                        if ( item.is_override === true ) {
 
64
                                $( "tr[id='" + item.id + "']" ).addClass( 'user-data-total-override' );
 
65
                        }
 
66
                }
 
67
        },
 
68
 
 
69
        initOptions: function() {
 
70
                var $this = this;
 
71
 
 
72
                this.initDropDownOption( 'object_type' );
 
73
 
 
74
        },
 
75
 
 
76
        buildContextMenuModels: function() {
 
77
                //Context Menu
 
78
                var menu = new RibbonMenu( {
 
79
                        label: this.context_menu_name,
 
80
                        id: this.viewId + 'ContextMenu',
 
81
                        sub_menu_groups: []
 
82
                } );
 
83
 
 
84
                //menu group
 
85
                var editor_group = new RibbonSubMenuGroup( {
 
86
                        label: $.i18n._( 'Editor' ),
 
87
                        id: this.viewId + 'Editor',
 
88
                        ribbon_menu: menu,
 
89
                        sub_menus: []
 
90
                } );
 
91
 
 
92
                var other_group = new RibbonSubMenuGroup( {
 
93
                        label: $.i18n._( 'Other' ),
 
94
                        id: this.viewId + 'other',
 
95
                        ribbon_menu: menu,
 
96
                        sub_menus: []
 
97
                } );
 
98
 
 
99
                var view = new RibbonSubMenu( {
 
100
                        label: $.i18n._( 'New' ),
 
101
                        id: ContextMenuIconName.add,
 
102
                        group: editor_group,
 
103
                        icon: Icons.new_add,
 
104
                        permission_result: true,
 
105
                        permission: null
 
106
                } );
 
107
 
 
108
                var view = new RibbonSubMenu( {
 
109
                        label: $.i18n._( 'View' ),
 
110
                        id: ContextMenuIconName.view,
 
111
                        group: editor_group,
 
112
                        icon: Icons.view,
 
113
                        permission_result: true,
 
114
                        permission: null
 
115
                } );
 
116
 
 
117
                var edit = new RibbonSubMenu( {
 
118
                        label: $.i18n._( 'Edit' ),
 
119
                        id: ContextMenuIconName.edit,
 
120
                        group: editor_group,
 
121
                        icon: Icons.edit,
 
122
                        permission_result: true,
 
123
                        permission: null
 
124
                } );
 
125
 
 
126
                var mass_edit = new RibbonSubMenu( {
 
127
                        label: $.i18n._( 'Mass<br>Edit' ),
 
128
                        id: ContextMenuIconName.mass_edit,
 
129
                        group: editor_group,
 
130
                        icon: Icons.mass_edit,
 
131
                        permission_result: true,
 
132
                        permission: null
 
133
                } );
 
134
 
 
135
                var del = new RibbonSubMenu( {
 
136
                        label: $.i18n._( 'Delete' ),
 
137
                        id: ContextMenuIconName.delete_icon,
 
138
                        group: editor_group,
 
139
                        icon: Icons.delete_icon,
 
140
                        permission_result: true,
 
141
                        permission: null
 
142
                } );
 
143
 
 
144
                var delAndNext = new RibbonSubMenu( {
 
145
                        label: $.i18n._( 'Delete<br>& Next' ),
 
146
                        id: ContextMenuIconName.delete_and_next,
 
147
                        group: editor_group,
 
148
                        icon: Icons.delete_and_next,
 
149
                        permission_result: true,
 
150
                        permission: null
 
151
                } );
 
152
 
 
153
                var copy_as_new = new RibbonSubMenu( {
 
154
                        label: $.i18n._( 'Copy<br>as New' ),
 
155
                        id: ContextMenuIconName.copy_as_new,
 
156
                        group: editor_group,
 
157
                        icon: Icons.copy,
 
158
                        permission_result: true,
 
159
                        permission: null
 
160
                } );
 
161
 
 
162
                var save = new RibbonSubMenu( {
 
163
                        label: $.i18n._( 'Save' ),
 
164
                        id: ContextMenuIconName.save,
 
165
                        group: editor_group,
 
166
                        icon: Icons.save,
 
167
                        permission_result: true,
 
168
                        permission: null
 
169
                } );
 
170
 
 
171
                var save_and_continue = new RibbonSubMenu( {
 
172
                        label: $.i18n._( 'Save<br>& Continue' ),
 
173
                        id: ContextMenuIconName.save_and_continue,
 
174
                        group: editor_group,
 
175
                        icon: Icons.save_and_continue,
 
176
                        permission_result: true,
 
177
                        permission: null
 
178
                } );
 
179
 
 
180
                var save_and_next = new RibbonSubMenu( {
 
181
                        label: $.i18n._( 'Save<br>& Next' ),
 
182
                        id: ContextMenuIconName.save_and_next,
 
183
                        group: editor_group,
 
184
                        icon: Icons.save_and_next,
 
185
                        permission_result: true,
 
186
                        permission: null
 
187
                } );
 
188
 
 
189
                var save_and_copy = new RibbonSubMenu( {
 
190
                        label: $.i18n._( 'Save<br>& Copy' ),
 
191
                        id: ContextMenuIconName.save_and_copy,
 
192
                        group: editor_group,
 
193
                        icon: Icons.save_and_copy,
 
194
                        permission_result: true,
 
195
                        permission: null
 
196
                } );
 
197
 
 
198
                var save_and_new = new RibbonSubMenu( {
 
199
                        label: $.i18n._( 'Save<br>& New' ),
 
200
                        id: ContextMenuIconName.save_and_new,
 
201
                        group: editor_group,
 
202
                        icon: Icons.save_and_new,
 
203
                        permission_result: true,
 
204
                        permission: null
 
205
                } );
 
206
 
 
207
                var cancel = new RibbonSubMenu( {
 
208
                        label: $.i18n._( 'Cancel' ),
 
209
                        id: ContextMenuIconName.cancel,
 
210
                        group: editor_group,
 
211
                        icon: Icons.cancel,
 
212
                        permission_result: true,
 
213
                        permission: null
 
214
                } );
 
215
 
 
216
                var import_csv = new RibbonSubMenu( {
 
217
                        label: $.i18n._( 'Import' ),
 
218
                        id: ContextMenuIconName.import_icon,
 
219
                        group: other_group,
 
220
                        icon: Icons.import_icon,
 
221
                        permission_result: PermissionManager.checkTopLevelPermission( 'ImportCSVUserDateTotal' ),
 
222
                        permission: null,
 
223
                        sort_order: 8000
 
224
                } );
 
225
 
 
226
                return [menu];
 
227
 
 
228
        },
 
229
 
 
230
        onFormItemChange: function( target, doNotValidate ) {
 
231
 
 
232
                this.setIsChanged( target );
 
233
                this.setMassEditingFieldsWhenFormChange( target );
 
234
                var key = target.getField();
 
235
                var c_value = target.getValue();
 
236
                this.current_edit_record[key] = c_value;
 
237
 
 
238
                switch ( key ) {
 
239
                        case 'object_type_id':
 
240
                                this.onTypeChange( true );
 
241
                                break;
 
242
                        case 'regular_policy_id':
 
243
                        case 'absence_policy_id':
 
244
                        case 'overtime_policy_id':
 
245
                        case 'premium_policy_id':
 
246
                        case 'break_policy_id':
 
247
                        case 'meal_policy_id':
 
248
                                this.current_edit_record.src_object_id = c_value;
 
249
                                delete this.current_edit_record[key];
 
250
                                this.onSrcObjectChange( key );
 
251
                                break;
 
252
                        case 'total_time':
 
253
                        case 'hourly_rate':
 
254
                                this.calculateAmount();
 
255
                                break;
 
256
                }
 
257
 
 
258
                if ( key !== 'override' ) {
 
259
                        this.edit_view_ui_dic.override.setValue( true );
 
260
                        this.current_edit_record.override = true;
 
261
                }
 
262
 
 
263
                if ( !doNotValidate ) {
 
264
                        this.validate();
 
265
                }
 
266
 
 
267
        },
 
268
 
 
269
        calculateAmount: function() {
 
270
                this.current_edit_record.total_time_amount = (this.current_edit_record.total_time / 3600) * parseFloat( this.current_edit_record.hourly_rate );
 
271
                this.edit_view_ui_dic.total_time_amount.setValue( this.current_edit_record.total_time_amount.toFixed( 4 ) );
 
272
        },
 
273
 
 
274
        onAddClick: function() {
 
275
                var $this = this;
 
276
                this.is_viewing = false;
 
277
                this.is_edit = false;
 
278
                this.is_add = true;
 
279
                LocalCacheData.current_doing_context_action = 'new';
 
280
                $this.openEditView();
 
281
 
 
282
                //Error: Uncaught TypeError: undefined is not a function in /interface/html5/views/BaseViewController.js?v=8.0.0-20141117-111140 line 897
 
283
                if ( $this.api ) {
 
284
                        $this.api['get' + $this.api.key_name + 'DefaultData'](
 
285
                                this.parent_edit_record.user_id,
 
286
                                this.parent_edit_record.date_stamp, {
 
287
                                        onResult: function( result ) {
 
288
                                                $this.onAddResult( result );
 
289
                                        }
 
290
                                } );
 
291
                }
 
292
 
 
293
        },
 
294
 
 
295
        onAddResult: function( result ) {
 
296
                var $this = this;
 
297
                var result_data = result.getResult();
 
298
 
 
299
                if ( !result_data ) {
 
300
                        result_data = [];
 
301
                }
 
302
 
 
303
                result_data.company = LocalCacheData.current_company.name;
 
304
 
 
305
                if ( $this.sub_view_mode && $this.parent_key ) {
 
306
                        result_data[$this.parent_key] = $this.parent_value;
 
307
                }
 
308
 
 
309
                if ( !result_data.date_stamp ) {
 
310
                        result_data.date_stamp = this.parent_edit_record.date_stamp;
 
311
                }
 
312
 
 
313
                $this.current_edit_record = result_data;
 
314
                $this.initEditView();
 
315
        },
 
316
 
 
317
        /* jshint ignore:start */
 
318
        setDefaultMenu: function( doNotSetFocus ) {
 
319
 
 
320
 
 
321
                //Error: Uncaught TypeError: Cannot read property 'length' of undefined in /interface/html5/#!m=Employee&a=edit&id=42411&tab=UserDateTotal line 282
 
322
                if ( !this.context_menu_array ) {
 
323
                        return;
 
324
                }
 
325
 
 
326
                if ( !Global.isSet( doNotSetFocus ) || !doNotSetFocus ) {
 
327
                        this.selectContextMenu();
 
328
                }
 
329
 
 
330
                this.setTotalDisplaySpan();
 
331
 
 
332
                var len = this.context_menu_array.length;
 
333
 
 
334
                var grid_selected_id_array = this.getGridSelectIdArray();
 
335
 
 
336
                var grid_selected_length = grid_selected_id_array.length;
 
337
 
 
338
                for ( var i = 0; i < len; i++ ) {
 
339
                        var context_btn = this.context_menu_array[i];
 
340
                        var id = $( context_btn.find( '.ribbon-sub-menu-icon' ) ).attr( 'id' );
 
341
                        context_btn.removeClass( 'invisible-image' );
 
342
                        context_btn.removeClass( 'disable-image' );
 
343
 
 
344
                        switch ( id ) {
 
345
                                case ContextMenuIconName.add:
 
346
                                        this.setDefaultMenuAddIcon( context_btn, grid_selected_length );
 
347
                                        break;
 
348
                                case ContextMenuIconName.edit:
 
349
                                        this.setDefaultMenuEditIcon( context_btn, grid_selected_length );
 
350
                                        break;
 
351
                                case ContextMenuIconName.view:
 
352
                                        this.setDefaultMenuViewIcon( context_btn, grid_selected_length );
 
353
                                        break;
 
354
                                case ContextMenuIconName.mass_edit:
 
355
                                        this.setDefaultMenuMassEditIcon( context_btn, grid_selected_length );
 
356
                                        break;
 
357
                                case ContextMenuIconName.copy:
 
358
                                        this.setDefaultMenuCopyIcon( context_btn, grid_selected_length );
 
359
                                        break;
 
360
                                case ContextMenuIconName.delete_icon:
 
361
                                        this.setDefaultMenuDeleteIcon( context_btn, grid_selected_length );
 
362
                                        break;
 
363
                                case ContextMenuIconName.delete_and_next:
 
364
                                        this.setDefaultMenuDeleteAndNextIcon( context_btn, grid_selected_length );
 
365
                                        break;
 
366
                                case ContextMenuIconName.save:
 
367
                                        this.setDefaultMenuSaveIcon( context_btn, grid_selected_length );
 
368
                                        break;
 
369
                                case ContextMenuIconName.save_and_next:
 
370
                                        this.setDefaultMenuSaveAndNextIcon( context_btn, grid_selected_length );
 
371
                                        break;
 
372
                                case ContextMenuIconName.save_and_continue:
 
373
                                        this.setDefaultMenuSaveAndContinueIcon( context_btn, grid_selected_length );
 
374
                                        break;
 
375
                                case ContextMenuIconName.save_and_new:
 
376
                                        this.setDefaultMenuSaveAndAddIcon( context_btn, grid_selected_length );
 
377
                                        break;
 
378
                                case ContextMenuIconName.save_and_copy:
 
379
                                        this.setDefaultMenuSaveAndCopyIcon( context_btn, grid_selected_length );
 
380
                                        break;
 
381
                                case ContextMenuIconName.copy_as_new:
 
382
                                        this.setDefaultMenuCopyAsNewIcon( context_btn, grid_selected_length );
 
383
                                        break;
 
384
                                case ContextMenuIconName.cancel:
 
385
                                        this.setDefaultMenuCancelIcon( context_btn, grid_selected_length );
 
386
                                        break;
 
387
                        }
 
388
 
 
389
                }
 
390
 
 
391
                this.setContextMenuGroupVisibility();
 
392
 
 
393
        },
 
394
 
 
395
        /* jshint ignore:end */
 
396
 
 
397
        initPermission: function() {
 
398
                this._super( 'initPermission' );
 
399
 
 
400
                if ( this.jobUIValidate() ) {
 
401
                        this.show_job_ui = true;
 
402
                } else {
 
403
                        this.show_job_ui = false;
 
404
                }
 
405
 
 
406
                if ( this.jobItemUIValidate() ) {
 
407
                        this.show_job_item_ui = true;
 
408
                } else {
 
409
                        this.show_job_item_ui = false;
 
410
                }
 
411
 
 
412
                if ( this.branchUIValidate() ) {
 
413
                        this.show_branch_ui = true;
 
414
                } else {
 
415
                        this.show_branch_ui = false;
 
416
                }
 
417
 
 
418
                if ( this.departmentUIValidate() ) {
 
419
                        this.show_department_ui = true;
 
420
                } else {
 
421
                        this.show_department_ui = false;
 
422
                }
 
423
 
 
424
                if ( this.goodQuantityUIValidate() ) {
 
425
                        this.show_good_quantity_ui = true;
 
426
                } else {
 
427
                        this.show_good_quantity_ui = false;
 
428
                }
 
429
 
 
430
                if ( this.badQuantityUIValidate() ) {
 
431
                        this.show_bad_quantity_ui = true;
 
432
                } else {
 
433
                        this.show_bad_quantity_ui = false;
 
434
                }
 
435
 
 
436
                if ( this.noteUIValidate() ) {
 
437
                        this.show_note_ui = true;
 
438
                } else {
 
439
                        this.show_note_ui = false;
 
440
                }
 
441
 
 
442
        },
 
443
 
 
444
        noteUIValidate: function( p_id ) {
 
445
 
 
446
                if ( !p_id ) {
 
447
                        p_id = 'punch';
 
448
                }
 
449
 
 
450
                if ( PermissionManager.validate( p_id, 'edit_note' ) ) {
 
451
                        return true;
 
452
                }
 
453
                return false;
 
454
        },
 
455
 
 
456
        branchUIValidate: function( p_id ) {
 
457
 
 
458
                if ( !p_id ) {
 
459
                        p_id = 'punch';
 
460
                }
 
461
 
 
462
                if ( PermissionManager.validate( p_id, 'edit_branch' ) ) {
 
463
                        return true;
 
464
                }
 
465
                return false;
 
466
        },
 
467
 
 
468
        departmentUIValidate: function( p_id ) {
 
469
 
 
470
                if ( !p_id ) {
 
471
                        p_id = 'punch';
 
472
                }
 
473
 
 
474
                if ( PermissionManager.validate( p_id, 'edit_department' ) ) {
 
475
                        return true;
 
476
                }
 
477
                return false;
 
478
        },
 
479
 
 
480
        jobUIValidate: function( p_id ) {
 
481
 
 
482
                if ( !p_id ) {
 
483
                        p_id = 'punch';
 
484
                }
 
485
 
 
486
                if ( PermissionManager.validate( "job", 'enabled' ) &&
 
487
                        PermissionManager.validate( p_id, 'edit_job' ) ) {
 
488
                        return true;
 
489
                }
 
490
                return false;
 
491
        },
 
492
 
 
493
        jobItemUIValidate: function( p_id ) {
 
494
 
 
495
                if ( !p_id ) {
 
496
                        p_id = 'punch';
 
497
                }
 
498
 
 
499
                if ( PermissionManager.validate( p_id, 'edit_job_item' ) ) {
 
500
                        return true;
 
501
                }
 
502
                return false;
 
503
        },
 
504
 
 
505
        goodQuantityUIValidate: function( p_id ) {
 
506
 
 
507
                if ( !p_id ) {
 
508
                        p_id = 'punch';
 
509
                }
 
510
 
 
511
                if ( PermissionManager.validate( p_id, 'edit_quantity' ) ) {
 
512
                        return true;
 
513
                }
 
514
                return false;
 
515
        },
 
516
 
 
517
        badQuantityUIValidate: function( p_id ) {
 
518
 
 
519
                if ( !p_id ) {
 
520
                        p_id = 'punch';
 
521
                }
 
522
 
 
523
                if ( PermissionManager.validate( p_id, 'edit_quantity' ) &&
 
524
                        PermissionManager.validate( p_id, 'edit_bad_quantity' ) ) {
 
525
                        return true;
 
526
                }
 
527
                return false;
 
528
        },
 
529
 
 
530
        setCurrency: function() {
 
531
                var $this = this;
 
532
                if ( Global.isSet( this.current_edit_record.user_id ) ) {
 
533
                        var filter = {};
 
534
                        filter.filter_data = {user_id: this.current_edit_record.user_id};
 
535
                        this.currency_api.getCurrency( filter, false, false, {
 
536
                                onResult: function( res ) {
 
537
                                        res = res.getResult();
 
538
                                        if ( Global.isArray( res ) ) {
 
539
                                                $( '.userDateTotal-currency' ).text( res[0].symbol );
 
540
                                                $( '.userDateTotal-code' ).text( res[0].iso_code );
 
541
                                        } else {
 
542
                                                $( '.userDateTotal-currency' ).text( '' );
 
543
                                                $( '.userDateTotal-code' ).text( '' );
 
544
                                        }
 
545
                                }
 
546
                        } );
 
547
                }
 
548
        },
 
549
 
 
550
        setCurrentEditRecordData: function() {
 
551
                this.setCurrency();
 
552
                //Set current edit record data to all widgets
 
553
                for ( var key in this.current_edit_record ) {
 
554
 
 
555
                        if ( !this.current_edit_record.hasOwnProperty( key ) ) {
 
556
                                continue;
 
557
                        }
 
558
                        var widget = this.edit_view_ui_dic[key];
 
559
                        switch ( key ) {
 
560
                                case 'user_id':
 
561
                                        var current_widget = this.edit_view_ui_dic['first_last_name'];
 
562
                                        new (APIFactory.getAPIClass( 'APIUser' ))().getUser( {filter_data: {id: this.current_edit_record[key]}}, {
 
563
                                                onResult: function( result ) {
 
564
 
 
565
                                                        if ( result.isValid() ) {
 
566
                                                                var user_data = result.getResult()[0];
 
567
                                                        }
 
568
 
 
569
                                                        //Error: Unable to get property 'first_name' of undefined or null reference in /interface/html5/ line 511
 
570
                                                        if ( user_data && user_data.first_name ) {
 
571
                                                                current_widget.setValue( user_data.first_name + ' ' + user_data.last_name );
 
572
                                                        } else {
 
573
                                                                current_widget.setValue( '' );
 
574
                                                        }
 
575
 
 
576
                                                }
 
577
                                        } );
 
578
                                        break;
 
579
                                case 'date_stamp':
 
580
                                        widget.setEnabled( false );
 
581
                                        widget.setValue( this.current_edit_record[key] );
 
582
                                        break;
 
583
                                case 'override':
 
584
                                        //Always default to true
 
585
                                        this.current_edit_record.override = true;
 
586
                                        widget.setValue( true );
 
587
                                        break;
 
588
                                default:
 
589
                                        if ( widget ) {
 
590
                                                widget.setValue( this.current_edit_record[key] );
 
591
                                        }
 
592
                                        break;
 
593
                        }
 
594
                }
 
595
 
 
596
                this.collectUIDataToCurrentEditRecord();
 
597
                this.setEditViewDataDone();
 
598
 
 
599
        },
 
600
 
 
601
        setEditViewDataDone: function() {
 
602
                var $this = this;
 
603
                this._super( 'setEditViewDataDone' );
 
604
                this.onTypeChange();
 
605
        },
 
606
 
 
607
        onTypeChange: function( reset ) {
 
608
                this.detachElement( 'regular_policy_id' );
 
609
                this.detachElement( 'absence_policy_id' );
 
610
                this.detachElement( 'overtime_policy_id' );
 
611
                this.detachElement( 'premium_policy_id' );
 
612
                this.detachElement( 'meal_policy_id' );
 
613
                this.detachElement( 'break_policy_id' );
 
614
                var key = '';
 
615
                if ( this.current_edit_record['object_type_id'] === 20 ) {
 
616
                        key = 'regular_policy_id';
 
617
                } else if ( this.current_edit_record['object_type_id'] === 25 || this.current_edit_record['object_type_id'] === 50 ) {
 
618
                        key = 'absence_policy_id';
 
619
                } else if ( this.current_edit_record['object_type_id'] === 30 ) {
 
620
                        key = 'overtime_policy_id';
 
621
                } else if ( this.current_edit_record['object_type_id'] === 40 ) {
 
622
                        key = 'premium_policy_id';
 
623
                } else if ( this.current_edit_record['object_type_id'] === 100 || this.current_edit_record['object_type_id'] === 101 ) {
 
624
                        key = 'meal_policy_id';
 
625
                } else if ( this.current_edit_record['object_type_id'] === 110 || this.current_edit_record['object_type_id'] === 111 ) {
 
626
                        key = 'break_policy_id';
 
627
                }
 
628
                if ( key ) {
 
629
                        this.attachElement( key );
 
630
                        if ( reset ) {
 
631
                                this.edit_view_ui_dic[key].setValue( '' );
 
632
                                this.edit_view_ui_dic['pay_code_id'].setValue( '' );
 
633
                                this.current_edit_record.src_object_id = false;
 
634
                                this.current_edit_record.pay_code_id = false;
 
635
                                this.edit_view_ui_dic['pay_code_id'].setEnabled( true );
 
636
                        } else if ( this.current_edit_record.src_object_id ) {
 
637
                                this.edit_view_ui_dic[key].setValue( this.current_edit_record.src_object_id );
 
638
                                this.edit_view_ui_dic['pay_code_id'].setEnabled( false );
 
639
                        }
 
640
                } else {
 
641
                        this.edit_view_ui_dic['pay_code_id'].setEnabled( true );
 
642
                        this.current_edit_record.src_object_id = false;
 
643
                }
 
644
                this.editFieldResize();
 
645
        },
 
646
 
 
647
        onSrcObjectChange: function( key ) {
 
648
                var full_value = this.edit_view_ui_dic[key].getValue( true );
 
649
                if ( full_value && full_value.pay_code_id ) {
 
650
                        this.edit_view_ui_dic['pay_code_id'].setEnabled( false );
 
651
                        this.edit_view_ui_dic['pay_code_id'].setValue( full_value.pay_code_id );
 
652
                        this.current_edit_record.pay_code_id = full_value.pay_code_id;
 
653
                } else {
 
654
                        this.edit_view_ui_dic['pay_code_id'].setEnabled( true );
 
655
                        this.edit_view_ui_dic['pay_code_id'].setValue( '' );
 
656
                        this.current_edit_record.pay_code_id = false;
 
657
                }
 
658
 
 
659
        },
 
660
 
 
661
        search: function( set_default_menu, page_action, page_number, callBack ) {
 
662
                this.refresh_id = 0;
 
663
                this._super( 'search', set_default_menu, page_action, page_number, callBack )
 
664
        },
 
665
 
 
666
        getProperObjectType: function() {
 
667
                var array = [];
 
668
 
 
669
                for ( var i = 0; i < this.object_type_array.length; i++ ) {
 
670
                        var item = this.object_type_array[i];
 
671
 
 
672
                        if ( item.value === 20 ||
 
673
                                item.value === 25 ||
 
674
                                item.value === 30 ||
 
675
                                item.value === 40 ||
 
676
                                item.value === 100 ||
 
677
                                item.value === 110 ) {
 
678
                                array.push( item );
 
679
                        }
 
680
 
 
681
                }
 
682
 
 
683
                return array;
 
684
        },
 
685
 
 
686
        buildEditViewUI: function() {
 
687
 
 
688
                this._super( 'buildEditViewUI' );
 
689
 
 
690
                var $this = this;
 
691
 
 
692
                this.setTabLabels( {
 
693
                        'tab_user_date_total': $.i18n._( 'Accumulated Time' ),
 
694
                        'tab_audit': $.i18n._( 'Audit' )
 
695
                } );
 
696
 
 
697
                this.navigation.AComboBox( {
 
698
                        api_class: (APIFactory.getAPIClass( 'APIUserDateTotal' )),
 
699
                        id: this.script_name + '_navigation',
 
700
                        allow_multiple_selection: false,
 
701
                        layout_name: ALayoutIDs.WAGE,
 
702
                        show_search_inputs: true,
 
703
                        navigation_mode: true
 
704
                } );
 
705
 
 
706
                this.setNavigation();
 
707
 
 
708
                //Tab 0 start
 
709
 
 
710
                var tab_user_date_total = this.edit_view_tab.find( '#tab_user_date_total' );
 
711
 
 
712
                var tab_user_date_total_column1 = tab_user_date_total.find( '.first-column' );
 
713
                var tab_user_date_total_column2 = tab_user_date_total.find( '.second-column' );
 
714
 
 
715
                //Employee
 
716
 
 
717
                var form_item_input = Global.loadWidgetByName( FormItemType.TEXT );
 
718
                form_item_input.TText( {field: 'first_last_name'} );
 
719
                this.addEditFieldToColumn( $.i18n._( 'Employee' ), form_item_input, tab_user_date_total_column1, '' );
 
720
 
 
721
                //Date
 
722
                form_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );
 
723
                form_item_input.TDatePicker( {field: 'date_stamp'} );
 
724
 
 
725
                this.addEditFieldToColumn( $.i18n._( 'Date' ), form_item_input, tab_user_date_total_column1 );
 
726
 
 
727
                //Time
 
728
                form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
 
729
                form_item_input.TTextInput( {field: 'total_time', mode: 'time_unit', need_parser_sec: true} );
 
730
 
 
731
                this.addEditFieldToColumn( $.i18n._( 'Time' ), form_item_input, tab_user_date_total_column1, '', null, true );
 
732
 
 
733
                //Type
 
734
                form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
 
735
 
 
736
                form_item_input.TComboBox( {field: 'object_type_id'} );
 
737
                form_item_input.setSourceData( Global.addFirstItemToArray( this.getProperObjectType() ) );
 
738
                this.addEditFieldToColumn( $.i18n._( 'Type' ), form_item_input, tab_user_date_total_column1 );
 
739
 
 
740
                //Regular Policy
 
741
                form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
 
742
                form_item_input.AComboBox( {
 
743
                        api_class: (APIFactory.getAPIClass( 'APIRegularTimePolicy' )),
 
744
                        allow_multiple_selection: false,
 
745
                        layout_name: ALayoutIDs.REGULAR_TIME_POLICY,
 
746
                        show_search_inputs: true,
 
747
                        set_empty: true,
 
748
                        field: 'regular_policy_id'
 
749
                } );
 
750
                this.addEditFieldToColumn( $.i18n._( 'Policy' ), form_item_input, tab_user_date_total_column1, null, null, true );
 
751
                this.detachElement( 'regular_policy_id' );
 
752
 
 
753
                //Absence Policy
 
754
                form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
 
755
                form_item_input.AComboBox( {
 
756
                        api_class: (APIFactory.getAPIClass( 'APIAbsencePolicy' )),
 
757
                        allow_multiple_selection: false,
 
758
                        layout_name: ALayoutIDs.ABSENCES_POLICY,
 
759
                        show_search_inputs: true,
 
760
                        set_empty: true,
 
761
                        field: 'absence_policy_id'
 
762
                } );
 
763
                this.addEditFieldToColumn( $.i18n._( 'Policy' ), form_item_input, tab_user_date_total_column1, null, null, true );
 
764
                this.detachElement( 'absence_policy_id' );
 
765
 
 
766
                //Overtime Policy
 
767
                form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
 
768
                form_item_input.AComboBox( {
 
769
                        api_class: (APIFactory.getAPIClass( 'APIOvertimePolicy' )),
 
770
                        allow_multiple_selection: false,
 
771
                        layout_name: ALayoutIDs.OVER_TIME_POLICY,
 
772
                        show_search_inputs: true,
 
773
                        set_empty: true,
 
774
                        field: 'overtime_policy_id'
 
775
                } );
 
776
                this.addEditFieldToColumn( $.i18n._( 'Policy' ), form_item_input, tab_user_date_total_column1, null, null, true );
 
777
                this.detachElement( 'overtime_policy_id' );
 
778
 
 
779
                //Premium Policy
 
780
                form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
 
781
                form_item_input.AComboBox( {
 
782
                        api_class: (APIFactory.getAPIClass( 'APIPremiumPolicy' )),
 
783
                        allow_multiple_selection: false,
 
784
                        layout_name: ALayoutIDs.PREMIUM_POLICY,
 
785
                        show_search_inputs: true,
 
786
                        set_empty: true,
 
787
                        field: 'premium_policy_id'
 
788
                } );
 
789
                this.addEditFieldToColumn( $.i18n._( 'Policy' ), form_item_input, tab_user_date_total_column1, null, null, true );
 
790
                this.detachElement( 'premium_policy_id' );
 
791
 
 
792
                //Meal Policy
 
793
                form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
 
794
                form_item_input.AComboBox( {
 
795
                        api_class: (APIFactory.getAPIClass( 'APIMealPolicy' )),
 
796
                        allow_multiple_selection: false,
 
797
                        layout_name: ALayoutIDs.MEAL_POLICY,
 
798
                        show_search_inputs: true,
 
799
                        set_empty: true,
 
800
                        field: 'meal_policy_id'
 
801
                } );
 
802
                this.addEditFieldToColumn( $.i18n._( 'Policy' ), form_item_input, tab_user_date_total_column1, null, null, true );
 
803
                this.detachElement( 'meal_policy_id' );
 
804
 
 
805
                //Break Policy
 
806
                form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
 
807
                form_item_input.AComboBox( {
 
808
                        api_class: (APIFactory.getAPIClass( 'APIBreakPolicy' )),
 
809
                        allow_multiple_selection: false,
 
810
                        layout_name: ALayoutIDs.BREAK_POLICY,
 
811
                        show_search_inputs: true,
 
812
                        set_empty: true,
 
813
                        field: 'break_policy_id'
 
814
                } );
 
815
                this.addEditFieldToColumn( $.i18n._( 'Policy' ), form_item_input, tab_user_date_total_column1, null, null, true );
 
816
                this.detachElement( 'break_policy_id' );
 
817
 
 
818
                //Pay Code
 
819
                form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
 
820
                form_item_input.AComboBox( {
 
821
                        api_class: (APIFactory.getAPIClass( 'APIPayCode' )),
 
822
                        allow_multiple_selection: false,
 
823
                        layout_name: ALayoutIDs.PAY_CODE,
 
824
                        show_search_inputs: true,
 
825
                        set_empty: true,
 
826
                        field: 'pay_code_id'
 
827
                } );
 
828
                this.addEditFieldToColumn( $.i18n._( 'Pay Code' ), form_item_input, tab_user_date_total_column1 );
 
829
 
 
830
                //Default Branch
 
831
                form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
 
832
 
 
833
                form_item_input.AComboBox( {
 
834
                        api_class: (APIFactory.getAPIClass( 'APIBranch' )),
 
835
                        allow_multiple_selection: false,
 
836
                        layout_name: ALayoutIDs.BRANCH,
 
837
                        show_search_inputs: true,
 
838
                        set_empty: true,
 
839
                        field: 'branch_id'
 
840
                } );
 
841
                this.addEditFieldToColumn( $.i18n._( 'Branch' ), form_item_input, tab_user_date_total_column1, '', null, true );
 
842
 
 
843
                if ( !this.show_branch_ui ) {
 
844
                        this.detachElement( 'branch_id' );
 
845
                }
 
846
 
 
847
                //Department
 
848
                form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
 
849
 
 
850
                form_item_input.AComboBox( {
 
851
                        api_class: (APIFactory.getAPIClass( 'APIDepartment' )),
 
852
                        allow_multiple_selection: false,
 
853
                        layout_name: ALayoutIDs.DEPARTMENT,
 
854
                        show_search_inputs: true,
 
855
                        set_empty: true,
 
856
                        field: 'department_id'
 
857
                } );
 
858
                this.addEditFieldToColumn( $.i18n._( 'Department' ), form_item_input, tab_user_date_total_column1, '', null, true );
 
859
 
 
860
                if ( !this.show_department_ui ) {
 
861
                        this.detachElement( 'department_id' );
 
862
                }
 
863
 
 
864
                if ( ( LocalCacheData.getCurrentCompany().product_edition_id >= 20 ) ) {
 
865
 
 
866
                        //Job
 
867
                        form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
 
868
 
 
869
                        form_item_input.AComboBox( {
 
870
                                api_class: (APIFactory.getAPIClass( 'APIJob' )),
 
871
                                allow_multiple_selection: false,
 
872
                                layout_name: ALayoutIDs.JOB,
 
873
                                show_search_inputs: true,
 
874
                                set_empty: true,
 
875
                                setRealValueCallBack: (function( val ) {
 
876
 
 
877
                                        if ( val ) job_coder.setValue( val.manual_id );
 
878
                                }),
 
879
                                field: 'job_id'
 
880
                        } );
 
881
 
 
882
                        widgetContainer = $( "<div class='widget-h-box'></div>" );
 
883
 
 
884
                        var job_coder = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
 
885
                        job_coder.TTextInput( {field: 'job_quick_search', disable_keyup_event: true} );
 
886
                        job_coder.addClass( 'job-coder' );
 
887
 
 
888
                        widgetContainer.append( job_coder );
 
889
                        widgetContainer.append( form_item_input );
 
890
                        this.addEditFieldToColumn( $.i18n._( 'Job' ), [form_item_input, job_coder], tab_user_date_total_column1, '', widgetContainer, true );
 
891
 
 
892
                        if ( !this.show_job_ui ) {
 
893
                                this.detachElement( 'job_id' );
 
894
                        }
 
895
 
 
896
                        //Job Item
 
897
                        form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
 
898
 
 
899
                        form_item_input.AComboBox( {
 
900
                                api_class: (APIFactory.getAPIClass( 'APIJobItem' )),
 
901
                                allow_multiple_selection: false,
 
902
                                layout_name: ALayoutIDs.JOB_ITEM,
 
903
                                show_search_inputs: true,
 
904
                                set_empty: true,
 
905
                                setRealValueCallBack: (function( val ) {
 
906
 
 
907
                                        if ( val ) job_item_coder.setValue( val.manual_id );
 
908
                                }),
 
909
                                field: 'job_item_id'
 
910
                        } );
 
911
 
 
912
                        widgetContainer = $( "<div class='widget-h-box'></div>" );
 
913
 
 
914
                        var job_item_coder = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
 
915
                        job_item_coder.TTextInput( {field: 'job_item_quick_search', disable_keyup_event: true} );
 
916
                        job_item_coder.addClass( 'job-coder' );
 
917
 
 
918
                        widgetContainer.append( job_item_coder );
 
919
                        widgetContainer.append( form_item_input );
 
920
                        this.addEditFieldToColumn( $.i18n._( 'Task' ), [form_item_input, job_item_coder], tab_user_date_total_column1, '', widgetContainer, true );
 
921
 
 
922
                        if ( !this.show_job_item_ui ) {
 
923
                                this.detachElement( 'job_item_id' );
 
924
                        }
 
925
 
 
926
                }
 
927
 
 
928
                //Start Date Time
 
929
                form_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );
 
930
                form_item_input.TDatePicker( {field: 'start_time_stamp', mode: 'date_time'} );
 
931
                this.addEditFieldToColumn( $.i18n._( 'Start Date/Time' ), form_item_input, tab_user_date_total_column2, '', null, true, true );
 
932
 
 
933
                //End Date Time
 
934
                form_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );
 
935
                form_item_input.TDatePicker( {field: 'end_time_stamp', mode: 'date_time'} );
 
936
                this.addEditFieldToColumn( $.i18n._( 'End Date/Time' ), form_item_input, tab_user_date_total_column2, '', null, true, true );
 
937
 
 
938
                //Currency
 
939
                form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
 
940
                form_item_input.AComboBox( {
 
941
                        api_class: (APIFactory.getAPIClass( 'APICurrency' )),
 
942
                        allow_multiple_selection: false,
 
943
                        layout_name: ALayoutIDs.CURRENCY,
 
944
                        show_search_inputs: true,
 
945
                        field: 'currency_id',
 
946
                        set_empty: true
 
947
                } );
 
948
                this.addEditFieldToColumn( $.i18n._( 'Currency' ), form_item_input, tab_user_date_total_column2 );
 
949
 
 
950
                //Base Hourly Rate
 
951
                form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
 
952
                form_item_input.TTextInput( {field: 'base_hourly_rate', width: 90} );
 
953
 
 
954
                widgetContainer = $( "<div class='widget-h-box'></div>" );
 
955
                var currency = $( "<span class='userDateTotal-currency widget-left-label'></span>" );
 
956
                var code = $( "<span class='userDateTotal-code widget-right-label'></span>" );
 
957
                widgetContainer.append( currency );
 
958
                widgetContainer.append( form_item_input );
 
959
                widgetContainer.append( code );
 
960
 
 
961
                this.addEditFieldToColumn( $.i18n._( 'Base Hourly Rate' ), form_item_input, tab_user_date_total_column2, '', widgetContainer, true );
 
962
 
 
963
                //Hourly Rate
 
964
                form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
 
965
                form_item_input.TTextInput( {field: 'hourly_rate', width: 90} );
 
966
 
 
967
                widgetContainer = $( "<div class='widget-h-box'></div>" );
 
968
                currency = $( "<span class='userDateTotal-currency widget-left-label'></span>" );
 
969
                code = $( "<span class='userDateTotal-code widget-right-label'></span>" );
 
970
                widgetContainer.append( currency );
 
971
                widgetContainer.append( form_item_input );
 
972
                widgetContainer.append( code );
 
973
 
 
974
                this.addEditFieldToColumn( $.i18n._( 'Hourly Rate' ), form_item_input, tab_user_date_total_column2, '', widgetContainer, true );
 
975
 
 
976
                //Total Amount
 
977
                form_item_input = Global.loadWidgetByName( FormItemType.TEXT );
 
978
                form_item_input.TText( {field: 'total_time_amount'} );
 
979
                widgetContainer = $( "<div class='widget-h-box'></div>" );
 
980
                currency = $( "<span class='userDateTotal-currency widget-left-label'></span>" );
 
981
                code = $( "<span class='userDateTotal-code widget-right-label'></span>" );
 
982
                widgetContainer.append( currency );
 
983
                widgetContainer.append( form_item_input );
 
984
                widgetContainer.append( code );
 
985
                this.addEditFieldToColumn( $.i18n._( 'Total Amount' ), form_item_input, tab_user_date_total_column2, '', widgetContainer, true );
 
986
 
 
987
                if ( ( LocalCacheData.getCurrentCompany().product_edition_id >= 20 ) ) {
 
988
 
 
989
                        //Quanitity
 
990
                        var good = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
 
991
                        good.TTextInput( {field: 'quantity', width: 50} );
 
992
                        good.addClass( 'quantity-input' );
 
993
 
 
994
                        var good_label = $( "<span class='widget-right-label'>" + $.i18n._( 'Good' ) + ": </span>" );
 
995
 
 
996
                        var bad = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
 
997
                        bad.TTextInput( {field: 'bad_quantity', width: 50} );
 
998
                        bad.addClass( 'quantity-input' );
 
999
 
 
1000
                        var bad_label = $( "<span class='widget-right-label'>/ " + $.i18n._( 'Bad' ) + ": </span>" );
 
1001
 
 
1002
                        var widgetContainer = $( "<div class='widget-h-box'></div>" );
 
1003
 
 
1004
                        widgetContainer.append( good_label );
 
1005
                        widgetContainer.append( good );
 
1006
                        widgetContainer.append( bad_label );
 
1007
                        widgetContainer.append( bad );
 
1008
 
 
1009
                        this.addEditFieldToColumn( $.i18n._( 'Quantity' ), [good, bad], tab_user_date_total_column2, '', widgetContainer, true );
 
1010
 
 
1011
                        if ( !this.show_bad_quantity_ui && !this.show_good_quantity_ui ) {
 
1012
                                this.detachElement( 'quantity' );
 
1013
                        } else {
 
1014
                                if ( !this.show_bad_quantity_ui ) {
 
1015
                                        bad_label.hide();
 
1016
                                        bad.hide();
 
1017
                                }
 
1018
 
 
1019
                                if ( !this.show_good_quantity_ui ) {
 
1020
                                        good_label.hide();
 
1021
                                        good.hide();
 
1022
                                }
 
1023
                        }
 
1024
                }
 
1025
                //Note
 
1026
                form_item_input = Global.loadWidgetByName( FormItemType.TEXT_AREA );
 
1027
                form_item_input.TTextArea( {field: 'note', width: '100%'} );
 
1028
                this.addEditFieldToColumn( $.i18n._( 'Note' ), form_item_input, tab_user_date_total_column2, '', null, true, true );
 
1029
                form_item_input.parent().width( '45%' );
 
1030
 
 
1031
                if ( !this.show_note_ui ) {
 
1032
                        this.detachElement( 'note' );
 
1033
                }
 
1034
 
 
1035
                //Override
 
1036
                form_item_input = Global.loadWidgetByName( FormItemType.CHECKBOX );
 
1037
                form_item_input.TCheckbox( {field: 'override'} );
 
1038
                this.addEditFieldToColumn( $.i18n._( 'Override' ), form_item_input, tab_user_date_total_column2, '', null, true, true );
 
1039
 
 
1040
        },
 
1041
 
 
1042
        cleanWhenUnloadView: function( callBack ) {
 
1043
 
 
1044
                $( '#user_date_total_view_container' ).remove();
 
1045
                this._super( 'cleanWhenUnloadView', callBack );
 
1046
 
 
1047
        }
 
1048
 
 
1049
} );
 
1050
 
 
1051
UserDateTotalViewController.loadView = function( container ) {
 
1052
 
 
1053
        Global.loadViewSource( 'UserDateTotal', 'UserDateTotalView.html', function( result ) {
 
1054
 
 
1055
                var args = {};
 
1056
                var template = _.template( result );
 
1057
 
 
1058
                if ( Global.isSet( container ) ) {
 
1059
                        container.html( template( args ) );
 
1060
                } else {
 
1061
                        Global.contentContainer().html( template( args ) );
 
1062
                }
 
1063
 
 
1064
        } );
 
1065
 
 
1066
};
 
1067
 
 
1068
UserDateTotalViewController.loadSubView = function( container, beforeViewLoadedFun, afterViewLoadedFun ) {
 
1069
 
 
1070
        Global.loadViewSource( 'UserDateTotal', 'SubUserDateTotalView.html', function( result ) {
 
1071
 
 
1072
                var args = {};
 
1073
                var template = _.template( result );
 
1074
 
 
1075
                if ( Global.isSet( beforeViewLoadedFun ) ) {
 
1076
                        beforeViewLoadedFun();
 
1077
                }
 
1078
 
 
1079
                if ( Global.isSet( container ) ) {
 
1080
                        container.html( template( args ) );
 
1081
 
 
1082
                        if ( Global.isSet( afterViewLoadedFun ) ) {
 
1083
                                afterViewLoadedFun( sub_user_date_total_view_controller );
 
1084
                        }
 
1085
 
 
1086
                }
 
1087
 
 
1088
        } );
 
1089
 
 
1090
};