Compare commits
6 Commits
main
...
Company-ad
| Author | SHA1 | Date |
|---|---|---|
|
|
f23a5faf53 | |
|
|
ed7cbd167e | |
|
|
9d07f9d3bd | |
|
|
02ed2fea42 | |
|
|
1d9b9f63aa | |
|
|
f46a5792cb |
145
app.js
145
app.js
|
|
@ -24,7 +24,8 @@ var PdfPrinter=require('pdfmake');
|
|||
//const util = require('util');
|
||||
//var currentWorkNumber=0;
|
||||
const { XMLParser, XMLBuilder, XMLValidator} = require("fast-xml-parser/src/fxp");
|
||||
const { apiSaveReport, apiGetReport, apiGetReportList, apiGetUsers, apiGetReportDates, apiUpdateReport } = require('./js/workReport.js');
|
||||
const { apiSaveReport, apiGetReport, apiGetReportList, apiGetUsers, apiGetReportDates, apiUpdateReport, apiGetReportSum } = require('./js/workReport.js');
|
||||
const { apiGetDailyReportSum } = require('./js/dailyReport.js');
|
||||
let WorkReport = require('./models/workReportModel');
|
||||
moment.locale('HU');
|
||||
const fss = require('fs');
|
||||
|
|
@ -1223,6 +1224,7 @@ var wnY=dt.getFullYear();
|
|||
|
||||
// Get Single Work
|
||||
app.get('/work/:id',utils.ensureAuthenticated,function(req,res){
|
||||
|
||||
Work.findById(req.params.id, function(err,work) // Munka keresése sz ID-je alapján
|
||||
{
|
||||
if (err)
|
||||
|
|
@ -1299,6 +1301,7 @@ Work.findById(req.params.id, function(err,work) // Munka keresése sz ID-je alap
|
|||
{ $group: {_id: '$dailyReport._id','foreman':{$first: '$dailyReport.foremanId'}, list: {$push: '$books'},'date': {$first: '$dailyReport.date'},'title': {$first: '$dailyReport.workTitle'}}},
|
||||
{ $sort : { 'date' : -1 } }
|
||||
]).exec((err,results)=>{
|
||||
|
||||
res.render('work',
|
||||
{
|
||||
dailyReports:results,
|
||||
|
|
@ -1756,15 +1759,21 @@ function printWork(id,callback)
|
|||
|
||||
// Napi műhely jelentések nyomtatása
|
||||
// Get Single Work
|
||||
app.get('/print_workreport/:id',utils.ensureAuthenticated,async function(req,res){
|
||||
app.get('/print_workreport/:id/:date',utils.ensureAuthenticated,async function(req,res){
|
||||
var PdfPrinter=require('pdfmake');
|
||||
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
try{
|
||||
var wtSum=0;
|
||||
const reports=await WorkReport.find({workId: mongoose.Types.ObjectId(req.params.id)})
|
||||
var dr_firstDay= moment(req.params.date,"YYYY.MM").startOf('month').toDate();
|
||||
var dr_lastDay = moment(req.params.date,"YYYY.MM").endOf('month').toDate();
|
||||
const reports=await WorkReport.find({workId: mongoose.Types.ObjectId(req.params.id),
|
||||
date: {
|
||||
$gte: dr_firstDay,
|
||||
$lte: dr_lastDay
|
||||
}})
|
||||
const workHeader=await Work.findOne({"_id":mongoose.Types.ObjectId(req.params.id)},{poNumber:1,workNumber:1,megrendelo:1})
|
||||
const workTimesSum=await WorkReport.aggregate(
|
||||
/* const workTimesSum=await WorkReport.aggregate(
|
||||
[
|
||||
{ $match: { 'workId': mongoose.Types.ObjectId(req.params.id)} },
|
||||
{$unwind: '$workFlow'},
|
||||
|
|
@ -1775,11 +1784,87 @@ app.get('/print_workreport/:id',utils.ensureAuthenticated,async function(req,res
|
|||
"count": 1,}
|
||||
}
|
||||
]
|
||||
)*/
|
||||
const workTimesSum=await WorkReport.aggregate(
|
||||
[
|
||||
{ $match: { 'workId': mongoose.Types.ObjectId(req.params.id),
|
||||
date: {
|
||||
$gte: dr_firstDay,
|
||||
$lte: dr_lastDay
|
||||
}} },
|
||||
{$unwind: '$workFlow'},
|
||||
{$unwind: '$workFlow.employeeList'},
|
||||
{$group: {_id: '$workFlow.employeeList.company',
|
||||
count: {
|
||||
$sum: 8
|
||||
},
|
||||
employees:{
|
||||
$push:{
|
||||
name: "$workFlow.employeeList.name",
|
||||
id: "$_id"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
]
|
||||
)
|
||||
|
||||
if (workTimesSum.length>0) wtSum=workTimesSum[0].count*8
|
||||
var data=await printWorkReport(reports,workHeader)
|
||||
console.log(JSON.stringify(data));
|
||||
//if (workTimesSum.length>0) wtSum=workTimesSum[0].count*8
|
||||
var data=await printWorkReport(reports,workHeader,workTimesSum)
|
||||
//console.log(JSON.stringify(data));
|
||||
// fss.writeFile(path.normalize('d:\\test.json'), JSON.stringify(data));
|
||||
res.send(data);
|
||||
//res.send({'response':'ok','reports':reports, 'workTimesSum':wtSum});
|
||||
}catch(err){
|
||||
|
||||
res.status(500).json({'response':'fail','message':'Hiba a mentésnél !\n'+err.message});
|
||||
}
|
||||
})
|
||||
|
||||
// Napi műhely jelentések nyomtatása egész munka
|
||||
// Get Single Work
|
||||
app.get('/print_workreportAll/:id',utils.ensureAuthenticated,async function(req,res){
|
||||
var PdfPrinter=require('pdfmake');
|
||||
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
try{
|
||||
var wtSum=0;
|
||||
var dr_firstDay= moment(req.params.date,"YYYY.MM").startOf('month').toDate();
|
||||
var dr_lastDay = moment(req.params.date,"YYYY.MM").endOf('month').toDate();
|
||||
const reports=await WorkReport.find({workId: mongoose.Types.ObjectId(req.params.id)})
|
||||
const workHeader=await Work.findOne({"_id":mongoose.Types.ObjectId(req.params.id)},{poNumber:1,workNumber:1,megrendelo:1})
|
||||
const workTimesSum=await WorkReport.aggregate(
|
||||
[
|
||||
{ $match: { 'workId': mongoose.Types.ObjectId(req.params.id),
|
||||
/* date: {
|
||||
$gte: dr_firstDay,
|
||||
$lte: dr_lastDay
|
||||
}*/
|
||||
} },
|
||||
{$unwind: '$workFlow'},
|
||||
{$unwind: '$workFlow.employeeList'},
|
||||
{$group: {_id: '$workFlow.employeeList.company',
|
||||
count: {
|
||||
$sum: 8
|
||||
},
|
||||
employees:{
|
||||
$push:{
|
||||
name: "$workFlow.employeeList.name",
|
||||
id: "$_id"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
]
|
||||
)
|
||||
|
||||
//if (workTimesSum.length>0) wtSum=workTimesSum[0].count*8
|
||||
var data=await printWorkReport(reports,workHeader,workTimesSum)
|
||||
//console.log(JSON.stringify(data));
|
||||
// fss.writeFile(path.normalize('d:\\test.json'), JSON.stringify(data));
|
||||
res.send(data);
|
||||
//res.send({'response':'ok','reports':reports, 'workTimesSum':wtSum});
|
||||
|
|
@ -1790,14 +1875,17 @@ app.get('/print_workreport/:id',utils.ensureAuthenticated,async function(req,res
|
|||
})
|
||||
|
||||
// Műhely Napi jelentés Nyomtatási kép generálás
|
||||
async function printWorkReport(reports, workHeader)
|
||||
async function printWorkReport(reports, workHeader, workTimeSum)
|
||||
{
|
||||
|
||||
var item=[];
|
||||
var wtsum=[];
|
||||
var wName=workHeader;
|
||||
var i=0;
|
||||
var emps="";
|
||||
var companies="";
|
||||
moment.locale('hu');
|
||||
item.push([ {text:'#', alignment: 'left'},{text:'Dátum', alignment: 'center'}, {text:'Munkafolyamat', alignment: 'center'}, {text:'Résztvevők', alignment: 'center'}]);
|
||||
item.push([ {text:'#', alignment: 'left'},{text:'Dátum', alignment: 'center'}, {text:'Munkafolyamat', alignment: 'center'}, {text:'Cég', alignment: 'center'}, {text:'Résztvevők', alignment: 'center'}]);
|
||||
|
||||
|
||||
wName=reports[0].workTitle;
|
||||
|
|
@ -1805,22 +1893,38 @@ async function printWorkReport(reports, workHeader)
|
|||
|
||||
|
||||
report.workFlow.forEach((wf,idx)=>{
|
||||
var emps="";
|
||||
emps="";
|
||||
companies="";
|
||||
wf.employeeList.forEach((employee,ind)=>{
|
||||
emps=emps+employee.name+'\r\n';
|
||||
if (employee.company)
|
||||
{
|
||||
companies=companies+employee.company+'\r\n'
|
||||
}
|
||||
else
|
||||
{
|
||||
companies=companies+"K-L Electro Bt"+'\r\n'
|
||||
}
|
||||
i++;
|
||||
})
|
||||
item.push([
|
||||
{id:i,text: index+1, style:'tableData',rowSpan: report.workFlow.length},
|
||||
{text: moment(report.date).format('YYYY.MM.DD'), style:'tableData', alignment: 'center',rowSpan: report.workFlow.length},
|
||||
{text: wf.Title, style:'tableData', alignment: 'center'},
|
||||
{text: companies, style:'tableData', alignment: 'center'},
|
||||
{text: emps, style:'tableData', alignment: 'center'},
|
||||
]);
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
wtsum.push([{text:'Cég név'}, {text:'Munkaórák'}]),
|
||||
workTimeSum.forEach((ws,ind)=>{
|
||||
wtsum.push([
|
||||
{text: ws._id, style:'tableData'},
|
||||
{text: ws.count, style:'tableData'},
|
||||
])
|
||||
})
|
||||
|
||||
|
||||
// playground requires you to assign document definition to a variable called dd
|
||||
|
|
@ -1890,17 +1994,26 @@ async function printWorkReport(reports, workHeader)
|
|||
|
||||
//widths: [20, 'auto', 80, 80,'*','*','*'],
|
||||
// widths: [20, '*', 70, 70,50,'auto','auto'],
|
||||
widths: [20, 70,'*', 100],
|
||||
widths: [20, 70,'*', 100, 100],
|
||||
body: item,//[],
|
||||
|
||||
},
|
||||
|
||||
layout: {
|
||||
fillColor: function (rowIndex, node, columnIndex) {
|
||||
return (rowIndex % 2 === 0) ? '#CCCCCC' : null;
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
style: 'tableExample',
|
||||
table: {
|
||||
widths: [200, '*'],
|
||||
body: wtsum
|
||||
}
|
||||
},
|
||||
],
|
||||
styles: {
|
||||
header: {
|
||||
|
|
@ -2136,12 +2249,15 @@ app.get('/media/:file', function(req, res) {
|
|||
|
||||
|
||||
});
|
||||
app.route('/workreport').post(apiSaveReport);
|
||||
app.route('/workreportSave').post(apiSaveReport);
|
||||
app.route('/workreportUpdate').post(apiUpdateReport);
|
||||
app.route('/workreportUserList').get(apiGetUsers);
|
||||
app.route('/workreport/:id').get(apiGetReport);
|
||||
app.route('/workreportGet/:id/:date').get(apiGetReport);
|
||||
app.route('/workreportGetSum/:id').get(apiGetReportSum);
|
||||
app.route('/workreportList/:id').get(apiGetReportList);
|
||||
app.route('/workreportDates/:id').get(apiGetReportDates);
|
||||
|
||||
app.route('/dailyReportGetSum/:id').get(apiGetDailyReportSum);
|
||||
// Route Files
|
||||
app.locals.moment = require('moment');
|
||||
//app.use('/articles', articles);
|
||||
|
|
@ -2173,6 +2289,7 @@ const { string } = require('jszip/lib/support');
|
|||
const { generateXML } = require('./js/enaploGen');
|
||||
const { auto } = require('async');
|
||||
|
||||
|
||||
app.use('/devicesrfid', devices_rfid);
|
||||
app.use('/vehicles', vehicles);
|
||||
app.use('/gantt', gantt);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
let Work = require('../models/works');
|
||||
const asyncHandler = require('express-async-handler');
|
||||
var mongoose = require('mongoose');
|
||||
|
||||
// A teljes munka ráfordítás műhelyben
|
||||
exports.apiGetDailyReportSum=asyncHandler(async (req,res)=>{
|
||||
//const {workId,foremanId, workTitle,employeeList }=req.body;
|
||||
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
try{
|
||||
var wtSum=0;
|
||||
|
||||
const count=await Work.aggregate([
|
||||
{$match:{'_id' : mongoose.Types.ObjectId(req.params.id)}},
|
||||
{$unwind: '$dailyReport'},
|
||||
|
||||
{$unwind: {path:'$dailyReport.employeeList',preserveNullAndEmptyArrays:true}},
|
||||
|
||||
|
||||
{"$lookup": {
|
||||
"localField": "dailyReport.employeeList",
|
||||
|
||||
"from": "employees",
|
||||
"foreignField": "_id",
|
||||
"as": "books"
|
||||
}},
|
||||
|
||||
{$unwind: {path:'$books',preserveNullAndEmptyArrays:true}},
|
||||
{$group: {_id: '$workFlow.EmployeeList', count:{$sum:1}}},
|
||||
{ "$limit": 1 },
|
||||
{"$project": {"_id":0,
|
||||
"count": 1,}
|
||||
}
|
||||
])
|
||||
|
||||
if (count.length) wtSum=count[0].count*8
|
||||
res.send({'response':'ok', 'dailyReportSum':wtSum});
|
||||
}catch(err){
|
||||
|
||||
res.status(500).json({'response':'fail','message':'Hiba a mentésnél !\n'+err.message});
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -83,10 +83,22 @@ exports.apiGetReport=asyncHandler(async (req,res)=>{
|
|||
res.setHeader('Content-Type', 'application/json');
|
||||
try{
|
||||
var wtSum=0;
|
||||
const reports=await WorkReport.find({workId: mongoose.Types.ObjectId(req.params.id)})
|
||||
var dr_firstDay= moment(req.params.date,"YYYY.MM").startOf('month').toDate();
|
||||
var dr_lastDay = moment(req.params.date,"YYYY.MM").endOf('month').toDate();
|
||||
const reports=await WorkReport.find({workId: mongoose.Types.ObjectId(req.params.id),
|
||||
date: {
|
||||
$gte: dr_firstDay,
|
||||
$lte: dr_lastDay
|
||||
}
|
||||
})
|
||||
const workTimesSum=await WorkReport.aggregate(
|
||||
[
|
||||
{ $match: { 'workId': mongoose.Types.ObjectId(req.params.id)} },
|
||||
{ $match: { 'workId': mongoose.Types.ObjectId(req.params.id),
|
||||
date: {
|
||||
$gte: dr_firstDay,
|
||||
$lte: dr_lastDay
|
||||
}
|
||||
} },
|
||||
{$unwind: '$workFlow'},
|
||||
{$unwind: '$workFlow.employeeList'},
|
||||
{$group: {_id: '$workFlow.EmployeeList', count:{$sum:1}}},
|
||||
|
|
@ -106,6 +118,38 @@ exports.apiGetReport=asyncHandler(async (req,res)=>{
|
|||
|
||||
});
|
||||
|
||||
// A teljes munka ráfordítás műhelyben
|
||||
exports.apiGetReportSum=asyncHandler(async (req,res)=>{
|
||||
//const {workId,foremanId, workTitle,employeeList }=req.body;
|
||||
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
try{
|
||||
var wtSum=0;
|
||||
|
||||
const workTimesSum=await WorkReport.aggregate(
|
||||
[
|
||||
{ $match: { 'workId': mongoose.Types.ObjectId(req.params.id),
|
||||
|
||||
} },
|
||||
{$unwind: '$workFlow'},
|
||||
{$unwind: '$workFlow.employeeList'},
|
||||
{$group: {_id: '$workFlow.EmployeeList', count:{$sum:1}}},
|
||||
{ "$limit": 1 },
|
||||
{"$project": {"_id":0,
|
||||
"count": 1,}
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
if (workTimesSum.length>0) wtSum=workTimesSum[0].count*8
|
||||
res.send({'response':'ok', 'workTimesSum':wtSum});
|
||||
}catch(err){
|
||||
|
||||
res.status(500).json({'response':'fail','message':'Hiba a mentésnél !\n'+err.message});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Használt dátumok
|
||||
exports.apiGetReportDates=asyncHandler(async (req,res)=>{
|
||||
//const {workId,foremanId, workTitle,employeeList }=req.body;
|
||||
|
|
@ -130,14 +174,34 @@ exports.apiGetUsers=asyncHandler(async (req,res)=>{
|
|||
//const {workId,foremanId, workTitle,employeeList }=req.body;
|
||||
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
try{
|
||||
const users=await Employee.find({'konyvelesre': 'on'},{_id:1,name:1},{sort: {name: 1}})
|
||||
/* try{
|
||||
const users=await Employee.find({'konyvelesre': 'on'},{_id:1,name:1,company:1},{sort: {name: 1}})
|
||||
res.send({'response':'ok','users':users});
|
||||
}catch(err){
|
||||
|
||||
res.status(500).json({'response':'fail','message':'Hiba a mentésnél !\n'+err.message});
|
||||
}*/
|
||||
try{
|
||||
const users=await Employee.aggregate([
|
||||
{ $sort: { "name": 1 } },
|
||||
{$match: { "konyvelesre": "on"}},
|
||||
{
|
||||
$group: {
|
||||
_id: {company:'$company'},
|
||||
employees:{
|
||||
$push:{
|
||||
name: "$name",
|
||||
id: "$_id"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
]);
|
||||
res.send({'response':'ok','users':users});
|
||||
}
|
||||
catch(err){
|
||||
res.status(500).json({'response':'fail','message':'Hiba a mentésnél !\n'+err.message});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
exports.apiGetReportList=asyncHandler(async (req,res)=>{
|
||||
|
|
|
|||
|
|
@ -128,7 +128,11 @@ let employeeSchema = mongoose.Schema({
|
|||
end_date: {type: String},
|
||||
duration: {type: Number},
|
||||
|
||||
}]
|
||||
}],
|
||||
company:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
});
|
||||
|
||||
employeeSchema.methods.comparePassword = function(candidatePassword, cb) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ let workReportSchema = mongoose.Schema({
|
|||
employeeList:[{
|
||||
employeeId:{type: mongoose.Schema.Types.ObjectId},
|
||||
name: {type: String},
|
||||
company: {type: String},
|
||||
}]
|
||||
}],
|
||||
})
|
||||
|
|
|
|||
|
|
@ -30,8 +30,35 @@
|
|||
var workId = $(this).attr('data-Id');
|
||||
if (workId)
|
||||
{
|
||||
var selectedDate = $('#workReportDate').data("DateTimePicker").date().format('YYYY.MM');
|
||||
//$.get('/invoices/print2' , function(data) { console.log(data);
|
||||
$.get('/print_workreport/'+workId , function(data) {
|
||||
$.get('/print_workreport/'+workId+'/'+selectedDate , function(data) {
|
||||
|
||||
if (!isLoaded)
|
||||
{ isLoaded=true;
|
||||
|
||||
//console.log(data);
|
||||
pdfMake.createPdf(data).open();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
alert('Nincs mit nyomtatni!');
|
||||
}
|
||||
});
|
||||
|
||||
// Műhely munka nyomtatása teljes
|
||||
$("#printWorkReportAll").click(function(ev) {
|
||||
|
||||
isLoaded=false;
|
||||
var workId = $(this).attr('data-Id');
|
||||
if (workId)
|
||||
{
|
||||
var selectedDate = $('#workReportDate').data("DateTimePicker").date().format('YYYY.MM');
|
||||
//$.get('/invoices/print2' , function(data) { console.log(data);
|
||||
$.get('/print_workreportAll/'+workId , function(data) {
|
||||
|
||||
if (!isLoaded)
|
||||
{ isLoaded=true;
|
||||
|
|
@ -74,6 +101,132 @@
|
|||
.catch(() => alert('Fájl letöltés sikertelen!'));
|
||||
|
||||
}
|
||||
|
||||
function getWorkReportSumMuhely()
|
||||
{
|
||||
document.getElementById ('workReportSumMuhely').textContent=0;
|
||||
//Fetch workReport
|
||||
var wid = document.getElementById ('wn').textContent;
|
||||
fetch('/workreportGetSum/'+wid , {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
document.getElementById ('workReportSumMuhely').textContent=`Műhely munkaórák: ${data.workTimesSum} óra`
|
||||
})
|
||||
|
||||
.catch(error => console.error('Error:', error));
|
||||
}
|
||||
|
||||
function getDailyReportSum()
|
||||
{
|
||||
document.getElementById ('dailyReportGetSum').textContent=0;
|
||||
//Fetch workReport
|
||||
var wid = document.getElementById ('wn').textContent;
|
||||
fetch('/dailyReportGetSum/'+wid , {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
document.getElementById ('dailyReportGetSum').textContent=`Terep munkaórák: ${data.dailyReportSum} óra`
|
||||
})
|
||||
|
||||
.catch(error => console.error('Error:', error));
|
||||
}
|
||||
|
||||
function updateWorkReport()
|
||||
{
|
||||
var selectedDate = $('#workReportDate').data("DateTimePicker").date().format('YYYY.MM');
|
||||
|
||||
//console.log("Selected Date:", selectedDate ? selectedDate.format('YYYY-MM-DD') : "No date selected");
|
||||
document.getElementById ('workTimesSum').textContent=0;
|
||||
//Fetch workReport
|
||||
var wid = document.getElementById ('wn').textContent;
|
||||
fetch('/workreportGet/'+wid+'/'+selectedDate , {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
$('#workReportTable2 > tbody').empty();
|
||||
//console.log(data)
|
||||
//var t=data.reports[0];
|
||||
var newRow= ""
|
||||
|
||||
$.each(data.reports,function(ix,t){
|
||||
newRow= `<tr><td rowspan=${t.workFlow.length}>
|
||||
<div class="row" style="margin-left: 3px">
|
||||
${moment(t.date).format("YYYY.MM.DD")}
|
||||
</div>
|
||||
<div class="row" style="margin-left: 3px">
|
||||
${moment(t.date).format("dddd")}
|
||||
</div>
|
||||
<div class="row justify-content-center" style="margin-left: 3px">
|
||||
<button type="button" class="btn btn-primary btn-sm" style="margin-left: 4px" data-id=${t._id} onclick="editReport(this);">
|
||||
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
</td>`
|
||||
$.each(t.workFlow,function(i,item){
|
||||
|
||||
//newRow+= `<tr>` +
|
||||
|
||||
newRow+= `<td>${item.Title}</td><td>`
|
||||
$.each(item.employeeList,function(idx,employee){
|
||||
if (employee.company)
|
||||
{
|
||||
newRow+=employee.company+'<br>'
|
||||
}
|
||||
else
|
||||
{
|
||||
newRow+="K-L Electro Bt"+'<br>'
|
||||
}
|
||||
})
|
||||
newRow+= `</td><td>`
|
||||
$.each(item.employeeList,function(idx,employee){
|
||||
newRow+=employee.name+'<br>'
|
||||
})
|
||||
newRow+= `</td>`
|
||||
newRow+= `</tr>`
|
||||
})
|
||||
//newRow+= `<td rowspan=${t.workFlow.length}>12</td></tr>`
|
||||
$('#workReportTable2 > tbody:last-child').append (newRow);
|
||||
})
|
||||
//$('#workReportTable > tbody:last-child').append (newRow);
|
||||
document.getElementById ('workTimesSum').textContent=`Műhely munkaórák: ${data.workTimesSum} óra`
|
||||
})
|
||||
|
||||
.catch(error => console.error('Error:', error));
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
getWorkReportSumMuhely();
|
||||
getDailyReportSum();
|
||||
$('#workReportDate').datetimepicker({
|
||||
locale: 'hu',
|
||||
format: 'LD',
|
||||
defaultDate: new Date(),
|
||||
inline: false,
|
||||
sideBySide: true,
|
||||
showTodayButton: true,
|
||||
format: 'YYYY.MM'
|
||||
}).on('dp.change',function(e){
|
||||
var calcdate=moment(e.date).format('YYYY.MM');// new Date($('#calcDate').val());
|
||||
//refreshAccessDetails(calcdate); // Lista frissítése dátum választáskor
|
||||
updateWorkReport();
|
||||
});
|
||||
})
|
||||
/* $("#getXML").click(function(ev) {
|
||||
|
||||
//isLoaded=false;
|
||||
|
|
|
|||
|
|
@ -2642,6 +2642,7 @@ router.post('/add',utils.ensureAuthenticated,function(req,res){
|
|||
req.checkBody('rfid','RFID azonosító megadása kötelező!').notEmpty();
|
||||
req.checkBody('vacationYear','Éves szabadság megadása kötelező!').notEmpty();
|
||||
req.checkBody('vacationUsed','Kiadott szabadság megadása kötelező!').notEmpty();
|
||||
req.checkBody('company','Cégnév megadása kötelező!').notEmpty();
|
||||
req.checkBody('email', 'Email megadása kötelező!').notEmpty();
|
||||
req.checkBody('email', 'Nem valós email cím!').isEmail();
|
||||
req.checkBody('password', 'Jelszó megadása kötelező!').notEmpty();
|
||||
|
|
@ -2672,6 +2673,7 @@ router.post('/add',utils.ensureAuthenticated,function(req,res){
|
|||
employee.vacationUsed=req.body.vacationUsed;
|
||||
employee.password=req.body.password;
|
||||
employee.email=req.body.email;
|
||||
employee.company=req.body.company
|
||||
employee.apiKey='-';
|
||||
employee.uuid='-';
|
||||
mobilePortalAccessEnabled=false;
|
||||
|
|
@ -2768,6 +2770,7 @@ router.post('/edit/:id', utils.ensureAuthenticated,function(req,res){
|
|||
req.checkBody('rfid','RFID azonosító megadása kötelező!').notEmpty();
|
||||
req.checkBody('vacationYear','Éves szabadság megadása kötelező!').notEmpty();
|
||||
req.checkBody('vacationUsed','Kiadott szabadság megadása kötelező!').notEmpty();
|
||||
req.checkBody('company','Cégnév megadása kötelező!').notEmpty();
|
||||
// Get errors
|
||||
let errors = req.validationErrors();
|
||||
|
||||
|
|
@ -2790,6 +2793,7 @@ router.post('/edit/:id', utils.ensureAuthenticated,function(req,res){
|
|||
employee.vacationYear=req.body.vacationYear;
|
||||
employee.vacationUsed=req.body.vacationUsed;
|
||||
employee.konyvelesre=req.body.flagKonyveles;
|
||||
employee.company=req.body.company;
|
||||
employee.mobilePortalAccessEnabled=Boolean(req.body.mobilePortalAccessEnabled);
|
||||
employee.isSubcontractor=req.body.flagSubContractor;
|
||||
employee.isStudent=req.body.flagStudent;
|
||||
|
|
@ -5847,7 +5851,7 @@ async function makeWorktimeAll(calcdate)
|
|||
if (element.isSubcontractor===null) // Alkalmazott
|
||||
{
|
||||
msz=getMunkaszunet(calcdate);
|
||||
const data= printPage(employee,som,month,weekend,req.params.mindate,holidaysArray,sickpaysArray,msz)
|
||||
const data= printPage(element,som,month,weekend,calcdate,holidaysArray,sickpaysArray,msz)
|
||||
//var data= printPage(element,som,month,weekend,calcdate,holidaysArray,sickpaysArray,msz)//.then(function(data){
|
||||
var fonts = {
|
||||
Roboto: {
|
||||
|
|
@ -5887,7 +5891,7 @@ async function makeWorktimeAll(calcdate)
|
|||
{
|
||||
msz=getMunkaszunet(calcdate);
|
||||
//printPageContractor(element,som,month,weekend,calcdate,holidaysArray, function(err,data){
|
||||
const data= printPage(employee,som,month,weekend,req.params.mindate,holidaysArray,sickpaysArray,msz)
|
||||
const data= printPage(element,som,month,weekend,calcdate,holidaysArray,sickpaysArray,msz)
|
||||
// var data= printPage(element,som,month,weekend,calcdate,holidaysArray,sickpaysArray,msz)
|
||||
var fonts = {
|
||||
Roboto: {
|
||||
|
|
|
|||
|
|
@ -50,9 +50,10 @@ script.
|
|||
//const d=JSON.parse(decodeURIComponent($(identifier).data('item')))
|
||||
const d=$(identifier).data('id')
|
||||
const name=$(identifier).data('name')
|
||||
const company=$(identifier).data('company')
|
||||
if (!state)
|
||||
{
|
||||
workers.push({employeeId:d, name:name});
|
||||
workers.push({employeeId:d, name:name,company:company});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -185,9 +186,18 @@ script.
|
|||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
$.each(data.users,function(i,item){
|
||||
/*$.each(data.users,function(i,item){
|
||||
var data_str = encodeURIComponent(JSON.stringify(item));
|
||||
$('<button class="btn btn-primary aaa" disabled onclick="handleClick(this)" id="'+item._id+'" data-item="'+data_str+'" data-name="'+item.name+'" data-id="'+item._id+'" style="width:150px;margin: 3px" data-toggle="button" type="button">'+item.name+'</button>').appendTo('#buttons2');
|
||||
})*/
|
||||
$.each(data.users,function(i,item){
|
||||
$('<hr><h3>'+item._id.company+'</h3>').appendTo('#buttons2');
|
||||
$.each(item.employees,function(l,user){
|
||||
var data_str = encodeURIComponent(JSON.stringify(user));
|
||||
$('<button class="btn btn-primary aaa" disabled onclick="handleClick(this)" id="'+user.id+'"data-item="'+data_str+'" data-name="'+user.name+'" data-id="'+user.id+'" data-company="'+item._id.company+'"style="width:150px;margin: 3px" data-toggle="button" type="button">'+user.name+'</button>').appendTo('#buttons2');
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
textChanged()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -50,9 +50,10 @@ script.
|
|||
//const d=JSON.parse(decodeURIComponent($(identifier).data('item')))
|
||||
const d=$(identifier).data('id')
|
||||
const name=$(identifier).data('name')
|
||||
const company=$(identifier).data('company')
|
||||
if (!state)
|
||||
{
|
||||
workers.push({employeeId:d, name:name});
|
||||
workers.push({employeeId:d, name:name,company:company});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -185,9 +186,18 @@ script.
|
|||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
$.each(data.users,function(i,item){
|
||||
/* $.each(data.users,function(i,item){
|
||||
var data_str = encodeURIComponent(JSON.stringify(item));
|
||||
$('<button class="btn btn-primary aaa" disabled onclick="handleClick(this)" id="'+item._id+'" data-item="'+data_str+'" data-name="'+item.name+'" data-id="'+item._id+'" style="width:150px;margin: 3px" data-toggle="button" type="button">'+item.name+'</button>').appendTo('#buttons3');
|
||||
})*/
|
||||
$.each(data.users,function(i,item){
|
||||
$('<hr><h3>'+item._id.company+'</h3>').appendTo('#buttons3');
|
||||
$.each(item.employees,function(l,user){
|
||||
var data_str = encodeURIComponent(JSON.stringify(user));
|
||||
$('<button class="btn btn-primary aaa" disabled onclick="handleClick(this)" id="'+user.id+'"data-item="'+data_str+'" data-name="'+user.name+'" data-id="'+user.id+'" data-company="'+item._id.company+'"style="width:150px;margin: 3px" data-toggle="button" type="button">'+user.name+'</button>').appendTo('#buttons3');
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
textChanged1()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -50,9 +50,10 @@ script.
|
|||
//const d=JSON.parse(decodeURIComponent($(identifier).data('item')))
|
||||
const d=$(identifier).data('id')
|
||||
const name=$(identifier).data('name')
|
||||
const company=$(identifier).data('company')
|
||||
if (!state)
|
||||
{
|
||||
workers.push({employeeId:d, name:name});
|
||||
workers.push({employeeId:d, name:name,company:company});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -228,8 +229,14 @@ script.
|
|||
.then(data => {
|
||||
console.log(data)
|
||||
$.each(data.users,function(i,item){
|
||||
var data_str = encodeURIComponent(JSON.stringify(item));
|
||||
$('<button class="btn btn-primary aaa" disabled onclick="handleClick(this)" id="'+item._id+'"data-item="'+data_str+'" data-name="'+item.name+'" data-id="'+item._id+'" style="width:150px;margin: 3px" data-toggle="button" type="button">'+item.name+'</button>').appendTo('#buttons');
|
||||
$('<hr><h3>'+item._id.company+'</h3>').appendTo('#buttons');
|
||||
$.each(item.employees,function(l,user){
|
||||
var data_str = encodeURIComponent(JSON.stringify(user));
|
||||
//$('<button class="btn btn-primary aaa" disabled onclick="handleClick(this)" id="'+item._id+'"data-item="'+data_str+'" data-name="'+item.name+'" data-id="'+item._id+'" style="width:150px;margin: 3px" data-toggle="button" type="button">'+item.name+'</button>').appendTo('#buttons');
|
||||
$('<button class="btn btn-primary aaa" disabled onclick="handleClick(this)" id="'+user.id+'"data-item="'+data_str+'" data-name="'+user.name+'" data-id="'+user.id+'" data-company="'+item._id.company+'"style="width:150px;margin: 3px" data-toggle="button" type="button">'+user.name+'</button>').appendTo('#buttons');
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
.catch(error => console.error('Error:', error));
|
||||
|
|
|
|||
|
|
@ -10,8 +10,13 @@ block content
|
|||
.form-group(style='width:100%; background-color:#1F2739;')
|
||||
form(method='POST', action='/employee/add',onsubmit='frmSubmit(event)',style='padding:20px')
|
||||
#form-group
|
||||
.row
|
||||
.col-sm-6
|
||||
label Név:
|
||||
input.form-control.inputDark(name='Name',type=text, autofocus,tabindex='1', readonly=false,width='1000', value= workNum)
|
||||
.col-sm-6
|
||||
label Cég:
|
||||
input.form-control.inputDark(name='company',type=text, autofocus,tabindex='1', readonly=false,width='1000', value= "K-L Electro Bt",style='color: white;background-color:blueviolet;')
|
||||
label Rövidített név:
|
||||
input.form-control.inputDark(name='shortName',type=text, tabindex='2', readonly=false, value= workNum)
|
||||
label Email:
|
||||
|
|
|
|||
|
|
@ -10,8 +10,13 @@ block content
|
|||
br
|
||||
form(method='POST',style='width:90%;padding-left: 50px', action='/employee/edit/'+employee._id,onsubmit='frmSubmit(event)')
|
||||
#form-group
|
||||
.row
|
||||
.col-sm-6
|
||||
label Név:
|
||||
input.form-control.inputDark(name='Name',type=text, autofocus,tabindex='1', readonly=false,width='1000', value= employee.name)
|
||||
.col-sm-6
|
||||
label Cégnév:
|
||||
input.form-control.inputDark(name='company',type=text, autofocus,tabindex='1', readonly=false,width='1000', value= employee.company)
|
||||
br
|
||||
label Rövidített név:
|
||||
input.form-control.inputDark(name='shortName',type=text, tabindex='2', readonly=false, value= employee.shortName)
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ block content
|
|||
col(width='1%')
|
||||
col(width='auto')
|
||||
col(width='auto')
|
||||
col(width='5%')
|
||||
//-col(width='5%')
|
||||
col(width='5%')
|
||||
col(width='5%')
|
||||
col(width='5%')
|
||||
|
|
@ -156,7 +156,7 @@ block content
|
|||
th
|
||||
th(style='text-align:left') Megrendelő
|
||||
th Megnevezés
|
||||
th(style='text-align:center') File
|
||||
//-th(style='text-align:center') File
|
||||
th(style='text-align:center') Létrehozva
|
||||
th(style='text-align:center') Státusz
|
||||
th(style='text-align:left') M.SZ.
|
||||
|
|
@ -176,7 +176,7 @@ block content
|
|||
td(style='text-align:left; vertical-align:middle;font-size: 9px;font-weight: bold;') #{work.megrendelo || "-"}
|
||||
td(style='vertical-align:middle')
|
||||
a(href="/work/"+work._id)= work.title
|
||||
td(style='text-align:center;vertical-align:middle')
|
||||
//-td(style='text-align:center;vertical-align:middle')
|
||||
if (work.filesCM.length>0)
|
||||
span.badge.badge-success #{work.filesCM.length}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ html
|
|||
title Munka nyílvántartó
|
||||
//-link(rel='icon' href='IOCT_LOGO.ico' type='image/icon type')
|
||||
link(rel='stylesheet' href='/bower_components/bootstrap/dist/css/bootstrap.css')
|
||||
|
||||
//-link(rel='stylesheet', href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css')
|
||||
link(rel='stylesheet' href='/css/style.css')
|
||||
link(rel='stylesheet' href='/css/switch.css')
|
||||
|
|
@ -125,7 +126,7 @@ html
|
|||
hr
|
||||
footer
|
||||
p IO-Technic Hungary Copyright © 2018
|
||||
script(src='/bower_components/jquery/dist/jquery.js')
|
||||
script(src='/bower_components/jquery/dist/jquery.min.js')
|
||||
//script(src='http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js')
|
||||
//script(type='text/javascript', src='/bower_components/jquery/dist/jquery.min.js')
|
||||
script(src='/bower_components/bootstrap/dist/js/bootstrap.js')
|
||||
|
|
|
|||
112
views/work.pug
112
views/work.pug
|
|
@ -2,9 +2,11 @@ extends layout
|
|||
|
||||
block content
|
||||
.container
|
||||
link(rel='stylesheet' href='/bower_components/bootstrap/dist/css/bootstrap.css')
|
||||
//-link(rel='stylesheet' href='/bower_components/bootstrap/dist/css/bootstrap.css')
|
||||
//-link(rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css')
|
||||
link(href='//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css', rel='stylesheet')
|
||||
link(rel='stylesheet', type='text/css', href='https://unpkg.com/lightpick@latest/css/lightpick.css')
|
||||
link(rel='stylesheet', href='/bower_components/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css')
|
||||
link(rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/11.14.2/sweetalert2.css" integrity="sha512-TG239kA30BXeGpy+HpJei+qfJcKo8V9HKpe8UWuVdpk49NGUe86EDhmdXkCxMqD5gSlkLLi6YQ9SbNp+yRa9xQ==" crossorigin="anonymous" referrerpolicy="no-referrer")
|
||||
include Modals/modal_workReport
|
||||
|
||||
|
|
@ -83,7 +85,13 @@ block content
|
|||
hr
|
||||
div.row
|
||||
div.col-md-12
|
||||
p Megjegyzés: #{work.body}
|
||||
h4#workTimeSum
|
||||
hr
|
||||
.row
|
||||
.col-sm-6
|
||||
h4#workReportSumMuhely
|
||||
.col-sm-6
|
||||
h4#dailyReportGetSum
|
||||
if (work.filesCM.length)
|
||||
hr
|
||||
each file, i in work.filesCM
|
||||
|
|
@ -98,7 +106,7 @@ block content
|
|||
img(src='/pdf.jpg',align='right', width='16px', height='16px')
|
||||
div.col-md-5
|
||||
//a(href="/cmfile/"+encodeURIComponent(work._id)+"/"+i)= file
|
||||
a(href=`localhost:5000/api/db/getDocumentByPath?param=${encodeURIComponent(work.pathCM+"\\"+encodeURIComponent(work.filesCM[i]))}` target='_blank')= file
|
||||
a(href=`https://cmmunkaszam.klelectro.eu/api/db/getDocumentByPath?param=${encodeURIComponent(work.pathCM+"\\"+encodeURIComponent(work.filesCM[i]))}` target='_blank')= file
|
||||
|
||||
|
||||
.panel-footer
|
||||
|
|
@ -201,13 +209,21 @@ block content
|
|||
.panel.panel-warning
|
||||
.panel-heading
|
||||
.row
|
||||
.col-md-7
|
||||
.col-md-5
|
||||
h4 Műhely munkavégzés
|
||||
.col-md-2
|
||||
h5#workTimesSum
|
||||
.col-md-2
|
||||
#workReportDate.input-group.date
|
||||
input.form-control(id='calcDate',name='wrDate', tabindex='6',type='text',style='color: white;background-color:#2C3446;')
|
||||
span.input-group-addon
|
||||
span.glyphicon.glyphicon-calendar
|
||||
.col-md-1.float-right
|
||||
button.btn.btn-success.button-spacer(id='printWorkReport',name='printWorkReport', data-id=work._id,type='button')
|
||||
span.fa.fa-solid.fa-print
|
||||
.col-md-1.float-right
|
||||
button.btn.btn-success.button-spacer(id='printWorkReportAll',name='printWorkReportAll', data-id=work._id,type='button')
|
||||
span.fa.fa-solid.fa-print
|
||||
.col-md-2.float-right
|
||||
span.pull-right.clickable
|
||||
i.glyphicon.glyphicon-chevron-up
|
||||
|
|
@ -219,13 +235,14 @@ block content
|
|||
-//col(width='5%')
|
||||
col(width='10%')
|
||||
col(width='auto')
|
||||
col(width='10%')
|
||||
col(width='15%')
|
||||
|
||||
thead
|
||||
tr
|
||||
-//th #
|
||||
th(style='text-align:left') Dátum
|
||||
th(style='text-align:left') Munkavégzés leírása
|
||||
th(style='text-align:left') Cég
|
||||
th(style='text-align:left') Résztvevők
|
||||
|
||||
|
||||
|
|
@ -282,11 +299,14 @@ block content
|
|||
| Vissza
|
||||
|
||||
script(src='/bower_components/jquery/dist/jquery.js')
|
||||
script(type='text/javascript', src='/bower_components/bootstrap/dist/js/bootstrap.min.js')
|
||||
script(type='text/javascript', src='/bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js')
|
||||
script(src='/js/work_utils.js')
|
||||
script(type='text/javascript', src='/bower_components/moment/min/moment.min.js')
|
||||
script(src='/bower_components/moment/min/moment-with-locales.js')
|
||||
script(type='text/javascript',src='/build/pdfmake.js')
|
||||
script(type='text/javascript',src='/build/vfs_fonts.js')
|
||||
script(src='https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js')
|
||||
script(src='https://unpkg.com/lightpick@latest/lightpick.js')
|
||||
script(src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/11.14.2/sweetalert2.min.js" integrity="sha512-nD7/PXl2UD6bAYMJVKTLhr7qwnWVvoyqk8/WMzedDKMiQbaNXT3EUPzLYbLUHCLWqAZoXO37aVCtCKmAxZfqGw==" crossorigin="anonymous" referrerpolicy="no-referrer")
|
||||
script.
|
||||
|
|
@ -305,88 +325,8 @@ block content
|
|||
}
|
||||
$(document).ready(function () {
|
||||
moment.locale('HU')
|
||||
document.getElementById ('workTimesSum').textContent=0;
|
||||
//Fetch workReport
|
||||
var wid = document.getElementById ('wn').textContent;
|
||||
fetch('/workreport/'+wid, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
//var t=data.reports[0];
|
||||
var newRow= ""
|
||||
updateWorkReport()
|
||||
|
||||
$.each(data.reports,function(ix,t){
|
||||
newRow= `<tr><td rowspan=${t.workFlow.length}>
|
||||
<div class="row" style="margin-left: 3px">
|
||||
${moment(t.date).format("YYYY.MM.DD")}
|
||||
</div>
|
||||
<div class="row" style="margin-left: 3px">
|
||||
${moment(t.date).format("dddd")}
|
||||
</div>
|
||||
<div class="row justify-content-center" style="margin-left: 3px">
|
||||
<button type="button" class="btn btn-primary btn-sm" style="margin-left: 4px" data-id=${t._id} onclick="editReport(this);">
|
||||
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
</td>`
|
||||
$.each(t.workFlow,function(i,item){
|
||||
|
||||
//newRow+= `<tr>` +
|
||||
|
||||
newRow+= `<td>${item.Title}</td><td>`
|
||||
|
||||
$.each(item.employeeList,function(idx,employee){
|
||||
newRow+=employee.name+'<br>'
|
||||
})
|
||||
newRow+= `</td>`
|
||||
newRow+= `</tr>`
|
||||
})
|
||||
//newRow+= `<td rowspan=${t.workFlow.length}>12</td></tr>`
|
||||
$('#workReportTable2 > tbody:last-child').append (newRow);
|
||||
})
|
||||
//$('#workReportTable > tbody:last-child').append (newRow);
|
||||
document.getElementById ('workTimesSum').textContent=`Munkaórák: ${data.workTimesSum} óra`
|
||||
})
|
||||
|
||||
.catch(error => console.error('Error:', error));
|
||||
/*fetch('/workreportList/'+wid, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
$.each(data.reports,function(i,item){
|
||||
var newRow="<tr><td>"+(i+1)+"</td>"
|
||||
newRow+=
|
||||
'<td style="text-align:left">'+moment(new Date(item.date)).format('YYYY.MM.DD')+'</td>'
|
||||
//'<td style="text-align:right">'+item.workTitle+'</td>'
|
||||
|
||||
newRow+='<td>'
|
||||
$.each(item.items,function(i,employee){
|
||||
newRow+=employee.name+'<br>'
|
||||
});
|
||||
newRow+='</td>'
|
||||
newRow+='<td>'
|
||||
$.each(item.items,function(i,wf){
|
||||
newRow+=wf.workFlow+'<br>'
|
||||
});
|
||||
newRow+='</td>'
|
||||
newRow+='</tr>';
|
||||
$('#workReportTable > tbody:last-child').append (newRow);
|
||||
})
|
||||
})
|
||||
.catch(error => console.error('Error:', error));
|
||||
*/
|
||||
|
||||
document.getElementById('enaploImp').addEventListener('change', readFile, false);
|
||||
/* var entemplate = document.getElementById ('entemp').textContent;
|
||||
|
|
|
|||
|
|
@ -40,11 +40,13 @@ block content
|
|||
col(width='auto')
|
||||
col(width='15%')
|
||||
col(width='15%')
|
||||
col(width='15%')
|
||||
thead
|
||||
tr
|
||||
|
||||
th(style='text-align:left') #
|
||||
th(style='text-align:left') Munkavégzés leírása
|
||||
th(style='text-align:left') Cég
|
||||
th(style='text-align:left') Résztvevők
|
||||
th(style='text-align:center') Művelet
|
||||
|
||||
|
|
@ -100,12 +102,14 @@ block content
|
|||
var rid
|
||||
if (item._id){ rid=item._id} else {rid=item.cid}
|
||||
if (idx==0){
|
||||
newRow+=`<td>${employee.company}</td>`
|
||||
newRow+=`<td>${employee.name}</td>`+
|
||||
`<td rowspan="${rows}" class="vcenter"><button class="btn btn-success" data-rid='${rid}' data-toggle='modal' type='button' data-target='#workReportEditModal'>Szerkeszt</button></td>`
|
||||
newRow+= `</tr>`
|
||||
} else
|
||||
{
|
||||
newRow+=`<tr><td>${employee.name}</td></tr>`//+
|
||||
//newRow+=`<tr><td>${employee.company}</td></tr>`//+
|
||||
newRow+=`<tr><td>${employee.company}</td><td>${employee.name}</td></tr>`//+
|
||||
//`<td><button>Edit</button></td></tr>`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ block content
|
|||
.clickable{
|
||||
cursor: pointer;
|
||||
}
|
||||
h4#dummy(style="display:none")
|
||||
h4#dummy
|
||||
#form-group
|
||||
form(id="myForm",name="myForm",method='get', action='/work/generateXML/')
|
||||
.panel.panel-warning
|
||||
|
|
@ -139,7 +139,7 @@ block content
|
|||
console.log(da)
|
||||
|
||||
// Adatok mentése szerverre
|
||||
const response = fetch('/workreport', {
|
||||
const response = fetch('/workreportSave', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
|
|
|||
Loading…
Reference in New Issue