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
|
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)) {
|
if (!Array.isArray(data)) {
|
||||||
return res.status(400).json({ error: 'Invalid data format' });
|
return res.status(400).json({ error: 'Invalid data format' });
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,26 +145,20 @@
|
||||||
rows.forEach(tr => {
|
rows.forEach(tr => {
|
||||||
const selected = tr.querySelector('input[type="checkbox"]');
|
const selected = tr.querySelector('input[type="checkbox"]');
|
||||||
if (selected && selected.checked) {
|
if (selected && selected.checked) {
|
||||||
const cardNumber = tr.children[1].textContent;
|
const CardNumber = tr.children[1].textContent;
|
||||||
const controller = tr.children[2].textContent;
|
const Name = tr.querySelector('input[name="name"]').value;
|
||||||
const door = tr.children[3].textContent;
|
const StartDate = tr.querySelectorAll('input[type="date"]')[0].value;
|
||||||
const timestamp = tr.children[4].textContent;
|
const EndDate = tr.querySelectorAll('input[type="date"]')[1].value;
|
||||||
const name = tr.querySelector('input[name="name"]').value;
|
const Doors = [];
|
||||||
const startDate = tr.querySelectorAll('input[type="date"]')[0].value;
|
|
||||||
const endDate = tr.querySelectorAll('input[type="date"]')[1].value;
|
|
||||||
const allowedDoors = [];
|
|
||||||
tr.children[8].querySelectorAll('input[type="checkbox"]').forEach(cb => {
|
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({
|
credentials.push({
|
||||||
cardNumber,
|
CardNumber,
|
||||||
controller,
|
Name,
|
||||||
door,
|
StartDate,
|
||||||
timestamp,
|
EndDate,
|
||||||
name,
|
Doors
|
||||||
startDate,
|
|
||||||
endDate,
|
|
||||||
allowedDoors
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue