CM91 - RMA update
This commit is contained in:
103
rma.php
103
rma.php
@@ -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>
|
||||
|
||||
@@ -28,11 +28,11 @@ $rma_status = 'Status';
|
||||
$rma_sw_version_latest = 'Latest software version';
|
||||
$rma_servicereport_latest = 'Servicereport created last 7days';
|
||||
|
||||
$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_information = 'RMA information';
|
||||
$rma_return_reason = 'Return reason';
|
||||
@@ -184,9 +184,9 @@ if (isset($_GET['rowID'])) {
|
||||
|
||||
if (isset($equipment[0]['rowID'])){
|
||||
//CHECK FOR LATEST SERVICEREPORT
|
||||
$servicereport_date = date("Y-m-d", strtotime("-7 days"));
|
||||
$servicereport_date = date("Y-m-d", strtotime("-457 days"));
|
||||
|
||||
$api_url = '/v2/history/equipmentid='.$equipment[0]['rowID'].'&type=servicereport&created='.$servicereport_date.'&totals=';
|
||||
$api_url = '/v2/history/equipmentid='.$equipment[0]['rowID'].'&type=servicereport&created='.$servicereport_date;
|
||||
$servicereport = ioServer($api_url,'');
|
||||
//Decode Payload
|
||||
if (!empty($servicereport)){$servicereport = json_decode( $servicereport,true);}else{$servicereport = null;}
|
||||
@@ -211,7 +211,7 @@ if (isset($_GET['rowID'])) {
|
||||
'warranty_date'=> date('Y-m-d', strtotime($equipment[0]['warranty_date']. ' + 365 days')),
|
||||
'order_ref'=>$equipment[0]['order_ref'],
|
||||
'sw_version_latest'=>$equipment[0]['sw_version_latest'],
|
||||
'servicereport_available' => (($servicereport !=0) ? 1 : 0),
|
||||
'servicereport_available' => ((count($servicereport) !=0) ? 1 : 0),
|
||||
'productrowid'=> $equipment[0]['productrowid'],
|
||||
'productcode'=> $equipment[0]['productcode'],
|
||||
'productname'=> $equipment[0]['productname'],
|
||||
@@ -265,7 +265,7 @@ if (isset($_GET['rowID'])) {
|
||||
|
||||
//GET ALL POST DATA
|
||||
$payload = json_encode($_POST, JSON_UNESCAPED_UNICODE);
|
||||
var_dump($payload);
|
||||
|
||||
//API call
|
||||
$responses = ioServer('/v2/rma', $payload);
|
||||
if ($responses === 'NOK'){
|
||||
@@ -299,6 +299,10 @@ $view .= ' <div class="content-block order-details">
|
||||
<div class="block-header">
|
||||
<i class="fa-solid fa-circle-info"></i></i>'.($rma_information ?? 'RMA details').'
|
||||
</div>
|
||||
<div class="order-detail">
|
||||
<h3>'.$equipment_label2.'</h3>
|
||||
<p>'.$serial_input.'</p>
|
||||
</div>
|
||||
<div class="order-detail">
|
||||
<h3>'.$equipment_label3.'</h3>
|
||||
<p><select id="status" name="status" >
|
||||
@@ -309,11 +313,6 @@ $view .= ' <div class="content-block order-details">
|
||||
<option value="4" '.($rma['status']==4?' selected':'').'>'.$rma_status4_text .'</option>
|
||||
</select></p>
|
||||
</div>
|
||||
<div class="order-detail">
|
||||
<h3>'.$equipment_label2.'</h3>
|
||||
<p>'.$serial_input.'</p>
|
||||
</div>
|
||||
|
||||
<div class="order-detail">
|
||||
<h3>'.$product_code.'</h3>
|
||||
<p>'.(($view_product == 1)? '<a href="index.php?page=product&rowID='.$rma['header']['productrowid'].'" class="btn2">'.$rma['header']['productcode'].'</a>':'<input type="text" name="header[productcode]" value="'.$rma['header']['productcode'].'">').'</p>
|
||||
@@ -342,13 +341,22 @@ $view .= ' <div class="content-block order-details">
|
||||
</select>
|
||||
</p>
|
||||
</div>
|
||||
<input type="hidden" name="header[productrowid]" value="'.$rma['header']['productrowid'].'" readonly>
|
||||
<input type="hidden" name="header[rowID]" value="'.$rma['header']['rowID'].'" readonly>
|
||||
<input type="hidden" name="header[productcode]" value="'.$rma['header']['productcode'].'" readonly>
|
||||
<input type="hidden" name="header[productname]" value="'.$rma['header']['productname'].'" readonly>
|
||||
<input type="hidden" name="rowID" value="'.$rma['rowID'].'" readonly>
|
||||
|
||||
<input type="hidden" name="header[productrowid]" value="'.$rma['header']['productrowid'].'" readonly>
|
||||
<input type="hidden" name="header[rowID]" value="'.$rma['header']['rowID'].'" readonly>
|
||||
<input type="hidden" name="header[productcode]" value="'.$rma['header']['productcode'].'" readonly>
|
||||
<input type="hidden" name="header[productname]" value="'.$rma['header']['productname'].'" readonly>
|
||||
<input type="hidden" name="rowID" value="'.$rma['rowID'].'" readonly>
|
||||
';
|
||||
|
||||
if ($rma['header']['servicereport_available']==1){
|
||||
$view .='
|
||||
<div class="order-detail">
|
||||
<h3>'.$service_report_id.'</h3>
|
||||
<p><input type="text" name="questions[historyID]" value="'.(isset($rma['questions']['historyID'])?$rma['questions']['historyID']:$servicereport[0]['historyID']).'"></p>
|
||||
<input type="hidden" name="questions[equipmentID]" value="'.(isset($rma['questions']['equipmentID'])?$rma['questions']['equipmentID']:$servicereport[0]['equipmentID']).'" readonly>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
|
||||
$view .='
|
||||
</div>
|
||||
@@ -415,22 +423,22 @@ if($rma['header']['servicereport_available'] == 0 ){
|
||||
$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($cartest['questions'][$question['QuestionID']]) && $cartest['questions'][$question['QuestionID']] == $response['responseID'])? 'selected':'').'>'.$response['Response'].'</option>';
|
||||
$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($cartest['questions'][$question['QuestionID']])?$cartest['questions'][$question['QuestionID']]:'').'</textarea>';
|
||||
$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="'.$cartest['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="'.$cartest['questions'][$question['QuestionID']].'" width="150px"/>';
|
||||
$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"/>';
|
||||
}
|
||||
@@ -439,7 +447,7 @@ if($rma['header']['servicereport_available'] == 0 ){
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$view .= ' </div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user