Baufreigabe checks for missing required fields
This commit is contained in:
@@ -119,7 +119,7 @@
|
||||
<?=$building->email?>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<label><input type="checkbox" form="wf-building-<?=$building->id?>" name="pipework_enabled" value="1" <?=($building->pipework_enabled==1) ? "checked='checked'" : ""?>> Baufreigabe</label>
|
||||
<label <?=(!$building->pipeworker_id) ? "class='text-danger' title='Keine Tiefbaufirma ausgewählt'" : ""?>><input type="checkbox" form="wf-building-<?=$building->id?>" name="pipework_enabled" value="1" <?=($building->pipework_enabled==1) ? "checked='checked'" : ""?> <?=(!$building->pipeworker_id || !$me->is(["Admin", "Pipeplanner "])) ? "disabled='disabled'" : ""?>> Baufreigabe</label>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<button type="button" class="btn btn-primary" form="wf-building-<?=$building->id?>" onclick="document.getElementById(this.getAttribute('form')).submit()">Speichern</button>
|
||||
@@ -224,6 +224,40 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
$('select[name=wfitem_pipework_finished]').each(function() {
|
||||
var elem = this;
|
||||
//console.log(elem);
|
||||
$(elem).click(function() {
|
||||
var id_match = $(this).attr("id").match(/wfitem_pipework_finished_(\d+)$/);
|
||||
var id = id_match[1];
|
||||
//console.log(id);
|
||||
|
||||
var ap_type=$('#wfitem_anschlusspunkt_typ_' + id).val();
|
||||
var ap_name=$('#wfitem_anschlusspunkt_name_' + id).val();
|
||||
var rohrname=$('#wfitem_rohrverband_name_' + id).val();
|
||||
var rohrtype=$('#wfitem_rohrtype_' + id).val();
|
||||
var rohrfarbe=$('#wfitem_rohrfarbe_' + id).val();
|
||||
|
||||
var ist_ap_type=$('#wfitem_ist_anschlusspunkt_typ_' + id).val();
|
||||
var ist_ap_name=$('#wfitem_ist_anschlusspunkt_name_' + id).val();
|
||||
var ist_rohrname=$('#wfitem_ist_rohrverband_name_' + id).val();
|
||||
var ist_rohrtype=$('#wfitem_ist_rohrtype_' + id).val();
|
||||
var ist_rohrfarbe=$('#wfitem_ist_rohrfarbe_' + id).val();
|
||||
|
||||
//console.log(ap_type, ap_name, rohrname, rohrtype, rohrfarbe);
|
||||
|
||||
if((!ap_type && !ist_ap_type) || (!ap_name && !ist_ap_type) || (!rohrname && !ist_rohrname) || (!rohrtype || !ist_rohrtype) || (!rohrfarbe && !ist_rohrfarbe)) {
|
||||
$(this).find("option").attr("disabled", true);
|
||||
}
|
||||
|
||||
if((ap_type || ist_ap_type) && (ap_name || ist_ap_name) && (rohrname || ist_rohrname) && (rohrtype || ist_rohrtype) && (rohrfarbe || ist_rohrfarbe)) {
|
||||
//console.log("enable");
|
||||
$(this).find("option").removeAttr("disabled");
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user