tussenopslag

This commit is contained in:
Monique
2022-03-29 10:23:56 +02:00
parent 8696bc32b6
commit 606dad7d77
4 changed files with 85 additions and 9 deletions
@@ -20,6 +20,11 @@ class Beheer extends MY_Controller{
$modules = $this->Modules_model->getmodulesmetlijst();
echo json_encode($modules);
}
function getallmodules(){
$modules = $this->Modules_model->getallmodulesmetcluster();
echo json_encode($modules);
}
function getversies(){
if (!$this->userid) die;
$module=$this->uri->segment(4);
@@ -24,6 +24,25 @@ class Modules_model extends MY_Model{
ORDER BY volgorde";
return $this->get_query_result();
}
function getallmodulesmetcluster(){
$this->sql =" SELECT M.id, M.sysnr, M.naam AS instrument, COALESCE(C.naam, 'geen') AS cluster,
COALESCE(C.naam, 'aaaa') AS ordening, instrument_type,
CASE WHEN SOP.id IS NULL THEN
'F'
ELSE
'T'
END AS insop,
SOP.sopnaam, SOP.blokjesnaam
FROM tb_modules M
LEFT JOIN tb_cluster C ON M.cluster_id = C.id,
LEFT JOIN tb_compactsoponderdelen SOP on M.sysnr = SOP.module_nr
WHERE instrument_type <> 'GEENSOP'
ORDER BY ordening, instrument";
return $this->get_query_result();
}
function getversietoegevoegdemodule($chapterid){
$this->sql =" SELECT *
@@ -1,8 +1,37 @@
<div class="col-sm-12 mainpagina submenupage" id ="pagInstrumentenCompactSop">
<div class="col-xs-12 mainpagina submenupage" id ="pagInstrumentenCompactSop">
<div class='row'>
<div class="col-sm-12 col-md-3" style="border:1px solid #f2f2f2">
<h3>Instrument</h3>
<div class="col-xs-12" style="margin-top: 30px;">
<table class="lstable" style="width: 100%">
<thead>
<tr>
<th>cluster</th>
<th>instrument
</th>
<th>naam in Compact SOP</th>
<th>korte naam op blokje</th>
<th>in Compact SOP</th>
</tr>
</thead>
<tbody data-bind="foreach: modules">
<tr>
<td data-bind="text: cluster, visible: $index() == 0 || $parent.modules[$index-1].cluster != cluster "></td>
<td data-bind="text: instrument"></td>
<td ><input type="text" data-bind="textInput: sopnaam, click: $parent.fChangeSopnaam "/>
</td>
<td ><input type="text" data-bind="textInput: blokjesnaam, click: $parent.fChangeBlokjesnaam "/>
</td>
<td>
<input type="checkbox" data-bind="click: $parent.fToggleInSop"/>
</td>
</tr>
</tbody>
</table>
<!-- <select style="font-size:1em; max-width: 250px;"-->
<!-- data-bind=" options : modules,-->
<!-- optionsText : 'naam',-->
+29 -6
View File
@@ -4,8 +4,13 @@ $(function(){
var timeout;
function fAddModule(p){
this.sysnr = p.sysnr;
this.naam = p.naam;
this.sysnr = p.sysnr;
this.cluster = p.cluster
this.instrument = p.instrument;
this.inSOP = ko.observable(p.insop === 'T');
this.sopnaam = ko.observable(p.sopnaam);
this.blokjesnaam = ko.observable(p.blokjesnaam);
}
if (mh.InstrumentenCPModel !== undefined){
@@ -14,7 +19,7 @@ $(function(){
else {
mh.InstrumentenCPModel = {
modules : ko.observableArray([]),
selectedModule : ko.observable(''),
initBindings :function(){
var self = mh.InstrumentenCPModel;
@@ -23,14 +28,14 @@ $(function(){
ko.applyBindings(mh.InstrumentenCPModel, document.getElementById("pagInstrumentenCompactSop"));
}
$.post("index.php/monpas/beheer/getmodules", function(result){
$.post("index.php/monpas/beheer/getallmodules", 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');
@@ -39,8 +44,26 @@ $(function(){
},
fToggleInSop: function(){
var self = mh.InstrumentenCPModel;
this.inSOP(!this.inSOP);
},
fChangeSopnaam: function(){
var self = mh.InstrumentenCPModel;
},
fChangeBlokjesnaam: function(){
var self = mh.InstrumentenCPModel;
},
} ; // definition van model
mh.InstrumentenCPModel().initBindings();
mh.InstrumentenCPModel.initBindings();
} // else
}// function initInstrumentenCPModel
});