diff --git a/test/vuex/cpone-mcu-offline-preregister-v2/components/oneMdPatientList.vue b/test/vuex/cpone-mcu-offline-preregister-v2/components/oneMdPatientList.vue index c5dad9e..080a85d 100644 --- a/test/vuex/cpone-mcu-offline-preregister-v2/components/oneMdPatientList.vue +++ b/test/vuex/cpone-mcu-offline-preregister-v2/components/oneMdPatientList.vue @@ -89,7 +89,7 @@

silahkan download template di sini

- +
@@ -100,7 +100,7 @@ - + @@ -124,7 +124,7 @@ mounted() { //this.setNewSetup() this.$store.dispatch("patient/getmgmmcu") - + }, methods: { downloadxapp(){ @@ -152,7 +152,7 @@ this.$store.commit("patient/update_mou", {}) this.$store.commit("patient/update_selected_mous", row.mous) this.$store.commit("patient/update_selected_doctors", row.doctors) - + this.$store.commit("patient/update_start_date", moment(row.McuOfflinePrepareStartDate).format('YYYY-MM-DD')) this.$store.commit("patient/update_end_date", moment(row.McuOfflinePrepareEndDate).format('YYYY-MM-DD')) }, @@ -227,27 +227,27 @@ var lines = csv.split("\n") var result = [] var headers = lines[0].split(",") - vm.parse_header = lines[0].split(",") + vm.parse_header = lines[0].split(",") lines[0].split(",").forEach(function (key) { vm.sortOrders[key] = 1 }) - + lines.map(function(line, indexLine){ if (indexLine < 1) return // Jump header line - + var obj = {} var currentline = line.split(",") - + headers.map(function(header, indexHeader){ var header = header.trim(); obj[header] = currentline[indexHeader] }) - + result.push(obj) }) - + result.pop() // remove the last item because undefined values - + return result // JavaScript object }, loadCSV_old(e) { @@ -280,23 +280,23 @@ // var d = substr(nik, 6, 2); // var m = substr(nik, 8, 2); // var y = substr(nik, 10, 2); - + // //jika tahun full, ambil 2 digit terakhir // if(strlen(tahun==4)){ // tahun = substr(tahun,2,2); // } // if (intval(d) > 40) { // //Wanita - // d = intval(d) - 40; + // d = intval(d) - 40; // } // if(tanggal/d != 1){ // return false; // } - + // if(bulan/m != 1){ // return false; // } - + // if(tahun/y != 1){ // return false; // } @@ -361,7 +361,7 @@ if(iidx > 0){ //entry.TANGGAL_LAHIR = moment(entry.TANGGAL_LAHIR).format('DD-MM-YYYY') // console.log("DD", moment(entry.TANGGAL_LAHIR, 'DD-MM-YYYY').format('DD')); - + // const date = new Date(entry.TANGGAL_LAHIR); // console.log("date",date) var day = moment(entry.TANGGAL_LAHIR, 'DD-MM-YYYY').format('DD'); @@ -508,7 +508,7 @@ }, data() { return { - files: [], + files: [], dialog_identifier: false, channel_name: '', channel_fields: [], @@ -551,4 +551,4 @@ }; } } - \ No newline at end of file + diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/api/patient.js b/test/vuex/cpone-mcu-offline-preregister-v3/api/patient.js new file mode 100644 index 0000000..c8a8888 --- /dev/null +++ b/test/vuex/cpone-mcu-offline-preregister-v3/api/patient.js @@ -0,0 +1,366 @@ +const URL = "/one-api/cpone/mcuoffline/"; + +export async function getmgmmcu(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/getmgmmcu', 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 search(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/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 generatesetup(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/generatesetup', 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 getsexreg(token) { + try { + var resp = await axios.post(URL + 'preregisterv3/getsexreg',{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 savecsv(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/savecsv',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 newpatient(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/newpatient',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 xdelete(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/deletepatient',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 getaddress(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/getaddress',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 searchcity(token,prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/searchcity',{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 getdistrict(token,prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/getdistrict',{id:prm.M_CityID,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 getkelurahan(token,prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/getkelurahan',{token:token,id:prm.M_DistrictID}); + 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 savenewaddress(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/savenewaddress',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 saveeditaddress(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/saveeditaddress',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 deleteaddress(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/deleteaddress',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 searchdoctor(prm) { + try { + console.log('aye') + console.log(prm) + var resp = await axios.post(URL + 'preregisterv3/searchdoctor',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 searchcompany(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/searchcompany',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 getmou(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/getmou',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 savepreregisterv2(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/savepreregisterv2',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 gotoreg(prm) { + try { + var resp = await axios.post(URL + 'preregisterv3/gotoreg',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 + }; + } + } diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/components/VueCsvImport.vue b/test/vuex/cpone-mcu-offline-preregister-v3/components/VueCsvImport.vue new file mode 100644 index 0000000..a21896a --- /dev/null +++ b/test/vuex/cpone-mcu-offline-preregister-v3/components/VueCsvImport.vue @@ -0,0 +1,293 @@ + + + diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/components/oneMdPatientAddress.vue b/test/vuex/cpone-mcu-offline-preregister-v3/components/oneMdPatientAddress.vue new file mode 100644 index 0000000..6b33d32 --- /dev/null +++ b/test/vuex/cpone-mcu-offline-preregister-v3/components/oneMdPatientAddress.vue @@ -0,0 +1,397 @@ + + + + + diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/components/oneMdPatientDetail.vue b/test/vuex/cpone-mcu-offline-preregister-v3/components/oneMdPatientDetail.vue new file mode 100644 index 0000000..ed82e2c --- /dev/null +++ b/test/vuex/cpone-mcu-offline-preregister-v3/components/oneMdPatientDetail.vue @@ -0,0 +1,183 @@ + + + + + \ No newline at end of file diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/components/oneMdPatientList.vue b/test/vuex/cpone-mcu-offline-preregister-v3/components/oneMdPatientList.vue new file mode 100644 index 0000000..10ee9cc --- /dev/null +++ b/test/vuex/cpone-mcu-offline-preregister-v3/components/oneMdPatientList.vue @@ -0,0 +1,559 @@ + + + + diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.csv b/test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.csv new file mode 100644 index 0000000..50c9710 --- /dev/null +++ b/test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.csv @@ -0,0 +1,3 @@ +PID,NAMA,TANGGAL_LAHIR,JENIS_KELAMIN,NIK,JABATAN,EMAIL,HP,LOKASI,JOB,KEDUDUKAN +,AA,12-09-2001,P,,GURU,,,,, +,BB,14-01-1994,L,12.14.44.55,DIRKEU,,,,, diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.xls b/test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.xls new file mode 100644 index 0000000..e6ea410 Binary files /dev/null and b/test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.xls differ diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.xlsx b/test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.xlsx new file mode 100644 index 0000000..b131b5a Binary files /dev/null and b/test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.xlsx differ diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/index.php b/test/vuex/cpone-mcu-offline-preregister-v3/index.php new file mode 100644 index 0000000..25cae5e --- /dev/null +++ b/test/vuex/cpone-mcu-offline-preregister-v3/index.php @@ -0,0 +1,118 @@ + + + + + + + + One + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/mcu_template.xlsx b/test/vuex/cpone-mcu-offline-preregister-v3/mcu_template.xlsx new file mode 100644 index 0000000..53151a5 Binary files /dev/null and b/test/vuex/cpone-mcu-offline-preregister-v3/mcu_template.xlsx differ diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/mcu_template_default.xlsx b/test/vuex/cpone-mcu-offline-preregister-v3/mcu_template_default.xlsx new file mode 100644 index 0000000..d5e7d8d Binary files /dev/null and b/test/vuex/cpone-mcu-offline-preregister-v3/mcu_template_default.xlsx differ diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/mcu_template_west.xlsx b/test/vuex/cpone-mcu-offline-preregister-v3/mcu_template_west.xlsx new file mode 100644 index 0000000..84da927 Binary files /dev/null and b/test/vuex/cpone-mcu-offline-preregister-v3/mcu_template_west.xlsx differ diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/modules/patient.js b/test/vuex/cpone-mcu-offline-preregister-v3/modules/patient.js new file mode 100644 index 0000000..f9c68a0 --- /dev/null +++ b/test/vuex/cpone-mcu-offline-preregister-v3/modules/patient.js @@ -0,0 +1,796 @@ +// 1 => LOADING +// 2 => DONE +// 3 => ERROR +import * as api from "../api/patient.js" + +export default { + namespaced: true, + state: { + lookup_status: 0, + mgmmcu: [], + selected_mgmmcu: {}, + error_identifier: [], + // cpone + last_id: -1, + last_saved_id: -1, + x_addr_id: 0, + act: 'edit', + act_addr: 'new', + get_data_status: 0, + search_patient: 0, + search_status: 0, + search_error_message: '', + norm: '', + patient_prefix: '', + patient_name: '', + patient_suffix: '', + titles: [], + selected_title: {}, + dob: '', + patients: [], + total_patients: 0, + patient_address: [], + sexes: [], + selected_sex: {}, + religions: [], + selected_religion: {}, + phone: '', + hp: '', + email: '', + pob: '', + kartuidentitass: [], + selected_kartuidentitas: {}, + noidentitas: '', + note: '', + nik: '', + jabatan: '', + kedudukan: '', + pj: '', + location: '', + job: '', + total_patient: 0, + selected_patient: {}, + save_status: 0, + btn_save_seen: true, + pgrs_save: false, + save_error_message: '', + no_save: 0, + open_alert_confirmation: false, + alert_success: false, + msg_success: "", + dialog_success: false, + dialog_confirmation_delete: false, + msg_confirmation_delete: "", + dialog_confirmation_delete_addr: false, + msg_confirmation_delete_addr: "", + autocomplete_status: 0, + dialog_form_address: false, + label_address: '', + addresses: [], + cities: [], + city_address: {}, + companies:[], + company:{}, + mous:[], + mou:{}, + doctors:[], + doctor:{}, + districts: [], + district_address: {}, + kelurahans: [], + kelurahan_address: {}, + description_address: '', + errors: [], + current_page:1, + autocomplete_status:0, + status:{id:"N",name:"Belum di download"}, + start_date:moment(new Date()).format('YYYY-MM-DD'), + end_date:moment(new Date()).format('YYYY-MM-DD'), + selected_mous:[], + selected_doctors:[], + xid:-1, + csv_json:[], + data_setup:{}, + default_mu :{}, + default_doctor:{}, + setupcode:'', + search:'', + loading_save:false, + open_dialog_info: false, + msg_info: '' + }, + mutations: { + update_open_dialog_info(state, val) { + state.open_dialog_info = val + }, + update_msg_info(state, val) { + state.msg_info = val + }, + update_lookup_status(state, val) { + state.lookup_status = val + }, + update_mgmmcu(state, val) { + state.mgmmcu = val + }, + update_selected_mgmmcu(state, val) { + state.selected_mgmmcu = val + }, + update_error_identifier(state, val) { + state.error_identifier = val + }, + // cpone + update_search(state,val){ + state.search = val + }, + update_setupcode(state,val){ + state.setupcode = val + }, + update_default_mu(state,val){ + state.default_mu = val + }, + update_default_doctor(state,val){ + state.default_doctor = val + }, + update_data_setup(state,val){ + state.data_setup = val + }, + update_csv_json(state,val){ + state.csv_json = val + }, + update_xid(state,val){ + state.xid = val + }, + update_selected_doctors(state,val){ + state.selected_doctors = val + }, + update_selected_mous(state,val){ + state.selected_mous = val + }, + update_companies(state,val){ + state.companies = val + }, + update_company(state,val){ + state.company = val + }, + update_mous(state,val){ + state.mous = val + }, + update_mou(state,val){ + state.mou = val + }, + update_doctors(state,val){ + state.doctors = val + }, + update_doctor(state,val){ + state.doctor = val + }, + update_autocomplete_status(state,val){ + state.autocomplete_status = val + }, + update_start_date(state, val) { + state.start_date = val + }, + update_end_date(state, val) { + state.end_date = val + }, + update_status(state, val) { + state.status = val + }, + update_current_page(state, val) { + state.current_page = val + }, + update_x_addr_id(state, val) { + state.x_addr_id = val + }, + update_last_id(state, val) { + state.last_id = val + }, + update_last_saved_id(state, val) { + state.last_saved_id = val + }, + update_act(state, val) { + state.act = val + }, + update_act_addr(state, val) { + state.act_addr = val + }, + update_get_data_status(state, val) { + state.get_data_status = val + }, + update_search_error_message(state, patient) { + state.search_error_message = patient + }, + update_search_patient(state, patient) { + state.search_patient = patient + }, + update_dob(state, val) { + state.dob = val + }, + update_patient_prefix(state, val) { + state.patient_prefix= val + }, + update_patient_name(state, val) { + state.patient_name = val + }, + update_patient_suffix(state, val) { + state.patient_suffix = val + }, + update_norm(state, val) { + state.norm = val + }, + update_titles(state, val) { + state.titles = val + }, + update_selected_title(state, val) { + state.selected_title = val + }, + update_patients(state, data) { + state.patients = data + }, + update_selected_patient(state, val) { + state.selected_patient = val + }, + update_sexes(state, val) { + state.sexes = val + }, + update_selected_sex(state, val) { + state.selected_sex = val + }, + update_religions(state, val) { + state.religions = val + }, + update_selected_religion(state, val) { + state.selected_religion = val + }, + update_phone(state, val) { + state.phone = val + }, + update_email(state, val) { + state.email = val + }, + update_pob(state, val) { + state.pob = val + }, + update_hp(state, val) { + state.hp = val + }, + update_kartuidentitass(state, val) { + state.kartuidentitass = val + }, + update_selected_kartuidentitas(state, val) { + state.selected_kartuidentitas = val + }, + update_noidentitas(state, val) { + state.noidentitas = val + }, + update_note(state, val) { + state.note = val + }, + update_nik(state, val) { + state.nik = val + }, + update_jabatan(state, val) { + state.jabatan = val + }, + update_kedudukan(state, val) { + state.kedudukan = val + }, + update_pj(state, val) { + state.pj = val + }, + update_location(state, val) { + state.location = val + }, + update_job(state, val) { + state.job = val + }, + update_save_status(state, val) { + state.save_status = val + }, + update_btn_save_seen(state, val) { + state.btn_save_seen = val + }, + update_pgrs_save(state, val) { + state.pgrs_save = val + }, + update_save_error_message(state, msg) { + state.save_error_message = '' + }, + update_no_save(state, val) { + state.no_save = val + }, + update_open_alert_confirmation(state, val) { + state.open_alert_confirmation = val + }, + update_alert_success(state, val) { + state.alert_success = val + }, + update_msg_success(state, val) { + state.msg_success = val + }, + update_dialog_success(state, val) { + state.dialog_success = val + }, + update_dialog_confirmation_delete(state, val) { + state.dialog_confirmation_delete = val + }, + update_msg_confirmation_delete(state, val) { + state.msg_confirmation_delete = val + }, + update_dialog_confirmation_delete_addr(state, val) { + state.dialog_confirmation_delete_addr = val + }, + update_msg_confirmation_delete_addr(state, val) { + state.msg_confirmation_delete_addr = val + }, + update_addresses(state, val) { + state.addresses = val + }, + update_autocomplete_status(state, val) { + state.autocomplete_status = val + }, + update_dialog_form_address(state, val) { + state.dialog_form_address = val + }, + update_label_address(state, val) { + state.label_address = val + }, + update_cities(state, val) { + state.cities = val + }, + update_city_address(state, val) { + state.city_address = val + }, + update_districts(state, val) { + state.districts = val + }, + update_district_address(state, val) { + state.district_address = val + }, + update_kelurahans(state, val) { + state.kelurahans = val + }, + update_kelurahan_address(state, val) { + state.kelurahan_address = val + }, + update_description_address(state, val) { + state.description_address = val + }, + update_search_status(state, val) { + state.search_status = val + }, + update_errors(state, val) { + state.errors = val + }, + update_total_patients(state, val) { + state.total_patients = val + }, + update_total_patient(state, val) { + state.total_patient = val + }, + update_loading_save(state, val) { + state.loading_save = val + }, + }, + actions: { + async getmgmmcu(context) { + context.commit("update_lookup_status", 1) + try { + var prm = {token: one_token()} + let resp = await api.getmgmmcu(prm) + if (resp.status != "OK") { + context.commit("update_lookup_status", 3) + } else { + context.commit("update_lookup_status", 2) + let data = { + records: resp.data.records, + } + context.commit("update_mgmmcu", resp.data.records) + } + } catch (e) { + context.commit("update_lookup_status", 3) + } + }, + // cpone + + async generatesetup(context,prm) { + context.commit("update_get_data_status", 1) + try { + prm.token = one_token() + let resp = await api.generatesetup(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 + } + console.log(resp.data.records) + context.commit("update_data_setup", resp.data.records) + context.commit("update_setupcode", '') + context.commit("update_current_page", 1) + //context.commit("update_patients", data.records['patients']) + context.dispatch("search", { + search:'', + xid:context.state.data_setup.McuOfflinePrepareID, + current_page: 1, + lastid: -1 + }) + } + } catch (e) { + context.commit("update_get_data_status", 3) + } + }, + async search(context, prm) { + context.commit("update_search_patient", 1) + try { + prm.token = one_token() + prm.mgm_mcuid = context.state.selected_mgmmcu.Mgm_McuID + 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.records) + context.commit("update_total_patient", data.total) + context.commit("update_no_save", 0) + + //context.commit("update_data_setup", resp.data.setup) + + } + } catch (e) { + context.commit("update_search_patient", 3) + context.commit("update_search_error_message", e.message) + console.log(e) + } + }, + async getsexreg(context) { + context.commit("update_get_data_status", 1) + try { + let resp = await api.getsexreg(one_token()) + 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 + } + context.commit("update_sexes", data.records.sexes) + context.commit("update_religions", data.records.religions) + context.commit("update_titles", data.records.titles) + context.commit("update_kartuidentitass", data.records.kartuidentitass) + } + } catch (e) { + context.commit("update_get_data_status", 3) + } + }, + async savecsv(context, prm) { + context.commit("update_save_status", 1) + try { + context.commit("update_loading_save", true) + prm.token = one_token() + let resp = await api.savecsv(prm) + if (resp.status != "OK") { + context.commit("update_loading_save", false) + context.commit("update_save_status", 3) + context.commit("update_open_dialog_info", true) + context.commit("update_msg_info", resp.message) + } else { + context.commit("update_loading_save", false) + context.commit("update_save_status", 2) + //location.reload() + context.dispatch("search", { + search:'', + current_page: 1, + lastid: -1 + }) + } + } catch (e) { + context.commit("update_loading_save", false) + context.commit("update_save_status", 3) + } + }, + async gotoreg(context, prm) { + context.commit("update_save_status", 1) + try { + prm.token = one_token() + let resp = await api.gotoreg(prm) + if (resp.status != "OK") { + context.commit("update_save_status", 3) + } else { + context.commit("update_save_status", 2) + var pre_id = prm.Mcu_PreregisterDetailsID + location.replace("/one-ui/test/vuex/one-fo-registration-v8/" + "?pre_id=" +pre_id) + } + } catch (e) { + context.commit("update_save_status", 3) + } + }, + async newpatient(context, prm) { + context.commit("update_save_status", 1) + try { + prm.token = one_token() + let resp = await api.newpatient(prm) + if (resp.status != "OK") { + context.commit("update_save_status", 3) + } else { + context.commit("update_save_status", 2) + console.log(resp.data.id) + context.commit("update_last_id", resp.data.id) + context.commit("update_dialog_success", true) + var msg = "Data pasien " + prm.M_PatientName + " sudah tersimpan dong ..." + context.commit("update_msg_success", msg) + + } + } catch (e) { + context.commit("update_save_status", 3) + } + }, + async delete(context, prm) { + context.commit("update_save_status", 1) + try { + prm.token = one_token() + let resp = await api.xdelete(prm) + if (resp.status != "OK") { + context.commit("update_save_status", 3) + } else { + context.commit("update_save_status", 2) + context.commit("update_last_id", 0) + context.commit("update_dialog_confirmation_delete", false) + context.commit("update_dialog_success", true) + var msg = "Data setup " + prm.code + " sudah dihapus dong ..." + context.commit("update_msg_success", msg) + context.commit("update_company", {}) + context.commit("update_selected_mous", []) + context.commit("update_mou", {}) + context.commit("update_selected_doctors", []) + context.commit("update_start_date", moment(new Date()).format('YYYY-MM-DD')) + context.commit("update_end_date", moment(new Date()).format('YYYY-MM-DD')) + context.commit("update_default_mou", {}) + context.commit("update_default_doctor", {}) + } + } catch (e) { + context.commit("update_save_status", 3) + } + }, + async getaddress(context, prm) { + context.commit("update_save_status", 1) + try { + prm.token = one_token() + let resp = await api.getaddress(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 + } + context.commit("update_addresses", data.records) + } + } catch (e) { + context.commit("update_save_status", 3) + } + }, + async savesetup(context, prm) { + context.commit("update_save_status", 1) + try { + prm.token = one_token() + let resp = await api.savesetup(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 + } + context.commit("update_company", {}) + context.commit("update_selected_mous", []) + context.commit("update_mou", {}) + context.commit("update_selected_doctors", []) + context.commit("update_start_date", moment(new Date()).format('YYYY-MM-DD')) + context.commit("update_end_date", moment(new Date()).format('YYYY-MM-DD')) + context.commit("update_default_mou", {}) + context.commit("update_default_doctor", {}) + context.commit("update_dialog_success", true) + if(context.state.act === 'new') + var msg = "Pembuatan setup nomor " + resp.data.records.xnumber + " sudah berhasil dong ..." + else + var msg = "Perubahan setup nomor " + resp.data.records.xnumber + " sudah berhasil dong ..." + + context.commit("update_msg_success", msg) + } + } catch (e) { + context.commit("update_save_status", 3) + } + }, + async searchcity(context, prm) { + context.commit("update_autocomplete_status", 1) + try { + let resp = await api.searchcity(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_cities", resp.data.records) + } + } catch (e) { + context.commit("update_autocomplete_status", 3) + } + }, + async searchdoctor(context,prm) { + context.commit("update_autocomplete_status",1) + try { + var xpar = {} + xpar.search = prm + xpar.token = one_token() + let resp= await api.searchdoctor(xpar) + 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 + } + var arr = resp.data.records + var xsel = context.state.selected_doctors + var filtered = arr.filter(o1 => xsel.filter(o2 => o2.id === o1.id).length === 0) + context.commit("update_doctors",filtered) + } + } catch(e) { + context.commit("update_autocomplete_status",3) + } + }, + async searchcompany(context,prm) { + context.commit("update_autocomplete_status",1) + try { + prm.token = one_token() + + let resp= await api.searchcompany(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 getdistrict(context, prm) { + context.commit("update_get_data_status", 1) + try { + let resp = await api.getdistrict(one_token(), 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 + } + context.commit("update_districts", resp.data.records) + } + } catch (e) { + context.commit("update_get_data_status", 3) + } + }, + async getkelurahan(context, prm) { + context.commit("update_get_data_status", 1) + try { + let resp = await api.getkelurahan(one_token(), 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 + } + context.commit("update_kelurahans", resp.data.records) + } + } catch (e) { + context.commit("update_get_data_status", 3) + } + }, + async savenewaddress(context, prm) { + context.commit("update_save_status", 1) + try { + prm.token = one_token() + let resp = await api.savenewaddress(prm) + if (resp.status != "OK") { + context.commit("update_save_status", 3) + } else { + context.commit("update_save_status", 2) + context.commit("update_dialog_form_address", false) + context.commit("update_last_id", prm.M_PatientAddressM_PatientID) + context.commit("update_dialog_success", true) + var msg = "Penambahan data alamat pasien " + prm.M_PatientName + " sudah berhasil dong ..." + context.commit("update_msg_success", msg) + + } + } catch (e) { + context.commit("update_save_status", 3) + } + }, + async saveeditaddress(context, prm) { + context.commit("update_save_status", 1) + try { + prm.token = one_token() + let resp = await api.saveeditaddress(prm) + if (resp.status != "OK") { + context.commit("update_save_status", 3) + } else { + context.commit("update_save_status", 2) + context.commit("update_dialog_form_address", false) + context.commit("update_last_id", prm.M_PatientAddressM_PatientID) + context.commit("update_dialog_success", true) + var msg = "Perubahan data alamat pasien " + prm.M_PatientName + " sudah berhasil dong ..." + context.commit("update_msg_success", msg) + + } + } catch (e) { + context.commit("update_save_status", 3) + } + }, + async deleteaddress(context, prm) { + context.commit("update_save_status", 1) + try { + prm.token = one_token() + let resp = await api.deleteaddress(prm) + if (resp.status != "OK") { + context.commit("update_save_status", 3) + } else { + context.commit("update_save_status", 2) + context.commit("update_dialog_confirmation_delete_addr", false) + context.commit("update_last_id", prm.M_PatientAddressM_PatientID) + context.commit("update_dialog_success", true) + var msg = "Penghapusan data alamat " + prm.M_PatientAddressNote + " dari pasien " + prm.M_PatientName + " sudah berhasil dong ..." + context.commit("update_msg_success", msg) + + } + } catch (e) { + context.commit("update_save_status", 3) + } + }, + async getmou(context,prm) { + context.commit("update_lookup_order",1) + try { + prm.token = one_token() + let resp= await api.getmou(prm) + if (resp.status != "OK") { + context.commit("update_lookup_order",3) + } else { + context.commit("update_lookup_order",2) + let data = { + records : resp.data.records, + total: resp.data.total + } + context.commit("update_mous",resp.data.records) + context.commit("update_mou",{}) + context.commit("update_selected_mous",[]) + } + } catch(e) { + context.commit("update_lookup_order",3) + } + }, + } +} \ No newline at end of file diff --git a/test/vuex/cpone-mcu-offline-preregister-v3/store.js b/test/vuex/cpone-mcu-offline-preregister-v3/store.js new file mode 100644 index 0000000..61cf2a1 --- /dev/null +++ b/test/vuex/cpone-mcu-offline-preregister-v3/store.js @@ -0,0 +1,27 @@ +// State +// data ... +// Mutations +// +// +// Actions +import patient from "./modules/patient.js"; +import system from "../../../apps/modules/system/system.js"; +export const store = new Vuex.Store({ + modules: { + patient: patient, + 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) + } + } +}); \ No newline at end of file