tussenopslag
This commit is contained in:
@@ -23,46 +23,65 @@ ls.initStreefcijfersModel = function(){
|
||||
this.gemscore = ko.observable(p.gemscore);
|
||||
this.xijkpunten = ko.observable(p.xijkpunten);
|
||||
this.zprocent = ko.observable(p.zprocent);
|
||||
this.wijzigok = p.wijzigok;
|
||||
this.wijzigok = ko.observable(true);
|
||||
|
||||
}
|
||||
|
||||
function fAddSwv (p){
|
||||
function fAddSWV(p){
|
||||
var dit = this;
|
||||
this.id = p.id;
|
||||
this.brin = p.brin
|
||||
this.naam = p.brin + ' - ' + p.naamkort;
|
||||
this.id = p.id;
|
||||
this.soort = p.soort;
|
||||
this.brin = p.brin;
|
||||
this.naam = p.naamkort;
|
||||
this.plaats = p.plaats;
|
||||
this.kamers = ko.observableArray([]);
|
||||
if (p.kamers){
|
||||
this.geopend = ko.observable(false);
|
||||
dit.kamers = ko.observableArray([]);
|
||||
if (p.kamers ){
|
||||
$.each(p.kamers, function(j,k){
|
||||
dit.kamers.push(new fAddNivo2(k));
|
||||
dit.kamers.push(new fAddKamer(k));
|
||||
})
|
||||
}
|
||||
if (p.bgs){
|
||||
$.each(p.bgs, function(j,k){
|
||||
dit.kamers.push(new fAddBG(k));
|
||||
});
|
||||
}
|
||||
}
|
||||
function fAddNivo2 (p){
|
||||
|
||||
function fAddKamer(p){
|
||||
var dit = this;
|
||||
this.id = p.id;
|
||||
this.naam = p.brin + ' - ' + p.naamkort;
|
||||
this.id = p.id;
|
||||
this.soort = p.soort;
|
||||
this.brin = p.brin;
|
||||
this.naam = p.naamkort;
|
||||
this.plaats = p.plaats;
|
||||
this.bgs = ko.observableArray([]);
|
||||
this.geopend = ko.observable(false);
|
||||
this.bgs = ko.observableArray([]);
|
||||
if (p.bgs){
|
||||
$.each(p.bgs, function(j,k){
|
||||
dit.bgs.push(new fAddBG(k));
|
||||
$.each(p.bgs, function(x,z){
|
||||
dit.bgs.push(new fAddBG(z));
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fAddBG (p){
|
||||
var dit = this;
|
||||
this.id = p.id;
|
||||
this.naam = p.brin + ' - ' + p.naamkort;
|
||||
this.plaats = p.plaats;
|
||||
this.bgs = ko.observableArray([]);
|
||||
function fAddBG(p){
|
||||
var dit = this;
|
||||
this.id = p.id;
|
||||
this.soort = p.soort;
|
||||
this.brin = p.brin;
|
||||
this.naam = p.naamkort;
|
||||
this.plaats = p.plaats;
|
||||
this.geopend = ko.observable(false);
|
||||
this.scholen = ko.observableArray([]);
|
||||
if (p.scholen){
|
||||
$.each(p.scholen, function(a,b){
|
||||
dit.scholen.push(new fAddSchool(b));
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function fAddSchool(p){
|
||||
var dit = this;
|
||||
this.id = p.id;
|
||||
this.soort = p.soort;
|
||||
this.brin = p.brin;
|
||||
this.naam = p.naamkort;
|
||||
this.plaats = p.plaats;
|
||||
}
|
||||
|
||||
if (ls.StreefcijfersModel !== undefined){
|
||||
@@ -71,10 +90,15 @@ ls.initStreefcijfersModel = function(){
|
||||
else {
|
||||
ls.StreefcijfersModel = {
|
||||
versieambities : ko.observableArray([]),
|
||||
swv : ko.observableArray([]),
|
||||
selectedOrganisatie : ko.observable(''),
|
||||
zelfniveau : ko.observable(3),
|
||||
bezig : ko.observable(false),
|
||||
toporg : ko.observableArray([]),
|
||||
orgsoort : ko.observable(1),
|
||||
orgversions : ko.observableArray([]),
|
||||
selectedOrgversion : ko.observable(''),
|
||||
selectedOrg : ko.observable(''),
|
||||
userniveau : ko.observable(4),
|
||||
inzage : ko.observable(),
|
||||
bezig : ko.observable(false),
|
||||
isSWV : ko.observable(false),
|
||||
|
||||
initBindings :function(){
|
||||
var self = ls.StreefcijfersModel;
|
||||
@@ -86,32 +110,62 @@ ls.initStreefcijfersModel = function(){
|
||||
|
||||
initModel: function(){
|
||||
var self = ls.StreefcijfersModel;
|
||||
self.swv.removeAll();
|
||||
|
||||
$.post("index.php/monpas/streefcijfers/getorganisaties", function(swv){
|
||||
if (swv){
|
||||
self.swv.push(new fAddSwv(swv));
|
||||
self.selectedOrganisatie(self.swv()[0]);
|
||||
}
|
||||
|
||||
$.post("index.php/monpas/streefcijfers/getzelfniveau", function(nivo){
|
||||
self.zelfniveau(nivo);
|
||||
self.fGetAmbities();
|
||||
},'json')
|
||||
},'json');
|
||||
self.toporg('');
|
||||
|
||||
$.post("index.php/monpas/rapijkpunten/getorgs", function(data){
|
||||
self.bezig(true);
|
||||
if (data.organisatie){
|
||||
|
||||
self.orgsoort(data.soort);
|
||||
switch (self.orgsoort()){
|
||||
case 1: self.toporg(new fAddSWV(data.organisatie));
|
||||
self.isSWV(true);
|
||||
break;
|
||||
case 2: self.toporg(new fAddKamer(data.organisatie));
|
||||
break;
|
||||
case 3: self.toporg(new fAddBG(data.organisatie));
|
||||
break;
|
||||
case 4: self.toporg(new fAddSchool(data.organisatie));
|
||||
break;
|
||||
} // switch
|
||||
$.post('index.php/monpas/rapijkpunten/getusernivo', function(result){
|
||||
self.userniveau(result);
|
||||
self.selectedOrg(self.toporg());
|
||||
$.post('index.php/monpas/rapmatrix/checkinzage', function(result){
|
||||
self.inzage(result);
|
||||
},'json');
|
||||
|
||||
self.fGetAmbities();
|
||||
},'json');
|
||||
}
|
||||
|
||||
self.bezig(false);
|
||||
|
||||
},'json');
|
||||
|
||||
},
|
||||
|
||||
fToggleGeopend: function(){
|
||||
this.geopend(!this.geopend());
|
||||
},
|
||||
|
||||
fSetSelected : function(){
|
||||
fSwitchOrg : function(){
|
||||
var self = ls.StreefcijfersModel;
|
||||
if (this.id == self.selectedOrganisatie().id) return;
|
||||
self.selectedOrganisatie(this);
|
||||
if (self.selectedOrganisatie() == undefined) return;
|
||||
self.isSWV(false);
|
||||
if (this.id == self.selectedOrg().id) return;
|
||||
self.selectedOrg(this);
|
||||
if (self.selectedOrg() == undefined) return;
|
||||
if(self.selectedOrg().soort === '1'){
|
||||
self.isSWV(true);
|
||||
}
|
||||
|
||||
self.fGetAmbities();
|
||||
},
|
||||
|
||||
fGetAmbities : function() {
|
||||
var self = ls.StreefcijfersModel;
|
||||
self.versieambities.removeAll();
|
||||
$.post("index.php/monpas/streefcijfers/getorgversies_ambities/" + self.selectedOrganisatie().id, function(data){
|
||||
$.post("index.php/monpas/streefcijfers/mh_getorgversies_ambities/" + self.selectedOrg().id, function(data){
|
||||
if (data){
|
||||
$.each(data, function(i,p){
|
||||
self.versieambities.push(new fAddVersieAmbitie(p));
|
||||
@@ -132,14 +186,14 @@ ls.initStreefcijfersModel = function(){
|
||||
self.bezig(true);
|
||||
var submitData={ "id" : dit.id,
|
||||
"orgversie_id" : dit.orgversieid,
|
||||
"organisatie_id" : self.selectedOrganisatie().id,
|
||||
"organisatie_id" : self.selectedOrg().id,
|
||||
"gemscore" : dit.gemscore(),
|
||||
"xijkpunten" : dit.xijkpunten(),
|
||||
"zprocent" : dit.zprocent()}
|
||||
$.post("index.php/monpas/streefcijfers/updateambitie", submitData, function(newid){
|
||||
if (newid) {self.fGetAmbities();};
|
||||
self.bezig(false);
|
||||
},'json');
|
||||
// $.post("index.php/monpas/streefcijfers/updateambitie", submitData, function(newid){
|
||||
// if (newid) {self.fGetAmbities();};
|
||||
// self.bezig(false);
|
||||
// },'json');
|
||||
},700);
|
||||
},
|
||||
fDelete:function(){
|
||||
|
||||
Reference in New Issue
Block a user