CM91 - RMA update

This commit is contained in:
“VeLiTi”
2024-12-11 11:06:09 +01:00
parent 81bd7c6c64
commit 53d8f7f546
2 changed files with 109 additions and 52 deletions

103
rma.php
View File

@@ -26,11 +26,11 @@ $rma_search = 'Search RMA...';
$rma_rowID = 'Request number';
$rma_status = 'Status';
$rma_status0_text = '1';
$rma_status1_text = '2';
$rma_status2_text = '3';
$rma_status3_text = '4';
$rma_status4_text = '5';
$rma_status0_text = 'New';
$rma_status1_text = 'In Progress';
$rma_status2_text = 'Approved';
$rma_status3_text = 'Completed';
$rma_status4_text = 'Cancelled';
$rma_sw_version_latest = 'Latest software version';
$rma_servicereport_latest = 'Servicereport created last 7days';
@@ -105,6 +105,7 @@ $rma_questions = json_decode($rma['questions'],true) ?? '';
//Variables
//------------------------------
$status_text = 'rma_status'.$rma['status'].'_text';
$rma_status_text = 'rma_return_reason'.$rma['status'].'_text';
// Handle success messages
if (isset($_GET['success_msg'])) {
@@ -124,7 +125,7 @@ template_header('RMA', 'rma','manage');
$view = '
<div class="content-title responsive-flex-wrap responsive-pad-bot-3">
<h2 class="responsive-width-100">'.($rma_h2 ?? 'Return Material Request').' - '.$_GET['rowID'].'</h2>
<a href="index.php?page=rms" class="btn alt mar-right-2">'.$button_cancel.'</a>
<a href="index.php?page=rmas" class="btn alt mar-right-2">'.$button_cancel.'</a>
';
if ($update_allowed === 1){
@@ -141,6 +142,7 @@ if (isset($success_msg)){
</div>';
}
$view .= '<div class="content-block-wrapper">';
$view .= ' <div class="content-block order-details">
<div class="block-header">
@@ -165,25 +167,25 @@ $view .= ' <div class="content-block order-details">
</div>
<div class="order-detail">
<h3>'.$equipment_label10.'</h3>
<p><input type="text" name="header[rowID]" value="'.$rma_header['rowID'].'"></p>
<p>'.$rma_header['rowID'].'</p>
</div>
<div class="order-detail">
<h3>'.($rma_sw_version_latest ?? 'Latest software version').'</h3>
<p><select id="sw_version_latest" name="header[sw_version_latest]">
<option value="0" '.($rma_header['sw_version_latest']==0?' selected':'').'>'.$general_no .'</option>
<option value="1" '.($rma_header['sw_version_latest']==1?' selected':'').'>'.$general_yes .'</option>
</select>
</p>
<p>'.(($rma_header['sw_version_latest']==0) ? $general_no: $general_yes).'</p>
</div>
<div class="order-detail">
<h3>'.($rma_servicereport_latest ?? 'Servicereport created last 7days').'</h3>
<p><select id="servicereport_available" name="header[servicereport_available]">
<option value="0" '.($rma_header['servicereport_available']==0?' selected':'').'>'.$general_no .'</option>
<option value="1" '.($rma_header['servicereport_available']==1?' selected':'').'>'.$general_yes .'</option>
</select>
</p>
</div>
<p>'.(($rma_header['servicereport_available']==0) ? $general_no: $general_yes).'</p>
</div>';
if (isset($rma_questions['equipmentID'])){
$view .='
<div class="order-detail">
<h3>'.$servicereport_details.'</h3>
<p><a href="index.php?page=servicereport&equipmentID='.$rma_questions['equipmentID'].'&historyID='.$rma_questions['historyID'].'" class="btn_link">'.$general_view.'</a></p>
</div>
';
}
$view .='
</div>
@@ -195,15 +197,15 @@ $view .='<div class="content-block order-details">
</div>
<div class="order-detail">
<h3>'.$general_soldto.'</h3>
<p><input type="text" name="header[soldto]" value="'.($rma_header['soldto'] ?? '').'"></p>
<p>'.($rma_header['soldto'] ?? '').'</p>
</div>
<div class="order-detail">
<h3>'.$general_shipto.'</h3>
<p><input type="text" name="header[shipto]" value="'.($rma_header['shipto'] ?? '').'"></p>
<p>'.($rma_header['shipto'] ?? '').'</p>
</div>
<div class="order-detail">
<h3>'.$general_location.'</h3>
<p><input type="text" name="header[location]" value="'.($rma_header['location'] ?? '').'"></p>
<p>'.($rma_header['location'] ?? '').'</p>
</div>
</div>';
@@ -219,15 +221,15 @@ if($rma_header['servicereport_available'] == 0 ){
$view .='<a href="#">'.($rma_return_tab2 ?? 'Questions').'</a>';
}
$view .= '</div>';
$view .= '<a href="#">'.($general_actions ?? 'Actions').'</a>
<a href="#">'.($tab3 ?? 'Log').'</a>
</div>';
$view .= '<div class="content-block tab-content active">
<div class="form responsive-width-100">
<div class="order-detail">
<h3>'.($rma_return_reason ?? 'Return reason').'</h3>
<p><select id="return_reason" name="header[return_reason]">
<option value="0" '.($rma_header['return_reason']==0?' selected':'').'>'.$status0_text .'</option>
</select>
<p>'.$$rma_status_text.'</p>
</p>
</div>
<div class="order-detail">
@@ -238,13 +240,60 @@ $view .= '<div class="content-block tab-content active">
</div>
</div>';
$view .= '<div class="content-block tab-content">
if($rma_header['servicereport_available'] == 0 ){
$view .= '<div class="content-block tab-content">
<div class="form responsive-width-100">';
foreach($arrayQuestions_rma as $group){
foreach($group['Questions_in_group'] as $question){
switch ($question['Type']) {
case 'dropdown':
$view .= '<label for="" id="'.$question['QuestionID'].'">'.$question['Question'].'</label>';
$view .= '<select id="" name="questions['.$question['QuestionID'].']" required>';
$view .= '<option value=>'.$cartest_allowed_label0.'</option>';
foreach ($question['Response'] as $response){
$view .= '<option value="'.$response['responseID'].'" '.((isset($rma_questions[$question['QuestionID']]) && $rma_questions[$question['QuestionID']] == $response['responseID'])? 'selected':'').'>'.$response['Response'].'</option>';
}
$view .= '</select>';
break;
case 'textarea':
$view .= '<label for="" id="'.$question['QuestionID'].'">'.$question['Question'].'</label>';
$view .= '<textarea id="QuestionID" name="questions['.$question['QuestionID'].']" placeholder="">'.(isset($rma_questions[$question['QuestionID']])?$rma_questions[$question['QuestionID']]:'').'</textarea>';
break;
case 'file';
$view .= '<label for="" id="">'.$question['Question'].'</label>';
if ($question['QuestionID'] !=''){
$view .= '<input type="hidden" name="questions['.$question['QuestionID'].']" value="'.$rma_questions[$question['QuestionID']].'" />
<input type="file" name="fileToUpload['.$question['QuestionID'].']" onchange="preview('.$question['QuestionID'].')" style="width: 30%;padding: 50px 0 0 0;height: 10px;"><img id="'.$question['QuestionID'].'" src="'.$rma_questions[$question['QuestionID']].'" width="150px"/>';
} else {
$view .= '<input type="file" name="fileToUpload['.$question['QuestionID'].']" onchange="preview('.$question['QuestionID'].')" style="width: 30%;padding: 50px 0 0 0;height: 10px;" required><img id="'.$question['QuestionID'].'" src="" width="150px"/>';
}
break;
}
}
}
}
$view .= ' </div>
</div>
</form>';
$view .= '<div class="content-block tab-content active">
<div class="form responsive-width-100">
</div>
</div>';
$view .= '<div class="content-block tab-content active">
<div class="form responsive-width-100">
</div>
</div>';
$view .= '
</div>
</div>