228 lines
8.7 KiB
Plaintext
228 lines
8.7 KiB
Plaintext
doctype html
|
|
html
|
|
style(type='text/css').
|
|
.nested_task .gantt_add{
|
|
display: none !important;
|
|
}
|
|
.updColor{
|
|
background-color:#ffeb8a!important;
|
|
display: none !important;
|
|
}
|
|
head
|
|
title Munka nyílvántartó
|
|
h2.contHeader(id='title') #{title}
|
|
br
|
|
link(rel='stylesheet' href='/bower_components/bootstrap/dist/css/bootstrap.css')
|
|
link(rel='stylesheet', href='/bower_components/bootstrap/dist/css/bootstrap.min.css')
|
|
link(rel='stylesheet', href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css')
|
|
link(rel='stylesheet' href='/bower_components/jquery-typeahead/dist/jquery.typeahead.min.css')
|
|
style.
|
|
div.a {
|
|
text-indent: 50px;
|
|
}
|
|
body
|
|
#form-group(style='margin-left:20px')
|
|
.row
|
|
.col-sm-2
|
|
select.form-control(id='employeesel',name='employeesel',value=0, tabindex='29', style='background-color:#2C3446;color: #FFFFFF; width: 200px')
|
|
option(value='All',selected) Mindenki
|
|
each option in employee
|
|
option(value=(option.name)) #{option.name}
|
|
.col-sm-3
|
|
button.btn.btn-default(type='button' id='ajaxSubmit') Új
|
|
.col-sm-3
|
|
a.btn.btn-success(href='/employee/accesslist') Vissza
|
|
br
|
|
#form-group
|
|
meta(http-equiv='Content-type', content='text/html; charset=utf-8')
|
|
script(src='https://cdn.dhtmlx.com/gantt/edge/dhtmlxgantt.js')
|
|
link(href='https://cdn.dhtmlx.com/gantt/edge/dhtmlxgantt.css', rel='stylesheet')
|
|
style(type='text/css').
|
|
html, body{
|
|
height:100%;
|
|
padding:0px;
|
|
margin:0px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
#gantt_here(style='width:100%; height:100%;')
|
|
script(src='../gantt/locale/locale_hu.js', charset='utf-8')
|
|
script(src='/bower_components/jquery/dist/jquery.js')
|
|
script(type='text/javascript', src='/bower_components/jquery/dist/jquery.min.js')
|
|
script(type='text/javascript', src='/bower_components/moment/min/moment.min.js')
|
|
script(src='/bower_components/bootstrap/dist/js/bootstrap.js')
|
|
//script(type='text/javascript', src='https://cdn.dhtmlx.com/gantt/edge/ext/dhtmlxgantt_marker.js')
|
|
script.
|
|
$("#ajaxSubmit").click(function()
|
|
{
|
|
var taskId = gantt.createTask({
|
|
id:10,
|
|
text:"Task #5",
|
|
start_date: new Date(),
|
|
//end_date: new Date(),
|
|
duration:3
|
|
}, "project_2", 2);
|
|
gantt.showLightbox(taskId)
|
|
});
|
|
// $("#mworkers").click();
|
|
$("#listholidaysadd").addClass("active");
|
|
gantt.plugins({
|
|
marker: true
|
|
});
|
|
// Employee list get AJAX
|
|
$.get( 'get_employee_list', function(data) {
|
|
$('#results').html(data);
|
|
// Ligfhtbox customization
|
|
var emps=[];
|
|
$.each(data,function (idx,emp){
|
|
emps.push({'key':emp._id,'label':emp.name})
|
|
//console.log(emp); a(href='#',id='1', data-value='worktimeControl') Munkaidő rögzítés
|
|
|
|
})
|
|
gantt.config.lightbox.sections = [
|
|
//{name:"description", height:38, map_to:"text", type:"textarea", focus:true},
|
|
{name:"employee", height:22, map_to:"employee", type:"select", options: emps, focus:true,
|
|
/*onchange:function(){
|
|
alert('jajj');
|
|
}*/},
|
|
{name:"time", height:72, type:"time", map_to:"auto",time_format:["%Y","%m","%d"]}
|
|
];
|
|
});
|
|
// Alkalmazottak szűrése dropdown szerint
|
|
gantt.attachEvent("onBeforeTaskDisplay", function(id, task){
|
|
var selText= document.getElementById("employeesel").value
|
|
//console.log(selText);
|
|
if (selText==='All') return true;
|
|
if (task.text == selText){
|
|
return true;
|
|
}
|
|
return false;
|
|
|
|
});
|
|
|
|
$("#employeesel").click(function () {
|
|
|
|
gantt.refreshData();
|
|
});
|
|
gantt.locale.labels.section_employee = "Dolgozó";
|
|
// TEST {name:"template", height:16, type:"template", map_to:"my_template"},
|
|
/*gantt.attachEvent("onLightboxSave", function(id, task, is_new){
|
|
var taskStart = moment(task.start_date);
|
|
var taskEnd = moment(task.end_date);
|
|
var scaleStart = gantt.config.start_date;
|
|
var scaleEnd = gantt.config.end_date;
|
|
console.log(task);
|
|
// Munkavállaló adatainak lekérése
|
|
$.get( 'get_employee_list/'+task.employee, function(data) {
|
|
$('#results').html(data);
|
|
|
|
var selectedRange = taskEnd.diff(taskStart,'days');
|
|
var unusedDays=(data.vacationYear-data.vacationUsed);
|
|
console.log('Talált: '+data.name+' Össz: '+data.vacationYear+' Kiadott: '+data.vacationUsed+' Kiadható: '+unusedDays+' Intervallum: '+ selectedRange);
|
|
// check if the task is out of the range
|
|
if(selectedRange >unusedDays ){
|
|
gantt.message({
|
|
type:"warning",
|
|
text:"Maximum "+unusedDays+" nap szabadság adható ki!",
|
|
expire:5000
|
|
});
|
|
return false;
|
|
}
|
|
// Szabadság mentése
|
|
var used=(data.vacationUsed+selectedRange);
|
|
var data={employeeId:task.employee,content:used};
|
|
$.ajax({
|
|
type: 'POST',
|
|
data: JSON.stringify(data),
|
|
|
|
contentType: "application/json",
|
|
dataType:'json',
|
|
url: '/employee/update_employee_holidaysById',
|
|
success: function(data) {
|
|
alert("Success!");
|
|
},
|
|
error: function(error) {
|
|
console.log("some error in fetching the notifications");
|
|
alert("Hiba!");
|
|
}
|
|
|
|
})
|
|
|
|
|
|
return true;
|
|
});
|
|
});*/
|
|
|
|
// Task childtask hozzáadás gombelrejtése
|
|
gantt.templates.grid_row_class = function( start, end, task ){
|
|
//console.log(task);
|
|
if ( task.$level >=0)
|
|
{
|
|
// console.log("nested");
|
|
return "nested_task"
|
|
}
|
|
return "";
|
|
};
|
|
|
|
//Read only
|
|
|
|
function isEditableTask(task){
|
|
var dt= moment(task.end_date).isBefore(new Date());
|
|
//if (dt===false)
|
|
return dt ;
|
|
}
|
|
gantt.attachEvent("onBeforeTaskDrag", function(task){
|
|
var dt= moment(task.end_date).isBefore(new Date());
|
|
return !dt;
|
|
});
|
|
gantt.attachEvent("onBeforeLightbox", function(task){
|
|
var dt= moment(task.end_date).isBefore(new Date());
|
|
//console.log(dt);
|
|
if (!dt)
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
});
|
|
/*gantt.attachEvent("onTaskLoading", function(task){
|
|
var dt= moment(task.end_date).isBefore(new Date());
|
|
if (dt===true){
|
|
// task.readOnly=true;//moment(task.end_date).isBefore(new Date());
|
|
//task.color='gray';
|
|
}
|
|
//task.editable = task.has_owner && task.editable && task.text;
|
|
return true;
|
|
});*/
|
|
// Header task hozzáadás gomb elrejtése
|
|
/*gantt.templates.grid_header_class = function(columnName, column){
|
|
if(columnName == 'add' )
|
|
return "updColor";
|
|
};*/
|
|
gantt.config.columns=[
|
|
{name:"text", label:"Dolgozó", tree:true, width:'*' },
|
|
{name:"start_date", label:"Kezdési idő", align: "center" },
|
|
{name:"duration", label:"Időtartam", align: "center" },
|
|
{name:"add", label:"", width:44, hide:true }
|
|
];
|
|
gantt.config.open_split_tasks = true;
|
|
|
|
var date_to_str = gantt.date.date_to_str(gantt.config.task_date);
|
|
|
|
var markerId = gantt.addMarker({
|
|
start_date: new Date(),
|
|
css: "today",
|
|
text: "Most",
|
|
title:date_to_str( new Date())
|
|
});
|
|
gantt.getMarker(markerId); //->{css:"today", text:"Now", id:...}
|
|
|
|
// gantt.locale.labels.section_priority = "Priority";
|
|
gantt.init("gantt_here");
|
|
// gantt.parse(tasks);
|
|
gantt.load("/employee/data");
|
|
var dp = new gantt.dataProcessor("/employee/api");
|
|
dp.init(gantt);
|
|
dp.setTransactionMode("REST"); |