112 lines
3.6 KiB
PHP
112 lines
3.6 KiB
PHP
<?= $this->extend('layouts/main.php') ?>
|
|
|
|
<?= $this->section('content') ?>
|
|
<?php
|
|
$prodinstid = 0;
|
|
$prodinstname = '';
|
|
$prodinstcode = '';
|
|
$productid = '';
|
|
$prodinstkey = '';
|
|
$instid = '';
|
|
if(isset($prodinsts)) { $data = $prodinsts[0]; }
|
|
if(isset($new_value)) { $data = $new_value; }
|
|
if(isset($data)) {
|
|
if(isset($data['prodinstid'])) { $prodinstid = $data['prodinstid']; }
|
|
$prodinstname = $data['prodinstname'];
|
|
$prodinstcode = $data['prodinstcode'];
|
|
$prodinstkey = $data['prodinstkey'];
|
|
$productid = $data['productid'];
|
|
$instid = $data['instid'];
|
|
}
|
|
?>
|
|
<main id="main" class="main">
|
|
<div class="pagetitle">
|
|
<h1>Inst Editor</h1>
|
|
</div>
|
|
|
|
<?php
|
|
if(isset($validation)) {
|
|
?>
|
|
<div class='alert alert-danger alert-dismissible'>
|
|
<?= $validation->listErrors(); ?>
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Inst Editor</h5>
|
|
|
|
<form method='POST'>
|
|
<input type='hidden' name='prodinstid' value='<?=$prodinstid;?>' />
|
|
<div class="row mb-1">
|
|
<label for="productid" class="col-sm-2 col-form-label">Product</label>
|
|
<div class="col-sm-10">
|
|
<select class='form-control select2 pt-1 productid' name='productid'>
|
|
<option value=''></option>
|
|
<?php
|
|
foreach($products as $data) {
|
|
$qproductid = $data['productid'];
|
|
$qsitename = $data['sitename'];
|
|
$qproductname = $data['productname'];
|
|
$qproductnumber = $data['productnumber'];
|
|
if($qproductid == $productid) { echo "<option value='$qproductid' selected>$qsitename - $qproductname SN# $qproductnumber</option>"; }
|
|
else { echo "<option value='$qproductid'>$qsitename - $qproductname SN# $qproductnumber</option>"; }
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="row mb-1">
|
|
<label for="instid" class="col-sm-2 col-form-label">Instrument</label>
|
|
<div class="col-sm-10">
|
|
<select class='form-control select2' name='instid'>
|
|
<option value=''></option>
|
|
<?php
|
|
foreach($insts as $data) {
|
|
$qinstid = $data['instid'];
|
|
$qinstname = $data['instname'];
|
|
if($qinstid == $instid) { echo "<option value='$qinstid' selected>$qinstname</option>"; }
|
|
else { echo "<option value='$qinstid'>$qinstname</option>"; }
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<input type='hidden' class='prodinstname' name='prodinstname' value='<?=$prodinstname;?>' />
|
|
<div class="row mb-1">
|
|
<label for="testcode" class="col-sm-2 col-form-label">ProdInst Code</label>
|
|
<div class="col-sm-10">
|
|
<input type="text" class="form-control form-control-sm" name='prodinstcode' value='<?=$prodinstcode;?>' required />
|
|
</div>
|
|
</div>
|
|
<div class="row mb-1">
|
|
<label for="testcode" class="col-sm-2 col-form-label">ProdInst Key</label>
|
|
<div class="col-sm-10">
|
|
<input type="text" class="form-control form-control-sm" name='prodinstkey' value='<?=$prodinstkey;?>' required />
|
|
</div>
|
|
</div>
|
|
<div class="text-end">
|
|
<button type="submit" class="btn btn-primary">Submit</button>
|
|
<button type="reset" class="btn btn-secondary">Reset</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
<?= $this->endSection() ?>
|
|
|
|
<?= $this->section('script') ?>
|
|
<script>
|
|
document.body.classList.add('toggle-sidebar');
|
|
$('.select2').select2();
|
|
$('.productid').on('change', function(){
|
|
var selectedOption = $(this).find('option:selected');
|
|
var selectedText = selectedOption.text();
|
|
$('.prodinstname').val(selectedText);
|
|
})
|
|
</script>
|
|
<?= $this->endSection() ?>
|