Test
This commit is contained in:
parent
92505126af
commit
420595d23b
|
@ -196,7 +196,7 @@ router.get('/bulk-add', async (req, res) => { // Render form to bulk add ACL ent
|
|||
|
||||
|
||||
router.post('/bulk-add', async (req, res) => { // Process bulk add of ACL entries
|
||||
const data = req.body;
|
||||
const data = req.body.credentials;
|
||||
if (!Array.isArray(data)) {
|
||||
return res.status(400).json({ error: 'Invalid data format' });
|
||||
}
|
||||
|
|
|
@ -145,26 +145,20 @@
|
|||
rows.forEach(tr => {
|
||||
const selected = tr.querySelector('input[type="checkbox"]');
|
||||
if (selected && selected.checked) {
|
||||
const cardNumber = tr.children[1].textContent;
|
||||
const controller = tr.children[2].textContent;
|
||||
const door = tr.children[3].textContent;
|
||||
const timestamp = tr.children[4].textContent;
|
||||
const name = tr.querySelector('input[name="name"]').value;
|
||||
const startDate = tr.querySelectorAll('input[type="date"]')[0].value;
|
||||
const endDate = tr.querySelectorAll('input[type="date"]')[1].value;
|
||||
const allowedDoors = [];
|
||||
const CardNumber = tr.children[1].textContent;
|
||||
const Name = tr.querySelector('input[name="name"]').value;
|
||||
const StartDate = tr.querySelectorAll('input[type="date"]')[0].value;
|
||||
const EndDate = tr.querySelectorAll('input[type="date"]')[1].value;
|
||||
const Doors = [];
|
||||
tr.children[8].querySelectorAll('input[type="checkbox"]').forEach(cb => {
|
||||
if (cb.checked) allowedDoors.push(cb.name);
|
||||
if (cb.checked) Doors.push(cb.name);
|
||||
});
|
||||
credentials.push({
|
||||
cardNumber,
|
||||
controller,
|
||||
door,
|
||||
timestamp,
|
||||
name,
|
||||
startDate,
|
||||
endDate,
|
||||
allowedDoors
|
||||
CardNumber,
|
||||
Name,
|
||||
StartDate,
|
||||
EndDate,
|
||||
Doors
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue