Flatten nested repos
This commit is contained in:
233
test/vuex/one-mcu-download/modules/samplecall.js
Normal file
233
test/vuex/one-mcu-download/modules/samplecall.js
Normal file
@@ -0,0 +1,233 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/samplecall.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
trx_id:0,
|
||||
trx_numbering:'NO.TRANSAKSI',
|
||||
last_id:-1,
|
||||
last_saved_id:-1,
|
||||
x_addr_id:0,
|
||||
act:'edit',
|
||||
act_addr:'new',
|
||||
get_data_status:0,
|
||||
search_transaction: 0,
|
||||
search_status: 0,
|
||||
search_error_message: '',
|
||||
transactions: [],
|
||||
selected_transaction: {},
|
||||
statuses:[],
|
||||
selected_status:{},
|
||||
transaction_date:moment(new Date()).format('DD-MM-YYYY'),
|
||||
transaction_time:moment(new Date()).format("hh:mm"),
|
||||
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: "",
|
||||
dialog_form_address: false,
|
||||
errors:[],
|
||||
dialog_action:false,
|
||||
msg_action:'',
|
||||
current_page:1,
|
||||
total_page:1,
|
||||
autocomplete_status:0,
|
||||
readonlyattime:true,
|
||||
readonlyhour:false,
|
||||
formulas:[{'code':'BMI','fx':'count_bmi'}],
|
||||
start_todo:false,
|
||||
zipname:"",
|
||||
todos: [
|
||||
{agreement:'',suffix:'',process:'N',section:'data_patient', icon: 'assignment', iconClass: 'blue white--text', title: 'Data Pasien', filename: '', progressvalue:0, complete:'N', actions:1 ,rest:1},
|
||||
{agreement:'',suffix:'',process:'N',section:'data_test',icon: 'assignment', iconClass: 'amber white--text', title: 'Data Pemeriksaan', filename: '', progressvalue:0 , complete:'N',actions:2, rest:2 },
|
||||
{agreement:'',suffix:'',process:'N',section:'data_price',icon: 'assignment', iconClass: 'teal white--text', title: 'Data Harga', filename: '', progressvalue:0 , complete:'N',actions:3, rest:3 }
|
||||
],
|
||||
agreements:[],
|
||||
selected_agreement:{},
|
||||
numbering_suffix:''
|
||||
},
|
||||
mutations: {
|
||||
update_numbering_suffix(state,value){
|
||||
state.numbering_suffix = value
|
||||
},
|
||||
update_zipname(state,value){
|
||||
state.zipname = value
|
||||
},
|
||||
update_start_todo(state,value){
|
||||
state.start_todo = value
|
||||
},
|
||||
update_todos(state,value){
|
||||
state.todos = value
|
||||
},
|
||||
update_formulas(state,val){
|
||||
state.formulas = val
|
||||
},
|
||||
update_trx_id(state,val){
|
||||
state.trx_id = val
|
||||
},
|
||||
update_trx_numbering(state,val){
|
||||
state.trx_numbering = val
|
||||
},
|
||||
update_foods(state,val){
|
||||
state.foods = val
|
||||
},
|
||||
update_notes(state,val){
|
||||
state.notes = val
|
||||
},
|
||||
update_total_page(state, val) {
|
||||
state.total_page = 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, transaction) {
|
||||
state.search_error_message = transaction
|
||||
},
|
||||
update_search_transaction(state, transaction) {
|
||||
state.search_transaction = transaction
|
||||
},
|
||||
update_transactions(state, data) {
|
||||
state.transactions = data
|
||||
},
|
||||
update_selected_transaction(state, val) {
|
||||
state.selected_transaction = 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_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_total_transactions(state, val) {
|
||||
state.total_transactions = val
|
||||
},
|
||||
update_dialog_action(state, val) {
|
||||
state.dialog_action = val
|
||||
},
|
||||
update_msg_action(state, val) {
|
||||
state.msg_action = val
|
||||
},
|
||||
update_autocomplete_status(state, val) {
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_agreements(state, val) {
|
||||
state.agreements = val
|
||||
},
|
||||
update_selected_agreement(state, val) {
|
||||
state.selected_agreement = val
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async runningtodo(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.runningtodo(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
|
||||
}
|
||||
prm.count = data.total
|
||||
context.commit("update_todos",data.records)
|
||||
context.commit("update_zipname",resp.data.zipname)
|
||||
var todos = data.records
|
||||
|
||||
var isComplete = 'Y'
|
||||
|
||||
todos.forEach(function(entry) {
|
||||
if(entry.complete === 'N')
|
||||
isComplete = 'N'
|
||||
})
|
||||
var newprm = {
|
||||
todos:todos
|
||||
}
|
||||
if( isComplete === 'N')
|
||||
context.dispatch("runningtodo",newprm)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async search_agreement(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.search_agreement(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_agreements",resp.data.records)
|
||||
//context.commit("update_selected_agreement",{})
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user