src/ApplicationBundle/Resources/views/footer/footer_js_codecovers.html.twig line 1

Open in your IDE?
  1. {# <script src="{{ asset('condensed_assets/javascript.js',) }}"></script> #}
  2. {# {{  dump( constant('ApplicationBundle\\Constants\\GeneralConstant::NOTIFICATION_SERVER')) }}; #}
  3. <script>
  4.     var socketKeepAliveCall = {};
  5.     var lastActivityTs = 0;
  6.     var socket = '';
  7.     var socket_user_name = '{{ (session[UserConstants.USER_NAME] is defined)?session[UserConstants.USER_NAME]:'' }}';
  8.     var socket_user_id = '{{ (session[UserConstants.USER_APP_ID] is defined)?session[UserConstants.USER_APP_ID]:'' }}_{{ (session[UserConstants.USER_NAME] is defined)?session[UserConstants.USER_ID]:'' }}';
  9.     var socket_company_id = '{{ (session[UserConstants.USER_COMPANY_ID] is defined)?session[UserConstants.USER_COMPANY_ID]:'' }}';
  10.     var socket_app_id = '{{ (session[UserConstants.USER_APP_ID] is defined)?session[UserConstants.USER_APP_ID]:'' }}';
  11.     var socket_user_positions ={{ (session[UserConstants.USER_POSITION_LIST] is defined)?session[UserConstants.USER_POSITION_LIST]|json_encode()|raw:"\"[]\"" }};
  12.     var current_user_user_id = {{ session[UserConstants.USER_ID] is defined? session[UserConstants.USER_ID]:0 }};
  13.     var socket_user_session_token = '{{ session['token'] is defined? session['token']:'_GEN_' }}';
  14.     function addCommas(nStr) {
  15.         nStr += '';
  16.         x = nStr.split('.');
  17.         x1 = x[0];
  18.         x2 = x.length > 1 ? '.' + x[1] : '';
  19.         var rgx = /(\d+)(\d{3})/;
  20.         while (rgx.test(x1)) {
  21.             x1 = x1.replace(rgx, '$1' + ',' + '$2');
  22.         }
  23.         return x1 + x2;
  24.     }
  25.     {% if session[UserConstants.USER_ID] is defined %}
  26.     var currentTaskId ={{ session[UserConstants.USER_CURRENT_TASK_ID] is defined? (session[UserConstants.USER_CURRENT_TASK_ID] is null?'0':session[UserConstants.USER_CURRENT_TASK_ID]): '0' }};
  27.     var currentPlanningItemId ={{ session[UserConstants.USER_CURRENT_PLANNING_ITEM_ID] is defined?
  28.     (session[UserConstants.USER_CURRENT_PLANNING_ITEM_ID] is null?'0':session[UserConstants.USER_CURRENT_PLANNING_ITEM_ID]): '0' }};
  29.     var currentLastStartTs=0;
  30.     // alert(currentPlanningItemId)
  31.     function refreshPendingTaskDiv() {
  32.         var pika_ind_id = '_NOPE_'
  33.         $.ajax({
  34.             url: BaseURL + "get_pending_approval_list_for_user",
  35.             type: 'POST',
  36.             dataType: 'json',
  37.             data: {},
  38.             error: function () {
  39.                 // callback();
  40.             },
  41.             success: function (res) {
  42.                 $('.pending_task_div .body').html('');
  43.                 // callback(res.data);
  44.                 if (res.pending_approval_list.length == 0 && res.override_approval_list.length == 0) {
  45.                     $('.pending_task_div .body').html(
  46.                         '<blockquote class="m-b-25"><p>Great! No Pending Tasks</p><footer><cite title="Source Title">The News Bee</cite></footer></blockquote>'
  47.                     )
  48.                 } else {
  49.                     $('.pending_task_div .body').html(
  50.                         '<div class="table-responsive"><table class="table table-hover table-condensed dashboard-task-infos">' +
  51.                         '<thead><tr><th>#</th><th>Document</th><th>Created By</th><th>Status</th><th>Type</th><th style="text-align: right;">amount</th><th style="text-align: right;">Action</th></tr></thead><tbody></tbody></table> </div>'
  52.                     )
  53.                     var ind = 0;
  54.                     var pending_approval_list = res.pending_approval_list;
  55.                     var override_approval_list = res.override_approval_list;
  56.                     $('.pending_task_trigger .body .alert-callout').html('');
  57.                     $('.pending_task_trigger .body .alert-callout').html(
  58.                         '         <strong class="pull-right text-warning text-lg">' +
  59.                         '' + (pending_approval_list.length + override_approval_list.length) + '' +
  60.                         ' <i class="material-icons">playlist_add_check</i></strong> ' +
  61.                         '<strong class="text-xl number count-to-amount-specific" data-from="0" ' +
  62.                         'data-to="' + (pending_approval_list.length + override_approval_list.length) + '" ' +
  63.                         'data-speed="1000" data-fresh-interval="20">' + (pending_approval_list.length + override_approval_list.length) + ' </strong> <br> ' +
  64.                         '<span class="opacity-50">PENDING TASKS</span>'
  65.                     )
  66.                     for (var lipi = 0; lipi < pending_approval_list.length; lipi++) {
  67.                         var item = pending_approval_list[lipi];
  68.                         ind = ind + 1;
  69.                         $('.pending_task_div .body .dashboard-task-infos tbody').append(
  70.                             '<tr class="pending_row_' + item.entity + '_' + item.entityId + '">' +
  71.                             '<td>' + ind + '</td>' +
  72.                             '<td>' + item.documentHash + '</td>' +
  73.                             '<td>' + item.createdBy + '</td>' +
  74.                             '<td><span class="label bg-orange" style="background: orange;">Pending Approval</span></td>' +
  75.                             '<td>' + item.entityAlias + '</td>' +
  76.                             '<td style="text-align: right;">' + (item.amount == '' ? '' : addCommas((1 * item.amount).toFixed(2))) + '</td>' +
  77.                             '<td style="text-align: right;">' +
  78.                             '<div class="btn-group ">' +
  79.                             '<button type="button"' +
  80.                             'class="btn ink-reaction btn-sm btn-primary dropdown-toggle  waves-effect"' +
  81.                             'data-toggle="dropdown">' +
  82.                             'Action <i class="fa fa-caret-down"></i>' +
  83.                             '</button>' +
  84.                             '<ul class="dropdown-menu animation-expand"' +
  85.                             'style=""' +
  86.                             'role="menu">' +
  87.                             '<li><a href="' + item.viewPathAbs + '/' + item.entityId + '"> View</a></li> ' +
  88.                             '<li><a href="#" class="trigger_approval_btn"' +
  89.                             'data-toggle="modal"' +
  90.                             'data-entity="' + item.entity + '"' +
  91.                             'data-entity-id="' + item.entityId + '"' +
  92.                             'data-approval-id="' + item.approvalId + '"' +
  93.                             'data-target="#approveDocument">Approve</a></li>' +
  94.                             '</ul>' +
  95.                             '</div>' +
  96.                             '</td>' +
  97.                             '</tr>');
  98.                     }
  99.                     for (var lipi = 0; lipi < override_approval_list.length; lipi++) {
  100.                         var item = override_approval_list[lipi];
  101.                         ind = ind + 1;
  102.                         $('.pending_task_div .body .dashboard-task-infos tbody').append(
  103.                             '<tr class="pending_row_' + item.entity + '_' + item.entityId + '">' +
  104.                             '<td>' + ind + '</td>' +
  105.                             '<td>' + item.documentHash + '</td>' +
  106.                             '<td>' + item.createdBy + '</td>' +
  107.                             '<td><span class="label bg-orange" style="background: orange;">Override</span></td>' +
  108.                             '<td>' + item.entityAlias + '</td>' +
  109.                             '<td style="text-align: right;"> ' + (item.amount == '' ? '' : addCommas((1 * item.amount).toFixed(2))) + '</td>' +
  110.                             '<td style="text-align: right;">' +
  111.                             '<div class="btn-group ">' +
  112.                             '<button type="button" ' +
  113.                             'class="btn ink-reaction btn-sm btn-primary dropdown-toggle  waves-effect" ' +
  114.                             'data-toggle="dropdown"> ' +
  115.                             'Action <i class="fa fa-caret-down"></i> ' +
  116.                             '</button>' +
  117.                             '<ul class="dropdown-menu animation-expand"' +
  118.                             'style="" ' +
  119.                             'role="menu"> ' +
  120.                             '<li><a href="' + item.viewPathAbs + '/' + item.entityId + '"> View</a></li> ' +
  121.                             '<li><a href="#" class="trigger_approval_btn" ' +
  122.                             'data-toggle="modal" ' +
  123.                             'data-entity="' + item.entity + '" ' +
  124.                             'data-entity-id="' + item.entityId + '" ' +
  125.                             'data-approval-id="' + item.approvalId + '" ' +
  126.                             'data-target="#approveDocument">Approve</a></li> ' +
  127.                             '</ul> ' +
  128.                             '</div> ' +
  129.                             '</td> ' +
  130.                             '</tr> ');
  131.                     }
  132.                     $('.count-to-amount-specific').countTo(
  133.                         {
  134.                             formatter: function (value, options) {
  135. //                        value=value.split('৳')[1];
  136. //                        return '৳' + value.toFixed(2).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, ',');
  137. //                        //    console.log(value)
  138. //                        //    console.log('৳' + value.toFixed(2).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,'))
  139. //                        return '৳' + value.toFixed(0).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
  140. //                        return '৳ ' + abbreviateNumber(value.toFixed(0));
  141.                                 return abbreviateNumber(value.toFixed(0));
  142.                             }
  143.                         }
  144.                     );
  145.                 }
  146. //                        alert('pika master')
  147.             }
  148.         });
  149.     }
  150.     function RefreshAppListOnMenu() {
  151.         $.post('{{ url('get_app_list_from_central_server') }}', {
  152.             appIds: {{ session[UserConstants.USER_APP_ID_LIST] is defined?(session[UserConstants.USER_APP_ID_LIST]|json_encode|raw ): '[]' }},
  153.         })
  154.             .done(function (data) {
  155.                 var dataArray = $.map(data, function (value, index) {
  156.                     return [value];
  157.                 });
  158.                 //    console.log(dataArray);
  159.                 $('.this_is_company').remove()
  160.                 for (var koka = dataArray.length - 1; koka >= 0; koka--) {
  161.                     var currAppData = dataArray[koka]
  162.                     {# $('.company_list_here').after( #}
  163.                     {# '<li class="this_is_company"> ' + #}
  164.                     {#    '<a href="{{ url('change_company_dashboard') }}/'+currAppData['appId']+'"> <i class="fa fa-building"></i> '+ #}
  165.                     {#    (currAppData['name'].length>15?(currAppData['name'].slice(0, 15)+'...'):currAppData['name'])+'</a>' + #}
  166.                     {#    ' </li>'); #}
  167.                     // TEMP FOR NOW
  168.                     $('.company_list_here').after(
  169.                         '<li class="this_is_company"> ' +
  170.                         '<a href="{{ url('change_company_dashboard') }}/1"> <i class="fa fa-building"></i> ' +
  171.                         (currAppData['name'].length > 15 ? (currAppData['name'].slice(0, 15) + '...') : currAppData['name']) + '</a>' +
  172.                         ' </li>')
  173.                 }
  174.             })
  175.             .fail(function () {
  176.             });
  177.     }
  178.     function ListAvailableTaskOnMenu() {
  179.         //                        if (!query.length) return // callback();
  180.         var query = '_EMPTY_';
  181.         var pika_ind_id = '_NOPE_'
  182.         $.ajax({
  183.             url: BaseURL + "select_data_ajax",
  184.             type: 'POST',
  185.             dataType: 'json',
  186.             data: {
  187.                 //returnJson: 1,
  188.                 //sessionData: sessionData
  189.                 query: query,
  190.                 tableName: "planning_item",
  191.                 valueField: "id",
  192.                 textField: "item_alias",
  193.                 entity_group: 0,
  194.                 selectorId: pika_ind_id,
  195.                 isMultiple: 0,
  196.                 dataId: pika_ind_id,
  197. //                        isMultiple: 0,
  198.                 //textField: "rendered_text",
  199. //
  200. //                 renderTextFormat: "# __value__ __name__",
  201.                 andConditions: [],
  202.                 andOrConditions: [
  203.                     {type: "like", field: "name", value: query},
  204.                 ],
  205.                 mustConditions: [
  206.                     {
  207.                         type: "=",
  208.                         field: "assigned_to",
  209.                         value: {{ session[UserConstants.USER_EMPLOYEE_ID] is defined?session[UserConstants.USER_EMPLOYEE_ID]: '-1' }}},
  210.                     {type: "!=", field: "has_child", value: 1},
  211.                     // {type: "in", field: "user_type", value: [1,2,5]},
  212.                 ],
  213.                 joinTableData: [
  214.                     {
  215.                         tableName: "project",
  216.                         joinFieldPrimary: "project_id",
  217.                         joinOn: 'project_id',
  218.                         tableJoinType: 'left join',
  219.                         // fieldJoinType: '=',
  220.                         // selectPrefix: '',
  221.                         selectFieldList: [
  222.                             'project_name'
  223.                         ]
  224.                     },
  225.                     {
  226.                         tableName: "project",
  227.                         joinFieldPrimary: "project_id",
  228.                         joinOn: 'project_id',
  229.                         tableJoinType: 'left join',
  230.                         // fieldJoinType: '=',
  231.                         // selectPrefix: '',
  232.                         selectFieldList: [
  233.                             'project_name'
  234.                         ]
  235.                     },
  236.                      {
  237.                          tableName: "task_log",
  238.                          joinFieldPrimary: "id",
  239.                          joinOn: 'planning_item_id',
  240.                          tableJoinType: 'left join',
  241.                           fieldJoinType: '=',
  242.                           selectPrefix: 'task_',
  243.                          joinAndConditions:[
  244.                              {type: "=", field: "working_status", value: 1},
  245.                          ],
  246.                          selectFieldList: [
  247.                              'id','actual_start_ts','working_status'
  248.                          ]
  249.                      },
  250.                     // {
  251.                     //     tableName: "acc_clients",
  252.                     //     joinFieldPrimary: "client_id",
  253.                     //     joinOn: 'client_id',
  254.                     //     tableJoinType: 'join',
  255.                     //     // fieldJoinType: '=',
  256.                     //     // selectPrefix: 'client_',
  257.                     //     selectFieldList: [
  258.                     //         'client_name'
  259.                     //
  260.                     //     ]
  261.                     // },
  262.                 ],
  263.                 convertToObject: [
  264. //                            'accessories', 'issues'
  265.                 ],
  266.                 skipDefaultCompanyId: 1
  267.                 // setDataForSingle: 1,
  268.             },
  269.             error: function () {
  270.                 // callback();
  271.             },
  272.             success: function (res) {
  273.                 // callback(res.data);
  274.                 console.log(res.data)
  275. //                alert(currentPlanningItemId)
  276. //                alert(currentTaskId)
  277.                 $('.assigned_task_list_here').empty()
  278.                 var project_ids = [0]
  279.                 var div_by_project = {
  280.                     0: {
  281.                         project_name: 'General',
  282.                         divList: []
  283.                     }
  284.                 };
  285.                 for (var koka = 0; koka < res.data.length; koka++) {
  286.                     var currTaskData = res.data[koka]
  287.                     if(currTaskData['task_working_status']==1 && currTaskData['task_id']==currentTaskId)
  288.                     {
  289.                         currentLastStartTs=currTaskData['task_actual_start_ts']
  290.                     }
  291.                     if (currTaskData['project_id'] == null || currTaskData['project_id'] == '')
  292.                         currTaskData['project_id'] = 0;
  293.                     if (typeof div_by_project[currTaskData['project_id']] !== 'undefined') {
  294.                     } else {
  295.                         project_ids.push(currTaskData['project_id'])
  296.                         div_by_project[currTaskData['project_id']] = {
  297.                             project_name: currTaskData['project_name'],
  298.                             divList: []
  299.                         }
  300.                     }
  301.                     {# $('.company_list_here').after( #}
  302.                     {# '<li class="this_is_company"> ' + #}
  303.                     {#    '<a href="{{ url('change_company_dashboard') }}/'+currAppData['appId']+'"> <i class="fa fa-building"></i> '+ #}
  304.                     {#    (currAppData['name'].length>15?(currAppData['name'].slice(0, 15)+'...'):currAppData['name'])+'</a>' + #}
  305.                     {#    ' </li>'); #}
  306.                     // TEMP FOR NOW
  307.                     div_by_project[currTaskData['project_id']]['divList'].push('<li class="this_is_task task_planning_item_id_' + currTaskData['id'] + '"> ' +
  308.                         '<a href="#" data-pid="' + currTaskData['id'] + '"> <i class="fa fa-building"></i> ' +
  309.                         (currTaskData['item_alias'].length > 150 ? (currTaskData['item_alias'].slice(0, 150) + '...') : currTaskData['item_alias']) + '' +
  310.                         // '<small>'+currTaskData['project_name']+'</small>'+
  311.                         '</a>' +
  312.                         ' </li>')
  313.                     {# $('.assigned_task_list_here').after( #}
  314.                     {#    '<li class="this_is_task"> ' + #}
  315.                     {#    '<a href="{{ url('change_company_dashboard') }}/1"> <i class="fa fa-building"></i> '+ #}
  316.                     {#    (currTaskData['item_alias'].length>15?(currTaskData['item_alias'].slice(0, 15)+'...'):currTaskData['item_alias'])+'' + #}
  317.                     {#    '<small>'+currTaskData['project_name']+'</small>'+ #}
  318.                     {#    '</a>' + #}
  319.                     {#    ' </li>') #}
  320.                 }
  321.                 for (var koka = 0; koka < project_ids.length; koka++) {
  322.                     var prj_id = project_ids[koka];
  323.                     $('.assigned_task_list_here').append(
  324.                         '<li class="dropdown-header ">' + div_by_project[prj_id]['project_name'] + '</li>'
  325.                     );
  326.                     for (var loka = 0; loka < div_by_project[prj_id]['divList'].length; loka++) {
  327.                         $('.assigned_task_list_here').append(
  328.                             div_by_project[prj_id]['divList'][loka]
  329.                         );
  330.                     }
  331.                 }
  332.                 SetActiveTaskOnMenu(currentTaskId, currentPlanningItemId,currentLastStartTs);
  333. //                        alert('pika master')
  334.             }
  335.         });
  336.     }
  337.     function ChangeActiveTaskOnMenu(taskId, planningItemId) {
  338.         // EndCurrentTaskOnMenu();
  339.         StartNewTaskOnMenu(taskId, planningItemId);
  340.     }
  341.     function SetActiveTaskOnMenu(taskId, planningItemId,actualStartTs) {
  342.         // taskId = taskId || currentTaskId;
  343.         // planningItemId = planningItemId || currentPlanningItemId;
  344. // alert(planningItemId)
  345.         actualStartTs=actualStartTs||0;
  346.         $('.this_is_task').removeClass('active');
  347.         if (planningItemId != 0 && planningItemId != '') {
  348.             $('.task_planning_item_id_' + planningItemId).addClass('active');
  349.             $('.assigned_task_list_cont .profile-info').html($('.task_planning_item_id_' + planningItemId + ' a').text()+'' + '<small>' +
  350.                     '<b class="clock_update" data-start-ts="'+actualStartTs+'">00:00</b></small>')
  351.         } else {
  352.             $('.assigned_task_list_cont .profile-info').html('Select Task <small>Unselected</small>')
  353.         }
  354.         // $('.assigned_task_list_cont .profile-info').html('General Task<small>Current</small>')
  355.     }
  356.     function EndCurrentTaskOnMenu() {
  357.         var curr_ts = moment().unix();
  358.         var this_user_id = {{ session[UserConstants.USER_ID] }};
  359.         var this_employee_id = {{ session[UserConstants.USER_EMPLOYEE_ID] }};
  360.         $.ajax({
  361.             url: BaseURL + "insert_data_ajax_with_session",
  362.             type: 'POST',
  363.             dataType: 'json',
  364.             data: {
  365.                 entity_group: 0,
  366.                 dataToAdd: [
  367.                     {
  368.                         entityName: 'TaskLog',
  369.                         idField: 'id',
  370.                         // findByField: 'planningItemId',
  371.                         returnRefIndex: 'id',
  372.                         findId: 0,
  373.                         noCreation: 1,
  374.                         // findByValue: planningItemId,
  375.                         preAdditionalSql: 'UPDATE task_log set working_status=2, actual_end_ts=' + curr_ts + ' where working_status=1 and user_id= '+this_user_id+';',
  376.                         dataFields: [
  377.                             // {field: 'planningItemId', value: planningItemId, type: '_VALUE_'},
  378.                             // {field: 'userId', value: this_user_id, type: '_VALUE_'},
  379.                             // {field: 'workingStatus', value: 1, type: '_VALUE_'},
  380.                             // {field: 'actualStartTs', value: curr_ts, type: '_VALUE_'},
  381. //                                {field: 'completionPercentage', value: 0, type: '_VALUE_'},
  382.                         ],
  383.                         additionalSql: '',
  384.                     }
  385.                 ]
  386.             },
  387.             error: function () {
  388.                 // callback();
  389.             },
  390.             success: function (res) {
  391.                 currentTaskId = 0;
  392.                 currentPlanningItemId = 0;
  393.                 SetActiveTaskOnMenu(currentTaskId, currentPlanningItemId);
  394.             }
  395.         });
  396.     }
  397.     function StartNewTaskOnMenu(taskId, planningItemId) {
  398.         var curr_ts = moment().unix();
  399.         var this_user_id = {{ session[UserConstants.USER_ID] }};
  400.         $.ajax({
  401.             url: BaseURL + "insert_data_ajax_with_session",
  402.             type: 'POST',
  403.             dataType: 'json',
  404.             data: {
  405.                 entity_group: 0,
  406.                 dataToAdd: [
  407.                     {
  408.                         entityName: 'TaskLog',
  409.                         idField: 'id',
  410.                         // findByField: 'planningItemId',
  411.                         returnRefIndex: 'id',
  412.                         findId: 0,
  413.                         // findByValue: planningItemId,
  414.                         preAdditionalSql: 'UPDATE task_log set working_status=2, actual_end_ts=' + curr_ts + ' where working_status=1  and user_id= '+this_user_id+';;',
  415.                         dataFields: [
  416.                             {field: 'planningItemId', value: planningItemId, type: '_VALUE_'},
  417.                             {field: 'userId', value: this_user_id, type: '_VALUE_'},
  418.                             {field: 'workingStatus', value: 1, type: '_VALUE_'},
  419.                             {field: 'actualStartTs', value: curr_ts, type: '_VALUE_'},
  420. //                                {field: 'completionPercentage', value: 0, type: '_VALUE_'},
  421.                         ],
  422.                         additionalSql: '',
  423.                     }
  424.                 ]
  425.             },
  426.             error: function () {
  427.                 // callback();
  428.             },
  429.             success: function (res) {
  430.                 if (typeof res.updatedDataList[0] !== 'undefined') {
  431.                     var relatedDataCamelcase = res.updatedDataList[0];
  432.                     currentTaskId = relatedDataCamelcase['id'];
  433.                     currentPlanningItemId = relatedDataCamelcase['planningItemId'];
  434.                     SetActiveTaskOnMenu(currentTaskId, currentPlanningItemId,relatedDataCamelcase['actualStartTs']);
  435.                 }
  436.             }
  437.         });
  438.     }
  439.     {% endif %}
  440. </script>
  441. {% if not include_html is defined %}
  442.     {% set include_html=1 %}
  443.     {% if  app.request.request.get('skipHTML') !='' %}
  444.         {% set include_html= 0 %}
  445.     {% endif %}
  446. {% endif %}
  447. {% if include_html!=1 %}
  448.     <script src="{{ absolute_url(path('dashboard')) }}condensed_assets/javascript_codecovers_minimal.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
  449.     <script src="{{ absolute_url(path('dashboard')) }}js/jquery.editable.min.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
  450.     <script src="{{ absolute_url(path('dashboard')) }}condensed_assets/moment_timezone.min.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
  451.     <script>
  452.         var approveDocumentForwardUserListSelector = {};
  453.         $(document).ready(function () {
  454.             if (typeof initiate_comment_box_snippet !== 'undefined') {
  455.                 initiate_comment_box_snippet();
  456.             }
  457.             $('.modal').on('shown.bs.modal', function () {
  458.                 $(document).off('focusin.modal');
  459.             });
  460.             if (!window.isElectron) {
  461.                 $('#turn_off_button').hide();
  462.                 $('.close_window').hide();
  463. //                window.ipcRenderer.send('exit_app', 'hello')
  464.                 //window.ipcRenderer.on('pong', function(event, msg){//    console.log(msg)} )
  465.             }
  466.             $('input[type=radio][name=approvalAction]').change(function () {
  467.                 if (this.value == '3') {
  468.                     $("#forward_doc_div").show()
  469.                 } else {
  470.                     $("#forward_doc_div").hide()
  471.                 }
  472.             });
  473.             $('#forward_doc_check_label').click(function () {
  474.                 $('#forward_doc_check').prop("checked", true);
  475.                 $("#forward_doc_div").show()
  476.             });
  477.         });
  478.     </script>
  479. {% endif %}
  480. {% if include_html==1 %}
  481.     <script>
  482.         {# alert({{ app.request.request.get('skipHTML')}}) #}
  483.         if (typeof module === 'object') {
  484.             window.module = module;
  485.             module = undefined;
  486.         }
  487.     </script>
  488.     <link rel="stylesheet" href="{{ absolute_url(path('dashboard')) }}js/adminbsb/plugins/sweetalert/sweetalert.css">
  489.     <script src="{{ absolute_url(path('dashboard')) }}condensed_assets/javascript_codecovers.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
  490.     <script src="{{ absolute_url(path('dashboard')) }}condensed_assets/moment_timezone.min.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
  491.     <script src="{{ absolute_url(path('dashboard')) }}condensed_assets/ifvisible.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
  492.     {# <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script> #}
  493.     {# <!--<script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/plugins/bootstrap-select/js/bootstrap-select.js"></script>--> #}
  494.     {# <script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/plugins/jquery-slimscroll/jquery.slimscroll.js"></script> #}
  495.     {# <script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/plugins/node-waves/waves.js"></script> #}
  496.     {# <script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/plugins/jquery-countto/jquery.countTo.js"></script> #}
  497.     <script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/plugins/sweetalert/sweetalert.min.js"></script>
  498.     <script src="{{ absolute_url(path('dashboard')) }}js/jquery.editable.min.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
  499.     {# <script type="text/javascript" src="{{ absolute_url(path('dashboard')) }}condensed_assets/DataTables/datatables.min.js"></script> #}
  500.     <script src="{{ asset('jqueryui/jquery-ui.js') }}"></script>
  501.     {% if not new_calendar_version is defined %}
  502.         {% set new_calendar_version=0 %}
  503.     {% endif %}
  504.     {% if new_calendar_version==0 %}
  505.         <script src="{{ asset('js/fullcalendar.min.js') }}"></script>
  506.     {% endif %}
  507.     {# <script src="{{ absolute_url(path('dashboard')) }}condensed_assets/fullCalendar5/lib/main.min.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script> #}
  508.     <!--<script src="js/adminbsb/plugins/materialize-css/js/materialize.js"></script>-->
  509.     {# <script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/js/admin.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script> #}
  510.     <style>
  511.         /*.accessible-menu li*/
  512.         .treeview {
  513.             /*border: 1px solid;*/
  514.             /*border-color: #bcaaa4;*/
  515.             /*border-radius: 4px;*/
  516.         }
  517.         body {
  518.             /*text-transform: uppercase;*/
  519.         }
  520.         .sf-toolbar {
  521.             /*display: none !important;*/
  522.         }
  523.         .noty_bar.noty_type_error .noty_message {
  524.             text-align: center;
  525.             padding: 18px 23px;
  526.             width: auto;
  527.             position: relative;
  528.             font-weight: bold;
  529.             font-size: 1.75rem;
  530.         }
  531.     </style>
  532.     <!--
  533.     <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" ></script>
  534.     <script src="https://unpkg.com/popper.js@1.12.6/dist/umd/popper.js" ></script>
  535.     <script src="https://unpkg.com/bootstrap-material-design@4.1.1/dist/js/bootstrap-material-design.js" ></script>
  536.     -->
  537.     <!--<script>$(document).ready(function() { $('body').bootstrapMaterialDesign(); });</script>-->
  538.     {# <!--<script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/js/pages/index.js"></script>--> #}
  539.     {# <!--<script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/js/demo.js"></script>--> #}
  540.     <script>
  541.         function generateFileSmallView(fileDataList, as_thick_box) {
  542.             fileDataList = fileDataList || [];
  543.             as_thick_box = as_thick_box || 0;
  544.             var str = '';
  545.             if (fileDataList.length != 0) {
  546.                 for (var hope = 0; hope < fileDataList.length; hope++) {
  547.                     if ((fileDataList[hope].fileType).indexOf('pdf') != -1 || (fileDataList[hope].fileName).indexOf('pdf') != -1) {
  548.                         str += ' <div class="box-selector sm_th col-md-3 col-sm-6" > <div class="inside"> ' +
  549.                             '<div class="img" href="' + fileDataList[hope].fullPath + '" style="' +
  550.                             'background:url(\' ' + fileDataList[hope].fullPath + '\');' +
  551.                             'height: 50px !important;' +
  552.                             'width: 100%;' +
  553.                             'background-position: center;' +
  554.                             'background-size: contain;' +
  555.                             'background-repeat: no-repeat;"> </div> <h6 class="title" style="height: 2rem;">' + (typeof fileDataList['skipName'] !== 'undefined' ? fileDataList[hope].fileName : '') + '</h6>' +
  556.                             '</div></div>'
  557.                     } else if ((fileDataList[hope].fileType).indexOf('image') != -1 || (fileDataList[hope].fileName).indexOf('jpeg') != -1
  558.                         || (fileDataList[hope].fileName).indexOf('png') != -1 || (fileDataList[hope].fileName).indexOf('jpg') != -1
  559.                     ) {
  560.                         str += ' <div class="box-selector sm_th col-md-3 col-sm-6" > <div class="inside"> ' +
  561.                             '<div class="img" href="' + fileDataList[hope].fullPath + '" style="' +
  562.                             "background:url(' " + fileDataList[hope].fullPath + "');" +
  563.                             'height: 50px !important;' +
  564.                             'width: 100%;' +
  565.                             'background-position: center;' +
  566.                             'background-size: contain;' +
  567.                             'background-repeat: no-repeat;"> </div> <h6 class="title" style="height: 2rem;">' + (typeof fileDataList['skipName'] !== 'undefined' ? fileDataList[hope].fileName : '') + '</h6>' +
  568.                             '</div></div>'
  569.                     } else
  570.                         str += ' <div class="box-selector sm_th col-md-3 col-sm-6" > <div class="inside"> ' +
  571.                             '<div class="img" href="' + fileDataList[hope].fullPath + '" style="' +
  572.                             "background:url('" + fileDataList[hope].fullPath + "');" +
  573.                             'height: 50px !important;' +
  574.                             'width: 100%;' +
  575.                             'background-position: center;' +
  576.                             'background-size: contain;' +
  577.                             'background-repeat: no-repeat;"> </div> <h6 class="title" style="height: 2rem;">' + (typeof fileDataList['skipName'] !== 'undefined' ? fileDataList[hope].fileName : '') + '</h6>' +
  578.                             '</div></div>'
  579.                 }
  580.             }
  581.             // //    console.log('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPPPPPPPPPPPPPPPPPPPPPP')
  582.             // //    console.log(str)
  583.             // //    console.log(fileDataList)
  584.             return str;
  585.         }
  586.         {# var BaseURL='{{ url('dashboard') }}'; #}
  587.         {% set foo = url('dashboard')|split(':') %}
  588.         //    console.log('{{ foo|length }}');
  589.         {% if foo|length ==3 %}
  590.         {% set url_wo_port=foo[0]~':'~foo[1] %}
  591.         {# //    console.log('{{ 'length 3' }}'); #}
  592.         {# //    console.log('{{ url_wo_port }}'); #}
  593.         {% elseif foo|length ==2 %}
  594.         {% set url_wo_port=foo[0]~':' %}
  595.         {% set bar=foo[1]|split('/') %}
  596.         {# //    console.log('{{ url_wo_port }}'); #}
  597.         {# //    console.log('{{ bar|json_encode()|raw() }}'); #}
  598.         {% for indu,gg in bar %}
  599.         {# //    console.log('index {{ indu }}') #}
  600.         {# //    console.log('will append {{ gg }}') #}
  601.         {% if indu <((bar|length)-1)  and indu!=0 %}
  602.         {% set url_wo_port=url_wo_port~'/'~gg %}
  603.         {# //    console.log('appended {{ gg }}') #}
  604.         {% endif %}
  605.         {# //    console.log('{{ url_wo_port }}'); #}
  606.         {% endfor %}
  607.         {% endif %}
  608.         //        var url_without_port=BaseURL.split(':')[0]+':'+BaseURL.split(':')[1]
  609.         {# var DATE_BAR_START="{{ session.userCompanyOpeningYear }}-01-01"
  610.         var DATE_BAR_END="{{ 'now' | date('Y-m-d') }}" #}
  611.     </script>
  612.     {# the one in constant is the forced one #}
  613.     {% if constant('ApplicationBundle\\Constants\\GeneralConstant::NOTIFICATION_ENABLED')==1 %}
  614.         {# now check softone #}
  615.         {% if notification_enabled==1 %}
  616.             {% if session[UserConstants.USER_ID] is defined %}
  617.                 {% if 'localhost:' in notification_server %}
  618.                     {% set notification_server_full = url_wo_port ~':'~ notification_server|split('localhost:')[1] %}
  619.                 {% else %}
  620.                     {% if 'https://' in notification_server or 'http://' in notification_server %}
  621.                         {% set notification_server_full =notification_server %}
  622.                     {% else %}
  623.                         {% set notification_server_full = 'https://'~notification_server %}
  624.                     {% endif %}
  625.                 {% endif %}
  626.                 <script type="text/javascript">
  627.                     // //    console.log(io)
  628.                     function refreshKeepAliveCall() {
  629.                         socketKeepAliveCall = setInterval(function () {
  630.                             var nowTs = moment().unix(),
  631.                                 differenceFromStartTime = meetingStartTime.diff(now), // 86400000;
  632.                                 differenceFromEndTime = meetingEndTime.diff(now); // 86400000;
  633.                             if (nowTs - lastActivityTs > 60) {
  634.                                 clearInterval(socketKeepAliveCall);
  635.                             } else {
  636.                                 socket.emit('update_my_socket', {
  637.                                     userId: socket_user_id,
  638.                                     token: socket_user_session_token,
  639.                                 });
  640.                             }
  641.                             //seconds
  642.                         }, 30000)
  643.                     }
  644.                     // //    console.log(io)
  645.                     function initiateSocket() {
  646.                         lastActivityTs = moment().unix();
  647.                         $.getScript('{{ notification_server_full }}/socket.io/socket.io.js', function () {
  648.                             {# $.getScript('{{ absolute_url(path('dashboard')) }}buddybee_assets/js/socket-io.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}', function () { #}
  649.                             if (io) {
  650.                                 {# socket=io.connect( '{{ constant('ApplicationBundle\\Constants\\GeneralConstant::NOTIFICATION_SERVER') }}' ); #}
  651.                                 socket = io.connect('{{ notification_server_full }}');
  652.                                 socket.emit('update_my_socket', {
  653.                                     userId: socket_user_id,
  654.                                     token: socket_user_session_token,
  655.                                     user_status: '_ON_',
  656.                                     force_broadcast: 1,
  657.                                 });
  658.                                 {% if 1 %}
  659.                                 ifvisible.setIdleDuration(120);
  660.                                 ifvisible.onEvery(30, function () {
  661. //                            //    console.log('not idle')
  662.                                     socket.emit('update_my_socket', {
  663.                                         userId: socket_user_id,
  664.                                         token: socket_user_session_token,
  665.                                     });
  666.                                 });
  667.                                 ifvisible.idle(function () {
  668.                                     document.body.style.opacity = 0.5;
  669.                                     socket.emit('update_my_socket', {
  670.                                         userId: socket_user_id,
  671.                                         token: socket_user_session_token,
  672.                                         user_status: '_AWAY_',
  673.                                         force_broadcast: 1,
  674.                                     });
  675.                                 });
  676.                                 ifvisible.wakeup(function () {
  677.                                     document.body.style.opacity = 1;
  678.                                     socket.emit('update_my_socket', {
  679.                                         userId: socket_user_id,
  680.                                         token: socket_user_session_token,
  681.                                         user_status: '_ON_',
  682.                                         force_broadcast: 1,
  683.                                     });
  684.                                 });
  685.                                 {% endif %}
  686.                                 // socket.emit('update_my_socket', {
  687.                                 //     userId: socket_user_id,
  688.                                 //     token: socket_user_session_token,
  689.                                 // });
  690.                                 //
  691.                                 // socket.emit('trigger_socket',
  692.                                 //     {
  693.                                 //         sendType: 'all',
  694.                                 //         emitMarker: '_SOCKET_NOTIFICATION_HERE_',
  695.                                 //         dataObj: {
  696.                                 //             userId: socket_user_id,
  697.                                 //             token: socket_user_session_token,
  698.                                 //         }
  699.                                 //     });
  700.                                 if (typeof pageSocketInit !== 'undefined')
  701.                                     pageSocketInit();
  702.                                 socket.on('user_status_update', function (dataObj) {
  703.                                     //    console.log(dataObj)
  704.                                 });
  705.                                 socket.on('_SOCKET_NOTIFICATION_HERE_', function (dataObj) {
  706.                                     // if (typeof dataObj.targetRoute !== 'undefined') {
  707.                                     //     if (dataObj.targetRoute == 'consultancy_session')
  708.                                     //         refreshUpcomingMeetingList();
  709.                                     // }
  710.                                     //    console.log(dataObj)
  711.                                 });
  712.                                 // socket.on('refresh_upcoming_meeting_list', function (dataObj) {
  713.                                 //     refreshUpcomingMeetingList();
  714.                                 //     //    console.log(dataObj)
  715.                                 //
  716.                                 // });
  717.                                 //    console.log(socket);
  718.                             }
  719.                         });
  720.                     }
  721.                 </script>
  722.                 {# <script type="text/javascript" src="{{ constant('ApplicationBundle\\Constants\\GeneralConstant::NOTIFICATION_SERVER')=='localhost:5000'?url_wo_port~':5000':constant('ApplicationBundle\\Constants\\GeneralConstant::NOTIFICATION_SERVER') }}/socket.io/socket.io.js"></script> #}
  723.                 <script type="text/javascript"
  724.                         src="{{ notification_server_full }}/socket.io/socket.io.js"></script>
  725.                 <script type="text/javascript">
  726.                 </script>
  727.                 <script src="{{ absolute_url(path('dashboard')) }}js/inno_notify.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
  728.             {% endif %}
  729.         {% endif %}
  730.     {% endif %}
  731.     <script>
  732.         {% set left_panel_style='' %}
  733.         {% set curr_status_of_left_menu=1 %}
  734.         {% set content_panel_style='' %}
  735.         {% if session['HIDE_LEFT_PANEL'] is defined %}
  736.         {% if session['HIDE_LEFT_PANEL'] ==1 %}
  737.         {% set left_panel_style='display:none' %}
  738.         {% set curr_status_of_left_menu=0 %}
  739.         {% endif %}
  740.         {% endif %}
  741.         {# alert({{ curr_status_of_left_menu }}) #}
  742.         var curr_status_of_left_menu = "{{ curr_status_of_left_menu is defined? curr_status_of_left_menu:1 }}";
  743.         {% if session[UserConstants.USER_ID] is defined %}
  744.         var product_name_display_type = "{{ session[UserConstants.PRODUCT_NAME_DISPLAY_TYPE] }}";
  745.         {% endif %}
  746.         var autoApproveEcoDoc = 0;
  747.         $(document).ready(function () {
  748.             $('.change_app').click(function (ev) {
  749.                 ev.preventDefault();
  750.                 getUserCompanyList('_CENTRAL_')
  751.                 // $('#selectEntityModal').modal('show');
  752.                 // $('#selectEntityModal').modal('handleUpdate')
  753.                 // selectEntityModal.show();
  754.             })
  755.             {% set curr_route=app.request.attributes.get('_route') %}
  756.             $('input.devAdminOnly').attr('readonly', false);
  757.             $('.inplaceEditForced').editable({
  758.                 event: 'click',
  759.                 callback: function (data) {
  760.                     //    console.log('Stopped editing ' + data.$el[0].nodeName);
  761.                     //    console.log('the el data ' + data.$el[0].dataset.setMethod);
  762.                     //    console.log(data);
  763.                     var pika = `
  764.                    class="inplaceEdit"
  765.                        data-set-method="setStockTransferDate"
  766.                        data-entity-name="StockTransfer"
  767.                        data-entity-bundle="ApplicationBundle"
  768.                        data-find-value="1"
  769.                        data-find-field="stockTransferId"
  770.                        data-field-type="_DATE_"
  771.                        data-modify-trans-date="1"
  772.                        `
  773.                     if (data.content) {
  774.                         //    console.log('* The text was changed');
  775.                         $.post('{{ url('update_inline_value') }}', {
  776. //                        returnJson: 1,
  777. //                        sessionData: sessionData
  778.                             entityName: typeof data.$el[0].dataset.entityName !== 'undefined' ? data.$el[0].dataset.entityName : 'EntityApplicantDetails',
  779.                             entityBundle: typeof data.$el[0].dataset.entityBundle !== 'undefined' ? data.$el[0].dataset.entityBundle : 'Application',
  780.                             setValue: data.$el[0].outerText,
  781.                             setMethod: data.$el[0].dataset.setMethod,
  782.                             findValue: data.$el[0].dataset.findValue,
  783.                             findField: typeof data.$el[0].dataset.findField !== 'undefined' ? data.$el[0].dataset.findField : 'applicantId',
  784.                             modifyTransDateFlag: typeof data.$el[0].dataset.modifyTransDate !== 'undefined' ? data.$el[0].dataset.modifyTransDate : 0,
  785.                             fieldType: typeof data.$el[0].dataset.fieldType !== 'undefined' ? data.$el[0].dataset.fieldType : '_TEXT_',
  786.                             {# findValue: {{ consultantDetails.applicantId }}, #}
  787.                         })
  788.                             .done(function (data) {
  789.                                 //    console.log(data);
  790.                                 if (data.success == true) {
  791.                                     swal({
  792.                                         title: "Sweet!",
  793.                                         text: "Updated",
  794.                                         imageUrl: BaseURL + "images/thumbs-up.png"
  795.                                     });
  796. //                                    alertify.success("Order Confirmation Done");
  797.                                 } else {
  798.                                     swal({
  799.                                         title: "Sorry!",
  800.                                         text: "Your Action failed !",
  801.                                         imageUrl: BaseURL + "images/Bee_Sad_Emote.png"
  802.                                     });
  803. //                                    alertify.success("Order Confirmation Failed");
  804. //                            $('#barcode_selector_cont').waitMe('hide');
  805.                                 }
  806.                             })
  807.                             .fail(function () {
  808.                             });
  809.                     }
  810.                 }
  811.             });
  812.             {% if app.session.get('devAdminMode') ==1 %}
  813.             $('.inplaceEdit .fa.fa-edit').show();
  814.             $('input.devAdminOnly').attr('readonly', true)
  815.             {% if session[UserConstants.USER_ID] is defined %}
  816.             $(document).on('click', '.company_selector a.dropdown-toggle', function () {
  817.                 RefreshAppListOnMenu()
  818.             })
  819.             {% endif %}
  820.             $('.inplaceEdit').editable({
  821.                 event: 'click',
  822.                 callback: function (data) {
  823.                     //    console.log('Stopped editing ' + data.$el[0].nodeName);
  824.                     //    console.log('the el data ' + data.$el[0].dataset.setMethod);
  825.                     //    console.log(data);
  826.                     var pika = `
  827.                    class="inplaceEdit"
  828.                        data-set-method="setStockTransferDate"
  829.                        data-entity-name="StockTransfer"
  830.                        data-entity-bundle="ApplicationBundle"
  831.                        data-find-value="1"
  832.                        data-find-field="stockTransferId"
  833.                        data-field-type="_DATE_"
  834.                        data-modify-trans-date="1"
  835.                        `
  836.                     if (data.content) {
  837.                         //    console.log('* The text was changed');
  838.                         $.post('{{ url('update_inline_value') }}', {
  839. //                        returnJson: 1,
  840. //                        sessionData: sessionData
  841.                             entityName: typeof data.$el[0].dataset.entityName !== 'undefined' ? data.$el[0].dataset.entityName : 'EntityApplicantDetails',
  842.                             entityBundle: typeof data.$el[0].dataset.entityBundle !== 'undefined' ? data.$el[0].dataset.entityBundle : 'Application',
  843.                             setValue: data.$el[0].outerText,
  844.                             setMethod: data.$el[0].dataset.setMethod,
  845.                             findValue: data.$el[0].dataset.findValue,
  846.                             findField: typeof data.$el[0].dataset.findField !== 'undefined' ? data.$el[0].dataset.findField : 'applicantId',
  847.                             modifyTransDateFlag: typeof data.$el[0].dataset.modifyTransDate !== 'undefined' ? data.$el[0].dataset.modifyTransDate : 0,
  848.                             fieldType: typeof data.$el[0].dataset.fieldType !== 'undefined' ? data.$el[0].dataset.fieldType : '_TEXT_',
  849.                             {# findValue: {{ consultantDetails.applicantId }}, #}
  850.                         })
  851.                             .done(function (data) {
  852.                                 //    console.log(data);
  853.                                 if (data.success == true) {
  854.                                     swal({
  855.                                         title: "Sweet!",
  856.                                         text: "Updated",
  857.                                         imageUrl: BaseURL + "images/thumbs-up.png"
  858.                                     });
  859. //                                    alertify.success("Order Confirmation Done");
  860.                                 } else {
  861.                                     swal({
  862.                                         title: "Sorry!",
  863.                                         text: "Your Action failed !",
  864.                                         imageUrl: BaseURL + "images/Bee_Sad_Emote.png"
  865.                                     });
  866. //                                    alertify.success("Order Confirmation Failed");
  867. //                            $('#barcode_selector_cont').waitMe('hide');
  868.                                 }
  869.                             })
  870.                             .fail(function () {
  871.                             });
  872.                     }
  873.                 }
  874.             });
  875.             {% endif %}
  876.             {% if constant('ApplicationBundle\\Constants\\GeneralConstant::NOTIFICATION_ENABLED')==1 %}
  877.             {# now check softone #}
  878.             {% if notification_enabled==1 %}
  879.             {% if session[UserConstants.USER_ID] is defined %}
  880.             initiateSocket()
  881.             {% endif %}
  882.             {% endif %}
  883.             {% endif %}
  884.             $('.btn-file input[type="file"]').not('.show_images').change(function () {
  885.                 if (!$(this).parents('label').parent().find('.file_names_text').length)
  886.                     $(this).parents('label').parent().append('<p style="font-weight: bold" class="file_names_text"></p>')
  887.                 var fileNameList = [];
  888.                 for (var jj = 0; jj < $(this)[0].files.length; jj++)
  889.                     fileNameList.push($(this)[0].files[jj].name)
  890.                 // alert('pika')
  891.                 // //    console.log($(this)[0].files)
  892.                 var fileNameText = '';
  893.                 if (fileNameList.length != 0)
  894.                     fileNameText = fileNameList.join(' , ')
  895.                 if (!$(this).parents('label').parent().find('.file_names_text').length)
  896.                     $(this).parents('label').parent().append('<p style="font-weight: bold" class="file_names_text">' + fileNameText + '</p>')
  897.                 else
  898.                     $(this).parents('label').parent().find('.file_names_text').text(fileNameText)
  899.             });
  900.             $('.btn-file input[type="file"].show_images').change(function (e) {
  901.                 if (!$(this).parents('label').parent().find('.file_names_text').length)
  902.                     $(this).parents('label').parent().append('<p style="font-weight: bold" class="file_names_text"></p>')
  903.                 var fileNameList = [];
  904.                 var fileDataList = [];
  905.                 for (var jj = 0; jj < $(this)[0].files.length; jj++) {
  906.                     fileNameList.push($(this)[0].files[jj].name);
  907.                     //    console.log($(this)[0].files[jj].type)
  908.                     fileDataList.push({
  909.                         fullPath: URL.createObjectURL($(this)[0].files[jj]),
  910.                         fileType: $(this)[0].files[jj].type,
  911.                         fileName: $(this)[0].files[jj].name,
  912.                     })
  913.                 }
  914.                 // //    console.log($(this)[0].files)
  915.                 // // //    console.log(URL.createObjectURL($(this)[0].files[0]))
  916.                 // var fileNameText = '';
  917.                 // if (fileNameList.length != 0)
  918.                 //     fileNameText = fileNameList.join(' , ')
  919.                 //
  920.                 if (!$(this).parents('label').parent().find('.file_images_cont').length)
  921.                     $(this).parents('label').parent().append('<div  style="font-weight: bold" class="row file_images_cont">' + generateFileSmallView(fileDataList, 0) + '</div>')
  922.                 else
  923.                     $(this).parents('label').parent().find('.file_images_cont').html(generateFileSmallView(fileDataList, 0))
  924.             });
  925.             {% if session[UserConstants.USER_ID] is defined %}
  926.             if($('.assigned_task_list_here').length)
  927.                 ListAvailableTaskOnMenu();
  928.             $(document).on('click', '.this_is_task a', function (e) {
  929.                 e.preventDefault();
  930.                 if ($(this).parent('li').hasClass('active')) {
  931. //                    alert('Here')
  932.                     EndCurrentTaskOnMenu()
  933.                 } else
  934.                     ChangeActiveTaskOnMenu(0, $(this).data('pid'))
  935.             });
  936.             function clock_update_on_menu()
  937.             {
  938.                 var gg_cur_ts=moment().unix();
  939.                 $('.clock_update').each(function(invu,elem){
  940.                     var sec_diff=gg_cur_ts-1*$(elem).data('startTs');
  941.                     var hour_here=Math.floor(sec_diff/3600);
  942.                     var min_here=Math.floor((sec_diff%3600)/60);
  943.                     var sec_here=Math.floor((sec_diff%60));
  944. //                    $(elem).text(hour_here.padStart(2, 0)+':'+min_here.padStart(2, 0))
  945.                     $(elem).text((hour_here.toString()).padStart(2, 0)+':'+(min_here.toString()).padStart(2, 0)+':'+(sec_here.toString()).padStart(2, 0))
  946.                 })
  947.             }
  948.             setInterval(clock_update_on_menu, 1000);
  949.             {% endif %}
  950.             var CURRENT_ROUTE = '{{ curr_route }}';
  951.             // function checkApprovalSubmit(){
  952.             //     alert('MIA')
  953.             //     return false;
  954.             // }
  955.             if ($('#approveDocument #approveDocumentForwardUserList').length) {
  956.                 approveDocumentForwardUserListSelector = $('#approveDocument #approveDocumentForwardUserList').selectize({
  957.                     placeholder: 'Select a user',
  958.                     multiple: false,
  959. //            options: APTL.productListArray,
  960.                     options: [],
  961.                     valueField: 'value',
  962.                     labelField: 'text',
  963.                     preload: 'focus',
  964.                     searchField: ['text', 'value'],
  965.                     load: function (query, callback) {
  966. //                        if (!query.length) return // callback();
  967.                         if (!query.length) query = '_EMPTY_';
  968.                         var pika_ind_id = $($(this)[0].$input["0"]).attr('data-id')
  969.                         $.ajax({
  970.                             url: BaseURL + "select_data_ajax",
  971.                             type: 'POST',
  972.                             dataType: 'json',
  973.                             data: {
  974.                                 //returnJson: 1,
  975.                                 //sessionData: sessionData
  976.                                 query: query,
  977.                                 tableName: "sys_user",
  978.                                 valueField: "user_id",
  979.                                 textField: "rendered_text",
  980.                                 entity_group: 0,
  981.                                 selectorId: $($(this)[0].$input["0"]).attr('id'),
  982.                                 isMultiple: 0,
  983.                                 dataId: pika_ind_id,
  984. //                        isMultiple: 0,
  985.                                 //textField: "rendered_text",
  986. //
  987.                                 renderTextFormat: "# __value__ __name__",
  988.                                 andConditions: [],
  989.                                 andOrConditions: [
  990.                                     {type: "like", field: "name", value: query},
  991.                                 ],
  992.                                 mustConditions: [
  993.                                     {type: "=", field: "status", value: 1},
  994.                                     {type: "in", field: "user_type", value: [1, 2, 5]},
  995.                                 ],
  996.                                 joinTableData: [
  997.                                     // {
  998.                                     //     tableName: "sys_department_position",
  999.                                     //     joinFieldPrimary: "sys_department_position",
  1000.                                     //     joinOn: 'position_id',
  1001.                                     //     tableJoinType: 'left join',
  1002.                                     //     // fieldJoinType: '=',
  1003.                                     //     // selectPrefix: '',
  1004.                                     //     selectFieldList: [
  1005.                                     //         'project_name'
  1006.                                     //
  1007.                                     //     ]
  1008.                                     // },
  1009.                                     //
  1010.                                     // {
  1011.                                     //     tableName: "acc_clients",
  1012.                                     //     joinFieldPrimary: "client_id",
  1013.                                     //     joinOn: 'client_id',
  1014.                                     //     tableJoinType: 'join',
  1015.                                     //     // fieldJoinType: '=',
  1016.                                     //     // selectPrefix: 'client_',
  1017.                                     //     selectFieldList: [
  1018.                                     //         'client_name'
  1019.                                     //
  1020.                                     //     ]
  1021.                                     // },
  1022.                                 ],
  1023.                                 convertToObject: [
  1024. //                            'accessories', 'issues'
  1025.                                 ],
  1026.                                 skipDefaultCompanyId: 1
  1027.                                 // setDataForSingle: 1,
  1028.                             },
  1029.                             error: function () {
  1030.                                 // callback();
  1031.                             },
  1032.                             success: function (res) {
  1033.                                 callback(res.data);
  1034.                                 if (res.setValueArray.length != 0 && res.selectorId != '') {
  1035.                                     if (res.isMultiple == 1)
  1036.                                         $('#' + res.selectorId).selectize()[0].selectize.setValue(res.setValueArray)
  1037.                                     else
  1038.                                         $('#' + res.selectorId).selectize()[0].selectize.setValue(res.setValue)
  1039.                                 }
  1040. //                        alert('pika master')
  1041.                             }
  1042.                         });
  1043.                     },
  1044.                     onChange: function (value) {
  1045.                     }
  1046.                 })[0].selectize;
  1047.             }
  1048.             $(document).on('click', '.trigger_approval_btn', function () {
  1049.                 $('#approveDocument #approvalEntity').val($(this).data('entity'))
  1050.                 // $('#approveDocument #approvalRowId').val($(this).data('entity'))
  1051.                 $('#approveDocument #approvalEntityId').val($(this).data('entityId'))
  1052.                 $('#approveDocument #approvalId').val($(this).data('approvalId'))
  1053.             })
  1054.             $('.approval_submit').click(function (e) {
  1055.                 e.preventDefault();
  1056.                 if ($('#approveDocument input[name="approvalAction"]:checked').length) {
  1057.                     $('#approval_form').submit()
  1058.                 } else {
  1059.                     // alert('JOJO')
  1060.                     alertify.alert("Select an Approval Action!")
  1061.                 }
  1062.             })
  1063.             {% if  app.request.query.get('autoApproveEcoDoc') !='' %}
  1064.             autoApproveEcoDoc = 1;
  1065.             $('.trigger_approval_btn').eq(0).trigger('click');
  1066.             $('#approveDocument #radio1').prop('checked', true)
  1067.             $('#approveDocument #approveDocumentApprovalHash').val('_eco_')
  1068.             $('.approval_submit').trigger('click');
  1069.             {% endif %}
  1070.             {% if curr_route=='applicant_dashboard' or  curr_route=='dashboard' %}
  1071.             var globLsDataStr = window.localStorage.getItem('lsData');
  1072.             var globLsData = {};
  1073.             if (globLsDataStr != 'null' && globLsDataStr != null)
  1074.                 globLsData = JSON.parse(globLsDataStr);
  1075.             //    console.log(globLsData);
  1076.             if (typeof globLsData['checkoutPending'] !== 'undefined') {
  1077.                 if (globLsData['checkoutPending'] == 1)
  1078.                     window.location.href = "{{ url('pricing_plan_page') }}?autoRedirected=1";
  1079.             }
  1080.             {% endif %}
  1081.             if (typeof initiate_comment_box_snippet !== 'undefined') {
  1082.                 initiate_comment_box_snippet();
  1083.             }
  1084.             $('.modal').on('shown.bs.modal', function () {
  1085.                 $(document).off('focusin.modal');
  1086.             });
  1087.             $('a').each(function (index) {
  1088.                 var attr_href = $(this).attr('href');
  1089. // For some browsers, `attr` is undefined; for others,
  1090. // `attr` is false.  Check for both.
  1091.                 if (typeof attr_href !== typeof undefined && attr_href !== false)
  1092.                     if (($(this).attr('href')).indexOf('print') != -1) {
  1093.                         $(this).attr('target', '_blank')
  1094.                     }
  1095.             });
  1096.             if (!window.isElectron) {
  1097.                 $('#turn_off_button').hide();
  1098.                 $('.close_window').hide();
  1099. //                window.ipcRenderer.send('exit_app', 'hello')
  1100.                 //window.ipcRenderer.on('pong', function(event, msg){//    console.log(msg)} )
  1101.             }
  1102.             if (window.isElectron) {
  1103.                 if (window.localStorage.getItem('full_screen_enabled') == null) {
  1104.                     openFullscreen();
  1105.                 }
  1106.                 window.ipcRenderer.on('update_message', function (event, text) {
  1107.                     alertify.alert(text);
  1108. //                    var container = document.getElementById('messages');
  1109. //                    var message = document.createElement('div');
  1110. //                    message.innerHTML = text;
  1111. //                    container.appendChild(message);
  1112.                 })
  1113.                 $("a[target='_blank']").attr('target', '_self');
  1114.                 $("form[target='_blank']").attr('target', '_self');
  1115.             }
  1116.             $('#turn_off_button').click(function (e) {
  1117.                 e.preventDefault();
  1118. //            window.open('', '_self', '');
  1119.                 if (confirm('Are you sure to exit?') == true) {
  1120.                     if (window.isElectron) {
  1121.                         window.ipcRenderer.send('exit_app', 'hello')
  1122.                         //window.ipcRenderer.on('pong', function(event, msg){//    console.log(msg)} )
  1123.                     }
  1124.                 }
  1125.             });
  1126.             $('.close_window').click(function (e) {
  1127.                 e.preventDefault();
  1128. //            window.open('', '_self', '');
  1129.                 if (window.isElectron) {
  1130.                     window.ipcRenderer.send('close_window', 'hello') //no need to exit app
  1131.                     //window.ipcRenderer.on('pong', function(event, msg){//    console.log(msg)} )
  1132.                 }
  1133.             });
  1134.             $(".leftMenuToggle").click(function () {
  1135. //            alert(curr_status_of_left_menu);
  1136. //            alert(curr_status_of_left_menu)
  1137.                 if (curr_status_of_left_menu == 0) {
  1138.                     $("section.content").css("margin-left", "265px");
  1139.                     $("#leftsidebar").show();
  1140.                     curr_status_of_left_menu = 1;
  1141.                 } else if (curr_status_of_left_menu == 1) {
  1142.                     $("section.content").css("margin-left", "59px");
  1143.                     $("#leftsidebar").hide();
  1144.                     curr_status_of_left_menu = 0;
  1145.                 }
  1146.                 jQuery.get(BaseURL + "change_left_panel_display_status", function (data) {
  1147. //                jQuery('.SelectedSupplierDetails').html(data.content);
  1148.                 });
  1149.             })
  1150.             $('.dropdown-submenu a.expand_menu').on("click", function (e) {
  1151. //            alert("here")
  1152.                 $('.dropdown-submenu a.expand_menu').next('ul').hide();
  1153.                 $(this).next('ul').toggle();
  1154.                 e.stopPropagation();
  1155.                 e.preventDefault();
  1156.             });
  1157.         });
  1158.         {# var perSessionMinute={{ ConsultancyConstant.PER_SESSION_MINUTE }}; #}
  1159.         var system_notice ={% set sys_notice=''|getSystemNotice %}
  1160.                 {% set appValiditySeconds='_UNSET_' %}
  1161.                 {% if session['appValiditySeconds'] is defined %}
  1162.                 {% set appValiditySeconds=session['appValiditySeconds'] %}
  1163.                 {% endif %}
  1164.                 {% if appValiditySeconds!='_UNSET_' %}
  1165.                 {% if appValiditySeconds <= (30*24*3600) %}
  1166.                 {% set leftDays = appValiditySeconds/(24*3600) %}
  1167.                 {% set appIsValidTillTime=session['appIsValidTillTime'] %}
  1168.                 {% set mod_str ="Don't give up on us! We're still working to make your life easier. If you don't want to lose this precious service, make sure to pay your outstanding bill by "~(appIsValidTillTime|date('F d, Y'))~"!" %}
  1169.                 {% if leftDays <1 %}
  1170.                 {% set  mod_str=mod_str~' --- Time Left: '~((appValiditySeconds/60)|number_format(0,'.',','))~' minute(s)' %}
  1171.                 {% else %}
  1172.                 {% set mod_str=mod_str~' ---- Time Left: '~(leftDays|number_format(0,'.',','))~' day(s)' %}
  1173.                 {% endif %}
  1174.             noty({
  1175.                 text: "{{ mod_str }} ",
  1176.                 layout: 'bottom',
  1177.                 theme: 'defaultTheme', // or 'relax'
  1178. //                    theme: 'relax',
  1179.                 type: 'error',
  1180. //                    timeout: 100000,
  1181.                 timeout: false,
  1182.                 closeWith: ['click'],
  1183.                 animation: {
  1184.                     open: {height: 'toggle'}, // jQuery animate function property object
  1185.                     close: {height: 'toggle'}, // jQuery animate function property object
  1186.                     easing: 'swing', // easing
  1187.                     speed: 'slow' // opening & closing animation speed
  1188.                 },
  1189.                 callback: {
  1190.                     onShow: function () {
  1191.                     },
  1192.                     afterShow: function () {
  1193.                     },
  1194.                     onClose: function () {
  1195.                     },
  1196.                     afterClose: function () {
  1197.                     },
  1198.                     onCloseClick: function () {
  1199. //                window.location.href=data.viewlink
  1200.                         //alert('clicked')
  1201.                     },
  1202.                 }
  1203.             });
  1204.         {% endif %}
  1205.         {% endif %}
  1206.         {% for dt in  sys_notice %}
  1207.         {# endDate and startDate are strings or DateTime objects #}
  1208.         {% set difference = date(dt.countDownEnds).diff(date('')) %}
  1209.         {% set leftDays = difference.days %}
  1210.         {% set mod_str = dt.desc %}
  1211.         {% if leftDays == 1 %}
  1212.         {% set  mod_str=mod_str~' --- Time Left: 1 day' %}
  1213.         {% else %}
  1214.         {% set mod_str=mod_str~' ---- Time Left: '~leftDays~' days' %}
  1215.         {% endif %}
  1216.         noty({
  1217.             text: "{{ mod_str }} ",
  1218.             layout: 'bottom',
  1219. //                    theme: 'defaultTheme', // or 'relax'
  1220.             theme: 'relax',
  1221.             type: 'warning',
  1222. //                    timeout: 100000,
  1223.             timeout: false,
  1224.             closeWith: ['click'],
  1225.             animation: {
  1226.                 open: {height: 'toggle'}, // jQuery animate function property object
  1227.                 close: {height: 'toggle'}, // jQuery animate function property object
  1228.                 easing: 'swing', // easing
  1229.                 speed: 'slow' // opening & closing animation speed
  1230.             },
  1231.             callback: {
  1232.                 onShow: function () {
  1233.                 },
  1234.                 afterShow: function () {
  1235.                 },
  1236.                 onClose: function () {
  1237.                 },
  1238.                 afterClose: function () {
  1239.                 },
  1240.                 onCloseClick: function () {
  1241. //                window.location.href=data.viewlink
  1242.                     //alert('clicked')
  1243.                 },
  1244.             }
  1245.         });
  1246.         {% endfor %}
  1247.         $(document).ready(function () {
  1248.             $('input[type=radio][name=approvalAction]').change(function () {
  1249.                 if (this.value == '3') {
  1250.                     $("#forward_doc_div").show()
  1251.                 } else {
  1252.                     $("#forward_doc_div").hide()
  1253.                 }
  1254.             });
  1255.             $('#forward_doc_check_label').click(function () {
  1256.                 $('#forward_doc_check').prop("checked", true);
  1257.                 $("#forward_doc_div").show()
  1258.             });
  1259.             if ($('.pending_task_div').length) {
  1260.                 // //    console.log('HHHHHHHHHHHHHHHHHHHH________________________________________EEEEEEEEEEEEEEEEEEEEEEEEEEE________________')
  1261.                 refreshPendingTaskDiv()
  1262.             }
  1263.         });
  1264.     </script>
  1265.     <script>
  1266.         {% if new_calendar_version==0 %}
  1267.         var MenuCalendar = function () {
  1268.             // Create reference to this instance
  1269.             var o = this;
  1270.             // Initialize app when document is ready
  1271.         };
  1272.         var MP = MenuCalendar.prototype;
  1273.         // =========================================================================
  1274.         // INIT
  1275.         // =========================================================================
  1276.         MP.initialize = function () {
  1277.             this._enableEvents();
  1278.             this._initEventslist();
  1279.             this._initCalendar();
  1280.             this._displayDate();
  1281.         };
  1282.         // =========================================================================
  1283.         // EVENTS
  1284.         // =========================================================================
  1285.         // events
  1286.         MP._enableEvents = function () {
  1287. //        alert('pola')
  1288.             var o = this;
  1289.             $('#menu-calendar-prev').on('click', function (e) {
  1290. //            alert('lola')
  1291.                 o._handleCalendarPrevClick(e);
  1292.             });
  1293.             $('#menu-calendar-next').on('click', function (e) {
  1294.                 o._handleCalendarNextClick(e);
  1295.             });
  1296.             $('#menu-calendar-today').on('click', function (e) {
  1297.                 o._handleCalendarTodayClick(e);
  1298.             });
  1299.             $('.menu-calendar-holder .nav-tabs li').on('show.bs.tab', function (e) {
  1300.                 o._handleCalendarMode(e);
  1301.             });
  1302.         };
  1303.         // =========================================================================
  1304.         // CONTROLBAR
  1305.         // =========================================================================
  1306.         MP._handleCalendarPrevClick = function (e) {
  1307.             $('#menuCalendar').fullCalendar('prev');
  1308.             this._displayDate();
  1309.         };
  1310.         MP._handleCalendarNextClick = function (e) {
  1311.             $('#menuCalendar').fullCalendar('next');
  1312.             this._displayDate();
  1313.         };
  1314.         MP._handleCalendarTodayClick = function (e) {
  1315.             $('#menuCalendar').fullCalendar('today');
  1316.             this._displayDate();
  1317.         };
  1318.         MP._handleCalendarMode = function (e) {
  1319.             $('#menuCalendar').fullCalendar('changeView', $(e.currentTarget).data('mode'));
  1320.         };
  1321.         MP._displayDate = function () {
  1322.             var selectedDate = $('#menuCalendar').fullCalendar('getDate');
  1323.             $('.menu-calendar-selected-day').html(moment(selectedDate).format("dddd"));
  1324.             $('.menu-calendar-selected-date').html(moment(selectedDate).format("DD MMMM YYYY"));
  1325.             $('.menu-calendar-selected-year').html(moment(selectedDate).format("YYYY"));
  1326.         };
  1327.         // =========================================================================
  1328.         // TASKLIST
  1329.         // =========================================================================
  1330.         MP._initEventslist = function () {
  1331.             if (!$.isFunction($.fn.draggable)) {
  1332.                 return;
  1333.             }
  1334.             var o = this;
  1335.             $('.list-events li ').each(function () {
  1336.                 // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
  1337.                 // it doesn't need to have a start or end
  1338.                 var eventObject = {
  1339.                     title: $.trim($(this).text()), // use the element's text as the event title
  1340.                     className: $.trim($(this).data('className'))
  1341.                 };
  1342.                 // store the Event Object in the DOM element so we can get to it later
  1343.                 $(this).data('eventObject', eventObject);
  1344.                 // make the event draggable using jQuery UI
  1345.                 $(this).draggable({
  1346.                     zIndex: 999,
  1347.                     revert: true, // will cause the event to go back to its
  1348.                     revertDuration: 0, //  original position after the drag
  1349.                 });
  1350.             });
  1351.         };
  1352.         // =========================================================================
  1353.         // CALENDAR
  1354.         // =========================================================================
  1355.         MP._initCalendar = function (e) {
  1356.             if (!$.isFunction($.fn.fullCalendar)) {
  1357.                 return;
  1358.             }
  1359.             var date = new Date();
  1360.             var d = date.getDate();
  1361.             var m = date.getMonth();
  1362.             var y = date.getFullYear();
  1363.             $('#menuCalendar').fullCalendar({
  1364.                 schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
  1365.                 height: 700,
  1366.                 header: false,
  1367.                 editable: true,
  1368.                 eventStartEditable: true,
  1369.                 eventDurationEditable: true,
  1370.                 droppable: true,
  1371.                 drop: function (date, allDay) { // this function is called when something is dropped
  1372.                     // retrieve the dropped element's stored Event Object
  1373.                     var originalEventObject = $(this).data('eventObject');
  1374.                     // we need to copy it, so that multiple events don't have a reference to the same object
  1375.                     var copiedEventObject = $.extend({}, originalEventObject);
  1376.                     // assign it the date that was reported
  1377.                     copiedEventObject.start = date;
  1378.                     copiedEventObject.allDay = allDay;
  1379.                     copiedEventObject.className = originalEventObject.className;
  1380.                     // render the event on the calendar
  1381.                     // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
  1382.                     $('#menuCalendar').fullCalendar('renderEvent', copiedEventObject, true);
  1383.                     // is the "remove after drop" checkbox checked?
  1384.                     if ($('#drop-remove').is(':checked')) {
  1385.                         // if so, remove the element from the "Draggable Events" list
  1386.                         $(this).remove();
  1387.                     }
  1388.                 },
  1389.                 {% if session[UserConstants.USER_HOLIDAY_LIST_CURRENT_MONTH] is defined %}
  1390.                 {% set currMonthHolidayList=session[UserConstants.USER_HOLIDAY_LIST_CURRENT_MONTH]|jsonDecode() %}
  1391.                 {% else %}
  1392.                 {% set currMonthHolidayList=[] %}
  1393.                 {% endif %}
  1394.                 events: {{ currMonthHolidayList|json_encode()|raw }},
  1395.                 eventRender: function (event, element) {
  1396.                     element.find('#date-title').html(element.find('span.fc-event-title').text());
  1397.                 }
  1398.             });
  1399.         };
  1400.         window.MenuCalendar = new MenuCalendar;
  1401.         var menuCalendarRow = 0;
  1402.         $(document).ready(function () {
  1403.             window.MenuCalendar.initialize();
  1404.             $(document).on('click', '.menuCalendarTrigger', function () {
  1405.                 get_and_update_menu_calendar_according_to_holiday_calendar({% if session[UserConstants.USER_HOLIDAY_CALENDAR_ID] is defined %}
  1406.                         {{ session[UserConstants.USER_HOLIDAY_CALENDAR_ID] }}
  1407.                         {% else %}
  1408.                         {{ 0 }}
  1409.                         {% endif %})
  1410.                 get_and_update_time_details_for_attendance({% if session[UserConstants.USER_EMPLOYEE_ID] is defined %}
  1411.                         {{ session[UserConstants.USER_EMPLOYEE_ID] }}
  1412.                         {% else %}
  1413.                         {{ 0 }}
  1414.                         {% endif %})
  1415.             })
  1416.             function get_and_update_menu_calendar_according_to_holiday_calendar(calendarId) {
  1417.                 var to_get_calendar_id = 0;
  1418.                 if (calendarId !== undefined)
  1419.                     to_get_calendar_id = calendarId;
  1420.                 if (to_get_calendar_id == '' || to_get_calendar_id == 0) {
  1421.                     return;
  1422.                 }
  1423.                 jQuery.get(BaseURL + "get_holiday_details/" + to_get_calendar_id, function (data) {
  1424.                     //    console.log(data);
  1425.                     if (data.success == true) {
  1426.                         $('#menuCalendar').fullCalendar('removeEvents');
  1427.                         menuCalendarRow = 1;
  1428.                         var entry = data.holidayList;
  1429.                         for (var i = 0; i < entry.length; i++) {
  1430.                             var sdateStr = entry[i]['startDate'];
  1431.                             var edateStr = entry[i]['endDate'];
  1432.                             var sdate = new Date(sdateStr);
  1433.                             var edate = new Date(edateStr);
  1434.                             var title = entry[i]['title'];
  1435.                             var date = 0;
  1436.                             menuCalendarRow = menuCalendarRow + 1;
  1437.                             var originalEventObject = $(window.MenuCalendar).data('eventObject');
  1438.                             // we need to copy it, so that multiple events don't have a reference to the same object
  1439.                             var copiedEventObject = $.extend({}, originalEventObject);
  1440.                             // assign it the date that was reported
  1441.                             copiedEventObject.id = menuCalendarRow;
  1442.                             copiedEventObject.start = new Date(sdateStr);
  1443.                             copiedEventObject.end = new Date(edateStr + ' 00:00:00');
  1444.                             copiedEventObject.allDay = 1;
  1445.                             copiedEventObject.title = title;
  1446.                             $('#menuCalendar').fullCalendar('renderEvent', copiedEventObject, true);
  1447.                         }
  1448.                     }
  1449.                 });
  1450.             }
  1451.             function get_and_update_time_details_for_attendance(employee_id) {
  1452.                 employee_id = employee_id||0;
  1453.                 if (employee_id == '' || employee_id == 0) {
  1454.                     return;
  1455.                 }
  1456.                 $.post(BaseURL + 'attendance_report', {
  1457.                             start_date:'{{ ''|date('F d, Y') }}',
  1458.                             end_date:'{{ ''|date('F d, Y') }}',
  1459.                             employes:employee_id,
  1460.                             returnJson:1,
  1461.                             considerCurrTsIfNoOut:1,
  1462.                         })
  1463.                         .done(function (data) {
  1464.                                 console.log(data)
  1465.                             var sec_diff=0;
  1466.                             var workSecNeededToClearStrike=0;
  1467.                             if (typeof data.firstData.secForThis !== 'undefined')
  1468.                                     sec_diff=1*data.firstData.secForThis;
  1469.                             if (typeof data.firstData.workSecNeededToClearStrike !== 'undefined')
  1470.                                 workSecNeededToClearStrike=1*data.firstData.workSecNeededToClearStrike;
  1471.                             var hour_here=Math.floor(sec_diff/3600);
  1472.                             var min_here=Math.floor((sec_diff%3600)/60);
  1473.                             var sec_here=Math.floor((sec_diff%60));
  1474. //                    $(elem).text(hour_here.padStart(2, 0)+':'+min_here.padStart(2, 0))
  1475.                             $('.current_total_work_done').text((hour_here.toString()).padStart(2, 0)+':'+
  1476.                                     (min_here.toString()).padStart(2, 0)
  1477.                                     +':'+(sec_here.toString()).padStart(2, 0)
  1478.                             )
  1479.                             hour_here=Math.floor(workSecNeededToClearStrike/3600);
  1480.                              min_here=Math.floor((workSecNeededToClearStrike%3600)/60);
  1481.                             sec_here=Math.floor((workSecNeededToClearStrike%60));
  1482. //                    $(elem).text(hour_here.padStart(2, 0)+':'+min_here.padStart(2, 0))
  1483.                             $('.current_total_addtional_work_needed').text('+'+(hour_here.toString()).padStart(2, 0)+':'+
  1484.                                     (min_here.toString()).padStart(2, 0)
  1485.                                     +':'+(sec_here.toString()).padStart(2, 0)
  1486.                             )
  1487.                             //jQuery('.SelectedProductDetails').html(data.content);
  1488.                         })
  1489.                         .fail(function () {
  1490.                         });
  1491.             }
  1492.         });
  1493.         {% endif %}
  1494.     </script>
  1495. {% endif %}
  1496. </body>
  1497. {% include '@Application/modals/input_forms/selectEntityModal.html.twig' %}