instrumenten koppelen in beheer

This commit is contained in:
Monique
2022-04-26 16:16:20 +02:00
parent 4230646bd4
commit d26974e69f
5 changed files with 182 additions and 31 deletions
+62 -1
View File
@@ -8,7 +8,8 @@ class Beheer extends MY_Controller{
"monpas/Modules_model",
"monpas/Versies_model",
"monpas/Ijkpunten_model",
"monpas/Indicatoren_model");
"monpas/Indicatoren_model",
"monpas/Compactsoponderdelen_model");
$this->load->model($models);
$this->load->helper('string');
if ( ! $this->check_online_status() ) {
@@ -152,4 +153,64 @@ class Beheer extends MY_Controller{
}
function moduleinsop(){
if (!$this->userid) die;
$sopID = $this->clean_input("sopID");
$modulenr = $this->clean_input("sysnr");
$inSOP = $this->clean_input("inSOP");
if ($sopID > 0) {
$this->Compactsoponderdelen_model->update_record(['in_sop' => $inSOP], $sopID);
} else {
$sopID = $this->Compactsoponderdelen_model->insert_record(
['sopnaam' => '',
'blokjesnaam' => '',
'module_nr' => $modulenr,
'in_sop' => $inSOP
]
);
}
echo json_encode($sopID);
}
function savesopnaam(){
if (!$this->userid) die;
$sopID = $this->clean_input("sopID");
$modulenr = $this->clean_input("sysnr");
$sopnaam = $this->clean_input("sopnaam");
if ($sopID > 0) {
$this->Compactsoponderdelen_model->update_record(['sopnaam' => $sopnaam], $sopID);
} else {
$sopID = $this->Compactsoponderdelen_model->insert_record(
['sopnaam' => $sopnaam,
'blokjesnaam' => '',
'module_nr' => $modulenr,
'in_sop' => 'F'
]
);
}
echo json_encode($sopID);
}
function saveblokjesnaam(){
if (!$this->userid) die;
$sopID = $this->clean_input("sopID");
$modulenr = $this->clean_input("sysnr");
$blokjesnaam = $this->clean_input("blokjesnaam");
if ($sopID > 0) {
$this->Compactsoponderdelen_model->update_record(['blokjesnaam' => $blokjesnaam], $sopID);
} else {
$sopID = $this->Compactsoponderdelen_model->insert_record(
['sopnaam' => '',
'blokjesnaam' => $blokjesnaam,
'module_nr' => $modulenr,
'in_sop' => 'F'
]
);
}
echo json_encode($sopID);
}
}
+8 -4
View File
@@ -26,16 +26,20 @@ class Modules_model extends MY_Model{
}
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,
COALESCE(C.naam, 'aaaa') AS ordening, instrument_type, COALESCE(SOP.id, 0 ) AS sopID,
CASE WHEN SOP.id IS NULL THEN
'F'
ELSE
'T'
ELSE
CASE WHEN SOP.in_sop = 'F' THEN
'F'
ELSE
'T'
END
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_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";
@@ -1,32 +1,46 @@
<div class="col-xs-12 mainpagina submenupage" id ="pagInstrumentenCompactSop">
<div class='row'>
<div class="col-xs-12" style="margin-top: 30px;">
<table class="lstable" style="width: 100%">
<div class="col-xs-12" style="margin-top: 30px;margin-left: 20px;">
<table class="lstable" style="width: 95%">
<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>
<th style="width: 15%; vertical-align: text-top">cluster</th>
<th style="width: 25%; vertical-align: text-top">instrument</th>
<th style="width: 30%; vertical-align: text-top">naam in Compact SOP (max. 50 lettertekens)</th>
<th style="width: 20%; vertical-align: text-top">korte naam op gekozen blokje (max. 25 lettertekens)</th>
<th style="width: 10%; text-align: right;padding-right: 5px; vertical-align: text-top">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 style="vertical-align: top">
<!-- ko if: $index() == 0 || ($index() > 0 && $root.modules()[$index()-1].cluster != cluster) -->
<span data-bind="text: cluster"></span>
<!--/ko -->
</td>
<td ><input type="text" data-bind="textInput: sopnaam, click: $parent.fChangeSopnaam "/>
<td style="vertical-align: top" data-bind="text: instrument"></td>
<td style="vertical-align: top" ><input style="width:100%"
type="text"
maxlength="50"
data-bind="textInput: sopnaam, event:{input: $root.fSaveSopnaam} "/>
</td>
<td ><input type="text" data-bind="textInput: blokjesnaam, click: $parent.fChangeBlokjesnaam "/>
<td style="vertical-align: top" ><input style="width:100%"
type="text"
maxlength="24"
data-bind="textInput: blokjesnaam, event:{input: $root.fSaveBlokjesnaam}"/>
</td>
<td>
<input type="checkbox" data-bind="click: $parent.fToggleInSop"/>
<td style="text-align: right; padding-right: 5px;padding-top: 0; vertical-align: top; margin: 0">
<input type="checkbox" data-bind="checked: inSOP, click: $parent.fSaveInSop"/>
</td>
</tr>
<!-- ko if: $index() < $root.modules().length - 1 && $root.modules()[$index()+1].cluster != cluster -->
<tr>
<td colspan="5" style="border-top: 1px solid #ded0d7 "></td>
</tr>
<!--/ko-->
</tbody>
</table>
-1
View File
@@ -63,7 +63,6 @@ ls.initBeheerModel = function(){
$("#pagScores").hide().show("slide", {direction:"right"} ,200)
break;
case "instrumentencp":
console.log('bij het goede tabblad')
mh.initInstrumentenCPModel();
$("#pagInstrumentenCompactSop").hide().show("slide", {direction:"right"} ,200)
break;
+83 -10
View File
@@ -5,11 +5,12 @@ $(function(){
function fAddModule(p){
this.sysnr = p.sysnr;
this.sopID = ko.observable(p.sopID);
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);
this.inSOP = ko.observable(p.insop == 'T');
this.sopnaam = ko.observable(p.sopnaam ? p.sopnaam : '');
this.blokjesnaam = ko.observable(p.blokjesnaam ? p.blokjesnaam : '');
}
@@ -44,18 +45,90 @@ $(function(){
},
fToggleInSop: function(){
var self = mh.InstrumentenCPModel;
this.inSOP(!this.inSOP);
fSaveInSop: function(){
var dit = this;
if(this.inSOP()){
if(this.sopnaam().length < 3 || this.blokjesnaam() < 3){
apprise("vul eerst een (korte) naam in.");
this.inSOP(false);
return;
}
}
var sd ={
'sopID': this.sopID(),
'sysnr': this.sysnr,
'inSOP': this.inSOP() ? 'T ': 'F'
};
$.post("index.php/monpas/beheer/moduleinsop/",sd, function(result) {
if(result){
dit.sopID(result);
}
},'json');
return true;
},
fChangeSopnaam: function(){
var self = mh.InstrumentenCPModel;
fSaveSopnaam: function(){
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
var dit = this;
console.log(this, "this")
timeout = setTimeout(function () {
var submitData = {
'sopID': dit.sopID(),
'sysnr': dit.sysnr,
'sopnaam': dit.sopnaam()
};
console.log(submitData, "sopnaam")
$.post("index.php/monpas/beheer/savesopnaam", submitData, function (result) {
if(result){
if(result){
dit.sopID(result);
}
}
}, 'json');
}, 600);
},
fChangeBlokjesnaam: function(){
var self = mh.InstrumentenCPModel;
fSaveBlokjesnaam: function(){
console.log("nu hier")
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
var dit = this;
console.log(this, "this")
timeout = setTimeout(function () {
var submitData = {
'sopID': dit.sopID(),
'sysnr': dit.sysnr,
'blokjesnaam': dit.blokjesnaam()
};
console.log(submitData, 'data' );
$.post("index.php/monpas/beheer/saveblokjesnaam", submitData, function (result) {
if(result){
if(result){
dit.sopID(result);
}
}
}, 'json');
}, 600);
},