diff --git a/resources/js/Pages/Home/ArchiveHistoryModal/Index.vue b/resources/js/Pages/Home/ArchiveHistoryModal/Index.vue
index 4dd6988..6d2fc72 100644
--- a/resources/js/Pages/Home/ArchiveHistoryModal/Index.vue
+++ b/resources/js/Pages/Home/ArchiveHistoryModal/Index.vue
@@ -45,7 +45,7 @@ const loadPatientData = async () => {
loading.value = true
try {
- axios.get(`/api/si/patients/${props.patientId}?view_type=${filtersRef.value.view_type}`).then(res => {
+ await axios.get(`/api/si/patients/${props.patientId}?view_type=${filtersRef.value.view_type}`).then(res => {
patient.value = res.data
patientData.value = res.data.info
archiveInfo.value = res.data.archiveInfo ?? {
@@ -109,8 +109,15 @@ const rowProps = (row) => ({
}
})
-const onUpdateHistory = (updatedData) => {
- loadPatientData()
+const onUpdateHistory = async ({data}) => {
+ await loadPatientData()
+ const updatedData = {
+ status: archiveInfo.value.status,
+ }
+ emits('historyUpdated', {
+ data: updatedData,
+ patientId: props.patientId
+ })
}
const hasCreateNew = computed(() => archiveInfo.value === null)
@@ -119,11 +126,14 @@ const onSubmit = async () => {
try {
await axios.post(`/api/archive/histories/info/${props.patientId}`, archiveInfo.value).then(res => {
// onCloseWithoutSave()
+ const updatedData = {
+ status: archiveInfo.value.status,
+ }
emits('historyUpdated', {
- type: hasCreateNew.value ? 'created' : 'updated',
- data: res.data,
+ data: updatedData,
patientId: props.patientId
})
+ open.value = false
})
} catch (error) {
@@ -134,9 +144,9 @@ const onSubmit = async () => {
}
// Наблюдаем за изменением patientId
-watch(() => props.patientId, (newId) => {
+watch(() => props.patientId, async (newId) => {
if (newId) {
- loadPatientData()
+ await loadPatientData()
}
}, { immediate: true })
diff --git a/resources/js/Pages/Home/ArchiveHistoryMoveModal/Index.vue b/resources/js/Pages/Home/ArchiveHistoryMoveModal/Index.vue
index 3170c35..d89c1fb 100644
--- a/resources/js/Pages/Home/ArchiveHistoryMoveModal/Index.vue
+++ b/resources/js/Pages/Home/ArchiveHistoryMoveModal/Index.vue
@@ -73,12 +73,12 @@ const submit = () => {
: `/api/archive/histories/move/${archiveHistory.value.id}`
axios.post(url, archiveHistory.value).then(res => {
- onCloseWithoutSave()
emits('historyUpdated', {
type: props.isCreateNew ? 'created' : 'updated',
data: res.data,
historyId: archiveHistory.value.id
})
+ onCloseWithoutSave()
})
} catch (error) {
diff --git a/resources/js/Pages/Home/DataTable/Index.vue b/resources/js/Pages/Home/DataTable/Index.vue
index 39ca734..9ade34a 100644
--- a/resources/js/Pages/Home/DataTable/Index.vue
+++ b/resources/js/Pages/Home/DataTable/Index.vue
@@ -1,6 +1,6 @@
-
-
+
+