instrumenten koppelen in beheer
This commit is contained in:
@@ -8,7 +8,8 @@ class Beheer extends MY_Controller{
|
|||||||
"monpas/Modules_model",
|
"monpas/Modules_model",
|
||||||
"monpas/Versies_model",
|
"monpas/Versies_model",
|
||||||
"monpas/Ijkpunten_model",
|
"monpas/Ijkpunten_model",
|
||||||
"monpas/Indicatoren_model");
|
"monpas/Indicatoren_model",
|
||||||
|
"monpas/Compactsoponderdelen_model");
|
||||||
$this->load->model($models);
|
$this->load->model($models);
|
||||||
$this->load->helper('string');
|
$this->load->helper('string');
|
||||||
if ( ! $this->check_online_status() ) {
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,16 +26,20 @@ class Modules_model extends MY_Model{
|
|||||||
}
|
}
|
||||||
function getallmodulesmetcluster(){
|
function getallmodulesmetcluster(){
|
||||||
$this->sql =" SELECT M.id, M.sysnr, M.naam AS instrument, COALESCE(C.naam, 'geen') AS cluster,
|
$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
|
CASE WHEN SOP.id IS NULL THEN
|
||||||
'F'
|
'F'
|
||||||
ELSE
|
ELSE
|
||||||
'T'
|
CASE WHEN SOP.in_sop = 'F' THEN
|
||||||
|
'F'
|
||||||
|
ELSE
|
||||||
|
'T'
|
||||||
|
END
|
||||||
END AS insop,
|
END AS insop,
|
||||||
SOP.sopnaam, SOP.blokjesnaam
|
SOP.sopnaam, SOP.blokjesnaam
|
||||||
|
|
||||||
FROM tb_modules M
|
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
|
LEFT JOIN tb_compactsoponderdelen SOP on M.sysnr = SOP.module_nr
|
||||||
WHERE instrument_type <> 'GEENSOP'
|
WHERE instrument_type <> 'GEENSOP'
|
||||||
ORDER BY ordening, instrument";
|
ORDER BY ordening, instrument";
|
||||||
|
|||||||
@@ -1,32 +1,46 @@
|
|||||||
<div class="col-xs-12 mainpagina submenupage" id ="pagInstrumentenCompactSop">
|
<div class="col-xs-12 mainpagina submenupage" id ="pagInstrumentenCompactSop">
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
|
|
||||||
<div class="col-xs-12" style="margin-top: 30px;">
|
<div class="col-xs-12" style="margin-top: 30px;margin-left: 20px;">
|
||||||
<table class="lstable" style="width: 100%">
|
<table class="lstable" style="width: 95%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>cluster</th>
|
<th style="width: 15%; vertical-align: text-top">cluster</th>
|
||||||
<th>instrument
|
<th style="width: 25%; vertical-align: text-top">instrument</th>
|
||||||
</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>naam in Compact SOP</th>
|
<th style="width: 10%; text-align: right;padding-right: 5px; vertical-align: text-top">in Compact SOP</th>
|
||||||
<th>korte naam op blokje</th>
|
|
||||||
<th>in Compact SOP</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody data-bind="foreach: modules">
|
<tbody data-bind="foreach: modules">
|
||||||
<tr>
|
<tr>
|
||||||
<td data-bind="text: cluster, visible: $index() == 0 || $parent.modules[$index-1].cluster != cluster "></td>
|
<td style="vertical-align: top">
|
||||||
<td data-bind="text: instrument"></td>
|
<!-- 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>
|
||||||
<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>
|
||||||
<td>
|
<td style="text-align: right; padding-right: 5px;padding-top: 0; vertical-align: top; margin: 0">
|
||||||
<input type="checkbox" data-bind="click: $parent.fToggleInSop"/>
|
<input type="checkbox" data-bind="checked: inSOP, click: $parent.fSaveInSop"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ ls.initBeheerModel = function(){
|
|||||||
$("#pagScores").hide().show("slide", {direction:"right"} ,200)
|
$("#pagScores").hide().show("slide", {direction:"right"} ,200)
|
||||||
break;
|
break;
|
||||||
case "instrumentencp":
|
case "instrumentencp":
|
||||||
console.log('bij het goede tabblad')
|
|
||||||
mh.initInstrumentenCPModel();
|
mh.initInstrumentenCPModel();
|
||||||
$("#pagInstrumentenCompactSop").hide().show("slide", {direction:"right"} ,200)
|
$("#pagInstrumentenCompactSop").hide().show("slide", {direction:"right"} ,200)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ $(function(){
|
|||||||
|
|
||||||
function fAddModule(p){
|
function fAddModule(p){
|
||||||
this.sysnr = p.sysnr;
|
this.sysnr = p.sysnr;
|
||||||
|
this.sopID = ko.observable(p.sopID);
|
||||||
this.cluster = p.cluster
|
this.cluster = p.cluster
|
||||||
this.instrument = p.instrument;
|
this.instrument = p.instrument;
|
||||||
this.inSOP = ko.observable(p.insop === 'T');
|
this.inSOP = ko.observable(p.insop == 'T');
|
||||||
this.sopnaam = ko.observable(p.sopnaam);
|
this.sopnaam = ko.observable(p.sopnaam ? p.sopnaam : '');
|
||||||
this.blokjesnaam = ko.observable(p.blokjesnaam);
|
this.blokjesnaam = ko.observable(p.blokjesnaam ? p.blokjesnaam : '');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,18 +45,90 @@ $(function(){
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
fToggleInSop: function(){
|
fSaveInSop: function(){
|
||||||
var self = mh.InstrumentenCPModel;
|
var dit = this;
|
||||||
this.inSOP(!this.inSOP);
|
|
||||||
|
|
||||||
|
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(){
|
fSaveSopnaam: function(){
|
||||||
var self = mh.InstrumentenCPModel;
|
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(){
|
fSaveBlokjesnaam: function(){
|
||||||
var self = mh.InstrumentenCPModel;
|
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);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user