dearchiveren orgd=s
This commit is contained in:
@@ -15,6 +15,7 @@ class Organisaties extends MY_Controller{
|
|||||||
"monpas/Scores_model",
|
"monpas/Scores_model",
|
||||||
"monpas/Schooldetails_model",
|
"monpas/Schooldetails_model",
|
||||||
"monpas/Ambities_model",
|
"monpas/Ambities_model",
|
||||||
|
"monpas/Wenssituaties_model",
|
||||||
"shared/Licenties_model");
|
"shared/Licenties_model");
|
||||||
$this->load->model($models);
|
$this->load->model($models);
|
||||||
$this->load->helper('string');
|
$this->load->helper('string');
|
||||||
@@ -132,6 +133,7 @@ class Organisaties extends MY_Controller{
|
|||||||
$this->Ambities_model->delete_record_where(array("organisatie_id"=>$orgid));
|
$this->Ambities_model->delete_record_where(array("organisatie_id"=>$orgid));
|
||||||
$this->Orgversies_model->delete_record_where(array("organisatie_id" =>$orgid));
|
$this->Orgversies_model->delete_record_where(array("organisatie_id" =>$orgid));
|
||||||
$this->Licenties_model->delete_record_where(array("orgid" =>$orgid));
|
$this->Licenties_model->delete_record_where(array("orgid" =>$orgid));
|
||||||
|
$this->Wenssituaties_model->delete_record_where(["organisatie_id" =>$orgid ]);
|
||||||
$this->Organisaties_model->delete_record($orgid);
|
$this->Organisaties_model->delete_record($orgid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,7 +152,13 @@ class Organisaties extends MY_Controller{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$actief = 1;
|
$actief = 1;
|
||||||
if ($this->input->post("actief")=="false") $actief = 0;
|
if ($this->input->post("actief")=="false"){
|
||||||
|
if($this->input->post("soort")== "4") $actief = 0;
|
||||||
|
else{ $orgs = $this->Organisaties_model->getorgsonderbestuur($orgid);
|
||||||
|
if($orgs) $errortekst .= "Deactiveer eerst de actieve organisaties onder deze organisatie.";
|
||||||
|
else $actief = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
// $monbas=1;
|
// $monbas=1;
|
||||||
// if ($this->input->post("monbas")=="false") $monbas = 0;
|
// if ($this->input->post("monbas")=="false") $monbas = 0;
|
||||||
// $mondiv = 1;
|
// $mondiv = 1;
|
||||||
@@ -189,6 +197,29 @@ class Organisaties extends MY_Controller{
|
|||||||
else {$errortekst = " U bent niet geautoriseerd voor deze handeling.";};
|
else {$errortekst = " U bent niet geautoriseerd voor deze handeling.";};
|
||||||
echo json_encode($errortekst);
|
echo json_encode($errortekst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dearchiveer(){
|
||||||
|
//TODO clean input
|
||||||
|
if ($this->Autorisaties_model->check_autorisatie($this->userrole, SUPERUSER) > 0) {
|
||||||
|
$orgid =$this->input->post("id");
|
||||||
|
$errortekst = '';
|
||||||
|
|
||||||
|
if($this->input->post("soort")== "1") $actief = 1;
|
||||||
|
else{ $valtonderID = $this->input->post("valtonderID");
|
||||||
|
$actief = $this->Organisaties_model->get_fieldvalue(["valtonder_id" => $valtonderID], 'actief');
|
||||||
|
if($actief == 0) $errortekst .= "Activeer eerst de gearchiveerd organisatie(s) boven deze organisatie.";
|
||||||
|
else $actief = 1;
|
||||||
|
}
|
||||||
|
$data=array(
|
||||||
|
"actief" =>$actief
|
||||||
|
);
|
||||||
|
$this->Organisaties_model->update_record($data,$orgid);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {$errortekst = " U bent niet geautoriseerd voor deze handeling.";};
|
||||||
|
echo json_encode($errortekst);
|
||||||
|
}
|
||||||
|
|
||||||
function zoek(){
|
function zoek(){
|
||||||
//TODO clean input
|
//TODO clean input
|
||||||
$errortekst="";
|
$errortekst="";
|
||||||
|
|||||||
@@ -282,11 +282,11 @@ class Organisaties_model extends MY_Model{
|
|||||||
O.bijlagefile, SD.email1
|
O.bijlagefile, SD.email1
|
||||||
FROM tb_organisaties O
|
FROM tb_organisaties O
|
||||||
LEFT JOIN tb_schooldetails SD ON O.id = SD.organisatie_id
|
LEFT JOIN tb_schooldetails SD ON O.id = SD.organisatie_id
|
||||||
WHERE O.soort = {$soort}
|
WHERE O.soort = {$soort} ";
|
||||||
AND O.actief = 1";
|
|
||||||
if ($valtonder) {
|
if ($valtonder) {
|
||||||
$this->sql .=" AND O.valtonder_id = {$valtonder} ";
|
$this->sql .=" AND O.valtonder_id = {$valtonder} ";
|
||||||
};
|
}
|
||||||
|
$this->sql .=" ORDER BY O.actief DESC, O.id ASC ";
|
||||||
return $this->get_query_result();
|
return $this->get_query_result();
|
||||||
}
|
}
|
||||||
function getorgdetails($id){
|
function getorgdetails($id){
|
||||||
|
|||||||
@@ -7,11 +7,20 @@
|
|||||||
data-bind=" options : swvs,
|
data-bind=" options : swvs,
|
||||||
optionsText : 'naam',
|
optionsText : 'naam',
|
||||||
value : selectedSWV,
|
value : selectedSWV,
|
||||||
|
style : {'backgroundColor': selectedSWV() && selectedSWV().actief() == true ? 'white' : 'lightgrey'},
|
||||||
event : {change: fChangeSWV}">
|
event : {change: fChangeSWV}">
|
||||||
</select>
|
</select>
|
||||||
<button class="noshow plus" data-bind="click:fPopNewSWV"> </button>
|
<button class="noshow plus" data-bind="click:fPopNewSWV"> </button>
|
||||||
<button class="noshow editbutton" data-bind="click:fPopEditOrg.bind($data,1)"> </button>
|
<button class="noshow editbutton"
|
||||||
<button class="noshow delete" data-bind="click:fDeleteOrg.bind($data, 1)"> </button>
|
data-bind="visible: selectedSWV() && selectedSWV().actief() == true,
|
||||||
|
click:fPopEditOrg.bind($data,1)">
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<i class="fa fa-square-o"
|
||||||
|
style=" background-color: white; font-size: 23px; margin: 2px; margin-top 6px;"
|
||||||
|
data-bind="visible: selectedSWV() && selectedSWV().actief() == false, click: $root.fDearchiveer.bind($data,1)"></i>
|
||||||
|
|
||||||
|
<button class="noshow delete" data-bind="click:fDeleteOrg.bind($data, 1)"> </button>
|
||||||
|
|
||||||
|
|
||||||
<div style="margin-top:10px">
|
<div style="margin-top:10px">
|
||||||
@@ -20,24 +29,48 @@
|
|||||||
data-bind=" options : kamers,
|
data-bind=" options : kamers,
|
||||||
optionsText : 'naam',
|
optionsText : 'naam',
|
||||||
value : selectedKamer,
|
value : selectedKamer,
|
||||||
|
style : {'backgroundColor': selectedKamer() && selectedKamer().actief() == true ? 'white' : 'lightgrey'},
|
||||||
event : {change: fChangeKamer}">
|
event : {change: fChangeKamer}">
|
||||||
</select>
|
</select>
|
||||||
<button class="noshow plus" data-bind="click:fPopNewKamer"> </button>
|
<button class="noshow plus" data-bind="click:fPopNewKamer"> </button>
|
||||||
<button class="noshow editbutton" data-bind="click:fPopEditOrg.bind($data,2)"> </button>
|
<button class="noshow editbutton"
|
||||||
<button class="noshow delete" data-bind="click:fDeleteOrg.bind($data,2)"> </button>
|
data-bind="visible: selectedKamer() && selectedKamer().actief() == true,
|
||||||
|
click:fPopEditOrg.bind($data,2)">
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<i class="fa fa-square-o"
|
||||||
|
style=" background-color: white; font-size: 23px; margin: 2px; margin-top 6px;"
|
||||||
|
data-bind="visible: selectedKamer() && selectedKamer().actief() == false, click: $root.fDearchiveer.bind($data,2)"></i>
|
||||||
|
|
||||||
|
|
||||||
|
<button class="noshow delete" data-bind="click:fDeleteOrg.bind($data,2)"> </button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin-top:10px">
|
<div style="margin-top:10px">
|
||||||
|
|
||||||
<span style="width: 100px;display:inline-block;">BG</span>
|
<span style="width: 100px;display:inline-block;">BG</span>
|
||||||
<select style="width: 65%"
|
<select style="width: 65%"
|
||||||
data-bind=" options : bgs,
|
data-bind=" options : bgs,
|
||||||
optionsText : 'naam',
|
optionsText : 'naam',
|
||||||
value : selectedBG,
|
value : selectedBG,
|
||||||
|
style : {'backgroundColor': selectedBG() && selectedBG().actief() == true ? 'white' : 'lightgrey'},
|
||||||
event : {change: fChangeBG}">
|
event : {change: fChangeBG}">
|
||||||
</select>
|
</select>
|
||||||
<button class="noshow plus" data-bind="click:fPopNewBG"> </button>
|
<button class="noshow plus" data-bind="click:fPopNewBG"> </button>
|
||||||
<button class="noshow editbutton" data-bind="click:fPopEditOrg.bind($data,3)"> </button>
|
|
||||||
<button class="noshow delete" data-bind="click:fDeleteOrg.bind($data,3)"> </button>
|
|
||||||
|
<button class="noshow editbutton"
|
||||||
|
data-bind="visible: selectedBG() && selectedBG().actief() == true,
|
||||||
|
click:fPopEditOrg.bind($data,3)">
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<i class="fa fa-square-o"
|
||||||
|
style=" background-color: white; font-size: 23px; margin: 2px; margin-top 6px;"
|
||||||
|
data-bind="visible: selectedBG() && selectedBG().actief() == false, click: $root.fDearchiveer.bind($data,3)"></i>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<button class="noshow delete" data-bind="click:fDeleteOrg.bind($data,3)"> </button>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- div col 6-->
|
</div> <!-- div col 6-->
|
||||||
<div class="col-sm-5">
|
<div class="col-sm-5">
|
||||||
@@ -60,6 +93,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody data-bind="foreach: scholen">
|
<tbody data-bind="foreach: scholen">
|
||||||
|
<!-- ko if: actief() == true -->
|
||||||
<tr>
|
<tr>
|
||||||
<td data-bind="text: nummer"></td>
|
<td data-bind="text: nummer"></td>
|
||||||
<td data-bind="text: naamkort, attr:{'title': naam}"></td>
|
<td data-bind="text: naamkort, attr:{'title': naam}"></td>
|
||||||
@@ -67,9 +101,65 @@
|
|||||||
<td class="klikbaar editbutton" data-bind="click:$root.fPopEditOrg.bind($data,4)"></td>
|
<td class="klikbaar editbutton" data-bind="click:$root.fPopEditOrg.bind($data,4)"></td>
|
||||||
<td ><button class="noshow delete" data-bind="click: $root.fDeleteOrg.bind($data,4) "></button></td>
|
<td ><button class="noshow delete" data-bind="click: $root.fDeleteOrg.bind($data,4) "></button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<!--/ko-->
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ko if: erIsArchief() == true -->
|
||||||
|
<p style="margin-top: 30px; ">
|
||||||
|
<i class="fa fa-toggle-right "
|
||||||
|
data-bind="visible: toonArchief() == false,
|
||||||
|
click: fToggleArchief"
|
||||||
|
style=" ; font-size: large; ">
|
||||||
|
</i>
|
||||||
|
<i class="fa fa-toggle-down "
|
||||||
|
style=" font-size: large; "
|
||||||
|
data-bind="visible: toonArchief() == true,
|
||||||
|
click: fToggleArchief">
|
||||||
|
</i>
|
||||||
|
Gearchiveerde scholen
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table class='lstable' data-bind="visible: toonArchief() == true" style="width:100%; background-color:#f8f8f8" >
|
||||||
|
<thead style="background-color:lightgrey">
|
||||||
|
|
||||||
|
<tr >
|
||||||
|
<th style="width: 10%; background-color: lightgrey; ">brin</th>
|
||||||
|
<th style="width: 30%; background-color: lightgrey">naam (kort)</th>
|
||||||
|
<th style="width:40%; background-color: lightgrey">plaats</th>
|
||||||
|
<th style="width: 4%; background-color: lightgrey">actief</th>
|
||||||
|
<th style="width: 4%; background-color: lightgrey;"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody data-bind="foreach: scholen">
|
||||||
|
<!-- ko if: actief() == false -->
|
||||||
|
<tr>
|
||||||
|
<td data-bind="text: nummer"></td>
|
||||||
|
<td data-bind="text: naamkort, attr:{'title': naam}"></td>
|
||||||
|
<td data-bind="text: plaats"></td>
|
||||||
|
<td style="text-align: right ">
|
||||||
|
|
||||||
|
|
||||||
|
<i class="fa fa-square-o"
|
||||||
|
style=" background-color: white; font-size: 16px; padding-right: 3px;"
|
||||||
|
data-bind="visible: actief()== false, click: $root.fDearchiveer.bind($data,4)"></i>
|
||||||
|
<i class="fa fa-check-square"
|
||||||
|
style="color: #0066ff; font-size: 16px; padding-right: 3px;"
|
||||||
|
data-bind="visible: actief() == true "></i>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td ><button class="noshow delete" data-bind="click: $root.fDeleteOrg.bind($data,4) "></button></td>
|
||||||
|
</tr>
|
||||||
|
<!--/ko-->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<!-- /ko -->
|
||||||
|
</div>
|
||||||
</div> <!-- row-->
|
</div> <!-- row-->
|
||||||
<!-- ********************* MODALS ************************ -->
|
<!-- ********************* MODALS ************************ -->
|
||||||
<!-- **************** modal edit org ******************* -->
|
<!-- **************** modal edit org ******************* -->
|
||||||
|
|||||||
@@ -4,15 +4,19 @@ ls.initOrganisatiesModel = function(){
|
|||||||
|
|
||||||
function fAddOrg(p){
|
function fAddOrg(p){
|
||||||
this.id = p.id
|
this.id = p.id
|
||||||
this.naam = ko.observable(p.naam);
|
this.actief = ko.observable(false);
|
||||||
|
|
||||||
|
if (p.actief == 1) this.actief(true);
|
||||||
|
this.naam = ko.observable(p.naam);
|
||||||
|
this.selectnaam = ko.observable(this.actief() ? p.naam : p.naam + ' (archief)')
|
||||||
|
|
||||||
this.naamkort = ko.observable(p.naamkort);
|
this.naamkort = ko.observable(p.naamkort);
|
||||||
this.plaats = ko.observable(p.plaats);
|
this.plaats = ko.observable(p.plaats);
|
||||||
this.email = ko.observable(p.email1 ? p.email1 : '')
|
this.email = ko.observable(p.email1 ? p.email1 : '')
|
||||||
this.nummer = ko.observable(p.brin);
|
this.nummer = ko.observable(p.brin);
|
||||||
this.soort = p.soort;
|
this.soort = p.soort;
|
||||||
this.valtonder_id = p.valtonder_id;
|
this.valtonder_id = p.valtonder_id;
|
||||||
this.actief = ko.observable(false);
|
|
||||||
if (p.actief == 1) this.actief(true);
|
|
||||||
this.monbas = ko.observable(false);
|
this.monbas = ko.observable(false);
|
||||||
if (p.monbas==1) this.monbas(true);
|
if (p.monbas==1) this.monbas(true);
|
||||||
this.mondiv = ko.observable(false);
|
this.mondiv = ko.observable(false);
|
||||||
@@ -62,6 +66,8 @@ ls.initOrganisatiesModel = function(){
|
|||||||
selectedBG : ko.observable(),
|
selectedBG : ko.observable(),
|
||||||
scholen : ko.observableArray([]),
|
scholen : ko.observableArray([]),
|
||||||
targetsoort : ko.observable(1),
|
targetsoort : ko.observable(1),
|
||||||
|
erIsArchief : ko.observable(false),
|
||||||
|
toonArchief : ko.observable(false),
|
||||||
oldOrg : ko.observable(), // om de oude waardes vast te houden in geval van annuleren
|
oldOrg : ko.observable(), // om de oude waardes vast te houden in geval van annuleren
|
||||||
editOrg : ko.observable(), // organisatie die geupdate wordt
|
editOrg : ko.observable(), // organisatie die geupdate wordt
|
||||||
newOrg : ko.observable({
|
newOrg : ko.observable({
|
||||||
@@ -139,6 +145,9 @@ ls.initOrganisatiesModel = function(){
|
|||||||
var self=ls.OrganisatiesModel;
|
var self=ls.OrganisatiesModel;
|
||||||
if (self.ignore()) return;
|
if (self.ignore()) return;
|
||||||
self.scholen.removeAll();
|
self.scholen.removeAll();
|
||||||
|
self.erIsArchief(false);
|
||||||
|
|
||||||
|
|
||||||
if (self.selectedBG() == undefined) return;
|
if (self.selectedBG() == undefined) return;
|
||||||
|
|
||||||
var submitData={toporgid : self.selectedBG().id,
|
var submitData={toporgid : self.selectedBG().id,
|
||||||
@@ -146,6 +155,10 @@ ls.initOrganisatiesModel = function(){
|
|||||||
$.post("index.php/shared/organisaties/getorgsperlevel/4", submitData, function(data){
|
$.post("index.php/shared/organisaties/getorgsperlevel/4", submitData, function(data){
|
||||||
if (data){
|
if (data){
|
||||||
$.each(data,function(i,p){
|
$.each(data,function(i,p){
|
||||||
|
if(p.actief == 0){
|
||||||
|
self.erIsArchief(true);
|
||||||
|
|
||||||
|
}
|
||||||
self.scholen.push(new fAddOrg(p));
|
self.scholen.push(new fAddOrg(p));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -360,7 +373,7 @@ ls.initOrganisatiesModel = function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
var submitData = { id : self.editOrg().id,
|
var submitData = { id : self.editOrg().id,
|
||||||
nummer : self.editOrg().nummer(),
|
nummer : self.editOrg().nummer(),
|
||||||
naamkort : self.editOrg().naamkort(),
|
naamkort : self.editOrg().naamkort(),
|
||||||
naam : self.editOrg().naam(),
|
naam : self.editOrg().naam(),
|
||||||
plaats : self.editOrg().plaats(),
|
plaats : self.editOrg().plaats(),
|
||||||
@@ -383,10 +396,70 @@ ls.initOrganisatiesModel = function(){
|
|||||||
self.oldOrg().actief(self.editOrg().actief());
|
self.oldOrg().actief(self.editOrg().actief());
|
||||||
self.oldOrg().monbas(self.editOrg().monbas());
|
self.oldOrg().monbas(self.editOrg().monbas());
|
||||||
self.oldOrg().mondiv(self.editOrg().mondiv());
|
self.oldOrg().mondiv(self.editOrg().mondiv());
|
||||||
|
|
||||||
|
self.erIsArchief(false);
|
||||||
|
$.each(self.scholen(), function (i,s){
|
||||||
|
if(s.actief() == false) self.erIsArchief(true);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
$("#modEditOrg").modal('hide');
|
$("#modEditOrg").modal('hide');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},'json')
|
},'json')
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fDearchiveer :function(data, gek){
|
||||||
|
var self = ls.OrganisatiesModel;
|
||||||
|
var dit = this;
|
||||||
|
|
||||||
|
var dit;
|
||||||
|
switch (data){
|
||||||
|
case 1: if (self.selectedSWV() == undefined) return;
|
||||||
|
dit = self.selectedSWV();
|
||||||
|
break;
|
||||||
|
case 2: if (self.selectedKamer() == undefined) return;
|
||||||
|
dit = self.selectedKamer();
|
||||||
|
break;
|
||||||
|
case 3: if (self.selectedBG() == undefined) return;
|
||||||
|
dit = self.selectedBG();
|
||||||
|
break;
|
||||||
|
case 4: if (this== undefined) return;
|
||||||
|
dit = this;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dit.actief(true);
|
||||||
|
|
||||||
|
|
||||||
|
var submitData = {
|
||||||
|
id : dit.id,
|
||||||
|
soort : dit.soort,
|
||||||
|
valtonderID : dit.valtonder_id
|
||||||
|
};
|
||||||
|
|
||||||
|
$.post("index.php/shared/organisaties/dearchiveer", submitData, function(error){
|
||||||
|
if(error){apprise(error);
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
self.erIsArchief(false);
|
||||||
|
$.each(self.scholen(), function (i,s){
|
||||||
|
if(s.actief() == false) self.erIsArchief(true);
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
},'json')
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
fToggleArchief: function(){
|
||||||
|
var self = ls.OrganisatiesModel;
|
||||||
|
self.toonArchief(! self.toonArchief())
|
||||||
|
},
|
||||||
|
|
||||||
fStartZoek :function(){
|
fStartZoek :function(){
|
||||||
var self = ls.OrganisatiesModel;
|
var self = ls.OrganisatiesModel;
|
||||||
if (self.zoekstring().length < 2) return;
|
if (self.zoekstring().length < 2) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user