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; 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) if (err)
{ {
console.log(err); console.log(err);
@ -24,6 +62,7 @@ router.get('/list', utils.ensureAuthenticated, function(req, res) {
} }
}); });
}); });
// Járművek listázása // Járművek listázása
// RFID Device lista // RFID Device lista
@ -65,7 +104,7 @@ router.get('/edit/:id', utils.ensureAuthenticated,function (req,res) {
}else }else
{ {
res.render('device_rfid_edit', { res.render('device_rfid_edit', {
title: 'RFID Eszköz Felvétele', title: 'RFID Eszköz Módosítás',
user:req.user, user:req.user,
rfidDev:rfidDev, rfidDev:rfidDev,
vehicles:vehicle 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' ) button#oilChangeSave.btn.btn-primary(type='button' )
i.fa.fa-save i.fa.fa-save
| | Mentés | | 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(type='text/javascript', src='/bower_components/moment/min/moment.min.js')
script(src='https://unpkg.com/lightpick@latest/lightpick.js') script(src='https://unpkg.com/lightpick@latest/lightpick.js')

View File

@ -7,7 +7,7 @@ block content
#darktable.container #darktable.container
table.container(style='width:90%;') table.container(style='width:90%;')
col(width='5%') col(width='5%')
col(width='20%') col(width='15%')
col(width='auto') col(width='auto')
col(width='15%') col(width='15%')
col(width='15%') col(width='15%')
@ -31,10 +31,14 @@ block content
h1(style='text-align:left') FW Rev h1(style='text-align:left') FW Rev
tbody tbody
each rfidDevice, i in rfidDevices each rfidDevice, i in rfidDevices
tr.clickable-clientRow(data-href="/devicesrfid/edit/"+rfidDevice._id) tr.clickable-clientRow(data-href="/devicesrfid/edit/"+rfidDevice._id)
td #{i+1} td #{i+1}
td(style='text-align:left') #{rfidDevice.name} 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.imei}
td(style='text-align:left') #{rfidDevice.ccid} td(style='text-align:left') #{rfidDevice.ccid}
td(style='text-align:left') #{rfidDevice.state} td(style='text-align:left') #{rfidDevice.state}

View File

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