Fix right panel buttons not updating after save/validate in v8-all
test.status in template comes from selected_transaction.details[*].status, not from selected_transaction.status. Update details array too via shared _applyStatusUpdate action. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1296,6 +1296,23 @@ export default {
|
|||||||
context.commit("update_save_status", 3)
|
context.commit("update_save_status", 3)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
_applyStatusUpdate(context, rec) {
|
||||||
|
const statusMap = { NEW: 'BARU', VAL1: 'VALIDASI', VAL2: 'VERIFIKASI' }
|
||||||
|
const status_name = statusMap[rec.So_ResultEntryStatus] || 'NO TEMPLATE'
|
||||||
|
const status = rec.So_ResultEntryStatus
|
||||||
|
let transactions = [...context.state.transactions]
|
||||||
|
let idx = _.findIndex(transactions, t => t.re_id == rec.So_ResultEntryID)
|
||||||
|
if (idx !== -1) {
|
||||||
|
let trx = { ...transactions[idx], status_name, status }
|
||||||
|
if (trx.details && trx.details.length > 0) {
|
||||||
|
trx.details = trx.details.map(d => ({ ...d, status, status_name }))
|
||||||
|
}
|
||||||
|
transactions[idx] = trx
|
||||||
|
context.commit("update_transactions", transactions)
|
||||||
|
context.commit("update_selected_transaction", trx)
|
||||||
|
}
|
||||||
|
context.commit("update_cantedit", status_name !== 'BARU')
|
||||||
|
},
|
||||||
async saveresult(context, prm) {
|
async saveresult(context, prm) {
|
||||||
context.commit("update_save_status", 1)
|
context.commit("update_save_status", 1)
|
||||||
try {
|
try {
|
||||||
@@ -1311,19 +1328,8 @@ export default {
|
|||||||
context.commit("update_dialog_action", false)
|
context.commit("update_dialog_action", false)
|
||||||
var msg = "Order " + prm.trx_numbering + " pemeriksaan <span class='red--text'>" + prm.trx.test_name + "</span> berhasil diupdate dong ..."
|
var msg = "Order " + prm.trx_numbering + " pemeriksaan <span class='red--text'>" + prm.trx.test_name + "</span> berhasil diupdate dong ..."
|
||||||
context.commit("update_msg_success", msg)
|
context.commit("update_msg_success", msg)
|
||||||
if (resp.data && resp.data.records && resp.data.records.So_ResultEntryID) {
|
if (resp.data && resp.data.records && resp.data.records.So_ResultEntryID)
|
||||||
const rec = resp.data.records
|
context.dispatch("_applyStatusUpdate", resp.data.records)
|
||||||
const statusMap = { NEW: 'BARU', VAL1: 'VALIDASI', VAL2: 'VERIFIKASI' }
|
|
||||||
const status_name = statusMap[rec.So_ResultEntryStatus] || 'NO TEMPLATE'
|
|
||||||
let transactions = [...context.state.transactions]
|
|
||||||
let idx = _.findIndex(transactions, t => t.re_id == rec.So_ResultEntryID)
|
|
||||||
if (idx !== -1) {
|
|
||||||
transactions[idx] = { ...transactions[idx], status_name, status: rec.So_ResultEntryStatus }
|
|
||||||
context.commit("update_transactions", transactions)
|
|
||||||
context.commit("update_selected_transaction", transactions[idx])
|
|
||||||
}
|
|
||||||
context.commit("update_cantedit", status_name !== 'BARU')
|
|
||||||
}
|
|
||||||
context.commit("update_dialog_success", true)
|
context.commit("update_dialog_success", true)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -1370,19 +1376,8 @@ export default {
|
|||||||
context.commit("update_dialog_action", false)
|
context.commit("update_dialog_action", false)
|
||||||
var msg = "Order " + prm.trx_numbering + " pemeriksaan <span class='red--text'>" + prm.trx.test_name + "</span> berhasil diupdate dong ..."
|
var msg = "Order " + prm.trx_numbering + " pemeriksaan <span class='red--text'>" + prm.trx.test_name + "</span> berhasil diupdate dong ..."
|
||||||
context.commit("update_msg_success", msg)
|
context.commit("update_msg_success", msg)
|
||||||
if (resp.data && resp.data.records && resp.data.records.So_ResultEntryID) {
|
if (resp.data && resp.data.records && resp.data.records.So_ResultEntryID)
|
||||||
const rec = resp.data.records
|
context.dispatch("_applyStatusUpdate", resp.data.records)
|
||||||
const statusMap = { NEW: 'BARU', VAL1: 'VALIDASI', VAL2: 'VERIFIKASI' }
|
|
||||||
const status_name = statusMap[rec.So_ResultEntryStatus] || 'NO TEMPLATE'
|
|
||||||
let transactions = [...context.state.transactions]
|
|
||||||
let idx = _.findIndex(transactions, t => t.re_id == rec.So_ResultEntryID)
|
|
||||||
if (idx !== -1) {
|
|
||||||
transactions[idx] = { ...transactions[idx], status_name, status: rec.So_ResultEntryStatus }
|
|
||||||
context.commit("update_transactions", transactions)
|
|
||||||
context.commit("update_selected_transaction", transactions[idx])
|
|
||||||
}
|
|
||||||
context.commit("update_cantedit", status_name !== 'BARU')
|
|
||||||
}
|
|
||||||
context.commit("update_dialog_success", true)
|
context.commit("update_dialog_success", true)
|
||||||
if (context.state.search_lab_no !== '') {
|
if (context.state.search_lab_no !== '') {
|
||||||
console.log(context.state.next_url)
|
console.log(context.state.next_url)
|
||||||
|
|||||||
Reference in New Issue
Block a user