1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

добавление pop up уведомления

This commit is contained in:
MoonTestUse1
2025-01-05 05:23:22 +06:00
parent fba5b250a7
commit 357acd11a1
2 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
<template>
<Transition
enter-active-class="transform ease-out duration-300 transition"
enter-from-class="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"
enter-to-class="translate-y-0 opacity-100 sm:translate-x-0"
leave-active-class="transition ease-in duration-200"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
<div v-if="show" class="pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-green-50 shadow-lg ring-1 ring-black ring-opacity-5">
<div class="p-4">
<div class="flex items-start">
<div class="flex-shrink-0">
<svg class="h-6 w-6 text-green-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div class="ml-3 w-0 flex-1 pt-0.5">
<p class="text-sm font-medium text-green-800">{{ title }}</p>
<p class="mt-1 text-sm text-green-700">{{ message }}</p>
</div>
<div class="ml-4 flex flex-shrink-0">
<button
type="button"
class="inline-flex rounded-md bg-green-50 text-green-500 hover:text-green-600 focus:outline-none"
@click="$emit('close')"
>
<span class="sr-only">Закрыть</span>
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</button>
</div>
</div>
</div>
</div>
</Transition>
</template>
<script setup>
defineProps({
show: {
type: Boolean,
required: true
},
title: {
type: String,
default: 'Успешно'
},
message: {
type: String,
required: true
}
})
defineEmits(['close'])
</script>

View File

@@ -313,11 +313,22 @@
</form>
</div>
</div>
<!-- Уведомление -->
<div class="fixed bottom-4 right-4 z-50">
<Notification
:show="showNotification"
title="Заявка принята"
message="Ваша заявка успешно создана. Ожидайте ответа от службы поддержки."
@close="showNotification = false"
/>
</div>
</template>
<script setup>
import { ref, onMounted, computed } from 'vue'
import { useRouter } from 'vue-router'
import Notification from '@/components/Notification.vue'
const router = useRouter()
const requests = ref([])
@@ -325,6 +336,7 @@ const isSubmitting = ref(false)
const showRequestModal = ref(false)
const showRequestsModal = ref(false)
const isDarkMode = ref(false)
const showNotification = ref(false)
// Типы заявок
const requestTypes = [
@@ -460,6 +472,12 @@ const submitRequest = async () => {
}
showRequestModal.value = false
// Показываем уведомление
showNotification.value = true
setTimeout(() => {
showNotification.value = false
}, 5000) // Скрываем через 5 секунд
// Обновляем список заявок
await fetchRequests()
} catch (error) {