- Enable Edit Event into dialog form ... (and save to the db)

- Event: enabled drag and drop (date)
- Q-Select components in every table field external: Where, Operators, etc...
- CMyEditor: Add HTML Editor to the details field !
- Added button Color for change font color to the text.
- Complete insert Events Site
This commit is contained in:
Paolo Arena
2019-10-23 23:47:21 +02:00
parent 570bbf3744
commit 51ca2da45f
8 changed files with 386 additions and 49 deletions

View File

@@ -10,6 +10,7 @@ const { Booking } = require('../models/booking');
const { MyEvent } = require('../models/myevent');
const { Operator } = require('../models/operator');
const { Where } = require('../models/where');
const { Contribtype } = require('../models/contribtype');
const { ObjectID } = require('mongodb');
@@ -97,45 +98,41 @@ router.delete('/:id/:notify/:idapp', authenticate, (req, res) => {
});
router.get('/:userId/:idapp/:sall', authenticate, (req, res) => {
const userId = req.params.userId;
const idapp = req.params.idapp;
const sall = req.params.sall;
// var category = req.params.category;
// tools.mylog('GET BOOKINGS : ', req.params);
if (!ObjectID.isValid(userId)) {
return res.status(404).send();
}
if (userId !== String(req.user._id)) {
// I'm trying to write something not mine!
return res.status(404).send({ code: server_constants.RIS_CODE_TODO_CREATING_NOTMYUSER });
}
// Extract all the todos of the userId only
Booking.findAllByUserIdAndIdApp(userId, idapp, sall).then((bookedevent) => {
return MyEvent.findAllIdApp(idapp)
.then((eventlist) => {
return Operator.findAllIdApp(idapp)
.then((operators) => {
return Where.findAllIdApp(idapp)
.then((wheres) => {
res.send({ bookedevent, eventlist, operators, wheres });
})
})
})
}).catch((e) => {
console.log(e);
res.status(400).send(e);
});
});
// router.get('/:userId/:idapp/:sall', authenticate, (req, res) => {
// const userId = req.params.userId;
// const idapp = req.params.idapp;
// const sall = req.params.sall;
// // var category = req.params.category;
//
// // tools.mylog('GET BOOKINGS : ', req.params);
//
// if (!ObjectID.isValid(userId)) {
// return res.status(404).send();
// }
//
// if (userId !== String(req.user._id)) {
// // I'm trying to write something not mine!
// return res.status(404).send({ code: server_constants.RIS_CODE_TODO_CREATING_NOTMYUSER });
// }
//
// // Extract all the todos of the userId only
// const bookedevent = Booking.findAllByUserIdAndIdApp(userId, idapp, sall);
// const eventlist = MyEvent.findAllIdApp(idapp);
// const operators = Operator.findAllIdApp(idapp);
// const wheres = Where.findAllIdApp(idapp);
// const contribtype = Contribtype.findAllIdApp(idapp);
//
// return Promise.all([bookedevent, eventlist, operators, wheres, contribtype])
// .then((arrdata) => {
// console.table(arrdata);
// res.send({ bookedevent: arrdata[0], eventlist: arrdata[1], operators: arrdata[2], wheres: arrdata[3], contribtype: arrdata[4] });
// })
// .catch((e) => {
// console.log(e);
// res.status(400).send(e);
// });
//
// });
//
module.exports = router;