Vehicle Pozíció modal javítva
This commit is contained in:
parent
9679d69bba
commit
3fa433f2f1
|
|
@ -7,12 +7,14 @@ const { isValidObjectId } = require('mongoose');
|
|||
const { sendEmail } = require('./mailHelper.js');
|
||||
|
||||
|
||||
exports.apiVehicleSetCity=function(vehicleId,lastCity,rfid_device_id,callback){
|
||||
exports.apiVehicleSetCity=function(vehicleId,lastCity,rfid_device_id,lat,lon,callback){
|
||||
|
||||
|
||||
let lc={
|
||||
timestamp: new Date(),
|
||||
city:lastCity,
|
||||
lat:lat,
|
||||
lon:lon,
|
||||
rfid_device_id:rfid_device_id
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ const vehicleSchema=new mongoose.Schema({
|
|||
lastCity:[{
|
||||
timestamp: Date,
|
||||
city:String,
|
||||
lat:String,
|
||||
lon:String,
|
||||
rfid_device_id:{type: mongoose.Schema.Types.ObjectId}
|
||||
}],
|
||||
visible:{
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ transporter = nodemailer.createTransport({
|
|||
//road: resp[0].streetName,
|
||||
}));
|
||||
// Utolsó pozíció mentése adatbázisba.
|
||||
apiVehicle.apiVehicleSetCity(device.vehicle_id,resp.city,device._id,function(err,re){
|
||||
apiVehicle.apiVehicleSetCity(device.vehicle_id,resp.city,device._id,dec1,dec2,function(err,re){
|
||||
if(err)
|
||||
console.log(err);
|
||||
else
|
||||
|
|
@ -295,7 +295,7 @@ transporter = nodemailer.createTransport({
|
|||
//road: resp[0].streetName,
|
||||
}));
|
||||
// Utolsó pozíció mentése adatbázisba.
|
||||
apiVehicle.apiVehicleSetCity(device.vehicle_id,resp.city,device._id,function(err,re){
|
||||
apiVehicle.apiVehicleSetCity(device.vehicle_id,resp.city,device._id,data.lat,data.lon,function(err,re){
|
||||
if(err)
|
||||
console.log(err);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ router.get('/getvehicle/:id', utils.ensureAuthenticated, function(req, res) {
|
|||
else {
|
||||
var locations=[];
|
||||
vehicle.lastCity.forEach(element => {
|
||||
locations.push({title:element.city,start:element.timestamp,allDay:false})
|
||||
locations.push({title:element.city,start:element.timestamp,allDay:false,id:element._id,lat:element.lat,lon:element.lon})
|
||||
|
||||
});
|
||||
res.send(locations);
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ block content
|
|||
h4#vehicleId.modal-title A
|
||||
.modal-body
|
||||
#calendar(style="background-color: white")
|
||||
//iframe(src='https://www.google.com/maps/embed?pb=!1m10!1m8!1m3!1d116862.54554679655!2d90.40409584970706!3d23.749000170125925!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sen!2sbd!4v1550040341458' width='100%' height='450' frameborder='0' style='border:0' allowfullscreen='')
|
||||
br
|
||||
.modal-footer
|
||||
button.btn.btn-primary(type='button', data-dismiss='modal') Bezár
|
||||
|
|
@ -318,10 +319,6 @@ block content
|
|||
success: function(res) {
|
||||
//console.log(res.at(-1).title);
|
||||
// alert(res.at(-1).title);
|
||||
var newEvent = new Object();
|
||||
newEvent.title = "some text";
|
||||
newEvent.start = new Date();
|
||||
newEvent.allDay = false;
|
||||
|
||||
var calendarEl = document.getElementById('calendar');
|
||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
|
|
@ -329,9 +326,17 @@ block content
|
|||
initialView: 'dayGridMonth',
|
||||
locale: 'hu',
|
||||
firstDay: 1,
|
||||
initialEvents: res,
|
||||
//initialEvents: res,
|
||||
events:res,
|
||||
weekNumbers: true,
|
||||
themeSystem: 'default'
|
||||
themeSystem: 'default',
|
||||
eventClick: function(info) {
|
||||
alert('Event: ' + info.event.title+info.event.id+' '+info.event.extendedProps.lat+' '+info.event.extendedProps.lon);
|
||||
|
||||
|
||||
// change the border color just for fun
|
||||
info.el.style.borderColor = 'red';
|
||||
}
|
||||
});
|
||||
|
||||
calendar.render();
|
||||
|
|
|
|||
Loading…
Reference in New Issue