From 0d430ba3952ff42fc04bb90658081d2199f8754f Mon Sep 17 00:00:00 2001
From: "sas.fajri"
Date: Thu, 25 Jun 2026 16:52:45 +0700
Subject: [PATCH] 3Z4LPN - add ais monitoring transaction v4
---
.../Transaction.php | 804 ++++++++++++
.../api/patient.js | 269 ++++
.../api/payment.js | 170 +++
.../ais-monitoring-transaction-v4/api/test.js | 193 +++
.../components/oneFoCashierList.vue | 32 +
.../components/oneFoCashierPayment.vue | 681 +++++++++++
.../components/oneFoCashierPaymentNew.vue | 1081 +++++++++++++++++
.../components/oneFoCashierSearch.vue | 264 ++++
.../components/oneFoCashierTable.vue | 424 +++++++
.../components/oneFoCashierTest.vue | 784 ++++++++++++
.../ais-monitoring-transaction-v4/index.php | 96 ++
.../modules/patient.js | 609 ++++++++++
.../modules/payment.js | 200 +++
.../modules/paymentnew.js | 358 ++++++
.../modules/test.js | 446 +++++++
.../oneFooter.vue | 99 ++
.../oneNavbarComponent.vue | 182 +++
.../ais-monitoring-transaction-v4/patient.js | 467 +++++++
.../ais-monitoring-transaction-v4/store.js | 27 +
19 files changed, 7186 insertions(+)
create mode 100644 test/vuex/ais-monitoring-transaction-v4/Transaction.php
create mode 100644 test/vuex/ais-monitoring-transaction-v4/api/patient.js
create mode 100644 test/vuex/ais-monitoring-transaction-v4/api/payment.js
create mode 100644 test/vuex/ais-monitoring-transaction-v4/api/test.js
create mode 100644 test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierList.vue
create mode 100644 test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierPayment.vue
create mode 100644 test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierPaymentNew.vue
create mode 100644 test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierSearch.vue
create mode 100644 test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierTable.vue
create mode 100644 test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierTest.vue
create mode 100644 test/vuex/ais-monitoring-transaction-v4/index.php
create mode 100644 test/vuex/ais-monitoring-transaction-v4/modules/patient.js
create mode 100644 test/vuex/ais-monitoring-transaction-v4/modules/payment.js
create mode 100644 test/vuex/ais-monitoring-transaction-v4/modules/paymentnew.js
create mode 100644 test/vuex/ais-monitoring-transaction-v4/modules/test.js
create mode 100644 test/vuex/ais-monitoring-transaction-v4/oneFooter.vue
create mode 100644 test/vuex/ais-monitoring-transaction-v4/oneNavbarComponent.vue
create mode 100644 test/vuex/ais-monitoring-transaction-v4/patient.js
create mode 100644 test/vuex/ais-monitoring-transaction-v4/store.js
diff --git a/test/vuex/ais-monitoring-transaction-v4/Transaction.php b/test/vuex/ais-monitoring-transaction-v4/Transaction.php
new file mode 100644
index 0000000..ef56078
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/Transaction.php
@@ -0,0 +1,804 @@
+db_onedev = $this->load->database("onedev", true);
+ $this->db_log = $this->load->database("log", true);
+ $this->load->helper(array('form', 'url'));
+ }
+
+ public function error_log($data,$userid=999)
+ {
+
+ $sql = "INSERT INTO ais_error_log (
+ AisErrorLogFnName,
+ AisErrorLogMessage,
+ AisErrorLogQuery,
+ AisErrorLogJson,
+ AisErrorLogUserID,
+ AisErrorLogCreated
+ )
+ VALUES(
+ ?,
+ ?,
+ ?,
+ ?,
+ ?,
+ NOW()
+ )";
+ $qry = $this->db_log->query($sql, array($data['fn_name'],$data['message'],$data['query'],$data['json'],$userid));
+ //echo $this->db_log->last_query();
+ return true;
+ }
+
+ /**
+ * Generic POST request function
+ * @param string $url API endpoint URL
+ * @param array $data Request payload
+ * @param array $headers Custom headers (optional)
+ * @return array Response from API
+ */
+ public function post_request($url, $data = array(), $headers = array())
+ {
+ // Default headers
+ $default_headers = array(
+ 'Content-Type: application/json'
+ );
+
+ // Merge custom headers with default headers
+ $final_headers = array_merge($default_headers, $headers);
+
+ // Initialize cURL
+ $ch = curl_init();
+
+ // Set cURL options
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_POST, true);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $final_headers);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_TIMEOUT, 30);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+
+ // Execute cURL request
+ $response = curl_exec($ch);
+ $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ $error = curl_error($ch);
+
+ // Close cURL
+ curl_close($ch);
+
+ // Prepare result
+ $result = array(
+ 'success' => false,
+ 'http_code' => $http_code,
+ 'response' => null,
+ 'error' => null
+ );
+
+ if ($error) {
+ $result['error'] = $error;
+ } else {
+ $result = json_decode($response, true);
+ $result['success'] = true;
+ }
+
+ return $result;
+ }
+
+ public function get_request($url, $headers = array())
+ {
+ // Retrieve configuration
+ $config = $this->get_config();
+ $token = $config['AisConfigAuthToken'] ?? 'default-token';
+ $header_token = $config['AisConfigHeaderToken'];
+
+ // Default headers based on the curl command
+ $default_headers = array(
+ 'Header-Token: ' . $header_token,
+ 'Authorization: Bearer ' . $token
+ );
+
+ // Merge custom headers with default headers
+ $final_headers = array_merge($default_headers, $headers);
+
+ // Initialize cURL
+ $ch = curl_init();
+
+ // Set cURL options
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_HTTPGET, true);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $final_headers);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_TIMEOUT, 30);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+
+ // Execute cURL request
+ $response = curl_exec($ch);
+ $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ $error = curl_error($ch);
+
+ // Close cURL
+ curl_close($ch);
+
+ // Prepare result
+ $result = array(
+ 'success' => false,
+ 'http_code' => $http_code,
+ 'response' => null,
+ 'error' => null
+ );
+
+ if ($error) {
+ $result['error'] = $error;
+ } else {
+ $decoded = json_decode($response, true);
+ $result['response'] = $decoded;
+ // Check if response is successful based on http code
+ if ($http_code === 200) {
+ $result['success'] = true;
+ }
+ }
+
+ return $result;
+ }
+
+ function get_config()
+ {
+ $sql = "SELECT * FROM ais_config LIMIT 1";
+ $qry = $this->db_onedev->query($sql);
+ $dt_config = $qry->row_array();
+ return $dt_config;
+ }
+
+ /**
+ * POST request to auth API
+ * @param string $username Username for authentication
+ * @param string $password Password for authentication
+ * @return array Response from API
+ */
+ public function post_auth()
+ {
+ $dt_config = $this->get_config();
+ $baseUrl = $dt_config['AisConfigBaseUrl'];
+ $url = $baseUrl.'/api/auth/auth.php';
+ $headers = array(
+ 'Header-Token: '.$dt_config['AisConfigHeaderToken']
+ );
+
+ $username = $dt_config['AisConfigUsername'];
+ $password = $dt_config['AisConfigPassword'];
+
+ $data = array(
+ 'username' => $username,
+ 'password' => $password
+ );
+
+ $result = $this->post_request($url, $data, $headers);
+ $sql = "INSERT INTO ais_login_log(
+ AisLoginLogUsername,
+ AisLoginLogPassword,
+ AisLoginLogHeaderToken,
+ AisLoginLogResult,
+ AisLoginLogCreated
+ )
+ VALUES(
+ ?,
+ ?,
+ ?,
+ ?,
+ NOW()
+ )";
+ $qry = $this->db_log->query($sql, array($username,$password,$dt_config['AisConfigHeaderToken'],json_encode($result)));
+
+
+ if(!$qry){
+ $this->error_log(array('fn_name'=>'post_auth','message'=>'ais_login_log insert','query'=>$sql,'json'=>json_encode($result)),999);
+ exit;
+ }
+ //print_r($result);
+ //exit;
+ // Check if success
+ if(!$result['success']){
+ $this->error_log(array('fn_name'=>'post_auth','message'=>'failed auth','query'=>'','json'=>json_encode($result)),999);
+ $errors = array('status' => 'error','message' => 'Gagal Login');
+ return $errors;
+
+ }else{
+ // Update token
+ $token = $result['data']['token'];;
+ $sql = "UPDATE ais_config SET AisConfigAuthToken = ? WHERE AisConfigID = 1";
+ $qry = $this->db_onedev->query($sql, array($token));
+ //echo $this->db_onedev->last_query();
+ //exit;
+ if(!$qry){
+ $this->error_log(array('fn_name'=>'post_auth','message'=>'ais_config update','query'=>$sql,'json'=>''),999);
+ $errors = array('status' => 'error','message' => 'Gagal Update Token');
+ return $errors;
+
+ }
+
+ return $result;
+ }
+ }
+
+ function post_transaction($labnum='',$xdate=null)
+ {
+ // Auth Login
+ $login = $this->post_auth();
+ if (!$login['success']) {
+ $this->error_log(array('fn_name' => 'post_transaction', 'message' => 'failed auth', 'query' => '', 'json' => json_encode($login)), 555);
+ $errors = array('status' => 'error', 'message' => 'Gagal Login');
+ echo json_encode($errors);
+ exit;
+ }
+ // Get config
+ $dt_config = $this->get_config();
+ $baseUrl = $dt_config['AisConfigBaseUrl'];
+ $url = $baseUrl . '/api/transaction_full/transaksi.php';
+
+ $headers = array(
+ 'Header-Token: ' . $dt_config['AisConfigHeaderToken'],
+ 'Authorization: Bearer ' . $dt_config['AisConfigAuthToken']
+ );
+
+
+
+ if($labnum == ''){
+ $xdate = $xdate == null ? date('Y-m-d') : $xdate;
+ }
+ // Get data
+ $sql = "SELECT T_OrderHeaderID,
+ T_OrderHeaderTotal as Total,
+ T_OrderHeaderLabNumber as RegID,
+ Mgm_McuM_BranchID as mgm_mcu_m_branch_id,
+ M_PatientNoReg as MEDRECID,
+ T_OrderHeaderDate as Tanggal,
+ T_OrderHeaderDate as PulangTanggal,
+ IF(Mgm_McuM_BranchID = 100,'',CorporateCode) as PerusahaanID,
+ IF(Mgm_McuM_BranchID = 100,'',CorporateCode) as AsuransiID,
+ T_PriceHeaderCode as GroupTarifID,
+ M_PatientName as Nama,
+ M_PatientIdentifierValue as NIK,
+ DATE_FORMAT(M_PatientDOB, '%Y-%m-%d %H:%i:%s') as TglLahir,
+ IF(M_PatientGender = 'male','L','P') as JnsKelamin,
+ '' as NomorPolis,
+ '' as NomerJaminan,
+ '2' as JenisRegID,
+ IF(Mgm_McuM_BranchID = 100,0,1) as JenisPasienID,
+ 'LAB-WESTERINDO-01' as DepartemenID,
+ 'Y' as Pulang,
+ 'Y' as BolehPulang,
+ '' as Catatan,
+ 'Y' as Verified,
+ 'LABKLINIK' as KelasID,
+ M_UserEmail as LoginBuat,
+ T_OrderHeaderCreated as TanggalBuat,
+ branch_order.M_BranchAis_branch_code as BranchCode,
+ CorporateTypeais_pillar_code as PillarCode,
+ '4569' as SiteCenterCode,
+ M_UserEmail as VerifiedBy,
+ T_OrderHeaderCreated as VerifiedDate,
+ '' as TrxLayanan,
+ '' as TrxItem,
+ '' as TrxItemReturn,
+ '' as RegpasNominal,
+ '' as Trxtt,
+ '' as TrxBayar,
+ '' as TrxLain,
+ '' as PaketDispenser
+ FROM t_orderheader
+ JOIN m_branch branch_order ON branch_order.M_BranchID = T_OrderHeaderM_BranchID
+ JOIN m_patient ON M_PatientID = T_OrderHeaderM_PatientID
+ JOIN corporate ON CorporateID = T_OrderHeaderCorporateID
+ JOIN corporate_type ON CorporateTypeID = CorporateTypeID
+ JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID -- AND Mgm_McuID = 1566
+ JOIN t_priceheader ON Mgm_McuT_PriceHeaderID = T_PriceHeaderID
+ JOIN m_user ON T_OrderHeaderCreatedUserID = M_UserID
+ LEFT JOIN cpone_log.ais_transaction ON Ais_TransactionOrderHeaderLabNumber = T_OrderHeaderLabNumber AND
+ Ais_TransactionStatus = 'success'
+ WHERE T_OrderHeaderIsActive = 'Y' AND
+ T_OrderHeaderLabNumber = ? AND
+ Ais_TransactionID IS NULL
+ GROUP BY T_OrderHeaderID
+ LIMIT 100";
+ $qry = $this->db_onedev->query($sql, array($labnum));
+ //echo $this->db_onedev->last_query();
+ //exit;
+ if (!$qry) {
+ $this->error_log(array('fn_name' => 'post_transaction', 'message' => 't_orderheader select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
+ exit;
+ }
+ $raw_data = $qry->result_array();
+
+ $data = array();
+ foreach ($raw_data as $key => $row) {
+
+ $row['TrxLayanan'] = [];
+ $row['TrxItem'] = [];
+ $row['TrxItemReturn'] = [];
+ $row['RegpasNominal'] = [];
+ $row['Trxtt'] = null;
+ $row['TrxBayar'] = [];
+ $row['TrxLain'] = null;
+ $row['PaketDispenser'] = null;
+
+ $layanan = [];
+ $sql = "SELECT * FROM (
+ SELECT T_OrderDetailID as TrxLayananID,
+ case
+ when Nat_GroupID = 1 then '1100'
+ when Nat_GroupID = 2 then '1200'
+ when Nat_GroupID = 3 then '1200'
+ when Nat_GroupID = 4 then '1303'
+ end as ProfitCostCenterCode,
+ '' as TrxDepartemenID,
+ T_OrderDetailCreated as TanggalBuat,
+ T_OrderDetailT_TestSasCode as LayananID,
+ T_OrderDetailT_TestName as LayananName,
+ doctorlab.M_DoctorCode as DokterID,
+ 0 as ShareRS,
+ 0 as ShareDokter,
+ 0 as ShareExternal,
+ 0 as ShareLain2,
+ '' as PihakExternal,
+ '' as PihakLain2,
+ 'Percentage' as ShareTipe,
+ T_OrderDetailPrice as Harga,
+ 1 as Jumlah,
+ 1 as Rate,
+ 'N' as FOC,
+ T_OrderDetailDiscTotal as Diskon,
+ 'Absolute' as TipeDiskon,
+ '' as DepartemenID,
+ IF(Mgm_McuM_BranchID = 100,T_OrderDetailTotal,0) as DitanggungPasien,
+ IF(Mgm_McuM_BranchID = 100,0,T_OrderDetailTotal) as DitanggungPenjamin,
+ 0 as MarkUpCito,
+ 'N' as Cito,
+ T_PacketSasCode as PaketID,
+ 'LABKLINIK' as KelasID,
+ '' as TrxLayananDetail,
+ 'Y' as Tagihkan
+ FROM t_orderdetail
+ JOIN t_test ON T_TestID = T_OrderDetailT_TestID AND T_TestIsActive = 'Y'
+ JOIN nat_test ON T_TestNat_TestID = Nat_TestID AND Nat_TestIsActive = 'Y'
+ JOIN nat_group ON Nat_GroupID = Nat_TestNat_GroupID AND Nat_GroupIsActive = 'Y'
+ JOIN t_orderdetailorder ON T_OrderDetailT_OrderDetailOrderID = T_OrderDetailOrderID AND
+ T_OrderDetailOrderIsPacket = 'Y' AND T_OrderDetailOrderIsActive = 'Y'
+ JOIN t_packet ON T_OrderDetailOrderT_PacketID = T_PacketID
+ JOIN t_packetdetail ON T_PacketDetailT_PacketID = T_PacketID AND T_PacketDetailT_TestID = T_OrderDetailT_TestID AND
+ T_PacketDetailIsActive = 'Y'
+ JOIN t_orderheader ON T_OrderHeaderID = T_OrderDetailOrderT_OrderHeaderID
+ JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID
+ JOIN m_doctor doctorlab ON T_OrderHeaderPjM_DoctorID = M_DoctorID
+ LEFT JOIN f_payment ON T_OrderHeaderID = F_PaymentT_OrderHeaderID AND F_PaymentIsActive = 'Y'
+ WHERE
+ T_OrderDetailT_OrderHeaderID = ? AND
+ T_OrderDetailIsActive = 'Y'
+ UNION
+ SELECT T_OrderDetailID as TrxLayananID,
+ Nat_GroupID as ProfitCostCenterCode,
+ '' as TrxDepartemenID,
+ T_OrderDetailCreated as TanggalBuat,
+ T_OrderDetailT_TestSasCode as LayananID,
+ T_OrderDetailT_TestName as LayananName,
+ doctorlab.M_DoctorCode as DokterID,
+ 0 as ShareRS,
+ 0 as ShareDokter,
+ 0 as ShareExternal,
+ 0 as ShareLain2,
+ '' as PihakExternal,
+ '' as PihakLain2,
+ 'Percentage' as ShareTipe,
+ T_OrderDetailPrice as Harga,
+ 1 as Jumlah,
+ 1 as Rate,
+ 'N' as FOC,
+ T_OrderDetailDiscTotal as Diskon,
+ 'Absolute' as TipeDiskon,
+ '' as DepartemenID,
+ IF(Mgm_McuM_BranchID = 100,T_OrderDetailTotal,0) as DitanggungPasien,
+ IF(Mgm_McuM_BranchID = 100,0,T_OrderDetailTotal) as DitanggungPenjamin,
+ 0 as MarkUpCito,
+ 'N' as Cito,
+ '' as PaketID,
+ 'LABKLINIK' as KelasID,
+ NULL as TrxLayananDetail,
+ 'Y' as Tagihkan
+ FROM `t_orderdetailorder`
+ JOIN t_orderdetail ON T_OrderdetailT_OrderHeaderID = T_OrderDetailOrderT_OrderHeaderID AND
+ T_OrderDetailIsActive = 'Y' AND T_OrderDetailT_OrderDetailOrderID = T_OrderDetailOrderID
+ JOIN t_test ON T_TestID = T_OrderDetailT_TestID AND T_TestIsActive = 'Y'
+ JOIN nat_test ON T_TestNat_TestID = Nat_TestID AND Nat_TestIsActive = 'Y'
+ JOIN nat_group ON Nat_GroupID = Nat_TestNat_GroupID AND Nat_GroupIsActive = 'Y'
+ JOIN t_orderheader ON T_OrderHeaderID = T_OrderDetailOrderT_OrderHeaderID
+ JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID
+ JOIN m_doctor doctorlab ON T_OrderHeaderPjM_DoctorID = M_DoctorID
+ LEFT JOIN f_payment ON T_OrderHeaderID = F_PaymentT_OrderHeaderID AND F_PaymentIsActive = 'Y'
+ WHERE `T_OrderDetailOrderT_OrderHeaderID` = ? AND `T_OrderDetailOrderIsPacket` = 'N' AND
+ T_OrderDetailOrderIsActive = 'Y'
+ ) AS t_orderdetailorder";
+ $qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID'],$row['T_OrderHeaderID']));
+
+ if (!$qry) {
+ $this->error_log(array('fn_name' => 'post_transaction', 'message' => 't_orderdetail select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
+ exit;
+ }
+ $total_layanan_debug = 0;
+ $layanan = $qry->result_array();
+ $raw_data[$key]['TrxLayanan'] = [];
+ if(count($layanan) > 0){
+ foreach($layanan as $key_layanan => $row_layanan){
+ $total_layanan_debug += $row_layanan['Harga'];
+ $layanan[$key_layanan]['TrxLayananDetail'] = [];
+ $sql = "SELECT M_DoctorCode, M_DoctorID
+ FROM `so_resultentry`
+ JOIN t_orderdetail ON ? = So_ResultEntryT_OrderDetailID AND T_OrderDetailIsActive = 'Y'
+ JOIN m_doctor ON M_DoctorID = So_ResultEntryM_DoctorID AND M_DoctorIsActive = 'Y'
+ WHERE `So_ResultEntryT_OrderHeaderID` = ? AND
+ `So_ResultEntryIsActive` = 'Y' AND `So_ResultEntryM_DoctorID` > '0'
+ LIMIT 1
+ ";
+ $qry = $this->db_onedev->query($sql, array($row_layanan['TrxLayananID'],$row['T_OrderHeaderID']));
+ if (!$qry) {
+ $this->error_log(array('fn_name' => 'post_transaction', 'message' => 'so_resultentry select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
+ exit;
+ }
+ $get_resultentry = $qry->result_array();
+ if (count($get_resultentry) > 0) {
+ $row_layanan['DokterID'] = $get_resultentry[0]['M_DoctorCode'];
+ }
+ $raw_data[$key]['TrxLayanan'][] = $row_layanan;
+ }
+ }
+
+ $regpasnominal = [];
+ $jumlah_layanan_lab = 0;
+ $sql = "SELECT IFNULL(SUM(T_OrderDetailTotal),0) as total_layanan_lab
+ FROM t_orderdetail
+ JOIN t_test ON T_OrderDetailT_TestID = T_TestID AND T_TestIsActive = 'Y'
+ JOIN nat_test ON T_TestNat_TestID = Nat_TestID AND Nat_TestIsActive = 'Y'
+ JOIN nat_group ON Nat_GroupID = Nat_TestNat_GroupID AND Nat_GroupIsActive = 'Y' AND
+ Nat_GroupID = 1
+ WHERE T_OrderDetailT_OrderHeaderID = ? AND T_OrderDetailIsActive = 'Y'
+ ";
+ $qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID']));
+ //echo $this->db_onedev->last_query();
+ //exit;
+ if (!$qry) {
+ $this->error_log(array('fn_name' => 'post_transaction', 'message' => 't_orderdetail lab select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
+ exit;
+ }
+
+ $get_layanan_lab = $qry->row_array();
+ $jumlah_layanan_lab = $get_layanan_lab['total_layanan_lab'];
+
+ $jumlah_layanan_radiologi = 0;
+ $sql = "SELECT IFNULL(SUM(T_OrderDetailTotal),0) as total_layanan_radiologi
+ FROM t_orderdetail
+ JOIN t_test ON T_OrderDetailT_TestID = T_TestID AND T_TestIsActive = 'Y'
+ JOIN nat_test ON T_TestNat_TestID = Nat_TestID AND Nat_TestIsActive = 'Y'
+ JOIN nat_group ON Nat_GroupID = Nat_TestNat_GroupID AND Nat_GroupIsActive = 'Y' AND
+ Nat_GroupID = 3
+ WHERE T_OrderDetailT_OrderHeaderID = ? AND T_OrderDetailIsActive = 'Y'
+ ";
+ $qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID']));
+ if (!$qry) {
+ $this->error_log(array('fn_name' => 'post_transaction', 'message' => 't_orderdetail radiologi select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
+ exit;
+ }
+ $get_layanan_radiologi = $qry->row_array();
+ $jumlah_layanan_radiologi = $get_layanan_radiologi['total_layanan_radiologi'];
+
+ $jumlah_layanan_lain = 0;
+ $sql = "SELECT IFNULL(SUM(T_OrderDetailTotal),0) as total_layanan_lain
+ FROM t_orderdetail
+ JOIN t_test ON T_OrderDetailT_TestID = T_TestID AND T_TestIsActive = 'Y'
+ JOIN nat_test ON T_TestNat_TestID = Nat_TestID AND Nat_TestIsActive = 'Y'
+ JOIN nat_group ON Nat_GroupID = Nat_TestNat_GroupID AND Nat_GroupIsActive = 'Y' AND
+ Nat_GroupID IN (2,4)
+ WHERE T_OrderDetailT_OrderHeaderID = ? AND T_OrderDetailIsActive = 'Y'
+ ";
+ $qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID']));
+ if (!$qry) {
+ $this->error_log(array('fn_name' => 'post_transaction', 'message' => 't_orderdetail lain select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
+ exit;
+ }
+
+
+ $get_layanan_lain = $qry->row_array();
+ $jumlah_layanan_lain = $get_layanan_lain['total_layanan_lain'];
+
+ $total_layanan = 0;
+ $sql = "SELECT SUM(T_OrderDetailTotal) as total_layanan, Mgm_McuM_BranchID as BranchID
+ FROM t_orderdetail
+ JOIN t_orderheader ON T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
+ JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID
+ WHERE T_OrderDetailT_OrderHeaderID = ? AND T_OrderDetailIsActive = 'Y'
+ ";
+ $qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID']));
+ if (!$qry) {
+ $this->error_log(array('fn_name' => 'post_transaction', 'message' => 't_orderdetail total layanan select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
+ exit;
+ }
+ $total_layanan = $qry->row_array();
+ $total_layanan = $total_layanan['total_layanan'];
+
+
+ $total_bayar = 0;
+ $sql = "SELECT F_PaymentTotal as total
+ FROM f_payment
+ WHERE F_PaymentT_OrderHeaderID = ? AND F_PaymentIsActive = 'Y'
+ ";
+ $qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID']));
+ if (!$qry) {
+ $this->error_log(array('fn_name' => 'post_transaction', 'message' => 'f_payment select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
+ exit;
+ }
+
+ $get_total_bayar = $qry->result_array();
+ if (count($get_total_bayar) > 0) {
+ foreach($get_total_bayar as $key_total_bayar => $row_total_bayar){
+ $total_bayar += $row_total_bayar['total'];
+ }
+ }
+
+
+
+ $mgm_mcu_m_branch_id = $row['mgm_mcu_m_branch_id'];
+
+ $total_ditanggung_pasien = $mgm_mcu_m_branch_id == 100 ? $total_layanan : 0;
+ $total_ditanggung_penjamin = $mgm_mcu_m_branch_id == 100 ? 0 : $total_layanan;
+
+ $regpasnominal = array(
+ "BiayaParamedik" => "0.00",
+ "ParamedikDitanggungPasien" => "0.00",
+ "ParamedikDitanggungPenjamin" => "0.00",
+ "BiayaAdministrasi" => "0",
+ "AdmDitanggungPasien" => "0.00",
+ "AdmDitanggungPenjamin" => "0.00",
+ "BiayaMaterai" => "0.00",
+ "BiayaMateraiDitanggungPasien" => "0.00",
+ "BiayaMateraiDitanggungPenjamin" => "0.00",
+ "JumlahLayanan" => $jumlah_layanan_lain,
+ "JumlahLayananRadiologi" => $jumlah_layanan_radiologi,
+ "JumlahLayananLaboratorium" => $jumlah_layanan_lab,
+ "JumlahItem" => 0,
+ "JumlahItemRetur" => 0,
+ "JumlahTT" => "0.00",
+ "JumlahBiayaLain" => "0.00",
+ "JumlahBayar" => $total_bayar,
+ "TipeDiskonGlobal" => "Absolute",
+ "DiskonGlobal" => "0.00",
+ "TotalDitanggungPasien" => $total_ditanggung_pasien,
+ "TotalDitanggungPenjamin" => $total_ditanggung_penjamin
+ );
+
+ $raw_data[$key]['RegpasNominal'] = array(
+ $regpasnominal
+ );
+
+ //echo $total_bayar;
+ $raw_data[$key]['TrxBayar'] = null;
+ if($total_bayar > 0){
+ $sql = "SELECT M_PatientNoReg as MEDRECID,
+ F_PaymentDetailID as BayarID,
+ IFNULL(F_PaymentDetailAmount,0) as Jumlah,
+ F_PaymentDetailCreated as Tanggal,
+ 'Pelunasan' as JenisBayarID,
+ CONCAT(F_PaymentNumber,'.',F_PaymentDetailID) as KwitansiID,
+ CONCAT(F_PaymentDetailM_PaymentTypeID,F_PaymentDetailM_BankAccountID) as TipeBayarID,
+ 'N' as Dibatalkan
+ FROM f_paymentdetail
+ JOIN f_payment ON F_PaymentDetailF_PaymentID = F_PaymentID AND F_PaymentIsActive = 'Y'
+ JOIN t_orderheader ON F_PaymentT_OrderHeaderID = T_OrderHeaderID
+ JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID AND M_PatientIsActive = 'Y'
+ WHERE
+ F_PaymentT_OrderHeaderID = ? AND F_PaymentDetailIsActive = 'Y'
+ GROUP BY F_PaymentDetailID";
+ $qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID']));
+ if (!$qry) {
+ $this->error_log(array('fn_name' => 'post_transaction', 'message' => 'f_payment select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
+ exit;
+ }
+ //echo $this->db_onedev->last_query();
+ //exit;
+ $bayar = $qry->result_array();
+
+ $raw_data[$key]['TrxBayar'] = $bayar;
+ }
+
+ $raw_data[$key]['Trxtt'] = null;
+ $raw_data[$key]['TrxLain'] = null;
+ $raw_data[$key]['PaketDispenser'] = null;
+ $errors = [];
+
+ //echo json_encode($raw_data[$key]);
+ //exit;
+ $result = $this->post_request($url, $raw_data[$key], $headers);
+
+
+ if ($result['status'] == '400') {
+ $sql = "INSERT INTO ais_transaction(
+ Ais_TransactionOrderHeaderLabNumber,
+ Ais_TransactionJson,
+ Ais_TransactionStatus,
+ Ais_TransactionResponse,
+ Ais_TransactionUrl,
+ Ais_TransactionUserID,
+ Ais_TransactionCreated
+ )
+ VALUES(
+ ?,
+ ?,
+ ?,
+ ?,
+ ?,
+ ?,
+ NOW()
+ )";
+ $qry = $this->db_log->query($sql, array(
+ $row['RegID'],
+ json_encode($raw_data[$key]),
+ 'error',
+ json_encode($result),
+ $url,
+ 555
+ ));
+ if (!$qry) {
+ $this->error_log(array('fn_name' => 'post_transaction', 'message' => 'ais_transaction insert', 'query' => $this->db_log->last_query(), 'json' => json_encode($result)), 999);
+ exit;
+ }
+ $this->error_log(array('fn_name' => 'post_transaction', 'message' => 'transaction insert', 'query' => $this->db_onedev->last_query(), 'json' => json_encode($result)), 999);
+
+ $errors[] = array('RegID' => $row['RegID'], 'error' => $result['message']);
+
+
+ }else{
+ //echo 'insert ais_transaction';
+ $sql = "INSERT INTO ais_transaction(
+ Ais_TransactionOrderHeaderLabNumber,
+ Ais_TransactionJson,
+ Ais_TransactionStatus,
+ Ais_TransactionResponse,
+ Ais_TransactionUrl,
+ Ais_TransactionUserID,
+ Ais_TransactionCreated
+ )
+ VALUES(
+ ?,
+ ?,
+ ?,
+ ?,
+ ?,
+ ?,
+ NOW()
+ )";
+ $qry = $this->db_log->query($sql, array(
+ $row['RegID'],
+ json_encode($raw_data[$key]),
+ 'success',
+ json_encode($result),
+ $url,
+ 555
+ ));
+
+ if (!$qry) {
+ $this->error_log(array('fn_name' => 'post_transaction', 'message' => 'ais_transaction insert', 'query' => $this->db_log->last_query(), 'json' => json_encode($result)), 999);
+ exit;
+ }
+ }
+
+
+
+ }
+
+ if(count($errors) > 0){
+ $success = array('status' => 'error', 'message' => 'Gagal Post Transaction', 'errors' => $errors);
+ echo json_encode($success);
+ exit;
+ }else{
+ $success = array('status' => 'success', 'message' => 'Berhasil Post Transaction');
+ echo json_encode($success);
+ exit;
+ }
+
+ }
+
+ function get_transaction()
+ {
+ // Get id from query parameter
+ $id = $this->input->get('id');
+
+ if (empty($id)) {
+ $errors = array('status' => 'error', 'message' => 'ID parameter is required');
+ echo json_encode($errors);
+ exit;
+ }
+
+ $login = $this->post_auth();
+ if (!$login['success']) {
+ $this->error_log(array('fn_name' => 'get_transaction_auth', 'message' => 'failed auth', 'query' => '', 'json' => json_encode($login)), 999);
+ $errors = array('status' => 'error', 'message' => 'Gagal Login');
+ echo json_encode($errors);
+ exit;
+ }
+
+ $dt_config = $this->get_config();
+ $baseUrl = $dt_config['AisConfigBaseUrl'];
+ $url = $baseUrl . '/api/transaksi?id=' . $id;
+
+
+ $result = $this->get_request($url);
+ if (!$result['success']) {
+ $this->error_log(array('fn_name' => 'get_transaction', 'message' => 'failed get transaction', 'query' => '', 'json' => json_encode($result)), 999);
+ $errors = array('status' => 'error', 'message' => 'Gagal Get Transaction');
+ echo json_encode($errors);
+ exit;
+ }
+
+ $data = $result['response']['data'] ?? null;
+ // $data = json_encode($data);
+ $success = array('status' => 'success', 'message' => 'Berhasil Get Transaction', 'data' => $data);
+ echo json_encode($success);
+ exit;
+
+ }
+
+
+ function monitoring_transaction()
+ {
+
+ $sql = "SELECT
+ oh.T_OrderHeaderM_PatientID AS patient_id,
+ p.M_PatientName AS patient_name,
+ oh.T_OrderHeaderLabNumber AS lab_number,
+ b.M_BranchCode AS branch_code,
+ oh.T_OrderHeaderTotal AS total,
+ at.Ais_TransactionStatus,
+ IF(at.Ais_TransactionID IS NULL, 'N', 'Y') AS ais_status
+ FROM t_orderheader oh
+ JOIN m_patient p ON p.M_PatientID = oh.T_OrderHeaderM_PatientID
+ JOIN m_branch b ON b.M_BranchID = oh.T_OrderHeaderM_BranchID
+ LEFT JOIN " . $this->db_log->database . ".ais_transaction at ON at.Ais_TransactionOrderHeaderLabNumber = oh.T_OrderHeaderLabNumber
+ ";
+
+ // Ambil start_date dan end_date dari query parameter
+ $start_date = $this->input->get('start_date');
+ $end_date = $this->input->get('end_date');
+ $params = [];
+
+ if ($start_date && $end_date) {
+ $sql .= " WHERE DATE(oh.T_OrderHeaderDate) BETWEEN ? AND ?";
+ $params = [$start_date, $end_date];
+ } else {
+ // Gunakan default jika tidak ada input tanggal
+ $sql .= " WHERE date(oh.T_OrderHeaderDate) BETWEEN '2024-08-01' AND '2024-08-03'";
+ }
+
+ $qry = $this->db_onedev->query($sql, $params);
+ if (!$qry) {
+ $this->error_log(array('fn_name' => 'monitoring_transaction', 'message' => 'select monitoring data failed', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
+ echo json_encode(array('status' => 'error', 'message' => 'Gagal mengambil data monitoring.'));
+ exit;
+ }
+
+ $data = $qry->result_array();
+ echo json_encode(array('status' => 'success', 'message' => 'Berhasil mengambil data monitoring.', 'data' => $data));
+ exit;
+ }
+
+
+}
diff --git a/test/vuex/ais-monitoring-transaction-v4/api/patient.js b/test/vuex/ais-monitoring-transaction-v4/api/patient.js
new file mode 100644
index 0000000..bca7293
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/api/patient.js
@@ -0,0 +1,269 @@
+const URL = "/one-api/ais/transactionv4/";
+const URL_MASTERDATA = "/one-api/ais/masterdata/";
+
+function getTransactionBaseUrl(isStemcell) {
+ return isStemcell === 'Y'
+ ? "/one-api/ais/transactionv5/"
+ : "/one-api/ais/transactionv4/";
+}
+
+export async function search(prm) {
+ try {
+ var resp = await axios.post(URL + 'patient/search', prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+
+export async function download_data(token,prm) {
+ try {
+ var resp = await axios.post(URL_YANKES + 'trx_order/get_order',{});
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch(e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+ }
+
+ export async function sendresult(prm) {
+ try {
+ var resp = await axios.post(URL_YANKES + 'trx_order/sendresultorder',prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch(e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+ }
+
+
+ export async function getlogs(prm) {
+ try {
+ var resp = await axios.post(URL_YANKES + 'trx_order/getlogs',prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch(e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+ }
+
+ export async function monitoring_transaction(prm) {
+ try {
+ prm.token = one_token()
+ var resp = await axios.get(URL+'monitoring_transaction', { params: prm});
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ return resp.data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+ }
+
+export async function get_corporate() {
+ try {
+ var resp = await axios.get(URL+'get_corporate');
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ return resp.data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function get_json_response(prm) {
+ try {
+ var resp = await axios.get(URL+'get_json_response', { params: prm });
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ return resp.data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function post_transaction_by_labnumber(prm) {
+ try {
+ console.log('in post_transaction_by_labnumber');
+ var resp = await axios.post(getTransactionBaseUrl(prm.is_stemcell) + 'post_transaction_by_labnumber', prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ return resp.data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function re_post_transaction_by_labnumber(prm) {
+ try {
+ var resp = await axios.post(getTransactionBaseUrl(prm.is_stemcell) + 're_post_transaction_by_labnumber', prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ return resp.data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function delete_transaction_by_labnumber(prm) {
+ try {
+ prm.token = one_token()
+ var resp = await axios.post(getTransactionBaseUrl(prm.is_stemcell) + 'delete_transaction_by_labnumber', prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ return resp.data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function get_medrec_by_noreg(prm) {
+ try {
+ var resp = await axios.post(URL_MASTERDATA+'get_medrec_by_noreg', prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ return resp.data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function post_medrec_by_noreg(prm) {
+ try {
+ var resp = await axios.post(URL_MASTERDATA+'post_medrec_by_noreg', prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ return resp.data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function re_post_medrec_by_noreg(prm) {
+ try {
+ var resp = await axios.post(URL_MASTERDATA+'re_post_medrec_by_noreg', prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ return resp.data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function check_exist_transaction(prm) {
+ try {
+ var resp = await axios.post(URL+'check_exist_transaction', prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ return resp.data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
diff --git a/test/vuex/ais-monitoring-transaction-v4/api/payment.js b/test/vuex/ais-monitoring-transaction-v4/api/payment.js
new file mode 100644
index 0000000..1a942b6
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/api/payment.js
@@ -0,0 +1,170 @@
+const URL = "/one-api/mockup/fo/cashiernewpayment-v22/";
+var token = one_token()
+
+export async function getlanguages(token) {
+ try {
+ var resp = await axios.post(URL + 'payment/getlanguages',{token:token});
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function lookup_type(token) {
+ try {
+ var resp = await axios.post(URL + 'payment/lookup_type',{token:token});
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+
+export async function lookup_banks(token) {
+ try {
+ var resp = await axios.post(URL + 'payment/lookup_banks',{token:token});
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+
+export async function lookup_accounts(token) {
+ try {
+ var resp = await axios.post(URL + 'payment/lookup_accounts',{token:token});
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+
+export async function searchcard(token,prm) {
+ try {
+ var resp = await axios.post(URL + 'payment/searchcard',{token:token,search:prm});
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch(e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+ }
+
+export async function pay(prm) {
+ try {
+ var resp = await axios.post(URL + 'payment/pay',prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function delete_note(prm) {
+ try {
+ var resp = await axios.post(URL + 'payment/delete_note',prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+
+export async function getLocations(prm) {
+ try {
+ prm.token = token
+ var resp = await axios.post(URL + 'payment/getLocations', prm);
+
+ return resp.data
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ }
+ }
+ }
+
+
+ export async function save_control(prm) {
+ try {
+ var resp = await axios.post(URL + 'payment/save_control', prm);
+
+ return resp.data
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ }
+ }
+}
+
+
+
diff --git a/test/vuex/ais-monitoring-transaction-v4/api/test.js b/test/vuex/ais-monitoring-transaction-v4/api/test.js
new file mode 100644
index 0000000..3af3f70
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/api/test.js
@@ -0,0 +1,193 @@
+const URL = "/one-api/mockup/fo/supervisor_v8/";
+
+
+export async function lookup(prm) {
+ try {
+ var resp = await axios.post(URL + 'supervisor/lookup_test',prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function checkstatus(prm) {
+ try {
+ var resp = await axios.post(URL + 'supervisor/checkstatus',prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function getcitos(prm){
+ try {
+ var resp = await axios.post(URL +'supervisor/getcitos',prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function getnewprice(prm) {
+ try {
+ var resp = await axios.post(URL + 'supervisor/getnewprice',prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function lookup_promises(prm) {
+ try {
+ var resp = await axios.post(URL + 'supervisor/lookup_promises',prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+
+export async function savetestadditionalverification(prm) {
+ try {
+ var resp = await axios.post(URL + 'supervisor/save_test_additional_verification',prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+}
+
+export async function searchtest(prm) {
+ try {
+ var resp = await axios.post(URL + 'supervisor/search_test',prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch(e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+ }
+
+ export async function savetestadditional(prm) {
+ try {
+ var resp = await axios.post(URL + 'supervisor/save_test_additional',prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch(e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+ }
+
+ export async function checkpromisetests(prm) {
+ try {
+ var resp = await axios.post(URL + 'supervisor/checkpromisetests',prm);
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+ }
+
+ export async function getchildrenprofil(prm) {
+ try {
+ var resp = await axios.post(URL + 'supervisor/getchildrenprofil',{token:prm.token,data:prm.new});
+ if (resp.status != 200) {
+ return {
+ status: "ERR",
+ message: resp.statusText
+ };
+ }
+ let data = resp.data;
+ return data;
+ } catch (e) {
+ return {
+ status: "ERR",
+ message: e.message
+ };
+ }
+ }
\ No newline at end of file
diff --git a/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierList.vue b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierList.vue
new file mode 100644
index 0000000..25fe208
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierList.vue
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
diff --git a/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierPayment.vue b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierPayment.vue
new file mode 100644
index 0000000..e46a961
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierPayment.vue
@@ -0,0 +1,681 @@
+
+
+
+
+
+
+ | NOTA |
+ TIPE PEMBAYARAN |
+ JUMLAH |
+ USER |
+ AKSI |
+
+
+ | {{note.note_number}} |
+ {{note.paymenttypes_name}} |
+ {{convertMoney(note.note_amount)}} |
+ {{note.note_user}} |
+
+
+
+
+ |
+
+
+ |
+ Tidak ada data
+ |
+
+
+
+
+
+
+ Invoice
+
+
+ Kwitansi
+
+
+
+
+
+
+
+
+ Total Tagihan
+
+
+
+
+ Minimun DP ({{xmindp_percent}}%)
+
+
+ {{convertMoney(xmindp_amount)}}
+
+
+
+
+ {{convertMoney(restbill)}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bayar XXX
+
+
+
+
+ {{convertMoney(totpay)}}
+
+
+
+
+
+
+
+
+
+
+ Pembayaran Berhasil
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Print
+
+
+ Tutup
+
+
+
+
+
+
+
+
+
+
+
+
+ Peringatan !
+ Berhasil !
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Yakin dong !
+
+
+
+ Tutup
+
+
+ Tutup
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierPaymentNew.vue b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierPaymentNew.vue
new file mode 100644
index 0000000..a8411aa
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierPaymentNew.vue
@@ -0,0 +1,1081 @@
+
+
+
+
+
+
+ Logs
+
+
+ Send Results
+
+
+
+ Belum ada pengiriman hasil
+
+
+
+ sent : {{item.SendResultsCreated}}
+
+ {{item.SendResultsJsonBefore}}
+
+
+ {{item.SendResultsJsonAfter}}
+
+
+
+
+
+
+
+
+
+
+
+
+ Kwitansi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Print
+
+
+ Tutup
+
+
+
+
+
+
+
+
+
+
+ Unduh Berhasil
+
+
+
+
+
+
+
+
+ {{unduhan}}
+
+
+
+
+
+
+
+
+
+
+
+ Tutup
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Pilih
+
+
+
+
+
+
+
+
+
+
+
+ Peringatan !
+ Berhasil !
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Yakin dong !
+
+
+
+ Tutup
+
+
+ Tutup
+
+
+
+
+
+
+
+
+
+
+ Kartu Kontrol
+
+
+
+
+ SAMPLE STATION
+
+
+ LOKASI
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tutup
+
+
+ Print
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierSearch.vue b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierSearch.vue
new file mode 100644
index 0000000..9d63d1b
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierSearch.vue
@@ -0,0 +1,264 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ cloud_upload
+
+
+
+
+
+
+
+
+ Sedang mengupload data, harap tunggu...
+
+
+
+
+
+
+
+
diff --git a/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierTable.vue b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierTable.vue
new file mode 100644
index 0000000..9f8ce2a
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierTable.vue
@@ -0,0 +1,424 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ props.item.patient_name }}
+ {{ props.item.lab_number }}
+ |
+
+
+ {{ props.item.corporate_name }}
+ {{ props.item.mgm_mcu_name }}
+ Pillar : {{ props.item.ais_pillar_name }}
+ Pillar belum disetting
+ |
+
+
+ {{ props.item.branch_name }} ({{ props.item.branch_code_lab }})
+ |
+
+ {{ formatNumber(props.item.total_amount) }}
+ |
+
+ {{ props.item.ais_status === 'Y' ? 'check' : 'close' }}
+ |
+
+
+ cloud_upload
+
+
+ cloud_upload
+
+
+ delete
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Logs
+
+
+
+
+
+
+ Pilih transaksi untuk melihat log
+
+
+
+
+
+
+
+
+ Dikirim ke AIS pada : {{log.transaction_created}}
+
+
+
+ Lihat Log
+ Tutup Log
+
+
+
+
+ Request
+
+ {{ JSON.stringify(log.transaction_json, null, 2) }}
+
+
+
+ Response
+
+ {{ JSON.stringify(log.transaction_response, null, 2) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierTest.vue b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierTest.vue
new file mode 100644
index 0000000..1a04d50
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierTest.vue
@@ -0,0 +1,784 @@
+
+
+
+
+
+ Konfirmasi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tutup
+
+
+ Lanjutkan
+
+
+
+
+
+
+
+ Pemeriksaan
+
+
+
+
+
+
+
+
+ Tambah Pemeriksaan
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ add
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+ |
+
+
+ |
+
+ {{ props.item.pxname }}
+
+ |
+ {{ convertMoney(props.item.bruto) }} |
+ {{ convertMoney(props.item.discount) }} |
+
+ {{ convertMoney(props.item.total) }}
+ {{ convertMoney(props.item.total) }}
+ {{totalRetur(props.item)}}
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tutup
+
+ Simpan
+
+
+
+
+
+
+
+
+
diff --git a/test/vuex/ais-monitoring-transaction-v4/index.php b/test/vuex/ais-monitoring-transaction-v4/index.php
new file mode 100644
index 0000000..3027fd4
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/index.php
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+ One
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/vuex/ais-monitoring-transaction-v4/modules/patient.js b/test/vuex/ais-monitoring-transaction-v4/modules/patient.js
new file mode 100644
index 0000000..ad8e81f
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/modules/patient.js
@@ -0,0 +1,609 @@
+// 1 => LOADING
+// 2 => DONE
+// 3 => ERROR
+import * as api from "../api/patient.js"
+
+export default {
+ namespaced: true,
+ state: {
+ search_patient: 0,
+ search_error_message: '',
+ start_date:moment(new Date()).format('YYYY-MM-DD'),
+ last_search_val: '',
+ last_search_type: '',
+ end_date:moment(new Date()).format('YYYY-MM-DD'),
+ search:'',
+ patients: [],
+ total_patient: 0,
+ selected_patient: {},
+ save_error_message: '',
+ statuses:[{name:'Semua',value:'A'},{name:'Sudah Terkirim',value:'Y'},{name:'Belum Terkirim',value:'N'}],
+ selected_status:{name:'Semua',value:'A'},
+ open_alert_no_pay: false,
+ msg_alert_no_pay: "Loh ... Gak jadi bayar dong ?",
+ current_page:1,
+ total_page:0,
+ pay_disabled:'Y',
+ autocomplete_status:0,
+ companies:[{id:0,name:'Semua'}],
+ selected_company:{id:0,name:'Semua'},
+ logs:[],
+ unduhan:[],
+ loading_download:false,
+ loading_send:false,
+ monitoring_data: [],
+ monitoring_status: 0,
+ monitoring_error_message: '',
+ corporates: [],
+ selected_corporate: { CorporateID: '0', CorporateName: 'Semua', CorporateCode: '' },
+ transaction_log: null,
+ dialog_info: false,
+ dialog_info_message: ''
+ },
+ mutations: {
+ set_last_search(state, { val, type }) {
+ state.last_search_val = val;
+ state.last_search_type = type;
+ },
+
+ update_loading_send(state,val){
+ state.loading_send = val
+ },
+ update_loading_download(state,val){
+ state.loading_download = val
+ },
+ update_unduhan(state,val){
+ state.unduhan = val
+ },
+ update_logs(state,val){
+ state.logs = val
+ },
+ update_autocomplete_status(state,val){
+ state.autocomplete_status = val
+ },
+ update_companies(state, val) {
+ state.companies = val
+ },
+ update_selected_company(state, val) {
+ state.selected_company = val
+ },
+ update_pay_disabled(state, val) {
+ state.pay_disabled = val
+ },
+ update_total_page(state, val) {
+ state.total_page = val
+ },
+ update_current_page(state, val) {
+ state.current_page = val
+ },
+ update_search_error_message(state, patient) {
+ state.search_error_message = patient
+ },
+ update_search_patient(state, patient) {
+ state.search_patient = patient
+ },
+ update_patients(state, data) {
+ state.patients = data.records
+ state.total_patient = data.total
+ state.total_page = data.total
+ },
+ update_selected_patient(state, val) {
+ state.selected_patient = val
+ },
+ update_start_date(state, val) {
+ state.start_date = val
+ },
+ update_end_date(state, val) {
+ state.end_date = val
+ },
+ update_search(state, val) {
+ state.search = val
+ },
+ update_selected_status(state, val) {
+ state.selected_status = val
+ },
+ update_open_alert_no_pay(state, val) {
+ state.open_alert_no_pay = val
+ },
+ update_msg_alert_no_pay(state, val) {
+ state.msg_alert_no_pay = val
+ },
+ set_monitoring_data(state, data) {
+ state.monitoring_data = data;
+ },
+ set_monitoring_status(state, status) {
+ state.monitoring_status = status;
+ },
+ set_monitoring_error_message(state, message) {
+ state.monitoring_error_message = message;
+ },
+ update_corporates(state, data) {
+ state.corporates = data;
+ },
+ update_selected_corporate(state, data) {
+ state.selected_corporate = data;
+ },
+ set_transaction_log(state, payload) {
+ state.transaction_log = payload;
+ },
+ set_dialog_info(state, status) {
+ state.dialog_info = status;
+ },
+ set_dialog_info_message(state, message) {
+ state.dialog_info_message = message;
+ }
+
+ },
+ actions: {
+ async search(context, prm) {
+ context.commit("update_search_patient", 1)
+ try {
+ prm.token = one_token()
+ prm.company = context.state.selected_company.id
+ let resp = await api.search(prm)
+ if (resp.status != "OK") {
+ context.commit("update_search_patient", 3)
+ context.commit("update_search_error_message", resp.message)
+ } else {
+ context.commit("update_search_patient", 2)
+ context.commit("update_search_error_message", "")
+ let data = {
+ records: resp.data.records,
+ total: resp.data.total
+ }
+ context.commit("update_patients", data)
+ context.commit("update_selected_patient", [])
+ context.commit("update_total_page", data.total)
+ /*if(prm.lastidx === 0){
+ context.commit("update_selected_patient", data.records[0])
+ if(!_.isEmpty(data.records[0]))
+ context.commit("paymentnew/update_notes",data.records[0].notes,{root:true})
+ else
+ context.commit("paymentnew/update_notes",[],{root:true})
+ }
+ else{
+ context.commit("update_selected_patient", data.records[prm.lastidx])
+ context.commit("paymentnew/update_notes",data.records[prm.lastidx].notes,{root:true})
+ }*/
+
+ }
+ } catch (e) {
+ context.commit("update_search_patient", 3)
+ context.commit("update_search_error_message", e.message)
+ console.log(e)
+ }
+ },
+ async searchcompany(context,prm) {
+ context.commit("update_autocomplete_status",1)
+ try {
+ let resp= await api.searchcompany(one_token(),prm)
+ if (resp.status != "OK") {
+ context.commit("update_autocomplete_status",3)
+ } else {
+ context.commit("update_autocomplete_status",2)
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ context.commit("update_companies",resp.data.records)
+ }
+ } catch(e) {
+ context.commit("update_autocomplete_status",3)
+ }
+ },
+ async download_data(context,prm) {
+ context.commit("update_loading_download",true)
+ try {
+ let resp= await api.download_data(one_token(),prm)
+ if (resp.status != "OK") {
+ context.commit("update_loading_download",false)
+ } else {
+ context.commit("update_loading_download",false)
+ context.commit("update_unduhan",resp.data.records)
+ context.commit("paymentnew/update_dialog_pay_success",true,{root:true})
+ context.commit("update_autocomplete_status",2)
+ context.dispatch("search",{
+ startdate:context.state.start_date,
+ enddate:context.state.start_date,
+ search: context.state.search,
+ status: context.state.selected_status.value,
+ current_page:1,
+ lastidx:0
+ })
+ }
+ } catch(e) {
+ context.commit("update_loading_download",false)
+ }
+ },
+ async sendresult(context,prm) {
+ context.commit("update_loading_send",true)
+ try {
+ prm.token = one_token()
+ let resp= await api.sendresult(prm)
+ if (resp.status != "OK") {
+ context.commit("update_loading_send",false)
+ } else {
+
+ context.dispatch("getlogs",{})
+ //alert("Proses unduh selesai")
+ context.commit("update_loading_send",false)
+
+ }
+ } catch(e) {
+ context.commit("update_loading_send",false)
+ }
+ },
+ async getlogs(context,prm) {
+ context.commit("update_autocomplete_status",1)
+ try {
+ prm = context.state.selected_patient
+ prm.token = one_token()
+ let resp= await api.getlogs(prm)
+ if (resp.status != "OK") {
+ context.commit("update_autocomplete_status",3)
+ } else {
+
+ context.commit("update_logs",resp.data.records)
+
+ }
+ } catch(e) {
+ context.commit("update_autocomplete_status",3)
+ }
+ },
+ // async monitoring_transaction(context, prm) {
+ // context.commit("set_monitoring_status", 1);
+ // try {
+ // if (prm.lab_number) {
+ // context.commit('set_last_search', { val: prm.lab_number, type: 'lab_number' });
+ // } else if (prm.patient_name) {
+ // context.commit('set_last_search', { val: prm.patient_name, type: 'patient_name' });
+ // } else {
+ // context.commit('set_last_search', { val: '', type: '' });
+ // }
+
+ // let resp = await api.monitoring_transaction(prm);
+ // if (resp.status !== "success") {
+ // context.commit("set_monitoring_status", 3);
+ // context.commit("set_monitoring_error_message", resp.message);
+ // } else {
+ // context.commit("set_monitoring_status", 2);
+ // context.commit("set_monitoring_status", 2);
+ // context.commit("set_monitoring_data", resp.data);
+ // context.commit("set_monitoring_error_message", "");
+ // const total_page = Math.ceil(resp.total / resp.limit);
+ // context.commit("update_total_page", total_page);
+ // context.commit("update_current_page", resp.page);
+
+ // }
+ // } catch (e) {
+ // context.commit("set_monitoring_status", 3);
+ // context.commit("set_monitoring_error_message", e.message);
+ // console.error(e);
+ // }
+ // },
+
+ // Di bagian actions -> monitoring_transaction, ubah commit ini:
+ async monitoring_transaction(context, prm) {
+ context.commit("set_monitoring_status", 1); // 1: LOADING
+ try {
+ // Simpan parameter pencarian terakhir untuk paginasi
+ if (prm.lab_number) {
+ context.commit('set_last_search', { val: prm.lab_number, type: 'lab_number' });
+ } else if (prm.patient_name) {
+ context.commit('set_last_search', { val: prm.patient_name, type: 'patient_name' });
+ } else {
+ context.commit('set_last_search', { val: '', type: '' });
+ }
+
+ let resp = await api.monitoring_transaction(prm);
+ if (resp.status !== "success") {
+ context.commit("set_monitoring_status", 3); // 3: ERROR
+ context.commit("set_monitoring_error_message", resp.message);
+ } else {
+ context.commit("set_monitoring_status", 2); // 2: SUCCESS
+
+ // FIX: Wrap response data dengan struktur yang sesuai
+ const wrappedData = {
+ data: resp.data, // Array dari API
+ total: resp.total,
+ page: resp.page,
+ limit: resp.limit
+ };
+
+ context.commit("set_monitoring_data", wrappedData);
+ context.commit("set_monitoring_error_message", "");
+
+ const total_page = Math.ceil(resp.total / resp.limit);
+ context.commit("update_total_page", total_page);
+ context.commit("update_current_page", resp.page);
+ }
+ } catch (e) {
+ context.commit("set_monitoring_status", 3);
+ context.commit("set_monitoring_error_message", e.message);
+ console.error(e);
+ }
+ },
+
+ async check_exist_transaction(context, prm) {
+ context.commit("set_monitoring_status", 1); // 1: LOADING
+ try {
+ // Simpan parameter pencarian terakhir untuk paginasi
+
+ let resp = await api.check_exist_transaction(prm);
+ if (resp.status !== "success") {
+ context.commit("set_monitoring_status", 3); // 3: ERROR
+ context.commit("set_monitoring_error_message", resp.message);
+ if(resp.status === 'error' && resp.message === 'Transaksi tidak ditemukan'){
+ context.state.selected_patient.ais_status = 'N';
+ }
+ } else {
+ context.commit("set_monitoring_status", 2); // 2: SUCCESS
+ if(resp.status === 'success'){
+ if(resp.data && resp.data.length > 0){
+ context.state.selected_patient.ais_status = 'Y';
+ } else {
+ context.state.selected_patient.ais_status = 'N';
+ }
+ }
+
+ }
+ } catch (e) {
+ context.commit("set_monitoring_status", 3);
+ context.commit("set_monitoring_error_message", e.message);
+ console.error(e);
+ }
+ },
+
+ // Atau alternatif: ubah computed property di component
+ // Di file Vue component, ganti computed patients menjadi:
+ // Di computed patients
+ patients() {
+ console.log('monitoring_data:', this.$store.state.patient.monitoring_data);
+ const monitoringData = this.$store.state.patient.monitoring_data || {};
+ const result = Array.isArray(monitoringData.data) ? monitoringData.data : [];
+ console.log('patients result:', result);
+ return result;
+ },
+
+ async get_corporates(context) {
+ let resp = await api.get_corporate();
+ if (resp.status === 'success') {
+ let corporates = resp.data;
+ corporates.unshift({ CorporateID: '0', CorporateName: 'Semua', CorporateCode: '' });
+ context.commit('update_corporates', corporates);
+ }
+ },
+
+ async get_json_response({ commit, state }) {
+ commit('set_transaction_log', null); // Reset log saat memulai
+ commit('set_monitoring_status', 1); // Set status loading
+ if (!state.selected_patient || !state.selected_patient.lab_number) {
+ commit('set_monitoring_status', 2); // Selesai loading
+ return;
+ }
+
+ const params = {
+ lab_number: state.selected_patient.lab_number
+ };
+
+ const response = await api.get_json_response(params);
+
+ if (response.status === 'success' && response.data) {
+ commit('set_transaction_log', response.data);
+ } else {
+ commit('set_transaction_log', null);
+ console.error("Failed to get JSON response:", response.message);
+ }
+ commit('set_monitoring_status', 2); // Selesai loading
+ },
+
+ async post_transaction_by_labnumber(context, prm) {
+ context.commit("set_monitoring_status", 1);
+ try {
+ const response = await api.post_transaction_by_labnumber(prm);
+
+ if (response.status === 'success') {
+
+ const searchVal = context.state.search;
+ let searchParams = {};
+
+ if (/[a-zA-Z]/.test(searchVal) && /\d/.test(searchVal)) {
+ searchParams.lab_number = searchVal;
+ } else {
+ searchParams.patient_name = searchVal;
+ }
+
+ await context.dispatch("monitoring_transaction", {
+ start_date: context.state.start_date,
+ end_date: context.state.end_date,
+ ...searchParams,
+ corporate_id: context.state.selected_corporate.CorporateID,
+ ais_status: context.state.selected_status.value,
+ page: context.state.current_page
+ });
+
+ const updatedItem = context.state.monitoring_data.data.find(item => item.lab_number === prm.labnumber);
+ if (updatedItem) {
+ context.commit("update_selected_patient", updatedItem);
+ await context.dispatch("get_json_response");
+ }
+
+ let selpat = context.state.selected_patient;
+ console.log('selpat:', selpat);
+ //alert(selpat.noreg);
+
+ await context.dispatch("get_medrec_by_noreg", {
+ noreg: selpat.noreg
+ });
+
+ context.commit("set_dialog_info_message", "Transaksi berhasil dikirim.");
+
+ } else {
+ const errorMessage = response.message || "Gagal mengirim transaksi.";
+ context.commit("set_dialog_info_message", errorMessage);
+ }
+
+ context.commit("set_dialog_info", true);
+ } catch (e) {
+ context.commit("set_dialog_info_message", "Terjadi kesalahan: " + e.message);
+ context.commit("set_dialog_info", true);
+ } finally {
+ context.commit("set_monitoring_status", 2);
+ }
+ },
+
+ async re_post_transaction_by_labnumber(context, prm) {
+ context.commit("set_monitoring_status", 1);
+ try {
+ const response = await api.re_post_transaction_by_labnumber(prm);
+
+ if (response.status === 'success') {
+
+ const searchVal = context.state.search;
+ let searchParams = {};
+
+ if (/[a-zA-Z]/.test(searchVal) && /\d/.test(searchVal)) {
+ searchParams.lab_number = searchVal;
+ } else {
+ searchParams.patient_name = searchVal;
+ }
+
+ await context.dispatch("monitoring_transaction", {
+ start_date: context.state.start_date,
+ end_date: context.state.end_date,
+ ...searchParams,
+ corporate_id: context.state.selected_corporate.CorporateID,
+ ais_status: context.state.selected_status.value,
+ page: context.state.current_page
+ });
+
+ const updatedItem = context.state.monitoring_data.data.find(item => item.lab_number === prm.labnumber);
+ if (updatedItem) {
+ context.commit("update_selected_patient", updatedItem);
+ await context.dispatch("get_json_response");
+ }
+
+ let selpat = context.state.selected_patient;
+ await context.dispatch("get_medrec_by_noreg", {
+ noreg: selpat.noreg
+ });
+
+ context.commit("set_dialog_info_message", "Transaksi berhasil dikirim ulang.");
+
+ } else {
+ const errorMessage = response.message || "Gagal mengirim ulang transaksi.";
+ context.commit("set_dialog_info_message", errorMessage);
+ }
+
+ context.commit("set_dialog_info", true);
+
+ } catch (e) {
+ context.commit("set_dialog_info_message", "Terjadi kesalahan: " + e.message);
+ context.commit("set_dialog_info", true);
+ } finally {
+ context.commit("set_monitoring_status", 2);
+ }
+ },
+ async get_medrec_by_noreg(context, prm) {
+ context.commit("set_monitoring_status", 1);
+ try {
+ const response = await api.get_medrec_by_noreg(prm);
+
+ if (response.status === 'success') {
+
+ let patient = response.data;
+ let selpat = context.state.selected_patient;
+ if(patient && patient.length > 0) {
+ console.log('patient:', patient);
+ await context.dispatch("re_post_medrec_by_noreg", {
+ noreg: selpat.noreg
+ });
+ } else {
+ console.log('patient not found');
+ await context.dispatch("post_medrec_by_noreg", {
+ noreg: selpat.noreg
+ });
+ }
+
+ } else {
+ const errorMessage = response.message || "Gagal mengirim ulang transaksi.";
+ context.commit("set_dialog_info_message", errorMessage);
+ context.commit("set_dialog_info", true);
+ }
+
+
+ } catch (e) {
+ context.commit("set_dialog_info_message", "Terjadi kesalahan: " + e.message);
+ context.commit("set_dialog_info", true);
+ } finally {
+ context.commit("set_monitoring_status", 2);
+ }
+ },
+
+ async post_medrec_by_noreg(context, prm) {
+ context.commit("set_monitoring_status", 1);
+ try {
+ const response = await api.post_medrec_by_noreg(prm);
+
+ if (response.status === 'success') {
+ return response.data;
+ } else {
+ return null;
+ }
+ } catch (e) {
+ return null;
+ } finally {
+ context.commit("set_monitoring_status", 2);
+ }
+ },
+ async re_post_medrec_by_noreg(context, prm) {
+ context.commit("set_monitoring_status", 1);
+ try {
+ const response = await api.re_post_medrec_by_noreg(prm);
+
+ if (response.status === 'success') {
+ return response.data;
+ } else {
+ return null;
+ }
+ } catch (e) {
+ return null;
+ } finally {
+ context.commit("set_monitoring_status", 2);
+ }
+ },
+ async delete_transaction_by_labnumber(context, prm) {
+ context.commit("set_monitoring_status", 1);
+ try {
+ const response = await api.delete_transaction_by_labnumber(prm);
+
+ if(response.status !== 'OK'){
+ context.commit("set_dialog_info_message", response.message.message?response.message.message:"Gagal menghapus transaksi.");
+ context.commit("set_dialog_info", true);
+ return;
+ }
+ if(response.data.status === 'success'){
+ context.commit("set_dialog_info_message", "Transaksi berhasil dihapus.");
+ context.commit("set_dialog_info", true);
+ await context.dispatch("monitoring_transaction", {
+ start_date: context.state.start_date,
+ end_date: context.state.end_date,
+ lab_number: prm.labnumber,
+ corporate_id: context.state.selected_corporate.CorporateID,
+ ais_status: context.state.selected_status.value,
+ page: 1
+ });
+ } else {
+ context.commit("set_dialog_info_message", response.data.message?response.data.message:"Gagal menghapus transaksi.");
+ context.commit("set_dialog_info", true);
+ }
+ } catch (e) {
+ return null;
+ } finally {
+ context.commit("set_monitoring_status", 2);
+ }
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/test/vuex/ais-monitoring-transaction-v4/modules/payment.js b/test/vuex/ais-monitoring-transaction-v4/modules/payment.js
new file mode 100644
index 0000000..2fb364c
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/modules/payment.js
@@ -0,0 +1,200 @@
+// 1 => LOADING
+// 2 => DONE
+// 3 => ERROR
+import * as api from "../api/payment.js"
+
+export default {
+ namespaced: true,
+ state: {
+ lookup_status:0,
+ lookup_error_message:'',
+ types: [],
+ total_payment:0,
+ reload_after_save: false,
+ dialog_pay_success:false,
+ paynumber :'',
+ notes :[],
+ dialog_delete:false,
+ msg_delete:'',
+ note_delete:'',
+ nota_delete:{},
+ open_print_note:false,
+ idx:0,
+ last_payments:{},
+ payment_total: 0,
+ banks:[],
+ disable_btn_pay:'Y',
+ fajri_hide_btn_pay:'Y'
+ },
+ mutations: {
+ update_disable_btn_pay(state,val) {
+ console.log('module')
+ console.log(val)
+ state.disable_btn_pay = val
+ },
+ update_banks(state,val) {
+ state.banks = val
+ },
+ update_lookup_error_message(state,val) {
+ state.lookup_error_message = val
+ },
+ update_lookup_status(state,status) {
+ state.lookup_status = status
+ },
+ update_types(state,data) {
+ state.types = data.records
+ state.total_type = data.total
+ },
+ update_selected_status(state,val) {
+ state.selected_status=val
+ },
+ update_total_payment(state,val) {
+ state.total_payment=val
+ },
+ update_reload_after_save(state,val) {
+ state.reload_after_save=val
+ },
+ update_dialog_pay_success(state,val) {
+ state.dialog_pay_success=val
+ },
+ update_paynumber(state,val) {
+ state.paynumber=val
+ },
+ update_notes(state,val) {
+ state.notes=val
+ },
+ update_dialog_delete(state,val) {
+ state.dialog_delete=val
+ },
+ update_note_delete(state,val) {
+ state.note_delete=val
+ },
+ update_msg_delete(state,val) {
+ state.msg_delete=val
+ },
+ update_nota_delete(state,val) {
+ state.nota_delete=val
+ },
+ update_open_print_note(state,val) {
+ state.open_print_note=val
+ },
+ update_idx(state,val) {
+ state.idx=val
+ },
+ update_last_payments(state,val) {
+ state.last_payments=val
+ }
+ },
+ actions: {
+ async lookup_type(context) {
+ context.commit("update_lookup_status",1)
+ try {
+ let resp= await api.lookup_type(one_token())
+ if (resp.status != "OK") {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",resp.message)
+ } else {
+ context.commit("update_lookup_status",2)
+ context.commit("update_lookup_error_message","")
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ context.commit("update_types",data)
+ }
+ } catch(e) {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",e.message )
+ }
+ },
+ async lookup_banks(context) {
+ context.commit("update_lookup_status",1)
+ try {
+ let resp= await api.lookup_banks(one_token())
+ if (resp.status != "OK") {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",resp.message)
+ } else {
+ context.commit("update_lookup_status",2)
+ context.commit("update_lookup_error_message","")
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ context.commit("update_banks",data.records)
+ }
+ } catch(e) {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",e.message )
+ }
+ },
+ async searchcard(context,prm) {
+ context.commit("update_lookup_status",1)
+ try {
+ let resp= await api.searchcard(one_token(),prm)
+ if (resp.status != "OK") {
+ context.commit("update_lookup_status",3)
+ } else {
+ context.commit("update_lookup_status",2)
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ context.commit("update_cards",resp.data.records)
+ }
+ } catch(e) {
+ context.commit("update_lookup_status",3)
+ }
+ },
+ async pay(context,prm) {
+ context.commit("update_lookup_status",1)
+ try {
+ prm.token = one_token()
+ let resp= await api.pay(prm)
+ if (resp.status != "OK") {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",resp.message)
+ } else {
+ context.commit("update_lookup_status",2)
+ context.commit("update_lookup_error_message","")
+ let data = {
+ records : resp.data.records.types,
+ total: resp.data.total
+ }
+ let xnumber = resp.data.records.data.numberx
+ let id = resp.data.records.data.idx
+ context.commit("update_types",data)
+ context.commit("update_last_payments",prm.payments)
+ context.commit("update_idx",id)
+ context.commit("update_total_payment",0)
+ context.commit("update_paynumber","Pembayaran nomor "+xnumber+" telah berhasil")
+ context.commit("update_dialog_pay_success",true)
+ }
+ } catch(e) {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",e.message )
+ }
+ },
+ async delete_note(context,prm) {
+ context.commit("update_lookup_status",1)
+ try {
+ prm.token = one_token()
+ let resp= await api.delete_note(prm)
+ if (resp.status != "OK") {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",resp.message)
+ } else {
+ context.commit("update_lookup_status",2)
+ context.commit("update_lookup_error_message","")
+ let xmsg = "Nota nomor "+prm.nota.note_number+" telah dihapus"
+ context.commit("update_msg_delete",xmsg)
+ context.commit("update_note_delete",'')
+ context.commit("update_nota_delete",{})
+ }
+ } catch(e) {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",e.message )
+ }
+ }
+ }
+}
diff --git a/test/vuex/ais-monitoring-transaction-v4/modules/paymentnew.js b/test/vuex/ais-monitoring-transaction-v4/modules/paymentnew.js
new file mode 100644
index 0000000..e537924
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/modules/paymentnew.js
@@ -0,0 +1,358 @@
+import * as api from "../api/payment.js"
+
+export default {
+ namespaced: true,
+ state: {
+ lookup_status:0,
+ lookup_error_message:'',
+ types: [],
+ total_payment:0,
+ total_last_payment:0,
+ reload_after_save: false,
+ dialog_pay_success:false,
+ paynumber :'',
+ notes :[],
+ dialog_delete:false,
+ msg_delete:'',
+ note_delete:'',
+ nota_delete:{},
+ open_print_note:false,
+ idx:0,
+ last_payments:[],
+ payment_total: 0,
+ banks:[],
+ disable_btn_pay:'Y',
+ accounts:[],
+ save_process:false,
+ open_dialog_info:false,
+ msg_info:'',
+ languages:[],
+ selected_language:{},
+ data_station_location:[],
+ setting_controll:false,
+ urlprintnote:false
+ },
+ mutations: {
+ update_urlprintnote (state, value) {
+ state.urlprintnote = value
+ },
+ update_setting_controll (state, value) {
+ state.setting_controll = value
+ },
+ update_data_station_location (state, value) {
+ state.data_station_location = value
+ },
+ update_languages(state,val){
+ state.languages = val
+ },
+ update_selected_language(state,val){
+ state.selected_language = val
+ },
+ update_open_dialog_info(state,val){
+ state.open_dialog_info = val
+ },
+ update_msg_info(state,val){
+ state.msg_info = val
+ },
+ update_save_process(state,val){
+ state.save_process = val
+ },
+ update_total_last_payment(state,val){
+ state.total_last_payment
+ },
+ update_accounts(state,val) {
+ state.accounts = val
+ },
+ update_disable_btn_pay(state,val) {
+ state.disable_btn_pay = val
+ },
+ update_banks(state,val) {
+ state.banks = val
+ },
+ update_lookup_error_message(state,val) {
+ state.lookup_error_message = val
+ },
+ update_lookup_status(state,status) {
+ state.lookup_status = status
+ },
+ update_types(state,data) {
+ state.types = data.records
+ state.total_type = data.total
+ },
+ update_selected_status(state,val) {
+ state.selected_status=val
+ },
+ update_total_payment(state,val) {
+ state.total_payment=val
+ },
+ update_reload_after_save(state,val) {
+ state.reload_after_save=val
+ },
+ update_dialog_pay_success(state,val) {
+ state.dialog_pay_success=val
+ },
+ update_paynumber(state,val) {
+ state.paynumber=val
+ },
+ update_notes(state,val) {
+ state.notes=val
+ },
+ update_dialog_delete(state,val) {
+ state.dialog_delete=val
+ },
+ update_note_delete(state,val) {
+ state.note_delete=val
+ },
+ update_msg_delete(state,val) {
+ state.msg_delete=val
+ },
+ update_nota_delete(state,val) {
+ state.nota_delete=val
+ },
+ update_open_print_note(state,val) {
+ state.open_print_note=val
+ },
+ update_idx(state,val) {
+ state.idx=val
+ },
+ update_last_payments(state,val) {
+ state.last_payments=val
+ }
+ },
+ actions: {
+ async save_control(context,prm) {
+ // context.commit("update_search_status",1)
+ try {
+
+ prm.token = one_token()
+ let resp= await api.save_control(prm)
+ console.log(resp)
+ if (resp.status != "OK") {
+ // context.commit("update_search_status",3)
+ // context.commit("update_search_error_message",resp.message)
+ alert(resp.message)
+ } else {
+ // context.commit("update_search_status",2)
+ // context.commit("update_search_error_message","")
+ context.commit("update_setting_controll",false)
+ //context.dispatch('print_control', {order_id:context.rootState.patient.selected_patient.T_OrderHeaderID,time_start:context.rootState.order.show_time})
+
+ let idx = context.rootState.patient.selected_patient.T_OrderHeaderID
+ let user = one_user()
+ var tmx = Number(new Date());
+ let urlprintnote = "/birt/run?__report=report/one/lab/rpt_fo_001.rptdesign&__format=pdf&username="+user.M_StaffName+"&PID="+idx+"?t="+tmx
+ context.commit("update_urlprintnote",urlprintnote)
+ context.commit("update_open_print_note",true)
+
+ }
+ } catch(e) {
+ // context.commit("update_search_status",3)
+ console.log('gagal')
+ alert(e.message)
+ }
+ },
+ async getLocations(context) {
+ // context.commit("update_search_status",1)
+ try {
+ var prm = {}
+ prm.order_id = context.rootState.patient.selected_patient.T_OrderHeaderID
+ prm.token = one_token()
+ let resp= await api.getLocations(prm)
+ console.log(resp)
+ if (resp.status != "OK") {
+ // context.commit("update_search_status",3)
+ // context.commit("update_search_error_message",resp.message)
+ alert(resp.message)
+ } else {
+ // context.commit("update_search_status",2)
+ // context.commit("update_search_error_message","")
+
+ let sl = resp.data.datas
+ context.commit("update_data_station_location", sl)
+ context.commit("update_setting_controll",true)
+
+
+ }
+ } catch(e) {
+ // context.commit("update_search_status",3)
+ console.log('gagal')
+ alert(e.message)
+ }
+ },
+ async getlanguages(context) {
+ context.commit("update_lookup_status",1)
+ try {
+ let resp= await api.getlanguages(one_token())
+ if (resp.status != "OK") {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",resp.message)
+ } else {
+ context.commit("update_lookup_status",2)
+ context.commit("update_lookup_error_message","")
+ /*let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }*/
+ context.commit("update_languages",resp.data)
+ context.commit("update_selected_language",{})
+
+ }
+ } catch(e) {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",e.message )
+ }
+ },
+ async lookup_type(context,prm) {
+ context.commit("update_lookup_status",1)
+ try {
+ let resp= await api.lookup_type(one_token())
+ if (resp.status != "OK") {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",resp.message)
+ } else {
+ context.commit("update_lookup_status",2)
+ context.commit("update_lookup_error_message","")
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ context.commit("update_types",data)
+
+ }
+ } catch(e) {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",e.message )
+ }
+ },
+ async lookup_banks(context) {
+ context.commit("update_lookup_status",1)
+ try {
+ let resp= await api.lookup_banks(one_token())
+ if (resp.status != "OK") {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",resp.message)
+ } else {
+ context.commit("update_lookup_status",2)
+ context.commit("update_lookup_error_message","")
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ context.commit("update_banks",data.records)
+ }
+ } catch(e) {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",e.message )
+ }
+ },
+ async lookup_accounts(context) {
+ context.commit("update_lookup_status",1)
+ try {
+ let resp= await api.lookup_accounts(one_token())
+ if (resp.status != "OK") {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",resp.message)
+ } else {
+ context.commit("update_lookup_status",2)
+ context.commit("update_lookup_error_message","")
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ context.commit("update_accounts",data.records)
+ }
+ } catch(e) {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",e.message )
+ }
+ },
+ async searchcard(context,prm) {
+ context.commit("update_lookup_status",1)
+ try {
+ let resp= await api.searchcard(one_token(),prm)
+ if (resp.status != "OK") {
+ context.commit("update_lookup_status",3)
+ } else {
+ context.commit("update_lookup_status",2)
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ context.commit("update_cards",resp.data.records)
+ }
+ } catch(e) {
+ context.commit("update_lookup_status",3)
+ }
+ },
+ async pay(context,prm) {
+ context.commit("update_lookup_status",1)
+
+ console.log(prm)
+ try {
+ prm.token = one_token()
+ let resp= await api.pay(prm)
+ if (resp.status != "OK") {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",resp.message)
+ } else {
+ context.commit("update_lookup_status",2)
+ context.commit("update_lookup_error_message","")
+ let data = {
+ records : resp.data.records.types,
+ total: resp.data.total
+ }
+ context.commit("update_save_process",false)
+ var xpayments = resp.data.records.payments
+ console.log(xpayments)
+ context.commit("update_last_payments",xpayments)
+ //console.log(prm.payments)
+ let xnumber = resp.data.records.data.numberx
+ let id = resp.data.records.data.idx
+ var xobj = context.state.types
+ //console.log(xobj)
+ xobj.forEach(function(obj){
+ obj.chex = false
+ obj.leftvalue = 0
+ obj.rightvalue = 0
+ obj.selected_card = {id:0,name:''}
+ obj.selected_edc = {id:0,name:''}
+ obj.selected_account = {id:0,name:''}
+ })
+ var xray = {records:xobj,total:xobj.length}
+ context.commit("update_types",xray)
+ context.commit("update_disable_btn_pay",'Y')
+ console.log(context.state.types)
+
+ context.commit("update_idx",id)
+ context.commit("update_total_payment",0)
+ context.commit("update_paynumber","Pembayaran nomor "+xnumber+" telah berhasil")
+ context.commit("update_dialog_pay_success",true)
+ }
+ } catch(e) {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",e.message )
+ }
+ },
+ async delete_note(context,prm) {
+ context.commit("update_lookup_status",1)
+ try {
+ prm.token = one_token()
+ let resp= await api.delete_note(prm)
+ if (resp.status != "OK") {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",resp.message)
+ } else {
+ context.commit("update_lookup_status",2)
+ context.commit("update_lookup_error_message","")
+ let xmsg = "Nota nomor "+prm.nota.note_number+" telah dihapus"
+ context.commit("update_msg_delete",xmsg)
+ context.commit("update_note_delete",'')
+ context.commit("update_nota_delete",{})
+ }
+ } catch(e) {
+ context.commit("update_lookup_status",3)
+ context.commit("update_lookup_error_message",e.message )
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/vuex/ais-monitoring-transaction-v4/modules/test.js b/test/vuex/ais-monitoring-transaction-v4/modules/test.js
new file mode 100644
index 0000000..bda1640
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/modules/test.js
@@ -0,0 +1,446 @@
+// 1 => LOADING
+// 2 => DONE
+// 3 => ERROR
+import * as api from "../api/test.js"
+
+export default {
+ namespaced: true,
+ state: {
+ act:'',
+ lookup_test:0,
+ lookup_error_message:'',
+ get_data_status:0,
+ test_dialog:false,
+ test_message:'',
+ status_done:'N',
+ save_status:0,
+ save_message:false,
+ save_status_verification:0,
+ save_error_message:'',
+ autocomplete_status:0,
+ test_registration:[],
+ test_verification:[],
+ test_all:[],
+ tests:[],
+ selected_test:{},
+ test:{},
+ promises:[],
+ promise:{},
+ cito:false,
+ promise_dialog:false,
+ msg_promise_dialog:'',
+ selected_detail_verification:{},
+ show_promise_left:false,
+ showw_promise_right:false,
+ promise_left:'',
+ show_cito_dropdown:'N',
+ selected_cito:{},
+ citos:[],
+ orderid:0,
+ mouid:0,
+ },
+ mutations: {
+ update_orderid(state, val) {
+ state.orderid = val
+ },
+ update_mouid(state, val) {
+ state.mouid = val
+ },
+ update_citos(state, val) {
+ state.citos = val
+ },
+ update_selected_cito(state, val) {
+ state.selected_cito = val
+ },
+ update_show_cito_dropdown(state, val) {
+ state.show_cito_dropdown = val
+ },
+ update_selected_test(state, val) {
+ state.selected_test = val
+ },
+ update_act(state, val) {
+ state.act = val
+ },
+ update_lookup_test(state, val) {
+ state.lookup_test = val
+ },
+ update_get_data_status(state, val) {
+ state.get_data_status = val
+ },
+ update_lookup_error_message(state, val) {
+ state.lookup_error_message = val
+ },
+ update_test_dialog(state, val) {
+ state.test_dialog = val
+ },
+ update_test_message(state, val) {
+ state.test_message = val
+ },
+ update_status_done(state, val) {
+ state.status_done = val
+ },
+ update_save_status(state, val) {
+ state.save_status = val
+ },
+ update_save_status_verification(state, val) {
+ state.save_status_verification = val
+ },
+ update_save_error_message(state, val) {
+ state.save_error_message = val
+ },
+ update_save_message(state, val) {
+ state.save_message = val
+ },
+ update_autocomplete_status(state,val){
+ state.autocomplete_status = val
+ },
+ update_test_registration(state,val){
+ state.test_registration = val
+ },
+ update_test_verification(state,val){
+ state.test_verification = val
+ },
+ update_test_all(state,val){
+ state.test_all = val
+ },
+ update_tests(state,val){
+ state.tests = val
+ },
+ update_test(state,val){
+ state.test = val
+ },
+ update_promises(state,val){
+ state.promises = val
+ },
+ update_promise(state,val){
+ state.promise = val
+ },
+ update_cito(state,val){
+ state.cito = val
+ },
+ update_promise_dialog(state,val){
+ state.promise_dialog = val
+ },
+ update_msg_promise_dialog(state,val){
+ state.msg_promise_dialog = val
+ },
+ update_selected_detail_verification(state,val){
+ state.selected_detail_verification = val
+ },
+ update_show_promise_left(state,val){
+ state.show_promise_left = val
+ },
+ update_show_promise_right(state,val){
+ state.show_promise_right = val
+ },
+ update_promise_left(state,val){
+ state.promise_left = val
+ },
+ },
+ actions: {
+ async lookup(context,prm) {
+ context.commit("update_lookup_test",1)
+ try {
+ prm.token = one_token()
+ let resp= await api.lookup(prm)
+ if (resp.status != "OK") {
+ context.commit("update_lookup_test",3)
+ context.commit("update_lookup_error_message",resp.message)
+ } else {
+ context.commit("update_lookup_test",2)
+ context.commit("update_lookup_error_message","")
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ let rtn = data.records
+
+ context.commit("update_test_registration",rtn.testregistration)
+ context.commit("update_test_verification",rtn.testverification)
+ if(rtn.testverification.length > 0){
+ context.commit("update_promise_left",resp.data.promise)
+ context.commit("update_show_promise_left",true)
+ }
+ context.commit("update_test_all",rtn.testall)
+
+ }
+ } catch(e) {
+ context.commit("update_lookup_test",3)
+ context.commit("update_lookup_error_message",e.message )
+ }
+ },
+ async lookup_promises(context,prm) {
+ context.commit("update_lookup_test",1)
+ try {
+ prm.token = one_token()
+ let resp= await api.lookup_promises(prm)
+ if (resp.status != "OK") {
+ context.commit("update_lookup_test",3)
+ context.commit("update_lookup_error_message",resp.message)
+ } else {
+ context.commit("update_lookup_test",2)
+ context.commit("update_lookup_error_message","")
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ let rtn = data.records
+
+ context.commit("update_promises",rtn)
+
+ }
+ } catch(e) {
+ context.commit("update_lookup_test",3)
+ context.commit("update_lookup_error_message",e.message )
+ }
+ },
+ async savetestadditionalverification(context,prm) {
+ context.commit("update_save_status_verification",1)
+ try {
+ prm.token = one_token()
+ let resp = await api.savetestadditionalverification(prm)
+ if (resp.status != "OK") {
+ context.commit("update_save_status_verification", 3)
+ context.commit("update_save_error_message", resp.message)
+ } else {
+ context.commit("update_save_status_verification", 2)
+ context.commit("update_save_error_message", "")
+
+ context.commit("update_test_registration",resp.data.records)
+ context.commit("update_test_verification",[])
+ }
+ } catch (e) {
+ context.commit("update_save_status_verification", 3)
+ context.commit("update_save_error_message", e.message)
+ console.log(e)
+ }
+ },
+ async searchtest(context,prm) {
+ context.commit("update_autocomplete_status",1)
+ try {
+ prm.token = one_token()
+ let resp= await api.searchtest(prm)
+ if (resp.status != "OK") {
+ context.commit("update_autocomplete_status",3)
+ } else {
+ context.commit("update_autocomplete_status",2)
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ context.commit("update_tests",resp.data.records)
+ }
+ } catch(e) {
+ context.commit("update_autocomplete_status",3)
+ }
+ },
+ async checkstatus(context,prm) {
+ context.commit("update_autocomplete_status",1)
+ try {
+ prm.token = one_token()
+ let resp= await api.checkstatus(prm)
+ if (resp.status != "OK") {
+ context.commit("update_autocomplete_status",3)
+ } else {
+ context.commit("update_autocomplete_status",2)
+ let data = {
+ status : resp.data.status,
+ total: resp.data.total
+ }
+ var oldArr = context.state.test_all
+ delete prm.token
+ var idx = _.findIndex(oldArr, prm)
+ if(data.status == 'OK'){
+
+ oldArr[idx].active = 'Y'
+ oldArr[idx].status = false
+ context.commit("update_test_all",oldArr)
+ }
+ else{
+ oldArr[idx].status = true
+ //oldArr[idx]["status === 'Y'"] = true
+ context.commit("update_test_all",oldArr)
+ console.log(oldArr)
+ var msg = "Bang ... beli satenya 10 tusuk, pake lontong ya, kalo statusnya sdh divalidasi tidak bisa dihapus ya"
+ context.commit('patient/update_errormsg',msg,{root:true})
+ context.commit('patient/update_dialogerrormsg',msg,{root:true})
+ }
+ }
+ } catch(e) {
+ context.commit("update_autocomplete_status",3)
+ }
+ },
+ async savetestadditional(context,prm) {
+ context.commit("update_save_status",1)
+ try {
+ prm.token = one_token()
+ let resp= await api.savetestadditional(prm)
+ if (resp.status != "OK") {
+ context.commit("update_save_status",3)
+ } else {
+ context.commit("update_save_status",2)
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ console.log("dasdsa")
+ context.commit("update_promise_dialog",false)
+ context.commit("update_test_dialog",false)
+ context.commit("update_test_all",resp.data.records.testall)
+ context.commit("update_save_message", true)
+ context.commit("update_show_cito_dropdown","N")
+ context.commit("update_selected_cito",{})
+ //setTimeout(() => context.commit("update_save_message", false), 3000)
+ var snackbar = {value:true,text:"Data berhasil disimpan",timeout:4000}
+ context.commit("patient/update_snackbar", snackbar,{root:true})
+
+
+ }
+ } catch(e) {
+ context.commit("update_save_status",3)
+ }
+ },
+ async getnewprice(context,prm) {
+ context.commit("update_save_status",1)
+ try {
+ prm.token = one_token()
+ let resp= await api.getnewprice(prm)
+ if (resp.status != "OK") {
+ context.commit("update_save_status",3)
+ } else {
+ context.commit("update_save_status",2)
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ console.log(data.records.length)
+ if(data.records.length === 0){
+ var oldArr = context.state.test_all
+ var idx = _.findIndex(oldArr, {pxid:prm.pxid})
+ oldArr[idx].status = true
+ oldArr[idx].active = 'Y'
+ oldArr[idx].cito = false
+ console.log(oldArr)
+ context.commit("update_test_all",oldArr)
+
+ var msg = "Kala hujan di waktu pagi, cobalah sejenak untuk menepi, Jika harga belum diisi, tak ada yang bisa ditampilkan di sini"
+ context.commit('patient/update_errormsg',msg,{root:true})
+ context.commit('patient/update_dialogerrormsg',msg,{root:true})
+ }else{
+ var newprice = data.records[0]
+ var oldArr = context.state.test_all
+ var idx = _.findIndex(oldArr, {pxid:prm.pxid})
+ delete prm.token
+ delete prm.orderid
+
+ //var distot = ((parseFloat(newprice.T_PriceDisc)/100) * parseInt(newprice.T_PriceAmount)) + parseInt(newprice.T_PriceDiscRp)
+ //var total = parseInt(newprice.T_PriceAmount) - distot
+ //console.log(distot)
+ prm.discountpersen = newprice.discountpersen
+ prm.discountrp = newprice.discountrp
+ prm.bruto = newprice.bruto
+ prm.discount = newprice.discount
+ prm.total = newprice.total
+ prm.cito = newprice.cito
+ prm.status = newprice.cito_before
+ prm.active = 'Y'
+ //console.log(prm)
+ oldArr[idx] = prm
+
+ context.commit("update_test_all",oldArr)
+ }
+ //console.log(prm)
+ context.commit("update_show_cito_dropdown","N")
+ var rows = context.state.citos
+ var row = _.filter(rows, function(o) { return o.xdefault === 'Y' })
+ context.commit("update_selected_cito",row[0])
+ console.log(prm.cito_before)
+ console.log(prm.cito)
+ if(prm.cito & prm.cito_before === 'N'){
+ context.commit("update_show_cito_dropdown","Y")
+ }
+ }
+ } catch(e) {
+ context.commit("update_save_status",3)
+ }
+ },
+ async getchildrenprofil(context,prm) {
+ context.commit("update_get_data_status",1)
+ try {
+ prm.token = one_token()
+ let resp= await api.getchildrenprofil(prm)
+ if (resp.status != "OK") {
+ context.commit("update_get_data_status",3)
+ } else {
+ context.commit("update_get_data_status",2)
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ var rows = data.records
+ var xtestall = prm.all
+ rows.forEach(function(entry) {
+ xtestall.push(entry)
+ })
+
+ context.commit("update_test_all",xtestall)
+ context.commit("update_test",{})
+ context.commit("update_tests",[])
+
+ }
+ } catch(e) {
+ context.commit("update_get_data_status",3)
+ }
+ },
+ async getcitos(context,prm) {
+ context.commit("update_get_data_status",1)
+ try {
+ prm.token = one_token()
+ let resp= await api.getcitos(prm)
+ if (resp.status != "OK") {
+ context.commit("update_get_data_status",3)
+ } else {
+ context.commit("update_get_data_status",2)
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+
+ var rows = data.records
+ context.commit("update_citos",rows)
+ var row = _.filter(rows, function(o) { return o.xdefault === 'Y' })
+ context.commit("update_selected_cito",row)
+
+ context.commit("update_selected_cito","N")
+
+ }
+ } catch(e) {
+ context.commit("update_get_data_status",3)
+ }
+ },
+ async checkpromisetests(context,prm) {
+ context.commit("update_get_data_status",1)
+ try {
+ prm.token = one_token()
+ let resp= await api.checkpromisetests(prm)
+ if (resp.status != "OK") {
+ context.commit("update_get_data_status",3)
+ } else {
+ context.commit("update_get_data_status",2)
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ var msg = "Janji hasil sebelum tambahan adalah
"+data.records.before+"
"+
+ "Janji hasil setelah tambahan adalah
"+data.records.after+"
"+
+ "YAKIN AKAN UPDATE ?
"
+ context.commit("update_msg_promise_dialog",msg)
+ context.commit("update_promise_dialog", true)
+
+ }
+ } catch(e) {
+ context.commit("update_get_data_status",3)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/vuex/ais-monitoring-transaction-v4/oneFooter.vue b/test/vuex/ais-monitoring-transaction-v4/oneFooter.vue
new file mode 100644
index 0000000..1813e1b
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/oneFooter.vue
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/vuex/ais-monitoring-transaction-v4/oneNavbarComponent.vue b/test/vuex/ais-monitoring-transaction-v4/oneNavbarComponent.vue
new file mode 100644
index 0000000..3ccd915
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/oneNavbarComponent.vue
@@ -0,0 +1,182 @@
+
+
+
+
+
+
+
+
+ BISONE
+ {{bread_crumb}}
+
+
+
+
+
+
+
+ {{ xusername }}
+
+
+
+
+ notifications
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ apps
+
+
+
+
+
+
+
+
+ {{ xusername }}
+ {{xstaffname}}
+
+
+
+
+
+
+
+
+
+
+ security
+
+ Change Password
+
+
+
+
+
+
+ no_meeting_room
+
+ Log Out
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/vuex/ais-monitoring-transaction-v4/patient.js b/test/vuex/ais-monitoring-transaction-v4/patient.js
new file mode 100644
index 0000000..d6514a5
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/patient.js
@@ -0,0 +1,467 @@
+// 1 => LOADING
+// 2 => DONE
+// 3 => ERROR
+import * as api from "../api/patient.js"
+
+export default {
+ namespaced: true,
+ state: {
+ search_patient: 0,
+ search_error_message: '',
+ start_date:moment(new Date()).format('YYYY-MM-DD'),
+ last_search_val: '',
+ last_search_type: '',
+ end_date:moment(new Date()).format('YYYY-MM-DD'),
+ search:'',
+ patients: [],
+ total_patient: 0,
+ selected_patient: {},
+ save_error_message: '',
+ statuses:[{name:'Semua',value:'A'},{name:'Sudah Terkirim',value:'Y'},{name:'Belum Terkirim',value:'N'}],
+ selected_status:{name:'Semua',value:'A'},
+ open_alert_no_pay: false,
+ msg_alert_no_pay: "Loh ... Gak jadi bayar dong ?",
+ current_page:1,
+ total_page:0,
+ pay_disabled:'Y',
+ autocomplete_status:0,
+ companies:[{id:0,name:'Semua'}],
+ selected_company:{id:0,name:'Semua'},
+ logs:[],
+ unduhan:[],
+ loading_download:false,
+ loading_send:false,
+ monitoring_data: [],
+ monitoring_status: 0,
+ monitoring_error_message: '',
+ corporates: [],
+ selected_corporate: { CorporateID: '0', CorporateName: 'Semua', CorporateCode: '' },
+ transaction_log: null,
+ dialog_info: false,
+ dialog_info_message: ''
+ },
+ mutations: {
+ set_last_search(state, { val, type }) {
+ state.last_search_val = val;
+ state.last_search_type = type;
+ },
+
+ update_loading_send(state,val){
+ state.loading_send = val
+ },
+ update_loading_download(state,val){
+ state.loading_download = val
+ },
+ update_unduhan(state,val){
+ state.unduhan = val
+ },
+ update_logs(state,val){
+ state.logs = val
+ },
+ update_autocomplete_status(state,val){
+ state.autocomplete_status = val
+ },
+ update_companies(state, val) {
+ state.companies = val
+ },
+ update_selected_company(state, val) {
+ state.selected_company = val
+ },
+ update_pay_disabled(state, val) {
+ state.pay_disabled = val
+ },
+ update_total_page(state, val) {
+ state.total_page = val
+ },
+ update_current_page(state, val) {
+ state.current_page = val
+ },
+ update_search_error_message(state, patient) {
+ state.search_error_message = patient
+ },
+ update_search_patient(state, patient) {
+ state.search_patient = patient
+ },
+ update_patients(state, data) {
+ state.patients = data.records
+ state.total_patient = data.total
+ state.total_page = data.total
+ },
+ update_selected_patient(state, val) {
+ state.selected_patient = val
+ },
+ update_start_date(state, val) {
+ state.start_date = val
+ },
+ update_end_date(state, val) {
+ state.end_date = val
+ },
+ update_search(state, val) {
+ state.search = val
+ },
+ update_selected_status(state, val) {
+ state.selected_status = val
+ },
+ update_open_alert_no_pay(state, val) {
+ state.open_alert_no_pay = val
+ },
+ update_msg_alert_no_pay(state, val) {
+ state.msg_alert_no_pay = val
+ },
+ set_monitoring_data(state, data) {
+ state.monitoring_data = data;
+ },
+ set_monitoring_status(state, status) {
+ state.monitoring_status = status;
+ },
+ set_monitoring_error_message(state, message) {
+ state.monitoring_error_message = message;
+ },
+ update_corporates(state, data) {
+ state.corporates = data;
+ },
+ update_selected_corporate(state, data) {
+ state.selected_corporate = data;
+ },
+ set_transaction_log(state, payload) {
+ state.transaction_log = payload;
+ },
+ set_dialog_info(state, status) {
+ state.dialog_info = status;
+ },
+ set_dialog_info_message(state, message) {
+ state.dialog_info_message = message;
+ }
+
+ },
+ actions: {
+ async search(context, prm) {
+ context.commit("update_search_patient", 1)
+ try {
+ prm.token = one_token()
+ prm.company = context.state.selected_company.id
+ let resp = await api.search(prm)
+ if (resp.status != "OK") {
+ context.commit("update_search_patient", 3)
+ context.commit("update_search_error_message", resp.message)
+ } else {
+ context.commit("update_search_patient", 2)
+ context.commit("update_search_error_message", "")
+ let data = {
+ records: resp.data.records,
+ total: resp.data.total
+ }
+ context.commit("update_patients", data)
+ context.commit("update_selected_patient", [])
+ context.commit("update_total_page", data.total)
+ /*if(prm.lastidx === 0){
+ context.commit("update_selected_patient", data.records[0])
+ if(!_.isEmpty(data.records[0]))
+ context.commit("paymentnew/update_notes",data.records[0].notes,{root:true})
+ else
+ context.commit("paymentnew/update_notes",[],{root:true})
+ }
+ else{
+ context.commit("update_selected_patient", data.records[prm.lastidx])
+ context.commit("paymentnew/update_notes",data.records[prm.lastidx].notes,{root:true})
+ }*/
+
+ }
+ } catch (e) {
+ context.commit("update_search_patient", 3)
+ context.commit("update_search_error_message", e.message)
+ console.log(e)
+ }
+ },
+ async searchcompany(context,prm) {
+ context.commit("update_autocomplete_status",1)
+ try {
+ let resp= await api.searchcompany(one_token(),prm)
+ if (resp.status != "OK") {
+ context.commit("update_autocomplete_status",3)
+ } else {
+ context.commit("update_autocomplete_status",2)
+ let data = {
+ records : resp.data.records,
+ total: resp.data.total
+ }
+ context.commit("update_companies",resp.data.records)
+ }
+ } catch(e) {
+ context.commit("update_autocomplete_status",3)
+ }
+ },
+ async download_data(context,prm) {
+ context.commit("update_loading_download",true)
+ try {
+ let resp= await api.download_data(one_token(),prm)
+ if (resp.status != "OK") {
+ context.commit("update_loading_download",false)
+ } else {
+ context.commit("update_loading_download",false)
+ context.commit("update_unduhan",resp.data.records)
+ context.commit("paymentnew/update_dialog_pay_success",true,{root:true})
+ context.commit("update_autocomplete_status",2)
+ context.dispatch("search",{
+ startdate:context.state.start_date,
+ enddate:context.state.start_date,
+ search: context.state.search,
+ status: context.state.selected_status.value,
+ current_page:1,
+ lastidx:0
+ })
+ }
+ } catch(e) {
+ context.commit("update_loading_download",false)
+ }
+ },
+ async sendresult(context,prm) {
+ context.commit("update_loading_send",true)
+ try {
+ prm.token = one_token()
+ let resp= await api.sendresult(prm)
+ if (resp.status != "OK") {
+ context.commit("update_loading_send",false)
+ } else {
+
+ context.dispatch("getlogs",{})
+ //alert("Proses unduh selesai")
+ context.commit("update_loading_send",false)
+
+ }
+ } catch(e) {
+ context.commit("update_loading_send",false)
+ }
+ },
+ async getlogs(context,prm) {
+ context.commit("update_autocomplete_status",1)
+ try {
+ prm = context.state.selected_patient
+ prm.token = one_token()
+ let resp= await api.getlogs(prm)
+ if (resp.status != "OK") {
+ context.commit("update_autocomplete_status",3)
+ } else {
+
+ context.commit("update_logs",resp.data.records)
+
+ }
+ } catch(e) {
+ context.commit("update_autocomplete_status",3)
+ }
+ },
+ // async monitoring_transaction(context, prm) {
+ // context.commit("set_monitoring_status", 1);
+ // try {
+ // if (prm.lab_number) {
+ // context.commit('set_last_search', { val: prm.lab_number, type: 'lab_number' });
+ // } else if (prm.patient_name) {
+ // context.commit('set_last_search', { val: prm.patient_name, type: 'patient_name' });
+ // } else {
+ // context.commit('set_last_search', { val: '', type: '' });
+ // }
+
+ // let resp = await api.monitoring_transaction(prm);
+ // if (resp.status !== "success") {
+ // context.commit("set_monitoring_status", 3);
+ // context.commit("set_monitoring_error_message", resp.message);
+ // } else {
+ // context.commit("set_monitoring_status", 2);
+ // context.commit("set_monitoring_status", 2);
+ // context.commit("set_monitoring_data", resp.data);
+ // context.commit("set_monitoring_error_message", "");
+ // const total_page = Math.ceil(resp.total / resp.limit);
+ // context.commit("update_total_page", total_page);
+ // context.commit("update_current_page", resp.page);
+
+ // }
+ // } catch (e) {
+ // context.commit("set_monitoring_status", 3);
+ // context.commit("set_monitoring_error_message", e.message);
+ // console.error(e);
+ // }
+ // },
+
+ // Di bagian actions -> monitoring_transaction, ubah commit ini:
+ async monitoring_transaction(context, prm) {
+ context.commit("set_monitoring_status", 1); // 1: LOADING
+ try {
+ // Simpan parameter pencarian terakhir untuk paginasi
+ if (prm.lab_number) {
+ context.commit('set_last_search', { val: prm.lab_number, type: 'lab_number' });
+ } else if (prm.patient_name) {
+ context.commit('set_last_search', { val: prm.patient_name, type: 'patient_name' });
+ } else {
+ context.commit('set_last_search', { val: '', type: '' });
+ }
+
+ let resp = await api.monitoring_transaction(prm);
+ if (resp.status !== "success") {
+ context.commit("set_monitoring_status", 3); // 3: ERROR
+ context.commit("set_monitoring_error_message", resp.message);
+ } else {
+ context.commit("set_monitoring_status", 2); // 2: SUCCESS
+
+ // FIX: Wrap response data dengan struktur yang sesuai
+ const wrappedData = {
+ data: resp.data, // Array dari API
+ total: resp.total,
+ page: resp.page,
+ limit: resp.limit
+ };
+
+ context.commit("set_monitoring_data", wrappedData);
+ context.commit("set_monitoring_error_message", "");
+
+ const total_page = Math.ceil(resp.total / resp.limit);
+ context.commit("update_total_page", total_page);
+ context.commit("update_current_page", resp.page);
+ }
+ } catch (e) {
+ context.commit("set_monitoring_status", 3);
+ context.commit("set_monitoring_error_message", e.message);
+ console.error(e);
+ }
+ },
+
+ // Atau alternatif: ubah computed property di component
+ // Di file Vue component, ganti computed patients menjadi:
+ // Di computed patients
+ patients() {
+ console.log('monitoring_data:', this.$store.state.patient.monitoring_data);
+ const monitoringData = this.$store.state.patient.monitoring_data || {};
+ const result = Array.isArray(monitoringData.data) ? monitoringData.data : [];
+ console.log('patients result:', result);
+ return result;
+ },
+
+ async get_corporates(context) {
+ let resp = await api.get_corporate();
+ if (resp.status === 'success') {
+ let corporates = resp.data;
+ corporates.unshift({ CorporateID: '0', CorporateName: 'Semua', CorporateCode: '' });
+ context.commit('update_corporates', corporates);
+ }
+ },
+
+ async get_json_response({ commit, state }) {
+ commit('set_transaction_log', null); // Reset log saat memulai
+ commit('set_monitoring_status', 1); // Set status loading
+ if (!state.selected_patient || !state.selected_patient.lab_number) {
+ commit('set_monitoring_status', 2); // Selesai loading
+ return;
+ }
+
+ const params = {
+ lab_number: state.selected_patient.lab_number
+ };
+
+ const response = await api.get_json_response(params);
+
+ if (response.status === 'success' && response.data) {
+ commit('set_transaction_log', response.data);
+ } else {
+ commit('set_transaction_log', null);
+ console.error("Failed to get JSON response:", response.message);
+ }
+ commit('set_monitoring_status', 2); // Selesai loading
+ },
+
+ async post_transaction_by_labnumber(context, prm) {
+ context.commit("set_monitoring_status", 1);
+ try {
+ const response = await api.post_transaction_by_labnumber(prm);
+
+ if (response.status === 'success') {
+
+ const searchVal = context.state.search;
+ let searchParams = {};
+
+ if (/[a-zA-Z]/.test(searchVal) && /\d/.test(searchVal)) {
+ searchParams.lab_number = searchVal;
+ } else {
+ searchParams.patient_name = searchVal;
+ }
+
+ await context.dispatch("monitoring_transaction", {
+ start_date: context.state.start_date,
+ end_date: context.state.end_date,
+ ...searchParams,
+ corporate_id: context.state.selected_corporate.CorporateID,
+ ais_status: context.state.selected_status.value,
+ page: context.state.current_page
+ });
+
+ const updatedItem = context.state.monitoring_data.find(item => item.lab_number === prm.labnumber);
+ if (updatedItem) {
+ context.commit("update_selected_patient", updatedItem);
+ await context.dispatch("get_json_response");
+ }
+
+ context.commit("set_dialog_info_message", "Transaksi berhasil dikirim.");
+
+ } else {
+ const errorMessage = response.message || "Gagal mengirim transaksi.";
+ context.commit("set_dialog_info_message", errorMessage);
+ }
+
+ context.commit("set_dialog_info", true);
+ } catch (e) {
+ context.commit("set_dialog_info_message", "Terjadi kesalahan: " + e.message);
+ context.commit("set_dialog_info", true);
+ } finally {
+ context.commit("set_monitoring_status", 2);
+ }
+ },
+
+ async re_post_transaction_by_labnumber(context, prm) {
+ context.commit("set_monitoring_status", 1);
+ try {
+ const response = await api.re_post_transaction_by_labnumber(prm);
+
+ if (response.status === 'success') {
+
+ const searchVal = context.state.search;
+ let searchParams = {};
+
+ if (/[a-zA-Z]/.test(searchVal) && /\d/.test(searchVal)) {
+ searchParams.lab_number = searchVal;
+ } else {
+ searchParams.patient_name = searchVal;
+ }
+
+ await context.dispatch("monitoring_transaction", {
+ start_date: context.state.start_date,
+ end_date: context.state.end_date,
+ ...searchParams,
+ corporate_id: context.state.selected_corporate.CorporateID,
+ ais_status: context.state.selected_status.value,
+ page: context.state.current_page
+ });
+
+ const updatedItem = context.state.monitoring_data.find(item => item.lab_number === prm.labnumber);
+ if (updatedItem) {
+ context.commit("update_selected_patient", updatedItem);
+ await context.dispatch("get_json_response");
+ }
+
+ context.commit("set_dialog_info_message", "Transaksi berhasil dikirim ulang.");
+
+ } else {
+ const errorMessage = response.message || "Gagal mengirim ulang transaksi.";
+ context.commit("set_dialog_info_message", errorMessage);
+ }
+
+ context.commit("set_dialog_info", true);
+
+ } catch (e) {
+ context.commit("set_dialog_info_message", "Terjadi kesalahan: " + e.message);
+ context.commit("set_dialog_info", true);
+ } finally {
+ context.commit("set_monitoring_status", 2);
+ }
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/test/vuex/ais-monitoring-transaction-v4/store.js b/test/vuex/ais-monitoring-transaction-v4/store.js
new file mode 100644
index 0000000..de9a991
--- /dev/null
+++ b/test/vuex/ais-monitoring-transaction-v4/store.js
@@ -0,0 +1,27 @@
+import patient from "./modules/patient.js";
+import payment from "./modules/payment.js";
+import paymentnew from "./modules/paymentnew.js";
+import test from "./modules/test.js";
+import system from "../../../apps/modules/system/system.js";
+export const store = new Vuex.Store({
+ modules: {
+ patient: patient,
+ payment: payment,
+ test:test,
+ paymentnew:paymentnew,
+ system:system
+ },
+ state: {
+ tab_selected: 'pasien-dokter'
+ },
+ mutations: {
+ change_tab(state, ntab) {
+ state.tab_selected = ntab
+ }
+ },
+ actions: {
+ change_tab(context, ntab) {
+ context.commit('change_tab', ntab)
+ }
+ }
+});