tussenopslag

This commit is contained in:
Monique
2021-11-16 11:16:52 +01:00
parent eb0bd12ac8
commit 939e7f69ac
6 changed files with 998 additions and 864 deletions
+242 -239
View File
@@ -1,243 +1,246 @@
$(function(){
ls.initMonitorModel = function(){
var timer;
ls.initMonitorModel = function(){
var timer;
function fAddOrgversion(p){
function fAddOrgversion(p){
var dit = this;
this.id = p.id; //orgversion id
this.periodenummer = p.periodenummer;
this.versie_id = p.versie_id;
this.vorm = p.vorm;
this.scoretype = p.scoretype;
this.toonOmschrijving = ko.observable(false);
if(p.score_omschrijving == 'T') this.toonOmschrijving(true);
this.naam = p.naam;
// this.meetellen = ko.observable(false);
// if(p.meetellen == 1){
// dit.meetellen(true);
// }
var dit = this;
this.id = p.id; //orgversion id
this.periodenummer = p.periodenummer;
this.versie_id = p.versie_id;
this.vorm = p.vorm;
this.scoretype = p.scoretype;
this.toonOmschrijving = ko.observable(false);
if(p.score_omschrijving == 'T') this.toonOmschrijving(true);
this.naam = p.naam;
// this.meetellen = ko.observable(false);
// if(p.meetellen == 1){
// dit.meetellen(true);
// }
this.geldigvanaf = p.geldigvanaf;
this.geldigtm = p.geldigtm;
this.invullentm = p.invullentm;
this.info = ko.computed(function(){
var infostr=this.naam + " - periode " + this.periodenummer ;
infostr += " van " + this.geldigvanaf + " t/m " + this.geldigtm;
return infostr;
},this);
}
this.geldigvanaf = p.geldigvanaf;
this.geldigtm = p.geldigtm;
this.invullentm = p.invullentm;
this.info = ko.computed(function(){
var infostr=this.naam + " - periode " + this.periodenummer ;
infostr += " van " + this.geldigvanaf + " t/m " + this.geldigtm;
return infostr;
},this);
}
function fAddListitem(p){
var dit = this;
this.id = p.id
this.nummer = p.nummer
this.omschrijving = p.omschrijving;
this.toelichting = p.toelichting;
this.indicatorscores = ko.observableArray([]);
$.each(p.indicatorscores, function(j,k){
dit.indicatorscores.push(new fAddIndicatorscore(k));
});
function fAddListitem(p){
var dit = this;
this.id = p.id
this.nummer = p.nummer
this.omschrijving = p.omschrijving;
this.toelichting = p.toelichting;
this.disabled = ko.observable(false);
if(p.disabled == 'T')dit.disabled(true);
this.indicatorscores = ko.observableArray([]);
$.each(p.indicatorscores, function(j,k){
dit.indicatorscores.push(new fAddIndicatorscore(k));
});
}
}
function fAddIndicatorscore(k){
var dit = this;
this.id = k.id
this.nummer = k.nummer
this.omschrijving = k.omschrijving
this.inspectie = k.inspectie
this.score = ko.observable(k.score)
this.scoretype = k.scoretype;
function fAddIndicatorscore(k){
var dit = this;
this.id = k.id
this.nummer = k.nummer
this.omschrijving = k.omschrijving
this.inspectie = k.inspectie
this.score = ko.observable(k.score)
this.scoretype = k.scoretype;
// this.jatext = ko.computed(function(){
// switch (parseFloat(dit.scoretype)){
// case 3:
// case 4:
// case 5: return 'ja'; break;
// case 6: return "onvol."; break;
// case 7: return "included"; break;
// default: return 'ja';
// }
// })
// this.neetext = ko.computed(function(){
// switch (parseFloat(dit.scoretype)){
// case 3:
// case 4:
// case 5: return 'nee'; break;
// case 6: return "vol."; break;
// case 7: return "involved"; break;
// default: return 'nee';
// }
// })
// this.thirdoptiontext = ko.computed(function(){
// switch (parseFloat(dit.scoretype)){
// case 3: return "bezig"; break;
// case 4: return "nvt"; break;
// case 5: return "i.o."; break;
// case 6: return "goed"; break;
// case 7: return "present"; break;
// default: return "";
// }
// });
// this.fourthoptiontext = ko.computed(function(){
// return 'absent'
// });
}
// this.jatext = ko.computed(function(){
// switch (parseFloat(dit.scoretype)){
// case 3:
// case 4:
// case 5: return 'ja'; break;
// case 6: return "onvol."; break;
// case 7: return "included"; break;
// default: return 'ja';
// }
// })
// this.neetext = ko.computed(function(){
// switch (parseFloat(dit.scoretype)){
// case 3:
// case 4:
// case 5: return 'nee'; break;
// case 6: return "vol."; break;
// case 7: return "involved"; break;
// default: return 'nee';
// }
// })
// this.thirdoptiontext = ko.computed(function(){
// switch (parseFloat(dit.scoretype)){
// case 3: return "bezig"; break;
// case 4: return "nvt"; break;
// case 5: return "i.o."; break;
// case 6: return "goed"; break;
// case 7: return "present"; break;
// default: return "";
// }
// });
// this.fourthoptiontext = ko.computed(function(){
// return 'absent'
// });
}
function fAddScoreoptie(o){
this.scoreID = o.id;
this.type = o.type_nr;
this.optie = o.optie;
this.value = parseInt(o.score_value);
this.scoretekst = o.omschrijving;
function fAddScoreoptie(o){
this.scoreID = o.id;
this.type = o.type_nr;
this.optie = o.optie;
this.value = parseInt(o.score_value);
this.scoretekst = o.omschrijving;
}
}
if (ls.MonitorModel !== undefined){
ls.MonitorModel.initModel();
}
else {
ls.MonitorModel = {
orgversions : ko.observableArray([]),
selectedOrgversion : ko.observable(''),
listitems : ko.observableArray([]),
scoreopties : ko.observableArray(),
editok : ko.observable(false),
soort : ko.observable(4),
erzijnperiodes : ko.observable(false),
notitie : ko.observable(''),
fvid : ko.observable(null),
bezig : ko.observable(false),
meetellen : ko.observable(false),
optieslengte : ko.observable(0),
if (ls.MonitorModel !== undefined){
ls.MonitorModel.initModel();
}
else {
ls.MonitorModel = {
orgversions : ko.observableArray([]),
selectedOrgversion : ko.observable(''),
listitems : ko.observableArray([]),
scoreopties : ko.observableArray(),
editok : ko.observable(false),
soort : ko.observable(4),
erzijnperiodes : ko.observable(false),
notitie : ko.observable(''),
fvid : ko.observable(null),
bezig : ko.observable(false),
meetellen : ko.observable(false),
optieslengte : ko.observable(0),
initBindings :function(){
var self = ls.MonitorModel;
if (!ko.dataFor(document.getElementById('pagmonitor')) ) {
ko.applyBindings(ls.MonitorModel, document.getElementById("pagmonitor"));
}
self.initModel();
},
initModel: function(){
var self=ls.MonitorModel;
initBindings :function(){
var self = ls.MonitorModel;
if (!ko.dataFor(document.getElementById('pagmonitor')) ) {
ko.applyBindings(ls.MonitorModel, document.getElementById("pagmonitor"));
}
self.initModel();
},
initModel: function(){
var self=ls.MonitorModel;
self.orgversions.removeAll();
self.listitems.removeAll();
showAjaxLoader();
$.post("index.php/monpas/monitor/getperiodesperschool", function(data){
// get de reeds ingevulde versies of start een nieuwe versie voor de laatste periode
self.orgversions.removeAll();
self.listitems.removeAll();
showAjaxLoader();
$.post("index.php/monpas/monitor/getperiodesperschool", function(data){
// get de reeds ingevulde versies of start een nieuwe versie voor de laatste periode
self.orgversions.removeAll();
if (data.versies){
$.each(data.versies, function(i,p){
self.orgversions.push(new fAddOrgversion(p));
});//each
self.selectedOrgversion(self.orgversions()[0]);
self.erzijnperiodes(true);
if (data.versies){
$.each(data.versies, function(i,p){
self.orgversions.push(new fAddOrgversion(p));
});//each
self.selectedOrgversion(self.orgversions()[0]);
self.erzijnperiodes(true);
}; // if
self.soort(data.soort);
hideAjaxLoader();
},'json');
},
}; // if
self.soort(data.soort);
hideAjaxLoader();
},'json');
},
fChangeVersion: function(){
var self = ls.MonitorModel;
self.listitems.removeAll();
self.scoreopties.removeAll();
self.editok(false)
if (self.selectedOrgversion() == undefined) return;
fChangeVersion: function(){
var self = ls.MonitorModel;
self.listitems.removeAll();
self.scoreopties.removeAll();
self.editok(false)
if (self.selectedOrgversion() == undefined) return;
var tm = self.selectedOrgversion().invullentm;
var Dtm = new Date(tm.substring(6,10), parseInt(tm.substring(3,5)) -1, tm.substring(0,2),23,59,59,99);
var heden= new Date()
if (heden.getTime() <= Dtm.getTime() ) self.editok(true);
$.post("index.php/monpas/monitor/getlistitems/" + self.selectedOrgversion().id, function(data){
if (data.ijkpunten){
$.each(data.ijkpunten,function(i,p){
self.listitems.push(new fAddListitem(p));
});// each
}; //if
var tm = self.selectedOrgversion().invullentm;
var Dtm = new Date(tm.substring(6,10), parseInt(tm.substring(3,5)) -1, tm.substring(0,2),23,59,59,99);
var heden= new Date()
if (heden.getTime() <= Dtm.getTime() ) self.editok(true);
$.post("index.php/monpas/monitor/getlistitems/" + self.selectedOrgversion().id, function(data){
if (data.ijkpunten){
$.each(data.ijkpunten,function(i,p){
self.listitems.push(new fAddListitem(p));
});// each
}; //if
if(data.scoreopties){
$.each(data.scoreopties,function(x,o){
self.scoreopties.push(new fAddScoreoptie(o));
});// each
self.optieslengte(self.scoreopties().length);
if(data.scoreopties){
$.each(data.scoreopties,function(x,o){
self.scoreopties.push(new fAddScoreoptie(o));
});// each
self.optieslengte(self.scoreopties().length);
}
self.notitie(data.notitie);
if(data.meetellen && data.meetellen == 1) {
self.meetellen(true);
}
else{
self.meetellen(false);
}
self.fvid(data.fvid);
// als de versie een schoolversie is, dan mag alleen het management invullen
// maar ook het management mag niet invullen voorbij de invuldatum
if (self.editok() && self.selectedOrgversion().vorm==1) {self.editok(data.writer)}
},'json');
},
fUpdateScoretype12: function(){
var self= ls.MonitorModel
if (this.scoretype == 1 && (parseFloat(this.score().replace(',','.') ) > 10 ||
parseFloat(this.score().replace(',','.')) < 0)){
ls.MsgAutoFade("U moet een rapportcijfer tussen 0 en 10 invullen.",1000);
this.score(0);
};
if (this.scoretype ==2 && (parseInt(this.score())> 100 || parseInt(this.score()) < 0)){
ls.MsgAutoFade("U moet hier een percentage tussen 0 en 100 invullen.",1000);
this.score(0);
}
var submitData = {indicatorscoreid : this.id,
score : this.score()}
$.post("index.php/monpas/monitor/updatescore", submitData);
return true ; // nodig voor de eventuele radioset
},
self.notitie(data.notitie);
if(data.meetellen && data.meetellen == 1) {
self.meetellen(true);
fUpdateScoretypeVanaf3: function(data){
var self= ls.MonitorModel
var indicatorscoreID = data;
console.log(this, "this")
var submitData = {
indicatorscoreid : indicatorscoreID,
score : this.value }
$.post("index.php/monpas/monitor/updatescore", submitData);
return true ; // nodig voor de eventuele radioset
},
fToonToelichting: function(){
var self = ls.MonitorModel;
var dit = this;
var toelichting = '';
if (dit.toelichting != undefined) toelichting = dit.toelichting;
apprise(dit.nummer + '. ' + dit.omschrijving + '<br/>Toelichting: ' + toelichting);
},
fUpdateNotitie: function(){
var self = ls.MonitorModel;
if (timer){
clearTimeout(timer);
timeout = null;
}
else{
self.meetellen(false);
}
self.fvid(data.fvid);
// als de versie een schoolversie is, dan mag alleen het management invullen
// maar ook het management mag niet invullen voorbij de invuldatum
if (self.editok() && self.selectedOrgversion().vorm==1) {self.editok(data.writer)}
},'json');
},
fUpdateScoretype12: function(){
var self= ls.MonitorModel
if (this.scoretype == 1 && (parseFloat(this.score().replace(',','.') ) > 10 ||
parseFloat(this.score().replace(',','.')) < 0)){
ls.MsgAutoFade("U moet een rapportcijfer tussen 0 en 10 invullen.",1000);
this.score(0);
};
if (this.scoretype ==2 && (parseInt(this.score())> 100 || parseInt(this.score()) < 0)){
ls.MsgAutoFade("U moet hier een percentage tussen 0 en 100 invullen.",1000);
this.score(0);
}
var submitData = {indicatorscoreid : this.id,
score : this.score()}
$.post("index.php/monpas/monitor/updatescore", submitData);
return true ; // nodig voor de eventuele radioset
},
fUpdateScoretypeVanaf3: function(data){
var self= ls.MonitorModel
var indicatorscoreID = data;
var submitData = {
indicatorscoreid : indicatorscoreID,
score : this.value }
$.post("index.php/monpas/monitor/updatescore", submitData);
return true ; // nodig voor de eventuele radioset
},
fToonToelichting: function(){
var self = ls.MonitorModel;
var dit = this;
var toelichting = '';
if (dit.toelichting != undefined) toelichting = dit.toelichting;
apprise(dit.nummer + '. ' + dit.omschrijving + '<br/>Toelichting: ' + toelichting);
},
fUpdateNotitie: function(){
var self = ls.MonitorModel;
if (timer){
clearTimeout(timer);
timeout = null;
}
timer = setTimeout(function(){
var submitData= {notitie : self.notitie(),
fvID : self.fvid()}
$.post('index.php/monpas/monitor/savenotitie', submitData);
}, 600);
},
timer = setTimeout(function(){
var submitData= {notitie : self.notitie(),
fvID : self.fvid()}
$.post('index.php/monpas/monitor/savenotitie', submitData);
}, 600);
},
fTelMee: function(){
var self = ls.MonitorModel;
@@ -248,30 +251,30 @@ ls.initMonitorModel = function(){
meetellen = 0;
}
var submitData = {
meetellen: meetellen,
fvID: self.fvid(),
}
$.post("index.php/monpas/monitor/lijstmeetellen", submitData);
},
var submitData = {
meetellen: meetellen,
fvID: self.fvid(),
}
$.post("index.php/monpas/monitor/lijstmeetellen", submitData);
},
fPrint:function(){
var self =ls.MonitorModel;
if (self.bezig()) return;
self.bezig(true);
var items = ko.toJSON(self.listitems());
var data ={ 'orgversie' : self.selectedOrgversion().info(),
'tabelinfo' : items,
'notitie' : self.notitie()}
data=JSON.stringify(data);
var $form = $("<form method='post' action='index.php/monpas/monitor/printlijst' target='_blank'>").append($('<input type = "hidden" name="data" id ="data">').val(data) );
$form.appendTo("body").submit();
self.bezig(false);
}
} ; // definition van model
ls.MonitorModel.initBindings();
}; // else
}// function initMonitorModel
var self =ls.MonitorModel;
if (self.bezig()) return;
self.bezig(true);
var items = ko.toJSON(self.listitems());
var data ={ 'orgversie' : self.selectedOrgversion().info(),
'tabelinfo' : items,
'notitie' : self.notitie()}
data=JSON.stringify(data);
var $form = $("<form method='post' action='index.php/monpas/monitor/printlijst' target='_blank'>").append($('<input type = "hidden" name="data" id ="data">').val(data) );
$form.appendTo("body").submit();
self.bezig(false);
}
} ; // definition van model
ls.MonitorModel.initBindings();
}; // else
}// function initMonitorModel
});
+314 -289
View File
@@ -1,315 +1,340 @@
$(function(){
ls.initVersiesModel = function(){
var timeout;
ls.initVersiesModel = function(){
var timeout;
function fAddModule(p){
this.sysnr = p.sysnr;
this.naam = p.naam;
}
function fAddVersie(p){
this.id = p.id;
this.naam = ko.observable(p.naam);
this.ingang = ko.observable(p.ingangsdatum);
this.systemnorm = ko.observable(p.systemnorm);
this.deleteok = ko.observable(p.deleteok);
}
function fAddIJkpunt(p){
var dit = this;
this.id = p.id;
this.nummer = ko.observable(p.nummer);
this.omschrijving = ko.observable(p.omschrijving);
this.toelichting = ko.observable(p.toelichting);
this.indicatoren = ko.observableArray([]);
if (p.indicatoren){
$.each(p.indicatoren, function(j,k){
dit.indicatoren.push(new fAddIndicator(k));
});
function fAddModule(p){
this.sysnr = p.sysnr;
this.naam = p.naam;
}
function fAddVersie(p){
this.id = p.id;
this.naam = ko.observable(p.naam);
this.ingang = ko.observable(p.ingangsdatum);
this.systemnorm = ko.observable(p.systemnorm);
this.deleteok = ko.observable(p.deleteok);
}
function fAddIJkpunt(p){
var dit = this;
this.id = p.id;
this.nummer = ko.observable(p.nummer);
this.omschrijving = ko.observable(p.omschrijving);
this.toelichting = ko.observable(p.toelichting);
this.indicatoren = ko.observableArray([]);
if (p.indicatoren){
$.each(p.indicatoren, function(j,k){
dit.indicatoren.push(new fAddIndicator(k));
});
}
this.toonindics = ko.observable(false);
this.disabled = ko.observable(false)
if(p.disabled == 'T') this.disabled(true);
}
function fAddIndicator(k){
this.id = k.id;
this.nummer = ko.observable(k.nummer);
this.gewicht = ko.observable(k.gewicht);
this.omschrijving1 = ko.observable(k.omschrijving1);
this.omschrijving2 = ko.observable(k.omschrijving2);
this.inspectie = ko.observable(k.inspectie);
this.deleteok = k.deleteok;
}
this.toonindics = ko.observable(false);
}
function fAddIndicator(k){
this.id = k.id;
this.nummer = ko.observable(k.nummer);
this.gewicht = ko.observable(k.gewicht);
this.omschrijving1 = ko.observable(k.omschrijving1);
this.omschrijving2 = ko.observable(k.omschrijving2);
this.inspectie = ko.observable(k.inspectie);
this.deleteok = k.deleteok;
}
if (ls.VersiesModel !== undefined){
ls.VersiesModel.initModel();
}
else {
ls.VersiesModel = {
if (ls.VersiesModel !== undefined){
ls.VersiesModel.initModel();
}
else {
ls.VersiesModel = {
autonivo : ko.observable(0),
versies : ko.observableArray([]),
selectedVersie : ko.observable(''),
newVersieNaam : ko.observable(''),
ijkpunten : ko.observableArray([]),
newIJkpunt : ko.observable({nummer: ko.observable(0), naam:ko.observable(''), toelichting: ko.observable('')}),
selectedIJkpunt : ko.observable(''),
newIndicator : ko.observable({id : null,
ijkpunt_id : null,
nummer : ko.observable(0),
gewicht : ko.observable(1),
omschrijving1 : ko.observable(),
omschrijving2 : ko.observable(),
inspectie : ko.observable(),
deleteok : ko.observable(true) }),
modules : ko.observableArray([]),
selectedModule : ko.observable(''),
autonivo : ko.observable(0),
initBindings :function(){
var self = ls.VersiesModel;
if (!ko.dataFor(document.getElementById('pagVersies')) ) {
ko.applyBindings(ls.VersiesModel, document.getElementById("pagVersies"));
}
$.post("index.php/monpas/beheer/getmodules", function(result){
self.modules.removeAll();
versies : ko.observableArray([]),
selectedVersie : ko.observable(''),
newVersieNaam : ko.observable(''),
ijkpunten : ko.observableArray([]),
newIJkpunt : ko.observable({nummer: ko.observable(0), naam:ko.observable(''), toelichting: ko.observable('')}),
selectedIJkpunt : ko.observable(''),
newIndicator : ko.observable({id : null,
ijkpunt_id : null,
nummer : ko.observable(0),
gewicht : ko.observable(1),
omschrijving1 : ko.observable(),
omschrijving2 : ko.observable(),
inspectie : ko.observable(),
deleteok : ko.observable(true) }),
modules : ko.observableArray([]),
selectedModule : ko.observable(''),
if (result){
$.each(result, function(i,p){
self.modules.push(new fAddModule(p));
});
self.selectedModule(self.modules[0]);
}; // if rsult
self.initModel();
},'json');
},
initModel: function(){
var self = ls.VersiesModel;
$.post("index.php/shared/autorisatienivos/getautorisatie", function(result){
self.autonivo(result)
// self.fGetVersies();
},'json');
},
initBindings :function(){
var self = ls.VersiesModel;
fGetVersies : function(){
var self =ls.VersiesModel;
$.post("index.php/monpas/beheer/getversies/" + self.selectedModule().sysnr, function(data){
self.versies.removeAll();
self.ijkpunten.removeAll();
if (data) {
$.each(data,function(i,p){
self.versies.push(new fAddVersie(p));
});
self.selectedVersie(self.versies()[0] );
if (!ko.dataFor(document.getElementById('pagVersies')) ) {
ko.applyBindings(ls.VersiesModel, document.getElementById("pagVersies"));
}
},'json');
},
fChangeModule: function(){
var self =ls.VersiesModel;
self.fGetVersies();
},
fMaakNieuweVersie: function(){
var self = ls.VersiesModel;
self.newVersieNaam('');
$("#modNieuweVersie").modal('show');
},
fUpdateVersie: function(){
var self = ls.VersiesModel;
var dit = this;
if (timeout){
clearTimeout(timeout)
timeout ==null;
}
timeout=setTimeout(function(){
var submitData = { id : dit.id,
naam : dit.naam(),
ingangsdatum : dit.ingang(),
systemnorm : dit.systemnorm()}
$.post("index.php/monpas/beheer/updateversie",submitData, function(){})
},700);
},
fSaveVersie: function(){
var self = ls.VersiesModel;
if (!self.selectedModule()) {
apprise("Er is geen instrument geselecteerd. De lijst kan niet worden aangemaakt.");
return;
}
var submitData= {nieuwnaam : self.newVersieNaam(),
module : self.selectedModule().sysnr}
$.post("index.php/monpas/beheer/insertversie/" ,submitData, function(result){
if (result) {
self.versies.push(new fAddVersie(result));
$.each(self.versies(), function(i,p){
if (p.id == result.id){self.selectedVersie(p); return false;}
})
} ; // if result
$.post("index.php/monpas/beheer/getmodules", function(result){
self.modules.removeAll();
if (result){
$.each(result, function(i,p){
self.modules.push(new fAddModule(p));
});
self.selectedModule(self.modules[0]);
}; // if rsult
self.initModel();
},'json');
},
initModel: function(){
var self = ls.VersiesModel;
$.post("index.php/shared/autorisatienivos/getautorisatie", function(result){
self.autonivo(result)
// self.fGetVersies();
},'json');
},
fGetVersies : function(){
var self =ls.VersiesModel;
$.post("index.php/monpas/beheer/getversies/" + self.selectedModule().sysnr, function(data){
self.versies.removeAll();
self.ijkpunten.removeAll();
if (data) {
$.each(data,function(i,p){
self.versies.push(new fAddVersie(p));
});
self.selectedVersie(self.versies()[0] );
}
},'json');
},
fChangeModule: function(){
var self =ls.VersiesModel;
self.fGetVersies();
},
fMaakNieuweVersie: function(){
var self = ls.VersiesModel;
self.newVersieNaam('');
$("#modNieuweVersie").modal('show');
},
fUpdateVersie: function(){
var self = ls.VersiesModel;
var dit = this;
if (timeout){
clearTimeout(timeout)
timeout ==null;
}
timeout=setTimeout(function(){
var submitData = { id : dit.id,
naam : dit.naam(),
ingangsdatum : dit.ingang(),
systemnorm : dit.systemnorm()}
$.post("index.php/monpas/beheer/updateversie",submitData, function(){})
},700);
},
fSaveVersie: function(){
var self = ls.VersiesModel;
if (!self.selectedModule()) {
apprise("Er is geen instrument geselecteerd. De lijst kan niet worden aangemaakt.");
return;
}
var submitData= {nieuwnaam : self.newVersieNaam(),
module : self.selectedModule().sysnr}
$.post("index.php/monpas/beheer/insertversie/" ,submitData, function(result){
if (result) {
self.versies.push(new fAddVersie(result));
$.each(self.versies(), function(i,p){
if (p.id == result.id){self.selectedVersie(p); return false;}
})
} ; // if result
self.ijkpunten.removeAll();
},'json');
},
fDeleteVersie: function(){
var self=ls.VersiesModel;
$.post("index.php/monpas/beheer/deleteversie/" + self.selectedVersie().id, function(result){
if (result.length > 0){
apprise(resulterrortekst);
}
else{
self.versies.remove(self.selectedVersie());
}
},'json')
},
fChangeVersie: function(){
var self=ls.VersiesModel;
self.ijkpunten.removeAll();
},'json');
},
fDeleteVersie: function(){
var self=ls.VersiesModel;
$.post("index.php/monpas/beheer/deleteversie/" + self.selectedVersie().id, function(result){
if (result.length > 0){
apprise(resulterrortekst);
if (self.selectedVersie() == undefined) return;
$.post("index.php/monpas/beheer/getijkpunten/"+ self.selectedVersie().id, function(data){
self.ijkpunten.removeAll();
if (data){
$.each(data, function(i,p){
self.ijkpunten.push(new fAddIJkpunt(p));
});
}
},'json');
},
fNieuwIJkpunt: function(){
var self = ls.VersiesModel;
var num = 0;
var i=self.ijkpunten().length;
var i = parseInt(i) - 1;
if (i >= 0) {
num = self.ijkpunten()[i].nummer();
};
self.newIJkpunt().nummer(parseInt(num)+ 1);
self.newIJkpunt().naam('');
self.newIJkpunt().toelichting('');
$("#modNieuwIJkpunt").modal('show');
},
fSaveIJkpunt: function(){
var self=ls.VersiesModel;
var submitData={versie_id : self.selectedVersie().id,
nummer : self.newIJkpunt().nummer(),
omschrijving : self.newIJkpunt().naam(),
toelichting : self.newIJkpunt().toelichting()};
$.post("index.php/monpas/beheer/insertijkpunt", submitData, function(data){
if (data){
self.ijkpunten.push(new fAddIJkpunt(data));
$.each(self.ijkpunten(), function(i,p){
if (p.id == data.id){
self.selectedIJkpunt(p);
return false;
}
});
}
else { apprise("Er is een fout opgetreden bij opslaan."); };
},'json');
},
fToggleIndicatoren: function(){
var self= ls.VersiesModel;
self.selectedIJkpunt(null);
self.selectedIJkpunt(this);
this.toonindics(!this.toonindics());
},
fUpdateIJkpunt: function(){
var self= ls.VersiesModel;
var dit = this;
if(dit.disabled()) return;
if (timeout){
clearTimeout(timeout)
timeout ==null;
}
timeout=setTimeout(function(){
var submitData={id : dit.id,
nummer : dit.nummer(),
versie_id : self.selectedVersie().id,
omschrijving : dit.omschrijving(),
toelichting : dit.toelichting()}
$.post("index.php/monpas/beheer/updateijkpunt",submitData, function(){})
},800);
},
fDisableIJkpunt: function(){
var self = ls.VersiesModel;
var dit = this;
dit.disabled(! dit.disabled())
var disabled = 'F';
if(dit.disabled()) disabled = 'T';
var submitData = {
'id' : dit.id,
'disabled' : disabled
}
$.post("index.php/monpas/beheer/disableijkpunt", submitData, function(){
});
},
fDeleteIJkpunt:function(){
var self =ls.VersiesModel;
var id = this.id;
var dit = this;
if ( self.ijkpunten().indicatoren !== undefined && self.ijkpunten().indicatoren().length > 0) {
apprise('Er zijn nog indicatoren. IJkpunt mag niet verwijderd worden');
return;
}
else{
self.versies.remove(self.selectedVersie());
}
},'json')
},
fChangeVersie: function(){
var self=ls.VersiesModel;
self.ijkpunten.removeAll();
if (self.selectedVersie() == undefined) return;
$.post("index.php/monpas/beheer/getijkpunten/"+ self.selectedVersie().id, function(data){
self.ijkpunten.removeAll();
if (data){
$.each(data, function(i,p){
self.ijkpunten.push(new fAddIJkpunt(p));
});
}
},'json');
},
fNieuwIJkpunt: function(){
var self = ls.VersiesModel;
var num = 0;
var i=self.ijkpunten().length;
var i = parseInt(i) - 1;
if (i >= 0) {
num = self.ijkpunten()[i].nummer();
};
self.newIJkpunt().nummer(parseInt(num)+ 1);
self.newIJkpunt().naam('');
self.newIJkpunt().toelichting('');
$("#modNieuwIJkpunt").modal('show');
},
fSaveIJkpunt: function(){
var self=ls.VersiesModel;
var submitData={versie_id : self.selectedVersie().id,
nummer : self.newIJkpunt().nummer(),
omschrijving : self.newIJkpunt().naam(),
toelichting : self.newIJkpunt().toelichting()};
$.post("index.php/monpas/beheer/insertijkpunt", submitData, function(data){
if (data){
self.ijkpunten.push(new fAddIJkpunt(data));
$.each(self.ijkpunten(), function(i,p){
if (p.id == data.id){
self.selectedIJkpunt(p);
return false;
}
});
}
else { apprise("Er is een fout opgetreden bij opslaan."); };
},'json');
},
fToggleIndicatoren: function(){
var self= ls.VersiesModel;
self.selectedIJkpunt(null);
self.selectedIJkpunt(this);
this.toonindics(!this.toonindics());
},
fUpdateIJkpunt: function(){
var self= ls.VersiesModel;
var dit = this;
if (timeout){
clearTimeout(timeout)
timeout ==null;
}
timeout=setTimeout(function(){
var submitData={id : dit.id,
nummer : dit.nummer(),
versie_id : self.selectedVersie().id,
omschrijving : dit.omschrijving(),
toelichting : dit.toelichting()}
$.post("index.php/monpas/beheer/updateijkpunt",submitData, function(){})
},800);
},
fDeleteIJkpunt:function(){
var self =ls.VersiesModel;
var id = this.id;
var dit = this;
if ( self.ijkpunten().indicatoren !== undefined && self.ijkpunten().indicatoren().length > 0) {
apprise('Er zijn nog indicatoren. IJkpunt mag niet verwijderd worden');
return;
}
else{
apprise("Weet u zeker dat u " + this.omschrijving() + " wilt verwijderen? " ,
apprise("Weet u zeker dat u " + this.omschrijving() + " wilt verwijderen? " ,
{verify: true, textYes: 'ja', textNo: 'nee'}, function(ans){
if (ans){
$.post("index.php/monpas/beheer/deleteijkpunt/" + id);
self.ijkpunten.remove(dit);
}
}); // apprise
}
},
fNieuweIndicator: function(){
var self = ls.VersiesModel;
var num =0
self.selectedIJkpunt(this);
$.each(self.selectedIJkpunt().indicatoren(), function(j,k){
num=k.nummer();
})
self.newIndicator().nummer(parseInt(num) + 1);
self.newIndicator().gewicht(1);
self.newIndicator().ijkpunt_id= self.selectedIJkpunt().id;
self.newIndicator().omschrijving1('');
self.newIndicator().omschrijving2('');
self.newIndicator().inspectie('');
self.newIndicator().deleteok(true);
$("#modNieuwIndicator").modal('show');
},
fSaveIndicator: function(){
var self=ls.VersiesModel;
var submitData={ ijkpunt_id : self.newIndicator().ijkpunt_id,
nummer : self.newIndicator().nummer(),
omschrijving1 : self.newIndicator().omschrijving1(),
omschrijving2 : self.newIndicator().omschrijving2(),
inspectie : self.newIndicator().inspectie(),
gewicht : self.newIndicator().gewicht};
$.post("index.php/monpas/beheer/insertindicator", submitData, function(data){
if (data){
self.selectedIJkpunt().indicatoren.push(new fAddIndicator(data));
}); // apprise
}
else { apprise("Er is een fout opgetreden bij opslaan."); };
},'json');
},
fUpdateIndicator: function(){
var self = ls.VersiesModel;
var dit =this;
if (timeout){
clearTimeout(timeout);
timeout = null;
}
timeout = setTimeout(function(){
var submitData ={ id : dit.id,
nummer : dit.nummer(),
omschrijving1 : dit.omschrijving1(),
omschrijving2 : dit.omschrijving2(),
inspectie : dit.inspectie(),
gewicht : dit.gewicht()}
$.post("index.php/monpas/beheer/updateindicator", submitData);
},700);
},
fDeleteIndicator: function($parent, $data){
var self = ls.VersiesModel;
var dit = $data;
apprise ("Weet u zeker dat u <i>" + dit.omschrijving1() + "</i> wilt verwijderen?",
},
fNieuweIndicator: function(){
var self = ls.VersiesModel;
var num =0
var dit = this;
if(dit.disabled()) return;
self.selectedIJkpunt(this);
$.each(self.selectedIJkpunt().indicatoren(), function(j,k){
num=k.nummer();
})
self.newIndicator().nummer(parseInt(num) + 1);
self.newIndicator().gewicht(1);
self.newIndicator().ijkpunt_id= self.selectedIJkpunt().id;
self.newIndicator().omschrijving1('');
self.newIndicator().omschrijving2('');
self.newIndicator().inspectie('');
self.newIndicator().deleteok(true);
$("#modNieuwIndicator").modal('show');
},
fSaveIndicator: function(){
var self=ls.VersiesModel;
var submitData={ ijkpunt_id : self.newIndicator().ijkpunt_id,
nummer : self.newIndicator().nummer(),
omschrijving1 : self.newIndicator().omschrijving1(),
omschrijving2 : self.newIndicator().omschrijving2(),
inspectie : self.newIndicator().inspectie(),
gewicht : self.newIndicator().gewicht};
$.post("index.php/monpas/beheer/insertindicator", submitData, function(data){
if (data){
self.selectedIJkpunt().indicatoren.push(new fAddIndicator(data));
}
else { apprise("Er is een fout opgetreden bij opslaan."); };
},'json');
},
fUpdateIndicator: function(){
var self = ls.VersiesModel;
var dit =this;
if (timeout){
clearTimeout(timeout);
timeout = null;
}
timeout = setTimeout(function(){
var submitData ={ id : dit.id,
nummer : dit.nummer(),
omschrijving1 : dit.omschrijving1(),
omschrijving2 : dit.omschrijving2(),
inspectie : dit.inspectie(),
gewicht : dit.gewicht()}
$.post("index.php/monpas/beheer/updateindicator", submitData);
},700);
},
fDeleteIndicator: function($parent, $data){
var self = ls.VersiesModel;
var dit = $data;
apprise ("Weet u zeker dat u <i>" + dit.omschrijving1() + "</i> wilt verwijderen?",
{verify:true, textYes:'ja',textNo:'nee'}, function(ans){
if (ans){
$.post('index.php/monpas/beheer/deleteindicator/' + dit.id,function(result){
$.post('index.php/monpas/beheer/deleteindicator/' + dit.id,function(result){
$parent.indicatoren.remove(dit);
},'json');
}
}); // apprise
}
}); // apprise
}
} ; // definition van model
ls.VersiesModel.initBindings();
}; // else
}// function initVersiesModel
} ; // definition van model
ls.VersiesModel.initBindings();
}; // else
}// function initVersiesModel
});