vwf toggle required

This commit is contained in:
Josh North 2021-06-22 12:34:02 -04:00
parent fc66909cbb
commit 654e1d70c6

View File

@ -170,6 +170,7 @@ $form_data = filter_input_array(INPUT_POST, [
'db_vendorinfo_checklistrequired' => (string)FILTER_SANITIZE_STRING,
'db_vendorinfo_routinework' => (string)FILTER_SANITIZE_STRING,
'db_vendorinfo_nonroutinework' => (string)FILTER_SANITIZE_STRING,
'fd_routineornonroutine' => (int)FILTER_VALIDATE_INT,
'db_vendorinfo_coi' => (string)FILTER_SANITIZE_STRING,
'db_vendorinfo_worksummary' => (string)FILTER_SANITIZE_STRING,
'db_vendorinfo_equipmentsummary' => (string)FILTER_SANITIZE_STRING,
@ -219,11 +220,18 @@ $form_data = filter_input_array(INPUT_POST, [
<?php if(!empty($form_data['fd_formAction'])){ // CONFIRM VENDOR FORM INITIAL STAGE
if($form_data['fd_formAction']==='actionVendorConfirmation'){
ob_start();
if($form_data['fd_routineornonroutine']===(int)0){
$fdroutinework=(int)1;
$fdnonroutinework=(int)0;
}elseif($form_data['fd_routineornonroutine']===(int)1){
$fdroutinework=(int)0;
$fdnonroutinework=(int)1;
}
$VisitActions->setInfoVendorVisitInitial(
$form_data['db_vendorinfo_id'],
$form_data['db_vendorinfo_checklistrequired'],
$form_data['db_vendorinfo_routinework'],
$form_data['db_vendorinfo_nonroutinework'],
$fdroutinework,
$fdnonroutinework,
$form_data['db_vendorinfo_coi'],
$form_data['db_vendorinfo_worksummary'],
$form_data['db_vendorinfo_equipmentsummary'] );
@ -673,37 +681,25 @@ $form_data = filter_input_array(INPUT_POST, [
<input class="form-check-input" name="db_vendorinfo_checklistrequired" value="1" type="checkbox" id="db_vendorinfo_checklistrequired" <?php if (isset($db_vendorinfo_checklistrequired) && $db_vendorinfo_checklistrequired === 1) {echo "checked";}?>>
<label class="form-check-label" for="db_vendorinfo_checklistrequired"><span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-content="<?php echo $transLang['STR_VENDORINFO_CHECKLISTREQUIRED_DESC']; ?>"><?php echo $transLang['STR_VENDORINFO_CHECKLISTREQUIRED_TITLE']; ?></span></label>
</div>
</div>
<div class="col d-grid gap-2 routineornot">
<div class="form-check form-switch">
<input type="hidden" name="db_vendorinfo_coi" value="0" />
<input class="form-check-input" name="db_vendorinfo_coi" value="1" type="checkbox" id="db_vendorinfo_coi" <?php if (isset($db_vendorinfo_coi) && $db_vendorinfo_coi === 1) {echo "checked";}?>>
<label class="form-check-label" for="db_vendorinfo_coi"><span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-content="<?php echo $transLang['STR_VENDORINFO_COI_DESC']; ?>"><?php echo $transLang['STR_VENDORINFO_COI_TITLE']; ?></span></label>
</div>
</div>
<div class="col d-grid gap-2 routineornot">
<div class="form-check form-switch">
<input type="hidden" name="db_vendorinfo_routinework" value="0" />
<input class="form-check-input" name="db_vendorinfo_routinework" value="1" type="checkbox" id="db_vendorinfo_routinework" <?php if (isset($db_vendorinfo_routinework) && $db_vendorinfo_routinework === 1) {echo "checked";}?> oninvalid="this.setCustomValidity('<?php echo $transLang['STR_VENDORINFO_ROUTINEORNONROUTINE']; ?>')" onchange="this.setCustomValidity('')" required/>
<label class="form-check-label" for="db_vendorinfo_routinework"><span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-content="<?php echo $transLang['STR_VENDORINFO_ROUTINEWORK_DESC']; ?>"><?php echo $transLang['STR_VENDORINFO_ROUTINEWORK_TITLE']; ?></span></label>
</div>
<div class="form-check form-switch">
<input type="hidden" name="db_vendorinfo_nonroutinework" value="0" />
<input class="form-check-input" name="db_vendorinfo_nonroutinework" value="1" type="checkbox" id="db_vendorinfo_nonroutinework" <?php if (isset($db_vendorinfo_nonroutinework) && $db_vendorinfo_nonroutinework === 1) {echo "checked";}?> oninvalid="this.setCustomValidity('<?php echo $transLang['STR_VENDORINFO_ROUTINEORNONROUTINE']; ?>')" onchange="this.setCustomValidity('')" required/>
<label class="form-check-label" for="db_vendorinfo_nonroutinework"><span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-content="<?php echo $transLang['STR_VENDORINFO_NONROUTINEWORK_DESC']; ?>"><?php echo $transLang['STR_VENDORINFO_NONROUTINEWORK_TITLE']; ?></span></label>
</div>
<div class="row row-cols-1 mb-2">
<div class="col d-grid gap-2">
<div class="btn-group" role="group" data-toggle="button">
<input type="radio" class="btn-check" name="fd_routineornonroutine" autocomplete="off" value="0" id="fd_routinework-<?=$db_vendorinfo_id?>" <?php if (isset($db_vendorinfo_routinework) && $db_vendorinfo_routinework === 1) {echo "checked";}?> required/>
<label class="btn btn-outline-primary" for="fd_routinework-<?=$db_vendorinfo_id?>"><?php echo $transLang['STR_VENDORINFO_ROUTINEWORK_TITLE']; ?></label>
<input type="radio" class="btn-check" name="fd_routineornonroutine" autocomplete="off" value="1" id="fd_nonroutinework-<?=$db_vendorinfo_id?>" <?php if (isset($db_vendorinfo_nonroutinework) && $db_vendorinfo_nonroutinework === 1) {echo "checked";}?> required/>
<label class="btn btn-outline-primary" for="fd_nonroutinework-<?=$db_vendorinfo_id?>"><?php echo $transLang['STR_VENDORINFO_NONROUTINEWORK_TITLE']; ?></label>
</div>
</div>
</div>
<script>
$(function(){
var requiredCheckboxes = $('.routineornot :checkbox[required]');
requiredCheckboxes.change(function(){
if(requiredCheckboxes.is(':checked')) {
requiredCheckboxes.removeAttr('required');
} else {
requiredCheckboxes.attr('required', 'required');
}
});
});
</script>
<div class="row row-cols-1 mb-2">
<div class="col d-grid gap-2">
<div class="input-group input-group-sm mb-0">