{# <script src="{{ asset('condensed_assets/javascript.js',) }}"></script> #}
{# {{ dump( constant('ApplicationBundle\\Constants\\GeneralConstant::NOTIFICATION_SERVER')) }}; #}
<script>
var socketKeepAliveCall = {};
var lastActivityTs = 0;
var socket = '';
var socket_user_name = '{{ (session[UserConstants.USER_NAME] is defined)?session[UserConstants.USER_NAME]:'' }}';
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]:'' }}';
var socket_company_id = '{{ (session[UserConstants.USER_COMPANY_ID] is defined)?session[UserConstants.USER_COMPANY_ID]:'' }}';
var socket_app_id = '{{ (session[UserConstants.USER_APP_ID] is defined)?session[UserConstants.USER_APP_ID]:'' }}';
var socket_user_positions ={{ (session[UserConstants.USER_POSITION_LIST] is defined)?session[UserConstants.USER_POSITION_LIST]|json_encode()|raw:"\"[]\"" }};
var current_user_user_id = {{ session[UserConstants.USER_ID] is defined? session[UserConstants.USER_ID]:0 }};
var socket_user_session_token = '{{ session['token'] is defined? session['token']:'_GEN_' }}';
function addCommas(nStr) {
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
{% if session[UserConstants.USER_ID] is defined %}
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' }};
var currentPlanningItemId ={{ session[UserConstants.USER_CURRENT_PLANNING_ITEM_ID] is defined?
(session[UserConstants.USER_CURRENT_PLANNING_ITEM_ID] is null?'0':session[UserConstants.USER_CURRENT_PLANNING_ITEM_ID]): '0' }};
var currentLastStartTs=0;
// alert(currentPlanningItemId)
function refreshPendingTaskDiv() {
var pika_ind_id = '_NOPE_'
$.ajax({
url: BaseURL + "get_pending_approval_list_for_user",
type: 'POST',
dataType: 'json',
data: {},
error: function () {
// callback();
},
success: function (res) {
$('.pending_task_div .body').html('');
// callback(res.data);
if (res.pending_approval_list.length == 0 && res.override_approval_list.length == 0) {
$('.pending_task_div .body').html(
'<blockquote class="m-b-25"><p>Great! No Pending Tasks</p><footer><cite title="Source Title">The News Bee</cite></footer></blockquote>'
)
} else {
$('.pending_task_div .body').html(
'<div class="table-responsive"><table class="table table-hover table-condensed dashboard-task-infos">' +
'<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>'
)
var ind = 0;
var pending_approval_list = res.pending_approval_list;
var override_approval_list = res.override_approval_list;
$('.pending_task_trigger .body .alert-callout').html('');
$('.pending_task_trigger .body .alert-callout').html(
' <strong class="pull-right text-warning text-lg">' +
'' + (pending_approval_list.length + override_approval_list.length) + '' +
' <i class="material-icons">playlist_add_check</i></strong> ' +
'<strong class="text-xl number count-to-amount-specific" data-from="0" ' +
'data-to="' + (pending_approval_list.length + override_approval_list.length) + '" ' +
'data-speed="1000" data-fresh-interval="20">' + (pending_approval_list.length + override_approval_list.length) + ' </strong> <br> ' +
'<span class="opacity-50">PENDING TASKS</span>'
)
for (var lipi = 0; lipi < pending_approval_list.length; lipi++) {
var item = pending_approval_list[lipi];
ind = ind + 1;
$('.pending_task_div .body .dashboard-task-infos tbody').append(
'<tr class="pending_row_' + item.entity + '_' + item.entityId + '">' +
'<td>' + ind + '</td>' +
'<td>' + item.documentHash + '</td>' +
'<td>' + item.createdBy + '</td>' +
'<td><span class="label bg-orange" style="background: orange;">Pending Approval</span></td>' +
'<td>' + item.entityAlias + '</td>' +
'<td style="text-align: right;">' + (item.amount == '' ? '' : addCommas((1 * item.amount).toFixed(2))) + '</td>' +
'<td style="text-align: right;">' +
'<div class="btn-group ">' +
'<button type="button"' +
'class="btn ink-reaction btn-sm btn-primary dropdown-toggle waves-effect"' +
'data-toggle="dropdown">' +
'Action <i class="fa fa-caret-down"></i>' +
'</button>' +
'<ul class="dropdown-menu animation-expand"' +
'style=""' +
'role="menu">' +
'<li><a href="' + item.viewPathAbs + '/' + item.entityId + '"> View</a></li> ' +
'<li><a href="#" class="trigger_approval_btn"' +
'data-toggle="modal"' +
'data-entity="' + item.entity + '"' +
'data-entity-id="' + item.entityId + '"' +
'data-approval-id="' + item.approvalId + '"' +
'data-target="#approveDocument">Approve</a></li>' +
'</ul>' +
'</div>' +
'</td>' +
'</tr>');
}
for (var lipi = 0; lipi < override_approval_list.length; lipi++) {
var item = override_approval_list[lipi];
ind = ind + 1;
$('.pending_task_div .body .dashboard-task-infos tbody').append(
'<tr class="pending_row_' + item.entity + '_' + item.entityId + '">' +
'<td>' + ind + '</td>' +
'<td>' + item.documentHash + '</td>' +
'<td>' + item.createdBy + '</td>' +
'<td><span class="label bg-orange" style="background: orange;">Override</span></td>' +
'<td>' + item.entityAlias + '</td>' +
'<td style="text-align: right;"> ' + (item.amount == '' ? '' : addCommas((1 * item.amount).toFixed(2))) + '</td>' +
'<td style="text-align: right;">' +
'<div class="btn-group ">' +
'<button type="button" ' +
'class="btn ink-reaction btn-sm btn-primary dropdown-toggle waves-effect" ' +
'data-toggle="dropdown"> ' +
'Action <i class="fa fa-caret-down"></i> ' +
'</button>' +
'<ul class="dropdown-menu animation-expand"' +
'style="" ' +
'role="menu"> ' +
'<li><a href="' + item.viewPathAbs + '/' + item.entityId + '"> View</a></li> ' +
'<li><a href="#" class="trigger_approval_btn" ' +
'data-toggle="modal" ' +
'data-entity="' + item.entity + '" ' +
'data-entity-id="' + item.entityId + '" ' +
'data-approval-id="' + item.approvalId + '" ' +
'data-target="#approveDocument">Approve</a></li> ' +
'</ul> ' +
'</div> ' +
'</td> ' +
'</tr> ');
}
$('.count-to-amount-specific').countTo(
{
formatter: function (value, options) {
// value=value.split('৳')[1];
// return '৳' + value.toFixed(2).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, ',');
// // console.log(value)
// // console.log('৳' + value.toFixed(2).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,'))
// return '৳' + value.toFixed(0).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
// return '৳ ' + abbreviateNumber(value.toFixed(0));
return abbreviateNumber(value.toFixed(0));
}
}
);
}
// alert('pika master')
}
});
}
function RefreshAppListOnMenu() {
$.post('{{ url('get_app_list_from_central_server') }}', {
appIds: {{ session[UserConstants.USER_APP_ID_LIST] is defined?(session[UserConstants.USER_APP_ID_LIST]|json_encode|raw ): '[]' }},
})
.done(function (data) {
var dataArray = $.map(data, function (value, index) {
return [value];
});
// console.log(dataArray);
$('.this_is_company').remove()
for (var koka = dataArray.length - 1; koka >= 0; koka--) {
var currAppData = dataArray[koka]
{# $('.company_list_here').after( #}
{# '<li class="this_is_company"> ' + #}
{# '<a href="{{ url('change_company_dashboard') }}/'+currAppData['appId']+'"> <i class="fa fa-building"></i> '+ #}
{# (currAppData['name'].length>15?(currAppData['name'].slice(0, 15)+'...'):currAppData['name'])+'</a>' + #}
{# ' </li>'); #}
// TEMP FOR NOW
$('.company_list_here').after(
'<li class="this_is_company"> ' +
'<a href="{{ url('change_company_dashboard') }}/1"> <i class="fa fa-building"></i> ' +
(currAppData['name'].length > 15 ? (currAppData['name'].slice(0, 15) + '...') : currAppData['name']) + '</a>' +
' </li>')
}
})
.fail(function () {
});
}
function ListAvailableTaskOnMenu() {
// if (!query.length) return // callback();
var query = '_EMPTY_';
var pika_ind_id = '_NOPE_'
$.ajax({
url: BaseURL + "select_data_ajax",
type: 'POST',
dataType: 'json',
data: {
//returnJson: 1,
//sessionData: sessionData
query: query,
tableName: "planning_item",
valueField: "id",
textField: "item_alias",
entity_group: 0,
selectorId: pika_ind_id,
isMultiple: 0,
dataId: pika_ind_id,
// isMultiple: 0,
//textField: "rendered_text",
//
// renderTextFormat: "# __value__ __name__",
andConditions: [],
andOrConditions: [
{type: "like", field: "name", value: query},
],
mustConditions: [
{
type: "=",
field: "assigned_to",
value: {{ session[UserConstants.USER_EMPLOYEE_ID] is defined?session[UserConstants.USER_EMPLOYEE_ID]: '-1' }}},
{type: "!=", field: "has_child", value: 1},
// {type: "in", field: "user_type", value: [1,2,5]},
],
joinTableData: [
{
tableName: "project",
joinFieldPrimary: "project_id",
joinOn: 'project_id',
tableJoinType: 'left join',
// fieldJoinType: '=',
// selectPrefix: '',
selectFieldList: [
'project_name'
]
},
{
tableName: "project",
joinFieldPrimary: "project_id",
joinOn: 'project_id',
tableJoinType: 'left join',
// fieldJoinType: '=',
// selectPrefix: '',
selectFieldList: [
'project_name'
]
},
{
tableName: "task_log",
joinFieldPrimary: "id",
joinOn: 'planning_item_id',
tableJoinType: 'left join',
fieldJoinType: '=',
selectPrefix: 'task_',
joinAndConditions:[
{type: "=", field: "working_status", value: 1},
],
selectFieldList: [
'id','actual_start_ts','working_status'
]
},
// {
// tableName: "acc_clients",
// joinFieldPrimary: "client_id",
// joinOn: 'client_id',
// tableJoinType: 'join',
// // fieldJoinType: '=',
// // selectPrefix: 'client_',
// selectFieldList: [
// 'client_name'
//
// ]
// },
],
convertToObject: [
// 'accessories', 'issues'
],
skipDefaultCompanyId: 1
// setDataForSingle: 1,
},
error: function () {
// callback();
},
success: function (res) {
// callback(res.data);
console.log(res.data)
// alert(currentPlanningItemId)
// alert(currentTaskId)
$('.assigned_task_list_here').empty()
var project_ids = [0]
var div_by_project = {
0: {
project_name: 'General',
divList: []
}
};
for (var koka = 0; koka < res.data.length; koka++) {
var currTaskData = res.data[koka]
if(currTaskData['task_working_status']==1 && currTaskData['task_id']==currentTaskId)
{
currentLastStartTs=currTaskData['task_actual_start_ts']
}
if (currTaskData['project_id'] == null || currTaskData['project_id'] == '')
currTaskData['project_id'] = 0;
if (typeof div_by_project[currTaskData['project_id']] !== 'undefined') {
} else {
project_ids.push(currTaskData['project_id'])
div_by_project[currTaskData['project_id']] = {
project_name: currTaskData['project_name'],
divList: []
}
}
{# $('.company_list_here').after( #}
{# '<li class="this_is_company"> ' + #}
{# '<a href="{{ url('change_company_dashboard') }}/'+currAppData['appId']+'"> <i class="fa fa-building"></i> '+ #}
{# (currAppData['name'].length>15?(currAppData['name'].slice(0, 15)+'...'):currAppData['name'])+'</a>' + #}
{# ' </li>'); #}
// TEMP FOR NOW
div_by_project[currTaskData['project_id']]['divList'].push('<li class="this_is_task task_planning_item_id_' + currTaskData['id'] + '"> ' +
'<a href="#" data-pid="' + currTaskData['id'] + '"> <i class="fa fa-building"></i> ' +
(currTaskData['item_alias'].length > 150 ? (currTaskData['item_alias'].slice(0, 150) + '...') : currTaskData['item_alias']) + '' +
// '<small>'+currTaskData['project_name']+'</small>'+
'</a>' +
' </li>')
{# $('.assigned_task_list_here').after( #}
{# '<li class="this_is_task"> ' + #}
{# '<a href="{{ url('change_company_dashboard') }}/1"> <i class="fa fa-building"></i> '+ #}
{# (currTaskData['item_alias'].length>15?(currTaskData['item_alias'].slice(0, 15)+'...'):currTaskData['item_alias'])+'' + #}
{# '<small>'+currTaskData['project_name']+'</small>'+ #}
{# '</a>' + #}
{# ' </li>') #}
}
for (var koka = 0; koka < project_ids.length; koka++) {
var prj_id = project_ids[koka];
$('.assigned_task_list_here').append(
'<li class="dropdown-header ">' + div_by_project[prj_id]['project_name'] + '</li>'
);
for (var loka = 0; loka < div_by_project[prj_id]['divList'].length; loka++) {
$('.assigned_task_list_here').append(
div_by_project[prj_id]['divList'][loka]
);
}
}
SetActiveTaskOnMenu(currentTaskId, currentPlanningItemId,currentLastStartTs);
// alert('pika master')
}
});
}
function ChangeActiveTaskOnMenu(taskId, planningItemId) {
// EndCurrentTaskOnMenu();
StartNewTaskOnMenu(taskId, planningItemId);
}
function SetActiveTaskOnMenu(taskId, planningItemId,actualStartTs) {
// taskId = taskId || currentTaskId;
// planningItemId = planningItemId || currentPlanningItemId;
// alert(planningItemId)
actualStartTs=actualStartTs||0;
$('.this_is_task').removeClass('active');
if (planningItemId != 0 && planningItemId != '') {
$('.task_planning_item_id_' + planningItemId).addClass('active');
$('.assigned_task_list_cont .profile-info').html($('.task_planning_item_id_' + planningItemId + ' a').text()+'' + '<small>' +
'<b class="clock_update" data-start-ts="'+actualStartTs+'">00:00</b></small>')
} else {
$('.assigned_task_list_cont .profile-info').html('Select Task <small>Unselected</small>')
}
// $('.assigned_task_list_cont .profile-info').html('General Task<small>Current</small>')
}
function EndCurrentTaskOnMenu() {
var curr_ts = moment().unix();
var this_user_id = {{ session[UserConstants.USER_ID] }};
var this_employee_id = {{ session[UserConstants.USER_EMPLOYEE_ID] }};
$.ajax({
url: BaseURL + "insert_data_ajax_with_session",
type: 'POST',
dataType: 'json',
data: {
entity_group: 0,
dataToAdd: [
{
entityName: 'TaskLog',
idField: 'id',
// findByField: 'planningItemId',
returnRefIndex: 'id',
findId: 0,
noCreation: 1,
// findByValue: planningItemId,
preAdditionalSql: 'UPDATE task_log set working_status=2, actual_end_ts=' + curr_ts + ' where working_status=1 and user_id= '+this_user_id+';',
dataFields: [
// {field: 'planningItemId', value: planningItemId, type: '_VALUE_'},
// {field: 'userId', value: this_user_id, type: '_VALUE_'},
// {field: 'workingStatus', value: 1, type: '_VALUE_'},
// {field: 'actualStartTs', value: curr_ts, type: '_VALUE_'},
// {field: 'completionPercentage', value: 0, type: '_VALUE_'},
],
additionalSql: '',
}
]
},
error: function () {
// callback();
},
success: function (res) {
currentTaskId = 0;
currentPlanningItemId = 0;
SetActiveTaskOnMenu(currentTaskId, currentPlanningItemId);
}
});
}
function StartNewTaskOnMenu(taskId, planningItemId) {
var curr_ts = moment().unix();
var this_user_id = {{ session[UserConstants.USER_ID] }};
$.ajax({
url: BaseURL + "insert_data_ajax_with_session",
type: 'POST',
dataType: 'json',
data: {
entity_group: 0,
dataToAdd: [
{
entityName: 'TaskLog',
idField: 'id',
// findByField: 'planningItemId',
returnRefIndex: 'id',
findId: 0,
// findByValue: planningItemId,
preAdditionalSql: 'UPDATE task_log set working_status=2, actual_end_ts=' + curr_ts + ' where working_status=1 and user_id= '+this_user_id+';;',
dataFields: [
{field: 'planningItemId', value: planningItemId, type: '_VALUE_'},
{field: 'userId', value: this_user_id, type: '_VALUE_'},
{field: 'workingStatus', value: 1, type: '_VALUE_'},
{field: 'actualStartTs', value: curr_ts, type: '_VALUE_'},
// {field: 'completionPercentage', value: 0, type: '_VALUE_'},
],
additionalSql: '',
}
]
},
error: function () {
// callback();
},
success: function (res) {
if (typeof res.updatedDataList[0] !== 'undefined') {
var relatedDataCamelcase = res.updatedDataList[0];
currentTaskId = relatedDataCamelcase['id'];
currentPlanningItemId = relatedDataCamelcase['planningItemId'];
SetActiveTaskOnMenu(currentTaskId, currentPlanningItemId,relatedDataCamelcase['actualStartTs']);
}
}
});
}
{% endif %}
</script>
{% if not include_html is defined %}
{% set include_html=1 %}
{% if app.request.request.get('skipHTML') !='' %}
{% set include_html= 0 %}
{% endif %}
{% endif %}
{% if include_html!=1 %}
<script src="{{ absolute_url(path('dashboard')) }}condensed_assets/javascript_codecovers_minimal.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
<script src="{{ absolute_url(path('dashboard')) }}js/jquery.editable.min.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
<script src="{{ absolute_url(path('dashboard')) }}condensed_assets/moment_timezone.min.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
<script>
var approveDocumentForwardUserListSelector = {};
$(document).ready(function () {
if (typeof initiate_comment_box_snippet !== 'undefined') {
initiate_comment_box_snippet();
}
$('.modal').on('shown.bs.modal', function () {
$(document).off('focusin.modal');
});
if (!window.isElectron) {
$('#turn_off_button').hide();
$('.close_window').hide();
// window.ipcRenderer.send('exit_app', 'hello')
//window.ipcRenderer.on('pong', function(event, msg){// console.log(msg)} )
}
$('input[type=radio][name=approvalAction]').change(function () {
if (this.value == '3') {
$("#forward_doc_div").show()
} else {
$("#forward_doc_div").hide()
}
});
$('#forward_doc_check_label').click(function () {
$('#forward_doc_check').prop("checked", true);
$("#forward_doc_div").show()
});
});
</script>
{% endif %}
{% if include_html==1 %}
<script>
{# alert({{ app.request.request.get('skipHTML')}}) #}
if (typeof module === 'object') {
window.module = module;
module = undefined;
}
</script>
<link rel="stylesheet" href="{{ absolute_url(path('dashboard')) }}js/adminbsb/plugins/sweetalert/sweetalert.css">
<script src="{{ absolute_url(path('dashboard')) }}condensed_assets/javascript_codecovers.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
<script src="{{ absolute_url(path('dashboard')) }}condensed_assets/moment_timezone.min.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
<script src="{{ absolute_url(path('dashboard')) }}condensed_assets/ifvisible.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
{# <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script> #}
{# <!--<script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/plugins/bootstrap-select/js/bootstrap-select.js"></script>--> #}
{# <script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/plugins/jquery-slimscroll/jquery.slimscroll.js"></script> #}
{# <script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/plugins/node-waves/waves.js"></script> #}
{# <script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/plugins/jquery-countto/jquery.countTo.js"></script> #}
<script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/plugins/sweetalert/sweetalert.min.js"></script>
<script src="{{ absolute_url(path('dashboard')) }}js/jquery.editable.min.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
{# <script type="text/javascript" src="{{ absolute_url(path('dashboard')) }}condensed_assets/DataTables/datatables.min.js"></script> #}
<script src="{{ asset('jqueryui/jquery-ui.js') }}"></script>
{% if not new_calendar_version is defined %}
{% set new_calendar_version=0 %}
{% endif %}
{% if new_calendar_version==0 %}
<script src="{{ asset('js/fullcalendar.min.js') }}"></script>
{% endif %}
{# <script src="{{ absolute_url(path('dashboard')) }}condensed_assets/fullCalendar5/lib/main.min.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script> #}
<!--<script src="js/adminbsb/plugins/materialize-css/js/materialize.js"></script>-->
{# <script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/js/admin.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script> #}
<style>
/*.accessible-menu li*/
.treeview {
/*border: 1px solid;*/
/*border-color: #bcaaa4;*/
/*border-radius: 4px;*/
}
body {
/*text-transform: uppercase;*/
}
.sf-toolbar {
/*display: none !important;*/
}
.noty_bar.noty_type_error .noty_message {
text-align: center;
padding: 18px 23px;
width: auto;
position: relative;
font-weight: bold;
font-size: 1.75rem;
}
</style>
<!--
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" ></script>
<script src="https://unpkg.com/popper.js@1.12.6/dist/umd/popper.js" ></script>
<script src="https://unpkg.com/bootstrap-material-design@4.1.1/dist/js/bootstrap-material-design.js" ></script>
-->
<!--<script>$(document).ready(function() { $('body').bootstrapMaterialDesign(); });</script>-->
{# <!--<script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/js/pages/index.js"></script>--> #}
{# <!--<script src="{{ absolute_url(path('dashboard')) }}js/adminbsb/js/demo.js"></script>--> #}
<script>
function generateFileSmallView(fileDataList, as_thick_box) {
fileDataList = fileDataList || [];
as_thick_box = as_thick_box || 0;
var str = '';
if (fileDataList.length != 0) {
for (var hope = 0; hope < fileDataList.length; hope++) {
if ((fileDataList[hope].fileType).indexOf('pdf') != -1 || (fileDataList[hope].fileName).indexOf('pdf') != -1) {
str += ' <div class="box-selector sm_th col-md-3 col-sm-6" > <div class="inside"> ' +
'<div class="img" href="' + fileDataList[hope].fullPath + '" style="' +
'background:url(\' ' + fileDataList[hope].fullPath + '\');' +
'height: 50px !important;' +
'width: 100%;' +
'background-position: center;' +
'background-size: contain;' +
'background-repeat: no-repeat;"> </div> <h6 class="title" style="height: 2rem;">' + (typeof fileDataList['skipName'] !== 'undefined' ? fileDataList[hope].fileName : '') + '</h6>' +
'</div></div>'
} else if ((fileDataList[hope].fileType).indexOf('image') != -1 || (fileDataList[hope].fileName).indexOf('jpeg') != -1
|| (fileDataList[hope].fileName).indexOf('png') != -1 || (fileDataList[hope].fileName).indexOf('jpg') != -1
) {
str += ' <div class="box-selector sm_th col-md-3 col-sm-6" > <div class="inside"> ' +
'<div class="img" href="' + fileDataList[hope].fullPath + '" style="' +
"background:url(' " + fileDataList[hope].fullPath + "');" +
'height: 50px !important;' +
'width: 100%;' +
'background-position: center;' +
'background-size: contain;' +
'background-repeat: no-repeat;"> </div> <h6 class="title" style="height: 2rem;">' + (typeof fileDataList['skipName'] !== 'undefined' ? fileDataList[hope].fileName : '') + '</h6>' +
'</div></div>'
} else
str += ' <div class="box-selector sm_th col-md-3 col-sm-6" > <div class="inside"> ' +
'<div class="img" href="' + fileDataList[hope].fullPath + '" style="' +
"background:url('" + fileDataList[hope].fullPath + "');" +
'height: 50px !important;' +
'width: 100%;' +
'background-position: center;' +
'background-size: contain;' +
'background-repeat: no-repeat;"> </div> <h6 class="title" style="height: 2rem;">' + (typeof fileDataList['skipName'] !== 'undefined' ? fileDataList[hope].fileName : '') + '</h6>' +
'</div></div>'
}
}
// // console.log('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPPPPPPPPPPPPPPPPPPPPPP')
// // console.log(str)
// // console.log(fileDataList)
return str;
}
{# var BaseURL='{{ url('dashboard') }}'; #}
{% set foo = url('dashboard')|split(':') %}
// console.log('{{ foo|length }}');
{% if foo|length ==3 %}
{% set url_wo_port=foo[0]~':'~foo[1] %}
{# // console.log('{{ 'length 3' }}'); #}
{# // console.log('{{ url_wo_port }}'); #}
{% elseif foo|length ==2 %}
{% set url_wo_port=foo[0]~':' %}
{% set bar=foo[1]|split('/') %}
{# // console.log('{{ url_wo_port }}'); #}
{# // console.log('{{ bar|json_encode()|raw() }}'); #}
{% for indu,gg in bar %}
{# // console.log('index {{ indu }}') #}
{# // console.log('will append {{ gg }}') #}
{% if indu <((bar|length)-1) and indu!=0 %}
{% set url_wo_port=url_wo_port~'/'~gg %}
{# // console.log('appended {{ gg }}') #}
{% endif %}
{# // console.log('{{ url_wo_port }}'); #}
{% endfor %}
{% endif %}
// var url_without_port=BaseURL.split(':')[0]+':'+BaseURL.split(':')[1]
{# var DATE_BAR_START="{{ session.userCompanyOpeningYear }}-01-01"
var DATE_BAR_END="{{ 'now' | date('Y-m-d') }}" #}
</script>
{# the one in constant is the forced one #}
{% if constant('ApplicationBundle\\Constants\\GeneralConstant::NOTIFICATION_ENABLED')==1 %}
{# now check softone #}
{% if notification_enabled==1 %}
{% if session[UserConstants.USER_ID] is defined %}
{% if 'localhost:' in notification_server %}
{% set notification_server_full = url_wo_port ~':'~ notification_server|split('localhost:')[1] %}
{% else %}
{% if 'https://' in notification_server or 'http://' in notification_server %}
{% set notification_server_full =notification_server %}
{% else %}
{% set notification_server_full = 'https://'~notification_server %}
{% endif %}
{% endif %}
<script type="text/javascript">
// // console.log(io)
function refreshKeepAliveCall() {
socketKeepAliveCall = setInterval(function () {
var nowTs = moment().unix(),
differenceFromStartTime = meetingStartTime.diff(now), // 86400000;
differenceFromEndTime = meetingEndTime.diff(now); // 86400000;
if (nowTs - lastActivityTs > 60) {
clearInterval(socketKeepAliveCall);
} else {
socket.emit('update_my_socket', {
userId: socket_user_id,
token: socket_user_session_token,
});
}
//seconds
}, 30000)
}
// // console.log(io)
function initiateSocket() {
lastActivityTs = moment().unix();
$.getScript('{{ notification_server_full }}/socket.io/socket.io.js', function () {
{# $.getScript('{{ absolute_url(path('dashboard')) }}buddybee_assets/js/socket-io.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}', function () { #}
if (io) {
{# socket=io.connect( '{{ constant('ApplicationBundle\\Constants\\GeneralConstant::NOTIFICATION_SERVER') }}' ); #}
socket = io.connect('{{ notification_server_full }}');
socket.emit('update_my_socket', {
userId: socket_user_id,
token: socket_user_session_token,
user_status: '_ON_',
force_broadcast: 1,
});
{% if 1 %}
ifvisible.setIdleDuration(120);
ifvisible.onEvery(30, function () {
// // console.log('not idle')
socket.emit('update_my_socket', {
userId: socket_user_id,
token: socket_user_session_token,
});
});
ifvisible.idle(function () {
document.body.style.opacity = 0.5;
socket.emit('update_my_socket', {
userId: socket_user_id,
token: socket_user_session_token,
user_status: '_AWAY_',
force_broadcast: 1,
});
});
ifvisible.wakeup(function () {
document.body.style.opacity = 1;
socket.emit('update_my_socket', {
userId: socket_user_id,
token: socket_user_session_token,
user_status: '_ON_',
force_broadcast: 1,
});
});
{% endif %}
// socket.emit('update_my_socket', {
// userId: socket_user_id,
// token: socket_user_session_token,
// });
//
// socket.emit('trigger_socket',
// {
// sendType: 'all',
// emitMarker: '_SOCKET_NOTIFICATION_HERE_',
// dataObj: {
// userId: socket_user_id,
// token: socket_user_session_token,
// }
// });
if (typeof pageSocketInit !== 'undefined')
pageSocketInit();
socket.on('user_status_update', function (dataObj) {
// console.log(dataObj)
});
socket.on('_SOCKET_NOTIFICATION_HERE_', function (dataObj) {
// if (typeof dataObj.targetRoute !== 'undefined') {
// if (dataObj.targetRoute == 'consultancy_session')
// refreshUpcomingMeetingList();
// }
// console.log(dataObj)
});
// socket.on('refresh_upcoming_meeting_list', function (dataObj) {
// refreshUpcomingMeetingList();
// // console.log(dataObj)
//
// });
// console.log(socket);
}
});
}
</script>
{# <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> #}
<script type="text/javascript"
src="{{ notification_server_full }}/socket.io/socket.io.js"></script>
<script type="text/javascript">
</script>
<script src="{{ absolute_url(path('dashboard')) }}js/inno_notify.js?version={{ constant('ApplicationBundle\\Constants\\GeneralConstant::ENTITY_APP_VERSION') }}"></script>
{% endif %}
{% endif %}
{% endif %}
<script>
{% set left_panel_style='' %}
{% set curr_status_of_left_menu=1 %}
{% set content_panel_style='' %}
{% if session['HIDE_LEFT_PANEL'] is defined %}
{% if session['HIDE_LEFT_PANEL'] ==1 %}
{% set left_panel_style='display:none' %}
{% set curr_status_of_left_menu=0 %}
{% endif %}
{% endif %}
{# alert({{ curr_status_of_left_menu }}) #}
var curr_status_of_left_menu = "{{ curr_status_of_left_menu is defined? curr_status_of_left_menu:1 }}";
{% if session[UserConstants.USER_ID] is defined %}
var product_name_display_type = "{{ session[UserConstants.PRODUCT_NAME_DISPLAY_TYPE] }}";
{% endif %}
var autoApproveEcoDoc = 0;
$(document).ready(function () {
$('.change_app').click(function (ev) {
ev.preventDefault();
getUserCompanyList('_CENTRAL_')
// $('#selectEntityModal').modal('show');
// $('#selectEntityModal').modal('handleUpdate')
// selectEntityModal.show();
})
{% set curr_route=app.request.attributes.get('_route') %}
$('input.devAdminOnly').attr('readonly', false);
$('.inplaceEditForced').editable({
event: 'click',
callback: function (data) {
// console.log('Stopped editing ' + data.$el[0].nodeName);
// console.log('the el data ' + data.$el[0].dataset.setMethod);
// console.log(data);
var pika = `
class="inplaceEdit"
data-set-method="setStockTransferDate"
data-entity-name="StockTransfer"
data-entity-bundle="ApplicationBundle"
data-find-value="1"
data-find-field="stockTransferId"
data-field-type="_DATE_"
data-modify-trans-date="1"
`
if (data.content) {
// console.log('* The text was changed');
$.post('{{ url('update_inline_value') }}', {
// returnJson: 1,
// sessionData: sessionData
entityName: typeof data.$el[0].dataset.entityName !== 'undefined' ? data.$el[0].dataset.entityName : 'EntityApplicantDetails',
entityBundle: typeof data.$el[0].dataset.entityBundle !== 'undefined' ? data.$el[0].dataset.entityBundle : 'Application',
setValue: data.$el[0].outerText,
setMethod: data.$el[0].dataset.setMethod,
findValue: data.$el[0].dataset.findValue,
findField: typeof data.$el[0].dataset.findField !== 'undefined' ? data.$el[0].dataset.findField : 'applicantId',
modifyTransDateFlag: typeof data.$el[0].dataset.modifyTransDate !== 'undefined' ? data.$el[0].dataset.modifyTransDate : 0,
fieldType: typeof data.$el[0].dataset.fieldType !== 'undefined' ? data.$el[0].dataset.fieldType : '_TEXT_',
{# findValue: {{ consultantDetails.applicantId }}, #}
})
.done(function (data) {
// console.log(data);
if (data.success == true) {
swal({
title: "Sweet!",
text: "Updated",
imageUrl: BaseURL + "images/thumbs-up.png"
});
// alertify.success("Order Confirmation Done");
} else {
swal({
title: "Sorry!",
text: "Your Action failed !",
imageUrl: BaseURL + "images/Bee_Sad_Emote.png"
});
// alertify.success("Order Confirmation Failed");
// $('#barcode_selector_cont').waitMe('hide');
}
})
.fail(function () {
});
}
}
});
{% if app.session.get('devAdminMode') ==1 %}
$('.inplaceEdit .fa.fa-edit').show();
$('input.devAdminOnly').attr('readonly', true)
{% if session[UserConstants.USER_ID] is defined %}
$(document).on('click', '.company_selector a.dropdown-toggle', function () {
RefreshAppListOnMenu()
})
{% endif %}
$('.inplaceEdit').editable({
event: 'click',
callback: function (data) {
// console.log('Stopped editing ' + data.$el[0].nodeName);
// console.log('the el data ' + data.$el[0].dataset.setMethod);
// console.log(data);
var pika = `
class="inplaceEdit"
data-set-method="setStockTransferDate"
data-entity-name="StockTransfer"
data-entity-bundle="ApplicationBundle"
data-find-value="1"
data-find-field="stockTransferId"
data-field-type="_DATE_"
data-modify-trans-date="1"
`
if (data.content) {
// console.log('* The text was changed');
$.post('{{ url('update_inline_value') }}', {
// returnJson: 1,
// sessionData: sessionData
entityName: typeof data.$el[0].dataset.entityName !== 'undefined' ? data.$el[0].dataset.entityName : 'EntityApplicantDetails',
entityBundle: typeof data.$el[0].dataset.entityBundle !== 'undefined' ? data.$el[0].dataset.entityBundle : 'Application',
setValue: data.$el[0].outerText,
setMethod: data.$el[0].dataset.setMethod,
findValue: data.$el[0].dataset.findValue,
findField: typeof data.$el[0].dataset.findField !== 'undefined' ? data.$el[0].dataset.findField : 'applicantId',
modifyTransDateFlag: typeof data.$el[0].dataset.modifyTransDate !== 'undefined' ? data.$el[0].dataset.modifyTransDate : 0,
fieldType: typeof data.$el[0].dataset.fieldType !== 'undefined' ? data.$el[0].dataset.fieldType : '_TEXT_',
{# findValue: {{ consultantDetails.applicantId }}, #}
})
.done(function (data) {
// console.log(data);
if (data.success == true) {
swal({
title: "Sweet!",
text: "Updated",
imageUrl: BaseURL + "images/thumbs-up.png"
});
// alertify.success("Order Confirmation Done");
} else {
swal({
title: "Sorry!",
text: "Your Action failed !",
imageUrl: BaseURL + "images/Bee_Sad_Emote.png"
});
// alertify.success("Order Confirmation Failed");
// $('#barcode_selector_cont').waitMe('hide');
}
})
.fail(function () {
});
}
}
});
{% endif %}
{% if constant('ApplicationBundle\\Constants\\GeneralConstant::NOTIFICATION_ENABLED')==1 %}
{# now check softone #}
{% if notification_enabled==1 %}
{% if session[UserConstants.USER_ID] is defined %}
initiateSocket()
{% endif %}
{% endif %}
{% endif %}
$('.btn-file input[type="file"]').not('.show_images').change(function () {
if (!$(this).parents('label').parent().find('.file_names_text').length)
$(this).parents('label').parent().append('<p style="font-weight: bold" class="file_names_text"></p>')
var fileNameList = [];
for (var jj = 0; jj < $(this)[0].files.length; jj++)
fileNameList.push($(this)[0].files[jj].name)
// alert('pika')
// // console.log($(this)[0].files)
var fileNameText = '';
if (fileNameList.length != 0)
fileNameText = fileNameList.join(' , ')
if (!$(this).parents('label').parent().find('.file_names_text').length)
$(this).parents('label').parent().append('<p style="font-weight: bold" class="file_names_text">' + fileNameText + '</p>')
else
$(this).parents('label').parent().find('.file_names_text').text(fileNameText)
});
$('.btn-file input[type="file"].show_images').change(function (e) {
if (!$(this).parents('label').parent().find('.file_names_text').length)
$(this).parents('label').parent().append('<p style="font-weight: bold" class="file_names_text"></p>')
var fileNameList = [];
var fileDataList = [];
for (var jj = 0; jj < $(this)[0].files.length; jj++) {
fileNameList.push($(this)[0].files[jj].name);
// console.log($(this)[0].files[jj].type)
fileDataList.push({
fullPath: URL.createObjectURL($(this)[0].files[jj]),
fileType: $(this)[0].files[jj].type,
fileName: $(this)[0].files[jj].name,
})
}
// // console.log($(this)[0].files)
// // // console.log(URL.createObjectURL($(this)[0].files[0]))
// var fileNameText = '';
// if (fileNameList.length != 0)
// fileNameText = fileNameList.join(' , ')
//
if (!$(this).parents('label').parent().find('.file_images_cont').length)
$(this).parents('label').parent().append('<div style="font-weight: bold" class="row file_images_cont">' + generateFileSmallView(fileDataList, 0) + '</div>')
else
$(this).parents('label').parent().find('.file_images_cont').html(generateFileSmallView(fileDataList, 0))
});
{% if session[UserConstants.USER_ID] is defined %}
if($('.assigned_task_list_here').length)
ListAvailableTaskOnMenu();
$(document).on('click', '.this_is_task a', function (e) {
e.preventDefault();
if ($(this).parent('li').hasClass('active')) {
// alert('Here')
EndCurrentTaskOnMenu()
} else
ChangeActiveTaskOnMenu(0, $(this).data('pid'))
});
function clock_update_on_menu()
{
var gg_cur_ts=moment().unix();
$('.clock_update').each(function(invu,elem){
var sec_diff=gg_cur_ts-1*$(elem).data('startTs');
var hour_here=Math.floor(sec_diff/3600);
var min_here=Math.floor((sec_diff%3600)/60);
var sec_here=Math.floor((sec_diff%60));
// $(elem).text(hour_here.padStart(2, 0)+':'+min_here.padStart(2, 0))
$(elem).text((hour_here.toString()).padStart(2, 0)+':'+(min_here.toString()).padStart(2, 0)+':'+(sec_here.toString()).padStart(2, 0))
})
}
setInterval(clock_update_on_menu, 1000);
{% endif %}
var CURRENT_ROUTE = '{{ curr_route }}';
// function checkApprovalSubmit(){
// alert('MIA')
// return false;
// }
if ($('#approveDocument #approveDocumentForwardUserList').length) {
approveDocumentForwardUserListSelector = $('#approveDocument #approveDocumentForwardUserList').selectize({
placeholder: 'Select a user',
multiple: false,
// options: APTL.productListArray,
options: [],
valueField: 'value',
labelField: 'text',
preload: 'focus',
searchField: ['text', 'value'],
load: function (query, callback) {
// if (!query.length) return // callback();
if (!query.length) query = '_EMPTY_';
var pika_ind_id = $($(this)[0].$input["0"]).attr('data-id')
$.ajax({
url: BaseURL + "select_data_ajax",
type: 'POST',
dataType: 'json',
data: {
//returnJson: 1,
//sessionData: sessionData
query: query,
tableName: "sys_user",
valueField: "user_id",
textField: "rendered_text",
entity_group: 0,
selectorId: $($(this)[0].$input["0"]).attr('id'),
isMultiple: 0,
dataId: pika_ind_id,
// isMultiple: 0,
//textField: "rendered_text",
//
renderTextFormat: "# __value__ __name__",
andConditions: [],
andOrConditions: [
{type: "like", field: "name", value: query},
],
mustConditions: [
{type: "=", field: "status", value: 1},
{type: "in", field: "user_type", value: [1, 2, 5]},
],
joinTableData: [
// {
// tableName: "sys_department_position",
// joinFieldPrimary: "sys_department_position",
// joinOn: 'position_id',
// tableJoinType: 'left join',
// // fieldJoinType: '=',
// // selectPrefix: '',
// selectFieldList: [
// 'project_name'
//
// ]
// },
//
// {
// tableName: "acc_clients",
// joinFieldPrimary: "client_id",
// joinOn: 'client_id',
// tableJoinType: 'join',
// // fieldJoinType: '=',
// // selectPrefix: 'client_',
// selectFieldList: [
// 'client_name'
//
// ]
// },
],
convertToObject: [
// 'accessories', 'issues'
],
skipDefaultCompanyId: 1
// setDataForSingle: 1,
},
error: function () {
// callback();
},
success: function (res) {
callback(res.data);
if (res.setValueArray.length != 0 && res.selectorId != '') {
if (res.isMultiple == 1)
$('#' + res.selectorId).selectize()[0].selectize.setValue(res.setValueArray)
else
$('#' + res.selectorId).selectize()[0].selectize.setValue(res.setValue)
}
// alert('pika master')
}
});
},
onChange: function (value) {
}
})[0].selectize;
}
$(document).on('click', '.trigger_approval_btn', function () {
$('#approveDocument #approvalEntity').val($(this).data('entity'))
// $('#approveDocument #approvalRowId').val($(this).data('entity'))
$('#approveDocument #approvalEntityId').val($(this).data('entityId'))
$('#approveDocument #approvalId').val($(this).data('approvalId'))
})
$('.approval_submit').click(function (e) {
e.preventDefault();
if ($('#approveDocument input[name="approvalAction"]:checked').length) {
$('#approval_form').submit()
} else {
// alert('JOJO')
alertify.alert("Select an Approval Action!")
}
})
{% if app.request.query.get('autoApproveEcoDoc') !='' %}
autoApproveEcoDoc = 1;
$('.trigger_approval_btn').eq(0).trigger('click');
$('#approveDocument #radio1').prop('checked', true)
$('#approveDocument #approveDocumentApprovalHash').val('_eco_')
$('.approval_submit').trigger('click');
{% endif %}
{% if curr_route=='applicant_dashboard' or curr_route=='dashboard' %}
var globLsDataStr = window.localStorage.getItem('lsData');
var globLsData = {};
if (globLsDataStr != 'null' && globLsDataStr != null)
globLsData = JSON.parse(globLsDataStr);
// console.log(globLsData);
if (typeof globLsData['checkoutPending'] !== 'undefined') {
if (globLsData['checkoutPending'] == 1)
window.location.href = "{{ url('pricing_plan_page') }}?autoRedirected=1";
}
{% endif %}
if (typeof initiate_comment_box_snippet !== 'undefined') {
initiate_comment_box_snippet();
}
$('.modal').on('shown.bs.modal', function () {
$(document).off('focusin.modal');
});
$('a').each(function (index) {
var attr_href = $(this).attr('href');
// For some browsers, `attr` is undefined; for others,
// `attr` is false. Check for both.
if (typeof attr_href !== typeof undefined && attr_href !== false)
if (($(this).attr('href')).indexOf('print') != -1) {
$(this).attr('target', '_blank')
}
});
if (!window.isElectron) {
$('#turn_off_button').hide();
$('.close_window').hide();
// window.ipcRenderer.send('exit_app', 'hello')
//window.ipcRenderer.on('pong', function(event, msg){// console.log(msg)} )
}
if (window.isElectron) {
if (window.localStorage.getItem('full_screen_enabled') == null) {
openFullscreen();
}
window.ipcRenderer.on('update_message', function (event, text) {
alertify.alert(text);
// var container = document.getElementById('messages');
// var message = document.createElement('div');
// message.innerHTML = text;
// container.appendChild(message);
})
$("a[target='_blank']").attr('target', '_self');
$("form[target='_blank']").attr('target', '_self');
}
$('#turn_off_button').click(function (e) {
e.preventDefault();
// window.open('', '_self', '');
if (confirm('Are you sure to exit?') == true) {
if (window.isElectron) {
window.ipcRenderer.send('exit_app', 'hello')
//window.ipcRenderer.on('pong', function(event, msg){// console.log(msg)} )
}
}
});
$('.close_window').click(function (e) {
e.preventDefault();
// window.open('', '_self', '');
if (window.isElectron) {
window.ipcRenderer.send('close_window', 'hello') //no need to exit app
//window.ipcRenderer.on('pong', function(event, msg){// console.log(msg)} )
}
});
$(".leftMenuToggle").click(function () {
// alert(curr_status_of_left_menu);
// alert(curr_status_of_left_menu)
if (curr_status_of_left_menu == 0) {
$("section.content").css("margin-left", "265px");
$("#leftsidebar").show();
curr_status_of_left_menu = 1;
} else if (curr_status_of_left_menu == 1) {
$("section.content").css("margin-left", "59px");
$("#leftsidebar").hide();
curr_status_of_left_menu = 0;
}
jQuery.get(BaseURL + "change_left_panel_display_status", function (data) {
// jQuery('.SelectedSupplierDetails').html(data.content);
});
})
$('.dropdown-submenu a.expand_menu').on("click", function (e) {
// alert("here")
$('.dropdown-submenu a.expand_menu').next('ul').hide();
$(this).next('ul').toggle();
e.stopPropagation();
e.preventDefault();
});
});
{# var perSessionMinute={{ ConsultancyConstant.PER_SESSION_MINUTE }}; #}
var system_notice ={% set sys_notice=''|getSystemNotice %}
{% set appValiditySeconds='_UNSET_' %}
{% if session['appValiditySeconds'] is defined %}
{% set appValiditySeconds=session['appValiditySeconds'] %}
{% endif %}
{% if appValiditySeconds!='_UNSET_' %}
{% if appValiditySeconds <= (30*24*3600) %}
{% set leftDays = appValiditySeconds/(24*3600) %}
{% set appIsValidTillTime=session['appIsValidTillTime'] %}
{% 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'))~"!" %}
{% if leftDays <1 %}
{% set mod_str=mod_str~' --- Time Left: '~((appValiditySeconds/60)|number_format(0,'.',','))~' minute(s)' %}
{% else %}
{% set mod_str=mod_str~' ---- Time Left: '~(leftDays|number_format(0,'.',','))~' day(s)' %}
{% endif %}
noty({
text: "{{ mod_str }} ",
layout: 'bottom',
theme: 'defaultTheme', // or 'relax'
// theme: 'relax',
type: 'error',
// timeout: 100000,
timeout: false,
closeWith: ['click'],
animation: {
open: {height: 'toggle'}, // jQuery animate function property object
close: {height: 'toggle'}, // jQuery animate function property object
easing: 'swing', // easing
speed: 'slow' // opening & closing animation speed
},
callback: {
onShow: function () {
},
afterShow: function () {
},
onClose: function () {
},
afterClose: function () {
},
onCloseClick: function () {
// window.location.href=data.viewlink
//alert('clicked')
},
}
});
{% endif %}
{% endif %}
{% for dt in sys_notice %}
{# endDate and startDate are strings or DateTime objects #}
{% set difference = date(dt.countDownEnds).diff(date('')) %}
{% set leftDays = difference.days %}
{% set mod_str = dt.desc %}
{% if leftDays == 1 %}
{% set mod_str=mod_str~' --- Time Left: 1 day' %}
{% else %}
{% set mod_str=mod_str~' ---- Time Left: '~leftDays~' days' %}
{% endif %}
noty({
text: "{{ mod_str }} ",
layout: 'bottom',
// theme: 'defaultTheme', // or 'relax'
theme: 'relax',
type: 'warning',
// timeout: 100000,
timeout: false,
closeWith: ['click'],
animation: {
open: {height: 'toggle'}, // jQuery animate function property object
close: {height: 'toggle'}, // jQuery animate function property object
easing: 'swing', // easing
speed: 'slow' // opening & closing animation speed
},
callback: {
onShow: function () {
},
afterShow: function () {
},
onClose: function () {
},
afterClose: function () {
},
onCloseClick: function () {
// window.location.href=data.viewlink
//alert('clicked')
},
}
});
{% endfor %}
$(document).ready(function () {
$('input[type=radio][name=approvalAction]').change(function () {
if (this.value == '3') {
$("#forward_doc_div").show()
} else {
$("#forward_doc_div").hide()
}
});
$('#forward_doc_check_label').click(function () {
$('#forward_doc_check').prop("checked", true);
$("#forward_doc_div").show()
});
if ($('.pending_task_div').length) {
// // console.log('HHHHHHHHHHHHHHHHHHHH________________________________________EEEEEEEEEEEEEEEEEEEEEEEEEEE________________')
refreshPendingTaskDiv()
}
});
</script>
<script>
{% if new_calendar_version==0 %}
var MenuCalendar = function () {
// Create reference to this instance
var o = this;
// Initialize app when document is ready
};
var MP = MenuCalendar.prototype;
// =========================================================================
// INIT
// =========================================================================
MP.initialize = function () {
this._enableEvents();
this._initEventslist();
this._initCalendar();
this._displayDate();
};
// =========================================================================
// EVENTS
// =========================================================================
// events
MP._enableEvents = function () {
// alert('pola')
var o = this;
$('#menu-calendar-prev').on('click', function (e) {
// alert('lola')
o._handleCalendarPrevClick(e);
});
$('#menu-calendar-next').on('click', function (e) {
o._handleCalendarNextClick(e);
});
$('#menu-calendar-today').on('click', function (e) {
o._handleCalendarTodayClick(e);
});
$('.menu-calendar-holder .nav-tabs li').on('show.bs.tab', function (e) {
o._handleCalendarMode(e);
});
};
// =========================================================================
// CONTROLBAR
// =========================================================================
MP._handleCalendarPrevClick = function (e) {
$('#menuCalendar').fullCalendar('prev');
this._displayDate();
};
MP._handleCalendarNextClick = function (e) {
$('#menuCalendar').fullCalendar('next');
this._displayDate();
};
MP._handleCalendarTodayClick = function (e) {
$('#menuCalendar').fullCalendar('today');
this._displayDate();
};
MP._handleCalendarMode = function (e) {
$('#menuCalendar').fullCalendar('changeView', $(e.currentTarget).data('mode'));
};
MP._displayDate = function () {
var selectedDate = $('#menuCalendar').fullCalendar('getDate');
$('.menu-calendar-selected-day').html(moment(selectedDate).format("dddd"));
$('.menu-calendar-selected-date').html(moment(selectedDate).format("DD MMMM YYYY"));
$('.menu-calendar-selected-year').html(moment(selectedDate).format("YYYY"));
};
// =========================================================================
// TASKLIST
// =========================================================================
MP._initEventslist = function () {
if (!$.isFunction($.fn.draggable)) {
return;
}
var o = this;
$('.list-events li ').each(function () {
// create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
// it doesn't need to have a start or end
var eventObject = {
title: $.trim($(this).text()), // use the element's text as the event title
className: $.trim($(this).data('className'))
};
// store the Event Object in the DOM element so we can get to it later
$(this).data('eventObject', eventObject);
// make the event draggable using jQuery UI
$(this).draggable({
zIndex: 999,
revert: true, // will cause the event to go back to its
revertDuration: 0, // original position after the drag
});
});
};
// =========================================================================
// CALENDAR
// =========================================================================
MP._initCalendar = function (e) {
if (!$.isFunction($.fn.fullCalendar)) {
return;
}
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#menuCalendar').fullCalendar({
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
height: 700,
header: false,
editable: true,
eventStartEditable: true,
eventDurationEditable: true,
droppable: true,
drop: function (date, allDay) { // this function is called when something is dropped
// retrieve the dropped element's stored Event Object
var originalEventObject = $(this).data('eventObject');
// we need to copy it, so that multiple events don't have a reference to the same object
var copiedEventObject = $.extend({}, originalEventObject);
// assign it the date that was reported
copiedEventObject.start = date;
copiedEventObject.allDay = allDay;
copiedEventObject.className = originalEventObject.className;
// render the event on the calendar
// the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
$('#menuCalendar').fullCalendar('renderEvent', copiedEventObject, true);
// is the "remove after drop" checkbox checked?
if ($('#drop-remove').is(':checked')) {
// if so, remove the element from the "Draggable Events" list
$(this).remove();
}
},
{% if session[UserConstants.USER_HOLIDAY_LIST_CURRENT_MONTH] is defined %}
{% set currMonthHolidayList=session[UserConstants.USER_HOLIDAY_LIST_CURRENT_MONTH]|jsonDecode() %}
{% else %}
{% set currMonthHolidayList=[] %}
{% endif %}
events: {{ currMonthHolidayList|json_encode()|raw }},
eventRender: function (event, element) {
element.find('#date-title').html(element.find('span.fc-event-title').text());
}
});
};
window.MenuCalendar = new MenuCalendar;
var menuCalendarRow = 0;
$(document).ready(function () {
window.MenuCalendar.initialize();
$(document).on('click', '.menuCalendarTrigger', function () {
get_and_update_menu_calendar_according_to_holiday_calendar({% if session[UserConstants.USER_HOLIDAY_CALENDAR_ID] is defined %}
{{ session[UserConstants.USER_HOLIDAY_CALENDAR_ID] }}
{% else %}
{{ 0 }}
{% endif %})
get_and_update_time_details_for_attendance({% if session[UserConstants.USER_EMPLOYEE_ID] is defined %}
{{ session[UserConstants.USER_EMPLOYEE_ID] }}
{% else %}
{{ 0 }}
{% endif %})
})
function get_and_update_menu_calendar_according_to_holiday_calendar(calendarId) {
var to_get_calendar_id = 0;
if (calendarId !== undefined)
to_get_calendar_id = calendarId;
if (to_get_calendar_id == '' || to_get_calendar_id == 0) {
return;
}
jQuery.get(BaseURL + "get_holiday_details/" + to_get_calendar_id, function (data) {
// console.log(data);
if (data.success == true) {
$('#menuCalendar').fullCalendar('removeEvents');
menuCalendarRow = 1;
var entry = data.holidayList;
for (var i = 0; i < entry.length; i++) {
var sdateStr = entry[i]['startDate'];
var edateStr = entry[i]['endDate'];
var sdate = new Date(sdateStr);
var edate = new Date(edateStr);
var title = entry[i]['title'];
var date = 0;
menuCalendarRow = menuCalendarRow + 1;
var originalEventObject = $(window.MenuCalendar).data('eventObject');
// we need to copy it, so that multiple events don't have a reference to the same object
var copiedEventObject = $.extend({}, originalEventObject);
// assign it the date that was reported
copiedEventObject.id = menuCalendarRow;
copiedEventObject.start = new Date(sdateStr);
copiedEventObject.end = new Date(edateStr + ' 00:00:00');
copiedEventObject.allDay = 1;
copiedEventObject.title = title;
$('#menuCalendar').fullCalendar('renderEvent', copiedEventObject, true);
}
}
});
}
function get_and_update_time_details_for_attendance(employee_id) {
employee_id = employee_id||0;
if (employee_id == '' || employee_id == 0) {
return;
}
$.post(BaseURL + 'attendance_report', {
start_date:'{{ ''|date('F d, Y') }}',
end_date:'{{ ''|date('F d, Y') }}',
employes:employee_id,
returnJson:1,
considerCurrTsIfNoOut:1,
})
.done(function (data) {
console.log(data)
var sec_diff=0;
var workSecNeededToClearStrike=0;
if (typeof data.firstData.secForThis !== 'undefined')
sec_diff=1*data.firstData.secForThis;
if (typeof data.firstData.workSecNeededToClearStrike !== 'undefined')
workSecNeededToClearStrike=1*data.firstData.workSecNeededToClearStrike;
var hour_here=Math.floor(sec_diff/3600);
var min_here=Math.floor((sec_diff%3600)/60);
var sec_here=Math.floor((sec_diff%60));
// $(elem).text(hour_here.padStart(2, 0)+':'+min_here.padStart(2, 0))
$('.current_total_work_done').text((hour_here.toString()).padStart(2, 0)+':'+
(min_here.toString()).padStart(2, 0)
+':'+(sec_here.toString()).padStart(2, 0)
)
hour_here=Math.floor(workSecNeededToClearStrike/3600);
min_here=Math.floor((workSecNeededToClearStrike%3600)/60);
sec_here=Math.floor((workSecNeededToClearStrike%60));
// $(elem).text(hour_here.padStart(2, 0)+':'+min_here.padStart(2, 0))
$('.current_total_addtional_work_needed').text('+'+(hour_here.toString()).padStart(2, 0)+':'+
(min_here.toString()).padStart(2, 0)
+':'+(sec_here.toString()).padStart(2, 0)
)
//jQuery('.SelectedProductDetails').html(data.content);
})
.fail(function () {
});
}
});
{% endif %}
</script>
{% endif %}
</body>
{% include '@Application/modals/input_forms/selectEntityModal.html.twig' %}