klnodekb/views/work.pug

282 lines
12 KiB
Plaintext

extends layout
block content
.container
link(rel='stylesheet' href='/bower_components/bootstrap/dist/css/bootstrap.css')
link(href='//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css', rel='stylesheet')
style(type="text/css").
.clickable{
cursor: pointer;
}
.zoom-in-out-box {
margin: 2px;
width: 50px;
height: 50px;
animation: zoom-in-zoom-out 2s ease infinite;
}
@keyframes zoom-in-zoom-out {
0% {
transform: scale(0.5, 0.5);
}
50% {
transform: scale(1, 1);
}
100% {
transform: scale(0.5, 0.5);
}
}
#form-group
.panel.panel-primary
.panel-heading
h4 #{work.title}
.panel-body
div.row
div.col-md-2
h4(id='wn',style='display:none;') #{work.id}
h4(id='entemp',style='display:none;') #{work.enaploTemplate}
h4(style="text-align:right;") Munka szám:
h4(style="text-align:right;") PO szám:
h4(style="text-align:right;") CMR Rendszám:
if (enaplodata.azonosito)
h5(style="text-align:right;") e-napló:
h5(style="text-align:right;") Projekt:
h5(style="text-align:right;") Munka:
div.col-md-7
h4 #{work.workNumber}
h4 #{work.poNumber}
h4 #{work.cmRendAzonosito}
if (enaplodata.azonosito)
h5 #{enaplodata.azonosito}
h5 #{enaplodata.project+' '+enaplodata.helyszin}
h5 #{enaplodata.munka}
div.col-md-3
h5(style="font-weight: bold;text-align:right;") Létrehozó:
p(style="font-weight: normal;text-align:right;") #{author}
p(style="font-weight: normal;text-align:right;") #{work.workDate}
if (enaplodata.azonosito)
img.zoom-in-out-box(src='/enaplo.png',align='right', width='32px', height='32px')
if (work.body)
hr
div.row
div.col-md-12
p Megjegyzés: #{work.body}
.panel-footer
#form-group
.btn-toolbar
if(user.canModify.work)
a.btn.btn-primary.col-sm-2(href='/work/edit/'+work._id)
i.fa.fa-edit.fa-lg.fa-fw
| Szerkesztés
if (articles.length===0)
if(user.canDelete.work)
a.btn.btn-primary.col-sm-1(href='/work/edit/'+work._id)
i.fa.fa-trash.fa-lg.fa-fw
| Törlés
if(user.canModify.work)
a.btn.btn-primary.col-sm-2(href='/work/copy/'+work._id)
i.fa.fa-copy.fa-lg.fa-fw
| Másolat készítése
if(user.canAdd.files)
input(id='enaploImp',type='file',enctype="multipart/form-data",style='display:none;',accept=".enyk")
a.btn.btn-warning.col-sm-2(onclick="document.getElementById('enaploImp').click();",type='button')
i.fa.fa-solid.fa-upload
| Enapló import
if(work.state==='Opened')
a.btn.btn-danger.col-sm-2(name='wClose',id='wClose',href='/work/close/'+work._id)
i.fa.fa-flag-checkered.fa-lg.fa-fw
| Munka lezárása
a.btn.btn-success.col-sm-1(href='/')
i.fa.fa-home.fa-lg.fa-fw
| Vissza
br
//-a(href='http://localhost/work/generateXML/634fdcc026d48a5c353a3e8d/63bd6a7d38a2c0150522567e')
span.glyphicon.glyphicon-download
//-form(id='a',method='get', action='/work/generateXML/634fdcc026d48a5c353a3e8d/63bd6a7d38a2c0150522567e')
input.btn.btn-primary(id='a',type='submit',value='enaplo',tabindex='56')
form(id="myForm",name="myForm",method='get', action='/work/generateXML/')
.panel.panel-primary( data-toggle="collapse")
.panel-heading
.row
.col-md-9
h4 Résztvevők
.col-md-1
if (dailyReports.length>0)
button.btn.btn-success.button-spacer(id='printReport',name='printReport', data-id=work._id,type='button')
span.fa.fa-solid.fa-print
else
button.btn.btn-secondary.button-spacer(id='printReport',name='printReport',disabled, 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
#collapsePanel.panel-body
form#form-1(method='POST' action='/submit/form-1')
.row
.table-responsive
table.table.table-striped
col(width='5%')
col(width='10%')
col(width='auto')
col(width='15%')
if (work.enaploTemplate)
col(width='5%')
thead
tr
th #
th Dátum
th(style='text-align:left') Munkavégzés leírása
th(style='text-align:left') Jelenlévők
if (work.enaploTemplate)
th(style='text-align:middle') export
tbody
if (dailyReports)
each report, i in dailyReports
tr
td(style='vertical-align: middle') #{i+1}
td(style='text-align:left;vertical-align: middle') #{report.date}
td(style='text-align:left;vertical-align: middle') #{report.title}
td(style='text-align:left;vertical-align: middle')
each empl, l in report.list
if (report.foreman===empl._id.toString())
div
| #{empl.name}
i.fa.fa-solid.fa-star.fa-fw(style='color:red')
else
p(style='margin-bottom:0px') #{empl.name}
if (work.enaploTemplate)
td(style='text-align:left;vertical-align: middle')
//-a(name='getXML'+i,id='getXML'+i,href='/work/generateXML', data-wid=work._id,data-drid=report._id)
a(name='getXML'+i,id='getXML'+i,href='#',onclick='getXML(\''+work._id+'\',\''+report._id+'\',\''+report.date+'\')')
span.glyphicon.glyphicon-download
//-button(type='submit' name='a' form='form-1')
//-button.btn.btn-primary(id=report._id,form="myForm",type='submit',formaction='/work/generateXML/'+work._id+'/'+report._id, value='enaplo',tabindex='56')
//-button.btn.btn-secondary.button-spacer(id=report._id,form="myForm", data-wid=work._id,data-rid=report._id, type='submit')
br
.panel.panel-primary
.panel-heading
h4 Berendezések:
.panel-body
.row
.table-responsive
table.table.table-striped
col(width='5%')
col(width='auto')
col(width='15%')
col(width='15%')
col(width='15%')
thead
tr
th #
th Megnevezés
th(style='text-align:center') Létrehozva
th(style='text-align:right') Munka szám
th(style='text-align:right') Gyártási szám
tbody
each article, i in articles
tr
td #{i+1}
td
a(href="/articles/"+article._id+"/"+work._id)= article.title+' +'+article.workSign
td(style='text-align:center') #{article.deviceDate}
td(style='text-align:right') #{article.workNumber}
td(style='text-align:right') #{article.deviceNumber}
.panel-footer
.btn-toolbar
if(user.canAdd.device)
a.btn.btn-primary.col-sm-3(href='/articles/addTo/'+work._id)
i.fa.fa-plus.fa-lg.fa-fw
| Berendezés hozzáadása
a.btn.btn-success.col-sm-2(href='/')
i.fa.fa-home.fa-lg.fa-fw
| Vissza
script(src='/bower_components/jquery/dist/jquery.js')
script(src='/js/work_utils.js')
script(type='text/javascript', src='/bower_components/moment/min/moment.min.js')
script(type='text/javascript',src='/build/pdfmake.js')
script(type='text/javascript',src='/build/vfs_fonts.js')
script.
$(document).ready(function () {
document.getElementById('enaploImp').addEventListener('change', readFile, false);
/* var entemplate = document.getElementById ('entemp').textContent;
if (entemplate){
xmlDoc = $.parseXML(entemplate);
var fl=$(xmlDoc).find('file');
var docname = $(fl).find('head').find('docinfo').attr('name');
document.getElementById ('endata').textContent='e-napló: '+docname;
var nyom=$(xmlDoc).find('nyomtatvanyok').find('nyomtatvany').find('mezok')
}*/
$(document).on('click', '.panel-heading span.clickable', function(e){
var $this = $(this);
if(!$this.hasClass('panel-collapsed')) {
$this.parents('.panel').find('.panel-body').slideUp();
$this.addClass('panel-collapsed');
$this.find('i').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
} else {
$this.parents('.panel').find('.panel-body').slideDown();
$this.removeClass('panel-collapsed');
$this.find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
}
})
function readFile (evt) {
var files = evt.target.files;
var file = files[0];
var reader = new FileReader();
reader.onload = function(event) {
var id = document.getElementById ('wn').textContent;
console.log("DataId: "+id)
xmlDoc = $.parseXML( event.target.result )
var xmlString = (new XMLSerializer()).serializeToString(xmlDoc);
var fl=$(xmlDoc).find('file');
var filetype = $(fl).find('head').attr('filetype');
if (filetype!='zn1810')
{
alert("Nem megfelelő fájl!");
return;
}
$.ajax({
type: 'POST',
url: '/work/enaploUpload/'+id,
data: {'xml':xmlString},
success: function(response){
//refreshAccessDetails(); // Lista frissítése betöltéskor
// window.location.href='/';
console.log(response);
location.reload();
},
error: function(err){
alert('A feltöltés nem sikerült!');
}
});
console.log(filetype );
// })
// console.log(event.target.result);
}
reader.readAsText(file)
}
$("#wClose").on("click", function( e ){ //e => event
if( ! confirm("Valóban lezárja a munkát?") ){
e.preventDefault(); // ! => don't want to do this
} else {
//want to do this! => maybe do something about it?
}
});
});