From 53d8f7f5467a7376f8750463e0ca324a07279328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CVeLiTi=E2=80=9D?= <“info@veliti.nl”> Date: Wed, 11 Dec 2024 11:06:09 +0100 Subject: [PATCH] CM91 - RMA update --- rma.php | 103 ++++++++++++++++++++++++++++++++++++------------- rma_manage.php | 58 ++++++++++++++++------------ 2 files changed, 109 insertions(+), 52 deletions(-) diff --git a/rma.php b/rma.php index 554fe99..63848b4 100644 --- a/rma.php +++ b/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 = '

'.($rma_h2 ?? 'Return Material Request').' - '.$_GET['rowID'].'

- '.$button_cancel.' + '.$button_cancel.' '; if ($update_allowed === 1){ @@ -141,6 +142,7 @@ if (isset($success_msg)){
'; } + $view .= '
'; $view .= '
@@ -165,25 +167,25 @@ $view .= '

'.$equipment_label10.'

-

+

'.$rma_header['rowID'].'

'.($rma_sw_version_latest ?? 'Latest software version').'

-

-

+

'.(($rma_header['sw_version_latest']==0) ? $general_no: $general_yes).'

'.($rma_servicereport_latest ?? 'Servicereport created last 7days').'

-

-

-
+

'.(($rma_header['servicereport_available']==0) ? $general_no: $general_yes).'

+
'; + + if (isset($rma_questions['equipmentID'])){ + $view .=' +
+

'.$servicereport_details.'

+

'.$general_view.'

+
'; + } $view .='
@@ -195,15 +197,15 @@ $view .='

'.$general_soldto.'

-

+

'.($rma_header['soldto'] ?? '').'

'.$general_shipto.'

-

+

'.($rma_header['shipto'] ?? '').'

'.$general_location.'

-

+

'.($rma_header['location'] ?? '').'

'; @@ -219,15 +221,15 @@ if($rma_header['servicereport_available'] == 0 ){ $view .=''.($rma_return_tab2 ?? 'Questions').''; } -$view .= ''; +$view .= ''.($general_actions ?? 'Actions').' + '.($tab3 ?? 'Log').' + '; $view .= '

'.($rma_return_reason ?? 'Return reason').'

-

+

'.$$rma_status_text.'

@@ -238,13 +240,60 @@ $view .= '
'; -$view .= '
+ if($rma_header['servicereport_available'] == 0 ){ + $view .= '
'; - + + foreach($arrayQuestions_rma as $group){ + foreach($group['Questions_in_group'] as $question){ + + switch ($question['Type']) { + case 'dropdown': + $view .= ''; + $view .= ''; + break; + + case 'textarea': + $view .= ''; + $view .= ''; + break; + + case 'file'; + $view .= ''; + + if ($question['QuestionID'] !=''){ + $view .= ' + '; + } else { + $view .= ''; + } + + break; + } + } + } + } $view .= '
'; +$view .= '
+
+ +
+
'; + +$view .= '
+
+ +
+
'; + $view .= '
diff --git a/rma_manage.php b/rma_manage.php index 8a943e8..f82f143 100644 --- a/rma_manage.php +++ b/rma_manage.php @@ -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 .= '
'.($rma_information ?? 'RMA details').'
+
+

'.$equipment_label2.'

+

'.$serial_input.'

+

'.$equipment_label3.'

-
-

'.$equipment_label2.'

-

'.$serial_input.'

-
-

'.$product_code.'

'.(($view_product == 1)? ''.$rma['header']['productcode'].'':'').'

@@ -342,13 +341,22 @@ $view .= '

- - - - - - + + + + + '; + + if ($rma['header']['servicereport_available']==1){ + $view .=' +
+

'.$service_report_id.'

+

+ +
+ '; + } $view .='
@@ -415,22 +423,22 @@ if($rma['header']['servicereport_available'] == 0 ){ $view .= ''; break; case 'textarea': $view .= ''; - $view .= ''; + $view .= ''; break; case 'file'; $view .= ''; if ($question['QuestionID'] !=''){ - $view .= ' - '; + $view .= ' + '; } else { $view .= ''; } @@ -439,7 +447,7 @@ if($rma['header']['servicereport_available'] == 0 ){ } } } -} +} $view .= '