Добавил уведомление о создании отчета
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import AppLayout from "../../../Layouts/AppLayout.vue";
|
||||
import {NFlex, NTag, NDataTable, NButton, NTabs, NTabPane, NSpace} from 'naive-ui'
|
||||
import {useNotification} from "../../../Composables/useNotification.js"
|
||||
import AppContainer from "../../../Components/AppContainer.vue";
|
||||
import AppPanel from "../../../Components/AppPanel.vue";
|
||||
import ShiftPickerQuery from "../../../Components/ShiftPickerQuery.vue";
|
||||
@@ -163,13 +164,46 @@ const onClickDeleteButton = async (historyId) => {
|
||||
}
|
||||
}
|
||||
|
||||
const {success} = useNotification()
|
||||
|
||||
const notifyReportSaved = () => {
|
||||
const notification = success('Сохранено', 'Отчет успешно сохранен', {
|
||||
meta: '',
|
||||
duration: 5000,
|
||||
action: () => h(
|
||||
NButton,
|
||||
{
|
||||
text: true,
|
||||
type: 'success',
|
||||
onClick: () => {
|
||||
notification.destroy()
|
||||
router.visit('/')
|
||||
}
|
||||
},
|
||||
{default: () => 'Вернуться на главную страницу'}
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
const submit = () => {
|
||||
router.post('/nurse/report/save', {
|
||||
const queryString = window.location.search;
|
||||
const params = new URLSearchParams(queryString);
|
||||
const url = new URL(`${window.location.origin}/nurse/report/save`)
|
||||
const startAt = params.get('startAt')
|
||||
const endAt = params.get('endAt')
|
||||
if (startAt && startAt !== 'null') url.searchParams.append('startAt', startAt)
|
||||
if (endAt && endAt !== 'null') url.searchParams.append('endAt', endAt)
|
||||
|
||||
loading.value = true
|
||||
router.post(url.toString(), {
|
||||
userId: props.selectedUserId,
|
||||
departmentId: props.selectedDepartmentId,
|
||||
}, {
|
||||
onSuccess: () => {
|
||||
alert('Сохранено')
|
||||
notifyReportSaved()
|
||||
},
|
||||
onFinish: () => {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user