Device, Vehicle hozzárendelés javítva

This commit is contained in:
Vincze József 2023-10-26 09:09:06 +02:00
parent dcedcfe0ff
commit c4c25a5eaf
4 changed files with 53 additions and 8 deletions

View File

@ -9,7 +9,45 @@ router.get('/list', utils.ensureAuthenticated, function(req, res) {
var admin=false;
RfidDevice.find({} ,function(err, rfidDevices){
/* RfidDevice.find({} ,function(err, rfidDevices){
if (err)
{
console.log(err);
}
else {
res.render('device_rfid_list', {
title: 'RFID Eszközök',
rfidDevices: rfidDevices,
// articles: workSign
});
}
});*/
RfidDevice.aggregate([
//{ $match: { bdTable: 'zzzz' } },
{ $lookup: {
from: 'vehicles',
let: { vehicle_id: '$vehicle_id' },
pipeline: [
{ $match: {
$expr: {
$eq: [
"$_id",
"$$vehicle_id"
]
}
} },
{
$project: {
name: 1,
vehicle_id: 1,
}
}
],
as: 'vehicle'
} },
]
,function(err, rfidDevices){
if (err)
{
console.log(err);
@ -24,6 +62,7 @@ router.get('/list', utils.ensureAuthenticated, function(req, res) {
}
});
});
// Járművek listázása
// RFID Device lista
@ -65,7 +104,7 @@ router.get('/edit/:id', utils.ensureAuthenticated,function (req,res) {
}else
{
res.render('device_rfid_edit', {
title: 'RFID Eszköz Felvétele',
title: 'RFID Eszköz Módosítás',
user:req.user,
rfidDev:rfidDev,
vehicles:vehicle

View File

@ -43,7 +43,7 @@ link(rel='stylesheet', type='text/css', href='https://unpkg.com/lightpick@latest
button#oilChangeSave.btn.btn-primary(type='button' )
i.fa.fa-save
| | Mentés
script(src='/bower_components/jquery/dist/jquery.js')
//-script(src='/bower_components/jquery/dist/jquery.js')
script(type='text/javascript', src='/bower_components/moment/min/moment.min.js')
script(src='https://unpkg.com/lightpick@latest/lightpick.js')

View File

@ -7,7 +7,7 @@ block content
#darktable.container
table.container(style='width:90%;')
col(width='5%')
col(width='20%')
col(width='15%')
col(width='auto')
col(width='15%')
col(width='15%')
@ -31,10 +31,14 @@ block content
h1(style='text-align:left') FW Rev
tbody
each rfidDevice, i in rfidDevices
tr.clickable-clientRow(data-href="/devicesrfid/edit/"+rfidDevice._id)
td #{i+1}
td(style='text-align:left') #{rfidDevice.name}
td(style='text-align:left') #{rfidDevice.assignment}
if(rfidDevice.vehicle.length)
td(style='text-align:left; color: #58D68D') #{rfidDevice.vehicle[0].vehicle_id+' '+rfidDevice.vehicle[0].name}
else
td(style='text-align:left') #{rfidDevice.assignment}
td(style='text-align:left') #{rfidDevice.imei}
td(style='text-align:left') #{rfidDevice.ccid}
td(style='text-align:left') #{rfidDevice.state}

View File

@ -92,11 +92,13 @@ block content
col(width='20%')
col(width='8%')
col(width='10%')
col(width='8%')
col(width='8%')
col(width='6%')
col(width='6%')
col(width='6%')
col(width='8%')
col(width='auto')
col(width='8%')
thead
tr
th