{# <script src="{{ asset('condensed_assets/javascript.js',) }}"></script> #}
{# {{ dump( constant('ApplicationBundle\\Constants\\GeneralConstant::NOTIFICATION_SERVER')) }}; #}
<div class="modal fade" id="endTaskModal" tabindex="-1" aria-labelledby="endTaskModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="endTaskModalLabel">Confirm Task Completion</h5>
</div>
<div class="modal-body">
<p>Are you sure you want to end the current task?</p>
<div class="form-check">
<input class="form-check-input" type="radio" name="taskStatus" id="taskCompleted" value="completed" checked>
<label class="form-check-label" for="taskCompleted">
Completed
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="taskStatus" id="taskPending" value="pending">
<label class="form-check-label" for="taskPending">
Pending
</label>
</div>
<div class="mb-3" id="feedbackInput" style="display: none;">
<label for="taskFeedback" class="form-label">Feedback (optional):</label>
<textarea id="taskFeedback" class="form-control" rows="3" placeholder="Enter feedback here..."></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" id="confirmEndTask">End Task</button>
</div>
</div>
</div>
</div>
<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 check_filters_default() {
$('.filter_this').hide()
$('.filter_with_this').each(function () {
if ($(this).attr('type') == 'checkbox' && $(this).prop('checked') == false)
return;
if ($(this).attr('type') == 'radio' && $(this).is(':checked') == false)
return;
var selector_name = '.filter_' + ($(this).attr('id')) + '_' + $(this).val();
$(selector_name).show()
})
}
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;
var bulkApproveFlag = 0;
var pendingApprovalTable={};
function refreshPendingTaskDivOld() {
var pika_ind_id = '_NOPE_'
$.ajax({
url: BaseURL + "get_pending_approval_list_for_user",
type: 'POST',
dataType: 'json',
data: {},
error: function () {
},
success: function (res) {
$('.pending_task_div .body').html('');
if (res.total_pending_task_count == 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>'
)
$('.pending_task_trigger .body .alert-callout').html('');
$('.pending_task_trigger .body .alert-callout').html(
' <strong class="pull-right text-warning text-lg">' +
'' + (res.total_pending_task_count) + '' +
' <i class="material-icons">playlist_add_check</i></strong> ' +
'<strong class="text-xl number count-to-amount-specific" data-from="0" ' +
'data-to="' + (res.total_pending_task_count) + '" ' +
'data-speed="1000" data-fresh-interval="20">' + (res.total_pending_task_count) + ' </strong> <br> ' +
'<span class="opacity-50">PENDING TASKS</span>'
);
} else {
$('.pending_task_trigger .body .alert-callout').html('');
$('.pending_task_trigger .body .alert-callout').html(
' <strong class="pull-right text-warning text-lg">' +
'' + (res.total_pending_task_count) + '' +
' <i class="material-icons">playlist_add_check</i></strong> ' +
'<strong class="text-xl number count-to-amount-specific" data-from="0" ' +
'data-to="' + (res.total_pending_task_count) + '" ' +
'data-speed="1000" data-fresh-interval="20">' + (res.total_pending_task_count) + ' </strong> <br> ' +
'<span class="opacity-50">PENDING TASKS</span>'
);
for (var koko = 0; koko < res.applicable_entities.length; koko++) {
var applicableEntityId = 1*res.applicable_entities[koko];
var ind = 0;
$('.pending_task_div .body').append('<h4>'+res.entity_list_details[applicableEntityId]['entity_alias']+'</h4>'+
'<div class="table-responsive"><table class="table table-hover table-condensed dashboard-task-infos app_pending_for_'+applicableEntityId+'">' +
'<thead><tr>' +
'<th style="width: 5%;">#</th>' +
'<th style="width: 20%;">Document</th>' +
'<th style="width: 20%;">Created By</th>' +
'<th style="width: 10%;">Status</th>' +
'<th style="width: 15%;text-align: right;">Amount</th>' +
'<th style="width: 10%;text-align: right;">Action</th>' +
'</tr></thead><tbody></tbody></table> </div>'
)
var pending_approval_list = res.grouped_approval_list[applicableEntityId];
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.app_pending_for_'+applicableEntityId+' 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;">'+(item.required==2?'Override':'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 + '"> 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) {
return abbreviateNumber(value.toFixed(0));
}
}
);
}
}
});
}
function refreshPendingTaskDiv() {
var pika_ind_id = '_NOPE_'
$.ajax({
url: BaseURL + "get_pending_approval_list_for_user",
type: 'POST',
dataType: 'json',
data: {},
error: function () {
},
success: function (res) {
$('.pending_task_div .body').html('');
if (res.total_pending_task_count == 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>'
)
$('.pending_task_trigger .body .alert-callout').html('');
$('.pending_task_trigger .body .alert-callout').html(
' <strong class="pull-right text-warning text-lg">' +
'' + (res.total_pending_task_count) + '' +
' <i class="material-icons">playlist_add_check</i></strong> ' +
'<strong class="text-xl number count-to-amount-specific" data-from="0" ' +
'data-to="' + (res.total_pending_task_count) + '" ' +
'data-speed="1000" data-fresh-interval="20">' + (res.total_pending_task_count) + ' </strong> <br> ' +
'<span class="opacity-50">PENDING TASKS</span>'
);
} else {
$('.pending_task_trigger .body .alert-callout').html('');
$('.pending_task_trigger .body .alert-callout').html(
' <strong class="pull-right text-warning text-lg">' +
'' + (res.total_pending_task_count) + '' +
' <i class="material-icons">playlist_add_check</i></strong> ' +
'<strong class="text-xl number count-to-amount-specific" data-from="0" ' +
'data-to="' + (res.total_pending_task_count) + '" ' +
'data-speed="1000" data-fresh-interval="20">' + (res.total_pending_task_count) + ' </strong> <br> ' +
'<span class="opacity-50">PENDING TASKS</span>'
);
$('.pending_task_div .body').append(
'<div class="table-responsive"><table class="table table-hover generic_document_list_table table-condensed dashboard-task-infos app_pending_for_all">' +
'<thead><tr>' +
'<th style="width: 5%;"> </th>' +
'<th style="width: 5%;">#</th>' +
'<th style="width: 20%;">Type</th>' +
'<th style="width: 20%;">Document</th>' +
'<th style="width: 20%;">Created By</th>' +
'<th style="width: 10%;">Status</th>' +
'<th style="width: 15%;text-align: right;">Amount</th>' +
'<th style="width: 10%;text-align: right;">Action</th>' +
'</tr></thead><tbody></tbody></table> </div>'
)
for (var koko = 0; koko < res.applicable_entities.length; koko++) {
var applicableEntityId = 1*res.applicable_entities[koko];
var ind = 0;
var pending_approval_list = res.grouped_approval_list[applicableEntityId];
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.app_pending_for_all tbody').append(
'<tr class="pending_row_' + item.entity + '_' + item.entityId + '">' +
'<td><label class="checkbox-inline checkbox-styled checkbox-datatable-selector "><input type="checkbox" value="1" ><span></span></label></td>' +
'<td>' + item.entity +'-'+item.entityId+ '</td>' +
'<td>'+res.entity_list_details[applicableEntityId]['entity_alias']+'</td>' +
'<td>' + item.documentHash + '</td>' +
'<td>' + ((item.createdUserImage== '' || item.createdUserImage ==null)? '':'<button type="button" style="' +
'background-image:url({{ url('dashboard') }}' + item.createdUserImage + ')' +
'" class="btn name_icon btn-default btn-sm" data-employee-name="' + item.createdBy + '" > <span style="display:none;">' + item.createdBy + '</span>') +
'</button>' + '</td>' +
'<td>'+(item.required==2?'<button class="text_hover_icon btn btn-default btn-sm style-accent" data-text="Override" ><i class="fa fa-gavel"></i></button>':'<button class="text_hover_icon btn btn-default btn-sm style-warning" data-text="Pending" ><i class="fa fa-exclamation"></i></button>')+'</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-flat btn-sm dropdown-toggle waves-effect"' +
'data-toggle="dropdown">' +
'<i class="fa fa-edit"></i> Action <i class="fa fa-caret-down"></i>' +
'</button>' +
'<ul class="dropdown-menu animation-expand"' +
'style=""' +
'role="menu">' +
'<li><a href="' + item.viewPathAbs + '"><i class="fa fa-eye"></i> View</a></li> ' +
'<li><a href="#" class="trigger_approval_btn trigger_approval_' + item.entity +'-'+item.entityId+ '"' +
'data-toggle="modal"' +
'data-entity="' + item.entity + '"' +
'data-entity-id="' + item.entityId + '"' +
'data-approval-id="' + item.approvalId + '"' +
'data-target="#approveDocument"><i class="fa fa-check"></i> Approve</a></li>' +
'</ul>' +
'</div>' +
'</td>' +
'</tr>');
}
}
pendingApprovalTable = $('.app_pending_for_all')
.DataTable({
dom: 'Blfrtip',
lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
"buttons": {
dom: {
button: {
tag: 'button',
className: 'dt-gen-button btn btn-sm waves-effect bg-grey'
}
},
"buttons": [
{
"extend": 'selectAll',
"text": 'select all'
},
{
"text": '<i class="fa fa-check"></i> APPROVE SELECTED',
"attr": {
"id": 'bulk_approval_action',
"className": 'bg-blue',
}
}
]
},
"select": {
style: 'multi',
selector: 'td:first-child .checkbox-inline>input:checkbox'
},
"order": [[1, "desc"]],
'columnDefs': [
{
responsivePriority: 1,
targets: [0, 1, -1]
},
{
responsivePriority: 2,
targets: [2, 3]
},
{
orderable: false,
targets: 0,
},
{
className: "trans_amount",
targets: [6]
},
{
className: "align_center",
targets: [1,2,3,4,5,7]
}
],
drawCallback: function (settings) {
$('.text_hover_icon').each(function (ind, elem) {
$(elem).popover({
content: $(elem).data('text'),
trigger: 'hover',
placement: 'top',
container: 'body',
html: true
});
});
$('.name_icon').each(function (ind, elem) {
$(elem).popover({
content: $(elem).data('employeeName'),
trigger: 'hover',
placement: 'top',
container: 'body',
html: true
});
});
},
initComplete: function () {
this.api().columns().every(function (col_ind) {
var column = this;
var exclude_col = [0,1];
if (exclude_col.indexOf(col_ind) > -1) {
} else {
var search_cont = $('<div class="form-line"></div>').appendTo($(column.header()))
var search_box = $('<input type="text" class="form-control ">')
.appendTo(search_cont)
.bindWithDelay('keyup change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search(val ? val : '', true, false)
.draw();
}, 1000);
}
});
}
});
$('.count-to-amount-specific').countTo(
{
formatter: function (value, options) {
return abbreviateNumber(value.toFixed(0));
}
}
);
}
}
});
}
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];
});
$('.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') }}/1"> <i class="fa fa-building"></i> ' +
(currAppData['name'].length > 15 ? (currAppData['name'].slice(0, 15) + '...') : currAppData['name']) + '</a>' +
' </li>')
}
})
.fail(function () {
});
}
function ListAvailableTaskOnMenu() {
var query = '_EMPTY_';
var pika_ind_id = '_NOPE_'
$.ajax({
url: url_path("select_data_ajax"),
type: 'POST',
dataType: 'json',
data: {
query: query,
tableName: "planning_item",
valueField: "id",
textField: "item_alias",
entity_group: 0,
selectorId: pika_ind_id,
isMultiple: 0,
dataId: pika_ind_id,
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},
],
joinTableData: [
{
tableName: "project",
joinFieldPrimary: "project_id",
joinOn: 'project_id',
tableJoinType: 'left join',
selectFieldList: [
'project_name'
]
},
{
tableName: "project",
joinFieldPrimary: "project_id",
joinOn: 'project_id',
tableJoinType: 'left join',
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'
]
},
],
convertToObject: [
],
skipDefaultCompanyId: 1
},
error: function () {
},
success: function (res) {
$('.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: []
}
}
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']) + '' +
'</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);
}
});
}
function ChangeActiveTaskOnMenu(taskId, planningItemId) {
StartNewTaskOnMenu(taskId, planningItemId);
}
function SetActiveTaskOnMenu(taskId, planningItemId, actualStartTs) {
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>')
}
}
function newSubmenuClose ()
{
$('.offcanvas-pane').removeClass('active');
$('.offcanvas-pane').css({
'-webkit-transform': '',
'-ms-transform': '',
'-o-transform': '',
'transform': ''
});
}
function newSubmenuOpen (id) {
if( $('#offcanvas-menu').hasClass('active'))
{
newSubmenuClose();
return 0;
}
else
{
newSubmenuClose();
}
$('#offcanvas-menu').addClass('active');
var width =$('#offcanvas-menu').width();
if (width > $(document).width()) {
width = $(document).width() - 8;
$('#offcanvas-menu.active').css({'width': width});
}
var translate = 'translate(' + width + 'px, 0)';
$('#offcanvas-menu.active').css({
'-webkit-transform': translate,
'-ms-transform': translate,
'-o-transform': translate,
'transform': translate
});
};
function EndCurrentTaskOnMenu() {
$('#endTaskModal').modal('show');
$('input[name="taskStatus"]').on('change', function() {
if ($('#taskPending').is(':checked')) {
$('#feedbackInput').show();
} else {
$('#feedbackInput').hide();
}
});
$('#confirmEndTask').off('click').on('click', function () {
var feedback = $('#taskFeedback').val().trim();
var taskStatus = $('input[name="taskStatus"]:checked').val();
if (taskStatus === 'completed') {
feedback = 'Completed';
}
$('#endTaskModal').modal('hide');
executeEndTask(feedback, taskStatus);
});
}
function executeEndTask(feedback, taskStatus) {
var curr_ts = moment().unix();
var this_user_id = {{ session[UserConstants.USER_ID] }};
var this_employee_id = {{ session[UserConstants.USER_EMPLOYEE_ID] }};
// Determine the value for the `status` field
var statusValue = taskStatus === 'completed' ? 1 : 'NULL';
var feedbackSqlPart = taskStatus === 'pending' ? ', feedback="' + feedback.replace(/"/g, '\\"') + '"' : ', feedback="' + feedback.replace(/"/g, '\\"') + '"';
$.ajax({
url: BaseURL + "insert_data_ajax_with_session",
type: 'POST',
dataType: 'json',
data: {
entity_group: 0,
dataToAdd: [
{
entityName: 'TaskLog',
idField: 'id',
returnRefIndex: 'id',
findId: 0,
noCreation: 1,
preAdditionalSql: 'UPDATE task_log SET working_status=2, actual_end_ts=' + curr_ts + ', status=' + statusValue + feedbackSqlPart + ' WHERE working_status=1 AND user_id=' + this_user_id + ';',
dataFields: [],
additionalSql: '',
}
]
},
error: function () {
alert("Error while ending the task!");
},
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',
returnRefIndex: 'id',
findId: 0,
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_'},
],
additionalSql: '',
}
]
},
error: function () {
},
success: function (res) {
if (typeof res.updatedDataList[0] !== 'undefined') {
var relatedDataCamelcase = res.updatedDataList[0];
if (relatedDataCamelcase['status'] !== 1) {
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();
}
$('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 %}
<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="{{ 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 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 %}
<style>
.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>
var generic_head_selectors = {}
var BUDDYBEE_COIN_BALANCE ={{ session['BUDDYBEE_COIN_BALANCE'] is defined? session['BUDDYBEE_COIN_BALANCE']:0 }};
{% if app.session.get('devAdminMode') ==1 %}
BUDDYBEE_COIN_BALANCE++;
{% endif %}
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>'
}
}
return str;
}
function update_head_selectors(selectorHere, options, returnLatest) {
selectorHere = selectorHere || '.generic_head_selector';
returnLatest = returnLatest || 0;
options = options || {};
$(selectorHere).not('.selectized').each(function (ind, elem) {
var childOnly = $(elem).hasClass('childOnly') ? 1 : 0;
var idIndex = $(elem).attr('id');
var isMultiple = $(elem).attr('multiple') ? 1 : 0;
var toSetValues = $(elem).attr('data-select-values') ? ($(elem).attr('data-select-values').split(',')) : [];
if (typeof options['markerHash'] !== "undefined") {
if (!$(elem).attr('data-marker-hash'))
$(elem).attr('data-marker-hash', options['markerHash'])
}
if (typeof options['renderText'] !== "undefined") {
if (!$(elem).attr('data-render-text'))
$(elem).attr('data-render-text', options['renderText'])
}
if (typeof options['markerHashStrictMatch'] !== "undefined") {
if (!$(elem).attr('data-marker-hash-strict-match'))
$(elem).attr('data-marker-hash-strict-match', options['markerHashStrictMatch'])
}
var the_awesome_selector = $(elem).selectize({
placeholder: 'Select a Head',
options: [],
valueField: 'value',
labelField: 'text',
onChange: function (value) {
},
preload: 'focus',
load: function (query, 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: {
query: query,
tableName: "acc_accounts_head",
valueField: "accounts_head_id",
// textField: "name",
textField: "rendered_text",
renderTextFormat: $($(this)[0].$input["0"]).attr('data-render-text') ? $($(this)[0].$input["0"]).attr('data-render-text') : "#__value__ - __name__ (__parent_table_name__)", //--change--//
selectorId: $($(this)[0].$input["0"]).attr('id'),
isMultiple: $($(this)[0].$input["0"]).attr('multiple') ? 1 : 0,
lastChildrenOnly: $($(this)[0].$input["0"]).hasClass('childOnly') ? 1 : 0,
parentOnly: $($(this)[0].$input["0"]).hasClass('parentOnly') ? 1 : 0,
parentIdField: 'parent_id',
dataId: pika_ind_id,
marker_hash: $($(this)[0].$input["0"]).attr('data-marker-hash'),
headMarkers: $($(this)[0].$input["0"]).attr('data-marker-hash'),
headMarkersStrictMatch: $($(this)[0].$input["0"]).attr('data-marker-hash-strict-match'),
itemLimit: ($($(this)[0].$input["0"]).attr('data-item-limit') ? $($(this)[0].$input["0"]).attr('data-item-limit') : 25),
andOrConditions: [
{type: "like", field: "name", value: query},
{type: "=", field: "accounts_head_id", value: isNaN(query) ? '' : query},
],
andConditions: [
(
$($(this)[0].$input["0"]).attr('data-head-type') ? {
type: "like",
field: "type",
value: $($(this)[0].$input["0"]).attr('data-head-type')
}
: undefined
),
(
$($(this)[0].$input["0"]).attr('data-head-nature') ? {
type: "like",
field: "type",
value: $($(this)[0].$input["0"]).attr('data-head-nature')
}
: undefined
),
],
mustConditions: [{
}
],
joinTableData: [
{
tableName: "acc_accounts_head",
joinFieldPrimary: "parent_id",
joinOn: 'accounts_head_id',
tableJoinType: 'cross join',
fieldJoinType: '=',
joinAndConditions: [
(
$($(this)[0].$input["0"]).attr('data-head-type') ? {
type: "like",
field: "type",
value: $($(this)[0].$input["0"]).attr('data-head-type')
}
: undefined
),
(
$($(this)[0].$input["0"]).attr('data-head-nature') ? {
type: "like",
field: "type",
value: $($(this)[0].$input["0"]).attr('data-head-nature')
}
: undefined
),
// {type: "!=", field: "parent_id", value: 0},
],
joinOrConditions: [
query.indexOf('#setValue') == -1 ? {
type: "like",
field: "name",
value: query
} : undefined,
query.indexOf('#setValue') == -1 ? {
type: "=",
field: "accounts_head_id",
value: isNaN(query) ? '' : query
} : undefined,
],
selectPrefix: 'parent_table_',
selectFieldList: [
'name'
]
},
],
convertToObject: [
],
},
error: function () {
},
success: function (res) {
if (typeof window[res.tableName + '_data_bank'] !== 'undefined') {
for (var chukapuka = 0; chukapuka < res.data.length; chukapuka++) {
if (typeof window[res.tableName + '_data_bank'][res.data[chukapuka]['value']] !== 'undefined') {
} else {
window[res.tableName + '_data_bank'][res.data[chukapuka]['value']] = res.data[chukapuka];
}
}
} else
window[res.tableName + '_data_bank'] = res.dataById;
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)
}
}
});
},
})[0].selectize;
if (toSetValues.length > 0)
populateAndSetSelectByAjaxSelector(the_awesome_selector, toSetValues)
if (returnLatest == 1)
return the_awesome_selector;
else
generic_head_selectors[idIndex] = the_awesome_selector;
})
}
{# 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">
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,
});
}
}, 30000)
}
function initiateSocket() {
lastActivityTs = moment().unix();
$.getScript('{{ notification_server_full }}/socket.io/socket.io.js', function () {
if (io) {
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 () {
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 %}
if (typeof pageSocketInit !== 'undefined')
pageSocketInit();
socket.on('user_status_update', function (dataObj) {
});
socket.on('_SOCKET_NOTIFICATION_HERE_', function (dataObj) {
});
}
});
}
</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 () {
$(document).on('focus', '.itemtable input[type="number"]', function (e) {
var theColIndex = $(this).data('colIndex');
$('.itemtable .col_title_' + theColIndex).addClass('expanded')
});
$(document).on('blur', '.itemtable input[type="number"]', function (e) {
var theColIndex = $(this).data('colIndex');
$('.itemtable .col_title_' + theColIndex).removeClass('expanded')
});
$('.nav-tabs li').not('.no-popover').each(function (ind, elem) {
$(elem).popover({
content: $(elem).find('a').html(),
trigger: 'hover',
placement: 'top',
container: 'body',
html: true
});
});
$('.change_app').click(function (ev) {
ev.preventDefault();
getUserCompanyList('_CENTRAL_')
})
{% set curr_route=app.request.attributes.get('_route') %}
$('input.devAdminOnly').attr('readonly', false);
update_head_selectors()
$(document).on('change', 'input.autoUpdateDataGeneric, select.autoUpdateDataGeneric, textarea.autoUpdateDataGeneric', function () {
$.post('{{ url('update_inline_value') }}', {
entityName: typeof $(this).data('entityName') !== 'undefined' ? $(this).data('entityName') :
(typeof autoUpdateDataGenericEntityName !== 'undefined' ? autoUpdateDataGenericEntityName : ''),
entityBundle: typeof $(this).data('entityBundle') !== 'undefined' ? $(this).data('entityBundle') : (typeof autoUpdateDataGenericEntityBundle !== 'undefined' ? autoUpdateDataGenericEntityBundle : 'ApplicationBundle'),
setValue: $(this).val(),
setMethod: typeof $(this).data('setMethod') !== 'undefined' ? $(this).data('setMethod') : (typeof autoUpdateDataGenericEntitySetMethod !== 'undefined' ? autoUpdateDataGenericEntitySetMethod : ''),
createIfNotFound: typeof $(this).data('createIfNotFound') !== 'undefined' ? $(this).data('createIfNotFound') : (typeof autoUpdateDataGenericEntityCreateIfNotFound !== 'undefined' ? autoUpdateDataGenericEntityCreateIfNotFound : 0),
findField: typeof $(this).data('findField') !== 'undefined' ? $(this).data('findField') : (typeof autoUpdateDataGenericEntityFindField !== 'undefined' ? autoUpdateDataGenericEntityFindField : ''),
findValue: typeof $(this).data('findValue') !== 'undefined' ? $(this).data('findValue') : (typeof autoUpdateDataGenericEntityFindValue !== 'undefined' ? autoUpdateDataGenericEntityFindValue : ''),
fieldType: typeof $(this).data('fieldType') !== 'undefined' ? $(this).data('fieldType') : (typeof autoUpdateDataGenericEntityFieldType !== 'undefined' ? autoUpdateDataGenericEntityFieldType : ''),
modifyTransDateFlag: typeof $(this).data('modifyTransDate') !== 'undefined' ? $(this).data('modifyTransDate') : 0,
modifyTransDateFlag: typeof $(this).data('modifyTransDate') !== 'undefined' ? $(this).data('modifyTransDate') : 0,
})
.done(function (data) {
})
.fail(function () {
});
});
$('.inplaceEditForced').editable({
event: 'click',
callback: function (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) {
$.post('{{ url('update_inline_value') }}', {
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_',
})
.done(function (data) {
if (data.success == true) {
swal({
title: "Sweet!",
text: "Updated",
imageUrl: BaseURL + "images/thumbs-up.png"
});
} else {
swal({
title: "Sorry!",
text: "Your Action failed !",
imageUrl: BaseURL + "images/Bee_Sad_Emote.png"
});
}
})
.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) {
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) {
$.post('{{ url('update_inline_value') }}', {
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_',
})
.done(function (data) {
if (data.success == true) {
swal({
title: "Sweet!",
text: "Updated",
imageUrl: BaseURL + "images/thumbs-up.png"
});
} else {
swal({
title: "Sorry!",
text: "Your Action failed !",
imageUrl: BaseURL + "images/Bee_Sad_Emote.png"
});
}
})
.fail(function () {
});
}
}
});
{% endif %}
{% if constant('ApplicationBundle\\Constants\\GeneralConstant::NOTIFICATION_ENABLED')==1 %}
{% 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)
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);
fileDataList.push({
fullPath: URL.createObjectURL($(this)[0].files[jj]),
fileType: $(this)[0].files[jj].type,
fileName: $(this)[0].files[jj].name,
})
}
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')) {
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.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 }}';
if ($('#approveDocument #approveDocumentForwardUserList').length) {
approveDocumentForwardUserListSelector = $('#approveDocument #approveDocumentForwardUserList').selectize({
placeholder: 'Select a user',
multiple: false,
options: [],
valueField: 'value',
labelField: 'text',
preload: 'focus',
searchField: ['text', 'value'],
load: function (query, 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,
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: [
],
convertToObject: [
],
skipDefaultCompanyId: 1
},
error: function () {
},
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)
}
}
});
},
onChange: function (value) {
}
})[0].selectize;
}
$(document).on('click', '.trigger_approval_btn', function () {
$('#approveDocument #approvalEntity').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 {
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);
{% 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');
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();
}
if (window.isElectron) {
if (window.localStorage.getItem('full_screen_enabled') == null) {
openFullscreen();
}
window.ipcRenderer.on('update_message', function (event, text) {
alertify.alert(text);
})
$("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')
}
}
});
$('.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={{ BuddybeeConstant.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' %}