Commit 3c6e6e4a authored by Chanon.u's avatar Chanon.u
Browse files

Fix issue after review with QA

+ HTTPS issue -> certificate expire, hosting QA(port 443)
+ No INBOX folder, but submit response success
+ Rename change password btn to Config password
+ Disable docType field when select message GCL and Short
parent 6f9687de
......@@ -18,6 +18,8 @@ class SpnConfigController extends Controller
curl_setopt($ch, CURLOPT_URL, "$link/spn/login_api.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Disable peer verification
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Disable host verification
// Set the Authorization header for Basic Auth
curl_setopt($ch, CURLOPT_HTTPHEADER, [
......
......@@ -41,6 +41,8 @@ class ManualResponse extends Component
public $disableLockData = true;
public $structureXML;
public $disableDocType = false;
protected $rules = [
'messageId' => 'required|string',
'templateId' => 'required|string'
......@@ -78,9 +80,15 @@ class ManualResponse extends Component
$this->templateId = '';
$this->responseTemplates = [];
$this->docTypes = [];
$this->docType = '';
$this->xmlData = [];
$this->xmlContent = '';
$this->displayCustomizeDiv = false;
if($this->messageId == 3 || $this->messageId == 4){
$this->disableDocType = true;
}else{
$this->disableDocType = false;
}
}
public function updatedXmlTagInputList()
......@@ -196,7 +204,7 @@ class ManualResponse extends Component
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
$result = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
......@@ -212,33 +220,30 @@ class ManualResponse extends Component
if ($error) {
//Cannot send response to SPN
$this->dispatchBrowserEvent('open-modal', [
'name' => 'alert-modal',
'message' => 'Cannot send response to SPN',
'status' => 'failed'
]);
$alertMessage = $error;
$alertStatus = 'failed';
} elseif(!$this->validateAfterSend($result)) {
$alertMessage = 'Unable to upload the file to SPN.<br>Please ensure the INBOX folder is properly set up before retrying.';
$alertStatus = 'failed';
} else {
$this->dispatchBrowserEvent('open-modal', [
'name' => 'alert-modal',
'message' => 'Send response successfully',
'status' => 'success'
]);
Storage::disk('local')->delete($filename);
$alertMessage = 'Send response successfully';
$alertStatus = 'success';
}
Storage::disk('local')->delete($filename);
}else if($spnConfig != null && $spnConfig['success'] == 'false'){
$this->dispatchBrowserEvent('open-modal', [
'name' => 'alert-modal',
'message' => $spnConfig['message'],
'status' => 'failed'
]);
$alertMessage = $spnConfig['message'];
$alertStatus = 'failed';
}else{
//Cannot get UID/UCODE from SPN
$this->dispatchBrowserEvent('open-modal', [
'name' => 'alert-modal',
'message' => 'Cannot connect to SPN',
'status' => 'failed'
]);
$alertMessage = 'Cannot connect to SPN';
$alertStatus = 'failed';
}
$this->dispatchBrowserEvent('open-modal', [
'name' => 'alert-modal',
'message' => $alertMessage,
'status' => $alertStatus
]);
}
private function validateBeforeSend(){
......@@ -249,4 +254,11 @@ class ManualResponse extends Component
}
return true;
}
private function validateAfterSend($result){
if(str_starts_with($result, 'Sorry, there was an error moving the file.')){
return false;
}
return true;
}
}
......@@ -38,7 +38,7 @@
</template>
<div class="mt-4">
<p class="mt-2" x-text="message"></p>
<p class="mt-2" x-html="message"></p>
<button @click="showModal = false"
class="btn mt-6 bg-gray-200 font-medium text-gray-700 hover:bg-gray-200-focus focus:bg-gray-200-focus active:bg-gray-200-focus/90">
Close
......
......@@ -50,7 +50,7 @@
<span class="relative mt-1.5 mb-0.1 flex">
<select
class="form-select h-9 w-full rounded-lg border border-slate-300 bg-white px-3 py-2 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:bg-navy-700 dark:hover:border-navy-400 dark:focus:border-accent"
wire:model.defer="docType">
wire:model.defer="docType" {{ $disableDocType ? 'disabled' : '' }}>
<option value="">Select an option</option>
@foreach ($docTypes as $value => $label)
<option value="{{ $value }}">{{ $label }}</option>
......
......@@ -19,12 +19,6 @@
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
placeholder="Username on SPN" wire:model.defer="usernameSPN" autocomplete="off">
</div>
<div class="mb-2" style="display: none;">
<label for="first_name" class="block text-sm font-medium text-gray-700">Password: SPN</label>
<input type="password" id="passwordSPN"
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
placeholder="Password on SPN" wire:model.defer="passwordSPN" autocomplete="off">
</div>
<div class="mb-2" x-show="showPasswordField" style="display: none;">
<label for="first_name" class="block text-sm font-medium text-gray-700">Password: SPN</label>
<input type="password" id="passwordSPN"
......@@ -35,7 +29,7 @@
<div class="flex w-full mt-5">
<div class="ml-auto flex space-x-2 w-3/4 justify-end">
<button class="w-1/4 py-2 bg-gray-200 text-gray-700 rounded-md shadow-sm hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-400" type="button" wire:click="backToMainList">Back</button>
<button class="w-1/4 py-2 bg-gray-200 text-gray-700 rounded-md shadow-sm hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-400" type="button" @click="showPasswordField = !showPasswordField">Change Password</button>
<button class="w-1/4 py-2 bg-gray-200 text-gray-700 rounded-md shadow-sm hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-400" type="button" @click="showPasswordField = !showPasswordField">Config Password</button>
<button class="w-1/4 py-2 bg-gray-200 text-gray-700 rounded-md shadow-sm hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-400" type="button" wire:click="testConnection">Test Connection</button>
<button class="w-1/4 py-2 bg-primary text-white rounded-md shadow-sm hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary" type="submit">Save</button>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment