CMXX - Upgrade products_software

This commit is contained in:
“VeLiTi”
2024-11-11 17:08:05 +01:00
parent 9afc383a09
commit 21d03072bd
6 changed files with 358 additions and 133 deletions

View File

@@ -1,7 +1,7 @@
<?php
defined(page_security_key) or exit;
$page = 'products_versions';
$page = 'products_software';
//Check if allowed
if (isAllowed($page,$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
header('location: index.php');
@@ -13,7 +13,7 @@ $delete_allowed = isAllowed($page ,$_SESSION['profile'],$_SESSION['permission'],
$create_allowed = isAllowed($page ,$_SESSION['profile'],$_SESSION['permission'],'C');
// Default input product values
$products_versions = [
$products_software = [
'rowID' => '',
'productrowid' => '',
'status' => '',
@@ -21,7 +21,8 @@ $products_versions = [
'software' => '',
'created' => '',
'createdby' => $_SESSION['username'],
'measurement' => '',
'mandatory' => '',
'latest' => ''
];
//productrowid is required by api
@@ -36,7 +37,7 @@ if (isset($_GET['rowID'])) {
//Decode Payload
if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = null;}
$products_versions = json_decode(json_encode($responses[0]), true);
$products_software = json_decode(json_encode($responses[0]), true);
if ($update_allowed === 1){
@@ -182,24 +183,37 @@ $view .= '<div class="content-block tab-content active">
<div class="form responsive-width-100">
<label for="status">'.$product_status.'</label>
<select id="status" name="status">
<option value="1" '.($products_versions['status']==1?' selected':'').'>'.$prod_status_1 .'</option>
<option value="0" '.($products_versions['status']==0?' selected':'').'>'.$prod_status_0 .'</option>
<option value="1" '.($products_software['status']==1?' selected':'').'>'.$prod_status_1 .'</option>
<option value="0" '.($products_software['status']==0?' selected':'').'>'.$prod_status_0 .'</option>
</select>
<label for=""><i class="required">*</i>'.$product_version_version.'</label>
<input id="name" type="text" name="version" placeholder="'.$product_version_version.'" value="'.$products_versions['version'].'" required>
<input id="name" type="text" name="version" placeholder="'.$product_version_version.'" value="'.$products_software['version'].'" required>
';
if ($products_software['software'] !=''){
$view .= '
<label for=""><i class="required">*</i>'.$product_version_software.'</label>
<input id="name" type="text" name="software" placeholder="'.$product_version_software.'" value="'.$products_versions['software'].'">
<label for=""><i class="required">*</i>'.ucfirst($register_mandatory).'</label>
<input id="name" type="text" name="software" placeholder="'.$product_version_software.'" value="'.$products_software['software'].'">
';
}
$view .= ' <label for=""><i class="required">*</i>'.ucfirst($register_mandatory).'</label>
<select id="mandatory" name="mandatory">
<option value="0" '.($products_software['mandatory']==0?' selected':'').'>'.$general_no.'</option>
<option value="1" '.($products_software['mandatory']==1?' selected':'').'>'.$general_yes.'</option>
</select>
</select>';
if ($products_software['software'] !=''){
$view .= '
<label for=""><i class="required">*</i>'.ucfirst($general_sort_type_3).'</label>
<select id="latest" name="latest">
<option value="0" '.($products_software['latest']==0?' selected':'').'>'.$general_no.'</option>
<option value="1" '.($products_software['latest']==1?' selected':'').'>'.$general_yes.'</option>
</select>
';
}
$view .= '
<label for=""></label>
<input type="file" name="fileToUpload" id="fileToUpload" accept=".hex, .HEX, .bin,.BIN,.exe,.EXE" style="width: 30%;padding: 50px 0 0 0;height: 10px;">
<input type="hidden" name="rowID" value="'.$products_versions['rowID'].'">
<input type="hidden" name="rowID" value="'.$products_software['rowID'].'">
<input type="hidden" name="productrowid" value="'.$productrowid.'">
</div>
</div>';
@@ -207,9 +221,9 @@ $view .= '<div class="content-block tab-content active">
$view .= '<div class="content-block tab-content">
<div class="form responsive-width-100">
<label for="productcode">'.$general_created.'</label>
<input id="name" type="text" name="" placeholder="'.$general_created.'" value="'.$products_versions['created'].'" readonly>
<input id="name" type="text" name="" placeholder="'.$general_created.'" value="'.$products_software['created'].'" readonly>
<label for="productcode">'.$general_createdby.'</label>
<input id="name" type="text" name="" placeholder="'.$general_createdby.'" value="'.$products_versions['createdby'].'" readonly>
<input id="name" type="text" name="" placeholder="'.$general_createdby.'" value="'.$products_software['createdby'].'" readonly>
</div>
</div>';
$view .= '</form>';