changes
This commit is contained in:
@@ -0,0 +1,395 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- Flash Messages -->
|
||||
<transition
|
||||
enter-active-class="transition duration-300 ease-out"
|
||||
enter-from-class="opacity-0 -translate-y-2"
|
||||
enter-to-class="opacity-100 translate-y-0"
|
||||
leave-active-class="transition duration-200 ease-in"
|
||||
leave-from-class="opacity-100 translate-y-0"
|
||||
leave-to-class="opacity-0 -translate-y-2"
|
||||
>
|
||||
<div v-if="$page.props.flash?.error" class="mb-4 p-4 bg-rose-500/10 border border-rose-500/20 rounded-lg">
|
||||
<div class="flex items-start gap-3">
|
||||
<DashboardIcon name="x-circle" size="5" class="text-rose-600 flex-shrink-0 mt-0.5" />
|
||||
<span class="text-sm text-foreground font-medium">{{ $page.props.flash.error }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<!-- Form Card -->
|
||||
<div class="bg-layer border border-layer-line rounded-lg shadow-xs">
|
||||
<!-- Tabs Navigation -->
|
||||
<div class="border-b border-line-2">
|
||||
<nav class="flex -mb-px px-6" aria-label="Tabs">
|
||||
<button
|
||||
type="button"
|
||||
@click="activeTab = 'main'"
|
||||
:class="[
|
||||
activeTab === 'main'
|
||||
? 'border-primary text-primary'
|
||||
: 'border-transparent text-muted-foreground-1 hover:text-foreground hover:border-line-2',
|
||||
'whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm transition-colors'
|
||||
]"
|
||||
>
|
||||
<div class="flex items-center gap-2">
|
||||
<DashboardIcon name="information-circle" size="4" />
|
||||
Основные данные
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@click="activeTab = 'content'"
|
||||
:class="[
|
||||
activeTab === 'content'
|
||||
? 'border-primary text-primary'
|
||||
: 'border-transparent text-muted-foreground-1 hover:text-foreground hover:border-line-2',
|
||||
'whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm transition-colors'
|
||||
]"
|
||||
>
|
||||
<div class="flex items-center gap-2">
|
||||
<DashboardIcon name="document-text" size="4" />
|
||||
Содержание программы
|
||||
</div>
|
||||
</button>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<form @submit.prevent="submit" class="p-6">
|
||||
<!-- Main Info Tab -->
|
||||
<div v-show="activeTab === 'main'" class="space-y-6">
|
||||
<!-- General Info Section -->
|
||||
<div>
|
||||
<h3 class="text-base font-medium text-foreground mb-4">Общая информация</h3>
|
||||
<p class="text-xs text-muted-foreground-1 mb-4">Основные сведения о программе</p>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<!-- Title -->
|
||||
<div>
|
||||
<label for="title" class="block text-sm font-medium text-foreground mb-2">
|
||||
Название программы <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="title"
|
||||
v-model="form.title"
|
||||
type="text"
|
||||
@blur="generateSlug"
|
||||
placeholder='Например: "Цифровые технологии в управлении"'
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-surface border rounded-lg text-sm text-foreground placeholder-muted-foreground-2 focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all',
|
||||
errors.title ? 'border-rose-500' : 'border-layer-line focus:border-primary'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.title" class="mt-1.5 text-xs text-rose-500">{{ errors.title }}</p>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Полное официальное название программы</p>
|
||||
</div>
|
||||
|
||||
<!-- Slug -->
|
||||
<div>
|
||||
<label for="slug" class="block text-sm font-medium text-foreground mb-2">
|
||||
URL-адрес <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="slug"
|
||||
v-model="form.slug"
|
||||
type="text"
|
||||
readonly
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-muted/30 border rounded-lg text-sm text-foreground cursor-not-allowed',
|
||||
errors.slug ? 'border-rose-500' : 'border-layer-line'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.slug" class="mt-1.5 text-xs text-rose-500">{{ errors.slug }}</p>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Человеко-понятный URL для страницы программы</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Category -->
|
||||
<div class="mt-6">
|
||||
<label for="category_id" class="block text-sm font-medium text-foreground mb-2">
|
||||
Категория <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<select
|
||||
id="category_id"
|
||||
v-model="form.category_id"
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-surface border rounded-lg text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all',
|
||||
errors.category_id ? 'border-rose-500' : 'border-layer-line focus:border-primary'
|
||||
]"
|
||||
>
|
||||
<option value="">Выберите категорию</option>
|
||||
<option v-for="category in categories" :key="category.id" :value="category.id">
|
||||
{{ category.title }}
|
||||
</option>
|
||||
</select>
|
||||
<p v-if="errors.category_id" class="mt-1.5 text-xs text-rose-500">{{ errors.category_id }}</p>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">К какой категории относится программа</p>
|
||||
</div>
|
||||
|
||||
<!-- Target Group -->
|
||||
<div class="mt-6">
|
||||
<label for="target_group" class="block text-sm font-medium text-foreground mb-2">
|
||||
Целевая аудитория <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="target_group"
|
||||
v-model="form.target_group"
|
||||
type="text"
|
||||
placeholder='Например: "Руководители среднего звена"'
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-surface border rounded-lg text-sm text-foreground placeholder-muted-foreground-2 focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all',
|
||||
errors.target_group ? 'border-rose-500' : 'border-layer-line focus:border-primary'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.target_group" class="mt-1.5 text-xs text-rose-500">{{ errors.target_group }}</p>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Для кого предназначена эта программа</p>
|
||||
</div>
|
||||
|
||||
<!-- Qualification -->
|
||||
<div class="mt-6">
|
||||
<label for="qualification" class="block text-sm font-medium text-foreground mb-2">
|
||||
Выдаваемый документ
|
||||
</label>
|
||||
<input
|
||||
id="qualification"
|
||||
v-model="form.qualification"
|
||||
type="text"
|
||||
placeholder='Например: "Удостоверение о повышении квалификации"'
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-surface border rounded-lg text-sm text-foreground placeholder-muted-foreground-2 focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all',
|
||||
errors.qualification ? 'border-rose-500' : 'border-layer-line focus:border-primary'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.qualification" class="mt-1.5 text-xs text-rose-500">{{ errors.qualification }}</p>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Какой документ получат слушатели</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Learning Parameters Section -->
|
||||
<div class="pt-6 border-t border-line-2">
|
||||
<h3 class="text-base font-medium text-foreground mb-4">Параметры обучения</h3>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<!-- Price -->
|
||||
<div>
|
||||
<label for="price" class="block text-sm font-medium text-foreground mb-2">
|
||||
Стоимость (руб) <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="price"
|
||||
v-model="form.price"
|
||||
type="number"
|
||||
min="0"
|
||||
placeholder="Укажите стоимость"
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-surface border rounded-lg text-sm text-foreground placeholder-muted-foreground-2 focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all',
|
||||
errors.price ? 'border-rose-500' : 'border-layer-line focus:border-primary'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.price" class="mt-1.5 text-xs text-rose-500">{{ errors.price }}</p>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Полная стоимость программы</p>
|
||||
</div>
|
||||
|
||||
<!-- Learning Time -->
|
||||
<div>
|
||||
<label for="learning_time" class="block text-sm font-medium text-foreground mb-2">
|
||||
Объем (часов) <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="learning_time"
|
||||
v-model="form.learning_time"
|
||||
type="number"
|
||||
min="1"
|
||||
placeholder="Укажите количество часов"
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-surface border rounded-lg text-sm text-foreground placeholder-muted-foreground-2 focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all',
|
||||
errors.learning_time ? 'border-rose-500' : 'border-layer-line focus:border-primary'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.learning_time" class="mt-1.5 text-xs text-rose-500">{{ errors.learning_time }}</p>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Общий объем программы в академических часах</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Form Education -->
|
||||
<div class="mt-6">
|
||||
<label for="form_education" class="block text-sm font-medium text-foreground mb-2">
|
||||
Форма обучения <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<select
|
||||
id="form_education"
|
||||
v-model="form.form_education"
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-surface border rounded-lg text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all',
|
||||
errors.form_education ? 'border-rose-500' : 'border-layer-line focus:border-primary'
|
||||
]"
|
||||
>
|
||||
<option value="">Выберите форму</option>
|
||||
<option v-for="formEducation in educationForms" :key="formEducation.value" :value="formEducation.value">
|
||||
{{ formEducation.label }}
|
||||
</option>
|
||||
</select>
|
||||
<p v-if="errors.form_education" class="mt-1.5 text-xs text-rose-500">{{ errors.form_education }}</p>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Основная форма проведения занятий</p>
|
||||
</div>
|
||||
|
||||
<!-- Is Active -->
|
||||
<div class="mt-6 flex items-center gap-3">
|
||||
<label for="is_active" class="text-sm font-medium text-foreground">
|
||||
Активна для записи
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
id="is_active"
|
||||
@click="form.is_active = !form.is_active"
|
||||
:class="[
|
||||
'relative inline-flex h-6 w-11 items-center rounded-full transition-colors',
|
||||
form.is_active ? 'bg-primary' : 'bg-muted'
|
||||
]"
|
||||
>
|
||||
<span
|
||||
:class="[
|
||||
'inline-block h-4 w-4 transform rounded-full bg-white transition-transform',
|
||||
form.is_active ? 'translate-x-6' : 'translate-x-1'
|
||||
]"
|
||||
/>
|
||||
</button>
|
||||
<span class="text-xs text-muted-foreground-1">Отображать ли программу на сайте</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Content Tab -->
|
||||
<div v-show="activeTab === 'content'">
|
||||
<div class="mb-4">
|
||||
<h3 class="text-base font-medium text-foreground mb-2">Описание программы</h3>
|
||||
<p class="text-xs text-muted-foreground-1">Создайте подробное описание программы с помощью конструктора</p>
|
||||
</div>
|
||||
|
||||
<ContentBuilder
|
||||
v-model="form.content"
|
||||
label="Содержание программы"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Submit Button -->
|
||||
<div class="flex items-center justify-end gap-3 mt-8 pt-6 border-t border-line-2">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.index')"
|
||||
class="inline-flex items-center gap-2 px-4 py-2.5 bg-surface border border-layer-line text-foreground text-sm font-medium rounded-lg hover:bg-muted-hover transition-all"
|
||||
>
|
||||
Отмена
|
||||
</a>
|
||||
<button
|
||||
type="submit"
|
||||
:disabled="processing"
|
||||
class="inline-flex items-center gap-2 px-4 py-2.5 bg-primary text-white text-sm font-medium rounded-lg hover:bg-primary-hover transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<svg v-if="processing" class="animate-spin h-4 w-4" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
|
||||
</svg>
|
||||
<DashboardIcon v-else name="check" size="4" />
|
||||
{{ processing ? 'Сохранение...' : submitLabel }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardIcon from '../Components/DashboardIcon.vue';
|
||||
import ContentBuilder from '../Components/ContentBuilder/ContentBuilder.vue';
|
||||
|
||||
export default {
|
||||
name: 'AdditionalEducationForm',
|
||||
components: {
|
||||
DashboardIcon,
|
||||
ContentBuilder
|
||||
},
|
||||
|
||||
props: {
|
||||
education: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
categories: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
educationForms: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
submitLabel: {
|
||||
type: String,
|
||||
default: 'Создать программу'
|
||||
},
|
||||
submitRoute: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
submitMethod: {
|
||||
type: String,
|
||||
default: 'post'
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
activeTab: 'main',
|
||||
form: {
|
||||
title: this.education?.title || '',
|
||||
slug: this.education?.slug || '',
|
||||
category_id: this.education?.category_id || '',
|
||||
target_group: this.education?.target_group || '',
|
||||
qualification: this.education?.qualification || '',
|
||||
price: this.education?.price || '',
|
||||
learning_time: this.education?.learning_time || '',
|
||||
form_education: this.education?.form_education || '',
|
||||
is_active: this.education?.is_active ?? true,
|
||||
content: this.education?.content || []
|
||||
},
|
||||
errors: {},
|
||||
processing: false
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
generateSlug() {
|
||||
if (this.form.title && !this.education) {
|
||||
this.form.slug = this.GENERATE_SLUG(this.form.title);
|
||||
}
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.processing = true;
|
||||
this.errors = {};
|
||||
|
||||
const routeName = this.submitRoute;
|
||||
const method = this.submitMethod;
|
||||
|
||||
if (method === 'put') {
|
||||
this.$inertia.put(route(routeName, this.education.id), this.form, {
|
||||
onFinish: () => {
|
||||
this.processing = false;
|
||||
},
|
||||
onError: (errors) => {
|
||||
this.errors = errors;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$inertia.post(route(routeName), this.form, {
|
||||
onFinish: () => {
|
||||
this.processing = false;
|
||||
},
|
||||
onError: (errors) => {
|
||||
this.errors = errors;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<div class="min-h-screen bg-background-2">
|
||||
<div class="border-b border-line-2 bg-layer/50 backdrop-blur-sm sticky top-0 z-10 h-16">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-full">
|
||||
<div class="flex items-center h-full gap-3">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.categories.index')"
|
||||
class="p-2 text-muted-foreground-1 hover:text-foreground hover:bg-muted-hover rounded-lg transition-all"
|
||||
>
|
||||
<DashboardIcon name="arrow-left" size="5" />
|
||||
</a>
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center">
|
||||
<DashboardIcon name="plus" size="5" class="text-primary" />
|
||||
</div>
|
||||
<div>
|
||||
<h1 class="text-lg font-medium text-foreground">Создание категории ДПО</h1>
|
||||
<p class="text-xs text-muted-foreground-1">Заполните информацию о новой категории</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
|
||||
<FlashMessages />
|
||||
|
||||
<div class="bg-layer border border-layer-line rounded-lg shadow-xs">
|
||||
<div class="p-6 border-b border-line-2">
|
||||
<div class="flex items-center gap-2">
|
||||
<DashboardIcon name="document-text" size="5" class="text-primary" />
|
||||
<h2 class="text-base font-medium text-foreground">Основная информация</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form @submit.prevent="submit" class="p-6">
|
||||
<div class="space-y-6">
|
||||
<div>
|
||||
<label for="title" class="block text-sm font-medium text-foreground mb-2">
|
||||
Название категории <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="title"
|
||||
v-model="form.title"
|
||||
type="text"
|
||||
@blur="generateSlug"
|
||||
placeholder='Например: "Профессиональная переподготовка"'
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-surface border rounded-lg text-sm text-foreground placeholder-muted-foreground-2 focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all',
|
||||
errors.title ? 'border-rose-500' : 'border-layer-line focus:border-primary'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.title" class="mt-1.5 text-xs text-rose-500">{{ errors.title }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="slug" class="block text-sm font-medium text-foreground mb-2">
|
||||
URL-идентификатор <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="slug"
|
||||
v-model="form.slug"
|
||||
type="text"
|
||||
readonly
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-muted/30 border rounded-lg text-sm text-foreground cursor-not-allowed',
|
||||
errors.slug ? 'border-rose-500' : 'border-layer-line'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.slug" class="mt-1.5 text-xs text-rose-500">{{ errors.slug }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="dir_addit_educat_id" class="block text-sm font-medium text-foreground mb-2">
|
||||
Направление ДПО <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<select
|
||||
id="dir_addit_educat_id"
|
||||
v-model="form.dir_addit_educat_id"
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-surface border rounded-lg text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all',
|
||||
errors.dir_addit_educat_id ? 'border-rose-500' : 'border-layer-line focus:border-primary'
|
||||
]"
|
||||
>
|
||||
<option value="">Выберите направление</option>
|
||||
<option v-for="direction in directions" :key="direction.id" :value="direction.id">
|
||||
{{ direction.title }}
|
||||
</option>
|
||||
</select>
|
||||
<p v-if="errors.dir_addit_educat_id" class="mt-1.5 text-xs text-rose-500">{{ errors.dir_addit_educat_id }}</p>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3">
|
||||
<label for="is_active" class="text-sm font-medium text-foreground">
|
||||
Активная категория
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
id="is_active"
|
||||
@click="form.is_active = !form.is_active"
|
||||
:class="[
|
||||
'relative inline-flex h-6 w-11 items-center rounded-full transition-colors',
|
||||
form.is_active ? 'bg-primary' : 'bg-muted'
|
||||
]"
|
||||
>
|
||||
<span
|
||||
:class="[
|
||||
'inline-block h-4 w-4 transform rounded-full bg-white transition-transform',
|
||||
form.is_active ? 'translate-x-6' : 'translate-x-1'
|
||||
]"
|
||||
/>
|
||||
</button>
|
||||
<span class="text-xs text-muted-foreground-1">Отображать ли категорию на сайте</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 mt-8 pt-6 border-t border-line-2">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.categories.index')"
|
||||
class="inline-flex items-center gap-2 px-4 py-2.5 bg-surface border border-layer-line text-foreground text-sm font-medium rounded-lg hover:bg-muted-hover transition-all"
|
||||
>
|
||||
Отмена
|
||||
</a>
|
||||
<button
|
||||
type="submit"
|
||||
:disabled="processing"
|
||||
class="inline-flex items-center gap-2 px-4 py-2.5 bg-primary text-white text-sm font-medium rounded-lg hover:bg-primary-hover transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<svg v-if="processing" class="animate-spin h-4 w-4" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
|
||||
</svg>
|
||||
<DashboardIcon v-else name="check" size="4" />
|
||||
{{ processing ? 'Сохранение...' : 'Создать категорию' }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardIcon from '../../Components/DashboardIcon.vue';
|
||||
import FlashMessages from '../../Components/shared/FlashMessages.vue';
|
||||
|
||||
export default {
|
||||
name: 'CategoryCreate',
|
||||
components: {
|
||||
DashboardIcon,
|
||||
FlashMessages
|
||||
},
|
||||
|
||||
props: {
|
||||
directions: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
title: '',
|
||||
slug: '',
|
||||
dir_addit_educat_id: '',
|
||||
is_active: true
|
||||
},
|
||||
errors: {},
|
||||
processing: false
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE('Создание категории ДПО');
|
||||
},
|
||||
|
||||
methods: {
|
||||
generateSlug() {
|
||||
if (this.form.title) {
|
||||
this.form.slug = this.GENERATE_SLUG(this.form.title);
|
||||
}
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.processing = true;
|
||||
this.errors = {};
|
||||
|
||||
this.$inertia.post(route('dashboard.additional-educations.categories.store'), this.form, {
|
||||
onFinish: () => {
|
||||
this.processing = false;
|
||||
},
|
||||
onError: (errors) => {
|
||||
this.errors = errors;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,204 @@
|
||||
<template>
|
||||
<div class="min-h-screen bg-background-2">
|
||||
<div class="border-b border-line-2 bg-layer/50 backdrop-blur-sm sticky top-0 z-10 h-16">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-full">
|
||||
<div class="flex items-center h-full gap-3">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.categories.index')"
|
||||
class="p-2 text-muted-foreground-1 hover:text-foreground hover:bg-muted-hover rounded-lg transition-all"
|
||||
>
|
||||
<DashboardIcon name="arrow-left" size="5" />
|
||||
</a>
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center">
|
||||
<DashboardIcon name="pencil-square" size="5" class="text-primary" />
|
||||
</div>
|
||||
<div>
|
||||
<h1 class="text-lg font-medium text-foreground">Редактирование категории ДПО</h1>
|
||||
<p class="text-xs text-muted-foreground-1">{{ category?.title }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
|
||||
<FlashMessages />
|
||||
|
||||
<div class="bg-layer border border-layer-line rounded-lg shadow-xs">
|
||||
<div class="p-6 border-b border-line-2">
|
||||
<div class="flex items-center gap-2">
|
||||
<DashboardIcon name="document-text" size="5" class="text-primary" />
|
||||
<h2 class="text-base font-medium text-foreground">Основная информация</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form @submit.prevent="submit" class="p-6">
|
||||
<div class="space-y-6">
|
||||
<div>
|
||||
<label for="title" class="block text-sm font-medium text-foreground mb-2">
|
||||
Название категории <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="title"
|
||||
v-model="form.title"
|
||||
type="text"
|
||||
@blur="generateSlug"
|
||||
placeholder='Например: "Профессиональная переподготовка"'
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-surface border rounded-lg text-sm text-foreground placeholder-muted-foreground-2 focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all',
|
||||
errors.title ? 'border-rose-500' : 'border-layer-line focus:border-primary'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.title" class="mt-1.5 text-xs text-rose-500">{{ errors.title }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="slug" class="block text-sm font-medium text-foreground mb-2">
|
||||
URL-идентификатор <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="slug"
|
||||
v-model="form.slug"
|
||||
type="text"
|
||||
readonly
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-muted/30 border rounded-lg text-sm text-foreground cursor-not-allowed',
|
||||
errors.slug ? 'border-rose-500' : 'border-layer-line'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.slug" class="mt-1.5 text-xs text-rose-500">{{ errors.slug }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="dir_addit_educat_id" class="block text-sm font-medium text-foreground mb-2">
|
||||
Направление ДПО <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<select
|
||||
id="dir_addit_educat_id"
|
||||
v-model="form.dir_addit_educat_id"
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-surface border rounded-lg text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all',
|
||||
errors.dir_addit_educat_id ? 'border-rose-500' : 'border-layer-line focus:border-primary'
|
||||
]"
|
||||
>
|
||||
<option value="">Выберите направление</option>
|
||||
<option v-for="direction in directions" :key="direction.id" :value="direction.id">
|
||||
{{ direction.title }}
|
||||
</option>
|
||||
</select>
|
||||
<p v-if="errors.dir_addit_educat_id" class="mt-1.5 text-xs text-rose-500">{{ errors.dir_addit_educat_id }}</p>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3">
|
||||
<label for="is_active" class="text-sm font-medium text-foreground">
|
||||
Активная категория
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
id="is_active"
|
||||
@click="form.is_active = !form.is_active"
|
||||
:class="[
|
||||
'relative inline-flex h-6 w-11 items-center rounded-full transition-colors',
|
||||
form.is_active ? 'bg-primary' : 'bg-muted'
|
||||
]"
|
||||
>
|
||||
<span
|
||||
:class="[
|
||||
'inline-block h-4 w-4 transform rounded-full bg-white transition-transform',
|
||||
form.is_active ? 'translate-x-6' : 'translate-x-1'
|
||||
]"
|
||||
/>
|
||||
</button>
|
||||
<span class="text-xs text-muted-foreground-1">Отображать ли категорию на сайте</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 mt-8 pt-6 border-t border-line-2">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.categories.index')"
|
||||
class="inline-flex items-center gap-2 px-4 py-2.5 bg-surface border border-layer-line text-foreground text-sm font-medium rounded-lg hover:bg-muted-hover transition-all"
|
||||
>
|
||||
Отмена
|
||||
</a>
|
||||
<button
|
||||
type="submit"
|
||||
:disabled="processing"
|
||||
class="inline-flex items-center gap-2 px-4 py-2.5 bg-primary text-white text-sm font-medium rounded-lg hover:bg-primary-hover transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<svg v-if="processing" class="animate-spin h-4 w-4" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
|
||||
</svg>
|
||||
<DashboardIcon v-else name="check" size="4" />
|
||||
{{ processing ? 'Сохранение...' : 'Сохранить изменения' }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardIcon from '../../Components/DashboardIcon.vue';
|
||||
import FlashMessages from '../../Components/shared/FlashMessages.vue';
|
||||
|
||||
export default {
|
||||
name: 'CategoryEdit',
|
||||
components: {
|
||||
DashboardIcon,
|
||||
FlashMessages
|
||||
},
|
||||
|
||||
props: {
|
||||
category: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
directions: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
title: this.category?.title || '',
|
||||
slug: this.category?.slug || '',
|
||||
dir_addit_educat_id: this.category?.dir_addit_educat_id || '',
|
||||
is_active: this.category?.is_active ?? true
|
||||
},
|
||||
errors: {},
|
||||
processing: false
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE(`Редактирование категории - ${this.category?.title}`);
|
||||
},
|
||||
|
||||
methods: {
|
||||
generateSlug() {
|
||||
if (this.form.title && !this.form.slug) {
|
||||
this.form.slug = this.GENERATE_SLUG(this.form.title);
|
||||
}
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.processing = true;
|
||||
this.errors = {};
|
||||
|
||||
this.$inertia.put(route('dashboard.additional-educations.categories.update', this.category.id), this.form, {
|
||||
onFinish: () => {
|
||||
this.processing = false;
|
||||
},
|
||||
onError: (errors) => {
|
||||
this.errors = errors;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,242 @@
|
||||
<template>
|
||||
<DashboardLayout>
|
||||
<template #header-icon>
|
||||
<DashboardIcon name="tag" size="5" class="text-primary" />
|
||||
</template>
|
||||
<template #header-title>Категории ДПО</template>
|
||||
<template #header-subtitle>Управление категориями программ дополнительного образования</template>
|
||||
<template #header-actions>
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.categories.create')"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 bg-primary text-white text-sm font-medium rounded-lg hover:bg-primary-hover transition-all duration-200 shadow-sm hover:shadow-md"
|
||||
>
|
||||
<DashboardIcon name="plus" size="4" />
|
||||
Добавить категорию
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<FlashMessages />
|
||||
|
||||
<DataFilters title="Фильтры" @reset="resetFilters">
|
||||
<SearchInput
|
||||
v-model="searchQuery"
|
||||
label="Поиск"
|
||||
placeholder="Введите название категории..."
|
||||
@search="search"
|
||||
/>
|
||||
|
||||
<SelectFilter
|
||||
v-model="directionQuery"
|
||||
label="Направление"
|
||||
placeholder="Все направления"
|
||||
@change="filterByDirection"
|
||||
>
|
||||
<option v-for="direction in directions" :key="direction.id" :value="direction.id">
|
||||
{{ direction.title }}
|
||||
</option>
|
||||
</SelectFilter>
|
||||
|
||||
<SelectFilter
|
||||
v-model="isActiveQuery"
|
||||
label="Статус"
|
||||
placeholder="Все"
|
||||
@change="filterByActive"
|
||||
>
|
||||
<option value="">Все</option>
|
||||
<option value="1">Активные</option>
|
||||
<option value="0">Неактивные</option>
|
||||
</SelectFilter>
|
||||
</DataFilters>
|
||||
|
||||
<div class="bg-layer border border-layer-line rounded-lg shadow-xs overflow-hidden">
|
||||
<div class="px-6 py-4 border-b border-line-2 bg-surface/50">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center gap-4">
|
||||
<span class="text-sm text-foreground">
|
||||
Всего: <span class="font-medium">{{ categories.total }}</span>
|
||||
</span>
|
||||
<span class="text-xs text-muted-foreground-1 px-2 py-0.5 bg-primary/10 text-primary rounded-full">
|
||||
{{ categories.data.length }} на странице
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
@click="refreshPage"
|
||||
class="p-2 text-muted-foreground-1 hover:text-foreground hover:bg-muted-hover rounded-lg transition-all"
|
||||
title="Обновить"
|
||||
>
|
||||
<DashboardIcon name="arrow-path" size="4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full divide-y divide-line-2">
|
||||
<thead class="bg-surface/50">
|
||||
<tr>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Название
|
||||
</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Направление
|
||||
</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Статус
|
||||
</th>
|
||||
<th class="px-6 py-3 text-right text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Действия
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-line-2">
|
||||
<tr
|
||||
v-for="category in categories.data"
|
||||
:key="category.id"
|
||||
class="group hover:bg-muted-hover/50 transition-all duration-200"
|
||||
>
|
||||
<td class="px-6 py-4">
|
||||
<div class="text-sm font-medium text-foreground group-hover:text-primary transition-colors">
|
||||
{{ TEXT_LIMIT(category.title, 50) }}
|
||||
</div>
|
||||
<div class="text-xs text-muted-foreground-1 mt-0.5">
|
||||
/{{ category.slug }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-md text-xs font-medium border bg-primary/10 text-primary border-primary/20">
|
||||
{{ category.direction?.title || '—' }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span :class="STATUS_BADGE_CLASS(category.is_active)">
|
||||
{{ category.is_active ? 'Активна' : 'Неактивна' }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-right">
|
||||
<div class="flex items-center justify-end gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.categories.edit', category.id)"
|
||||
class="p-2 text-muted-foreground-1 hover:text-primary hover:bg-primary/10 rounded-lg transition-all"
|
||||
title="Редактировать"
|
||||
>
|
||||
<DashboardIcon name="pencil-square" size="4" />
|
||||
</a>
|
||||
<button
|
||||
@click.prevent="deleteCategory(category)"
|
||||
class="p-2 text-muted-foreground-1 hover:text-rose-600 hover:bg-rose-500/10 rounded-lg transition-all"
|
||||
title="Удалить"
|
||||
>
|
||||
<DashboardIcon name="trash" size="4" />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<EmptyState
|
||||
v-if="categories.data.length === 0"
|
||||
:columns="4"
|
||||
title="Категории не найдены"
|
||||
description="Создайте первую категорию дополнительного образования или измените параметры поиска"
|
||||
:action-url="route('dashboard.additional-educations.categories.create')"
|
||||
action-text="Добавить категорию"
|
||||
icon-path="M9.568 3H5.25A2.25 2.25 0 003 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 005.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 009.568 3z"
|
||||
/>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<Pagination :data="categories" />
|
||||
</div>
|
||||
</DashboardLayout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardLayout from '../../Components/DashboardLayout.vue';
|
||||
import DashboardIcon from '../../Components/DashboardIcon.vue';
|
||||
import FlashMessages from '../../Components/shared/FlashMessages.vue';
|
||||
import DataFilters from '../../Components/shared/DataFilters.vue';
|
||||
import SearchInput from '../../Components/shared/SearchInput.vue';
|
||||
import SelectFilter from '../../Components/shared/SelectFilter.vue';
|
||||
import EmptyState from '../../Components/shared/EmptyState.vue';
|
||||
import Pagination from '../../Components/shared/Pagination.vue';
|
||||
|
||||
export default {
|
||||
name: 'CategoryIndex',
|
||||
components: {
|
||||
DashboardLayout,
|
||||
DashboardIcon,
|
||||
FlashMessages,
|
||||
DataFilters,
|
||||
SearchInput,
|
||||
SelectFilter,
|
||||
EmptyState,
|
||||
Pagination
|
||||
},
|
||||
|
||||
props: {
|
||||
categories: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
filters: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
direction_id: '',
|
||||
is_active: '',
|
||||
search: ''
|
||||
})
|
||||
},
|
||||
directions: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
searchQuery: this.filters?.search || '',
|
||||
directionQuery: this.filters?.direction_id || '',
|
||||
isActiveQuery: this.filters?.is_active || ''
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE('Категории ДПО');
|
||||
},
|
||||
|
||||
methods: {
|
||||
search() {
|
||||
this.INERTIA_FILTER('dashboard.additional-educations.categories.index', {
|
||||
search: this.searchQuery,
|
||||
direction_id: this.directionQuery,
|
||||
is_active: this.isActiveQuery
|
||||
});
|
||||
},
|
||||
|
||||
filterByDirection() {
|
||||
this.search();
|
||||
},
|
||||
|
||||
filterByActive() {
|
||||
this.search();
|
||||
},
|
||||
|
||||
resetFilters() {
|
||||
this.RESET_FILTERS(
|
||||
['searchQuery', 'directionQuery', 'isActiveQuery'],
|
||||
'dashboard.additional-educations.categories.index'
|
||||
);
|
||||
},
|
||||
|
||||
refreshPage() {
|
||||
this.search();
|
||||
},
|
||||
|
||||
deleteCategory(category) {
|
||||
this.CONFIRM_AND_DELETE(category, 'dashboard.additional-educations.categories.destroy', {
|
||||
message: 'Удалить категорию "' + category.title + '"?'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<div class="min-h-screen bg-background-2">
|
||||
<!-- Header -->
|
||||
<div class="border-b border-line-2 bg-layer/50 backdrop-blur-sm sticky top-0 z-10 h-16">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-full">
|
||||
<div class="flex items-center h-full gap-3">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.index')"
|
||||
class="p-2 text-muted-foreground-1 hover:text-foreground hover:bg-muted-hover rounded-lg transition-all"
|
||||
>
|
||||
<DashboardIcon name="arrow-left" size="5" />
|
||||
</a>
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center">
|
||||
<DashboardIcon name="plus" size="5" class="text-primary" />
|
||||
</div>
|
||||
<div>
|
||||
<h1 class="text-lg font-medium text-foreground">Создание программы ДПО</h1>
|
||||
<p class="text-xs text-muted-foreground-1">Заполните информацию о новой программе дополнительного образования</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Main Content -->
|
||||
<div class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
|
||||
<AdditionalEducationForm
|
||||
:categories="categories"
|
||||
:education-forms="educationForms"
|
||||
submit-label="Создать программу"
|
||||
submit-route="dashboard.additional-educations.store"
|
||||
submit-method="post"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardIcon from '../Components/DashboardIcon.vue';
|
||||
import AdditionalEducationForm from './AdditionalEducationForm.vue';
|
||||
|
||||
export default {
|
||||
name: 'AdditionalEducationCreate',
|
||||
components: {
|
||||
DashboardIcon,
|
||||
AdditionalEducationForm
|
||||
},
|
||||
|
||||
props: {
|
||||
categories: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
educationForms: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE('Создание программы ДПО');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<div class="min-h-screen bg-background-2">
|
||||
<div class="border-b border-line-2 bg-layer/50 backdrop-blur-sm sticky top-0 z-10 h-16">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-full">
|
||||
<div class="flex items-center h-full gap-3">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.directions.index')"
|
||||
class="p-2 text-muted-foreground-1 hover:text-foreground hover:bg-muted-hover rounded-lg transition-all"
|
||||
>
|
||||
<DashboardIcon name="arrow-left" size="5" />
|
||||
</a>
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center">
|
||||
<DashboardIcon name="plus" size="5" class="text-primary" />
|
||||
</div>
|
||||
<div>
|
||||
<h1 class="text-lg font-medium text-foreground">Создание направления ДПО</h1>
|
||||
<p class="text-xs text-muted-foreground-1">Заполните информацию о новом направлении</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
|
||||
<FlashMessages />
|
||||
|
||||
<div class="bg-layer border border-layer-line rounded-lg shadow-xs">
|
||||
<div class="p-6 border-b border-line-2">
|
||||
<div class="flex items-center gap-2">
|
||||
<DashboardIcon name="document-text" size="5" class="text-primary" />
|
||||
<h2 class="text-base font-medium text-foreground">Основная информация</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form @submit.prevent="submit" class="p-6">
|
||||
<div class="space-y-6">
|
||||
<div>
|
||||
<label for="title" class="block text-sm font-medium text-foreground mb-2">
|
||||
Название направления <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="title"
|
||||
v-model="form.title"
|
||||
type="text"
|
||||
@blur="generateSlug"
|
||||
placeholder='Например: "Информационные технологии"'
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-surface border rounded-lg text-sm text-foreground placeholder-muted-foreground-2 focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all',
|
||||
errors.title ? 'border-rose-500' : 'border-layer-line focus:border-primary'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.title" class="mt-1.5 text-xs text-rose-500">{{ errors.title }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="slug" class="block text-sm font-medium text-foreground mb-2">
|
||||
URL-идентификатор <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="slug"
|
||||
v-model="form.slug"
|
||||
type="text"
|
||||
readonly
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-muted/30 border rounded-lg text-sm text-foreground cursor-not-allowed',
|
||||
errors.slug ? 'border-rose-500' : 'border-layer-line'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.slug" class="mt-1.5 text-xs text-rose-500">{{ errors.slug }}</p>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3">
|
||||
<label for="is_active" class="text-sm font-medium text-foreground">
|
||||
Активное направление
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
id="is_active"
|
||||
@click="form.is_active = !form.is_active"
|
||||
:class="[
|
||||
'relative inline-flex h-6 w-11 items-center rounded-full transition-colors',
|
||||
form.is_active ? 'bg-primary' : 'bg-muted'
|
||||
]"
|
||||
>
|
||||
<span
|
||||
:class="[
|
||||
'inline-block h-4 w-4 transform rounded-full bg-white transition-transform',
|
||||
form.is_active ? 'translate-x-6' : 'translate-x-1'
|
||||
]"
|
||||
/>
|
||||
</button>
|
||||
<span class="text-xs text-muted-foreground-1">Отображать ли направление на сайте</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 mt-8 pt-6 border-t border-line-2">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.directions.index')"
|
||||
class="inline-flex items-center gap-2 px-4 py-2.5 bg-surface border border-layer-line text-foreground text-sm font-medium rounded-lg hover:bg-muted-hover transition-all"
|
||||
>
|
||||
Отмена
|
||||
</a>
|
||||
<button
|
||||
type="submit"
|
||||
:disabled="processing"
|
||||
class="inline-flex items-center gap-2 px-4 py-2.5 bg-primary text-white text-sm font-medium rounded-lg hover:bg-primary-hover transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<svg v-if="processing" class="animate-spin h-4 w-4" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
|
||||
</svg>
|
||||
<DashboardIcon v-else name="check" size="4" />
|
||||
{{ processing ? 'Сохранение...' : 'Создать направление' }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardIcon from '../../Components/DashboardIcon.vue';
|
||||
import FlashMessages from '../../Components/shared/FlashMessages.vue';
|
||||
|
||||
export default {
|
||||
name: 'DirectionCreate',
|
||||
components: {
|
||||
DashboardIcon,
|
||||
FlashMessages
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
title: '',
|
||||
slug: '',
|
||||
is_active: true
|
||||
},
|
||||
errors: {},
|
||||
processing: false
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE('Создание направления ДПО');
|
||||
},
|
||||
|
||||
methods: {
|
||||
generateSlug() {
|
||||
if (this.form.title) {
|
||||
this.form.slug = this.GENERATE_SLUG(this.form.title);
|
||||
}
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.processing = true;
|
||||
this.errors = {};
|
||||
|
||||
this.$inertia.post(route('dashboard.additional-educations.directions.store'), this.form, {
|
||||
onFinish: () => {
|
||||
this.processing = false;
|
||||
},
|
||||
onError: (errors) => {
|
||||
this.errors = errors;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,180 @@
|
||||
<template>
|
||||
<div class="min-h-screen bg-background-2">
|
||||
<div class="border-b border-line-2 bg-layer/50 backdrop-blur-sm sticky top-0 z-10 h-16">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-full">
|
||||
<div class="flex items-center h-full gap-3">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.directions.index')"
|
||||
class="p-2 text-muted-foreground-1 hover:text-foreground hover:bg-muted-hover rounded-lg transition-all"
|
||||
>
|
||||
<DashboardIcon name="arrow-left" size="5" />
|
||||
</a>
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center">
|
||||
<DashboardIcon name="pencil-square" size="5" class="text-primary" />
|
||||
</div>
|
||||
<div>
|
||||
<h1 class="text-lg font-medium text-foreground">Редактирование направления ДПО</h1>
|
||||
<p class="text-xs text-muted-foreground-1">{{ direction?.title }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
|
||||
<FlashMessages />
|
||||
|
||||
<div class="bg-layer border border-layer-line rounded-lg shadow-xs">
|
||||
<div class="p-6 border-b border-line-2">
|
||||
<div class="flex items-center gap-2">
|
||||
<DashboardIcon name="document-text" size="5" class="text-primary" />
|
||||
<h2 class="text-base font-medium text-foreground">Основная информация</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form @submit.prevent="submit" class="p-6">
|
||||
<div class="space-y-6">
|
||||
<div>
|
||||
<label for="title" class="block text-sm font-medium text-foreground mb-2">
|
||||
Название направления <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="title"
|
||||
v-model="form.title"
|
||||
type="text"
|
||||
@blur="generateSlug"
|
||||
placeholder='Например: "Информационные технологии"'
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-surface border rounded-lg text-sm text-foreground placeholder-muted-foreground-2 focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all',
|
||||
errors.title ? 'border-rose-500' : 'border-layer-line focus:border-primary'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.title" class="mt-1.5 text-xs text-rose-500">{{ errors.title }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="slug" class="block text-sm font-medium text-foreground mb-2">
|
||||
URL-идентификатор <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="slug"
|
||||
v-model="form.slug"
|
||||
type="text"
|
||||
readonly
|
||||
:class="[
|
||||
'w-full px-4 py-2.5 bg-muted/30 border rounded-lg text-sm text-foreground cursor-not-allowed',
|
||||
errors.slug ? 'border-rose-500' : 'border-layer-line'
|
||||
]"
|
||||
/>
|
||||
<p v-if="errors.slug" class="mt-1.5 text-xs text-rose-500">{{ errors.slug }}</p>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3">
|
||||
<label for="is_active" class="text-sm font-medium text-foreground">
|
||||
Активное направление
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
id="is_active"
|
||||
@click="form.is_active = !form.is_active"
|
||||
:class="[
|
||||
'relative inline-flex h-6 w-11 items-center rounded-full transition-colors',
|
||||
form.is_active ? 'bg-primary' : 'bg-muted'
|
||||
]"
|
||||
>
|
||||
<span
|
||||
:class="[
|
||||
'inline-block h-4 w-4 transform rounded-full bg-white transition-transform',
|
||||
form.is_active ? 'translate-x-6' : 'translate-x-1'
|
||||
]"
|
||||
/>
|
||||
</button>
|
||||
<span class="text-xs text-muted-foreground-1">Отображать ли направление на сайте</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 mt-8 pt-6 border-t border-line-2">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.directions.index')"
|
||||
class="inline-flex items-center gap-2 px-4 py-2.5 bg-surface border border-layer-line text-foreground text-sm font-medium rounded-lg hover:bg-muted-hover transition-all"
|
||||
>
|
||||
Отмена
|
||||
</a>
|
||||
<button
|
||||
type="submit"
|
||||
:disabled="processing"
|
||||
class="inline-flex items-center gap-2 px-4 py-2.5 bg-primary text-white text-sm font-medium rounded-lg hover:bg-primary-hover transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<svg v-if="processing" class="animate-spin h-4 w-4" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
|
||||
</svg>
|
||||
<DashboardIcon v-else name="check" size="4" />
|
||||
{{ processing ? 'Сохранение...' : 'Сохранить изменения' }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardIcon from '../../Components/DashboardIcon.vue';
|
||||
import FlashMessages from '../../Components/shared/FlashMessages.vue';
|
||||
|
||||
export default {
|
||||
name: 'DirectionEdit',
|
||||
components: {
|
||||
DashboardIcon,
|
||||
FlashMessages
|
||||
},
|
||||
|
||||
props: {
|
||||
direction: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
title: this.direction?.title || '',
|
||||
slug: this.direction?.slug || '',
|
||||
is_active: this.direction?.is_active ?? true
|
||||
},
|
||||
errors: {},
|
||||
processing: false
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE(`Редактирование направления - ${this.direction?.title}`);
|
||||
},
|
||||
|
||||
methods: {
|
||||
generateSlug() {
|
||||
// Не перегенерируем slug при редактировании если он уже есть
|
||||
if (this.form.title && !this.form.slug) {
|
||||
this.form.slug = this.GENERATE_SLUG(this.form.title);
|
||||
}
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.processing = true;
|
||||
this.errors = {};
|
||||
|
||||
this.$inertia.put(route('dashboard.additional-educations.directions.update', this.direction.id), this.form, {
|
||||
onFinish: () => {
|
||||
this.processing = false;
|
||||
},
|
||||
onError: (errors) => {
|
||||
this.errors = errors;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,214 @@
|
||||
<template>
|
||||
<DashboardLayout>
|
||||
<template #header-icon>
|
||||
<DashboardIcon name="arrow-trending-up" size="5" class="text-primary" />
|
||||
</template>
|
||||
<template #header-title>Направления ДПО</template>
|
||||
<template #header-subtitle>Управление направлениями дополнительного образования</template>
|
||||
<template #header-actions>
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.directions.create')"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 bg-primary text-white text-sm font-medium rounded-lg hover:bg-primary-hover transition-all duration-200 shadow-sm hover:shadow-md"
|
||||
>
|
||||
<DashboardIcon name="plus" size="4" />
|
||||
Добавить направление
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<FlashMessages />
|
||||
|
||||
<DataFilters title="Фильтры" @reset="resetFilters">
|
||||
<SearchInput
|
||||
v-model="searchQuery"
|
||||
label="Поиск"
|
||||
placeholder="Введите название направления..."
|
||||
@search="search"
|
||||
/>
|
||||
|
||||
<SelectFilter
|
||||
v-model="isActiveQuery"
|
||||
label="Статус"
|
||||
placeholder="Все"
|
||||
@change="filterByActive"
|
||||
>
|
||||
<option value="">Все</option>
|
||||
<option value="1">Активные</option>
|
||||
<option value="0">Неактивные</option>
|
||||
</SelectFilter>
|
||||
</DataFilters>
|
||||
|
||||
<div class="bg-layer border border-layer-line rounded-lg shadow-xs overflow-hidden">
|
||||
<div class="px-6 py-4 border-b border-line-2 bg-surface/50">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center gap-4">
|
||||
<span class="text-sm text-foreground">
|
||||
Всего: <span class="font-medium">{{ directions.total }}</span>
|
||||
</span>
|
||||
<span class="text-xs text-muted-foreground-1 px-2 py-0.5 bg-primary/10 text-primary rounded-full">
|
||||
{{ directions.data.length }} на странице
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
@click="refreshPage"
|
||||
class="p-2 text-muted-foreground-1 hover:text-foreground hover:bg-muted-hover rounded-lg transition-all"
|
||||
title="Обновить"
|
||||
>
|
||||
<DashboardIcon name="arrow-path" size="4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full divide-y divide-line-2">
|
||||
<thead class="bg-surface/50">
|
||||
<tr>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Название
|
||||
</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Статус
|
||||
</th>
|
||||
<th class="px-6 py-3 text-right text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Действия
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-line-2">
|
||||
<tr
|
||||
v-for="direction in directions.data"
|
||||
:key="direction.id"
|
||||
class="group hover:bg-muted-hover/50 transition-all duration-200"
|
||||
>
|
||||
<td class="px-6 py-4">
|
||||
<div class="text-sm font-medium text-foreground group-hover:text-primary transition-colors">
|
||||
{{ TEXT_LIMIT(direction.title, 60) }}
|
||||
</div>
|
||||
<div class="text-xs text-muted-foreground-1 mt-0.5">
|
||||
/{{ direction.slug }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span :class="STATUS_BADGE_CLASS(direction.is_active)">
|
||||
{{ direction.is_active ? 'Активно' : 'Неактивно' }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-right">
|
||||
<div class="flex items-center justify-end gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.directions.edit', direction.id)"
|
||||
class="p-2 text-muted-foreground-1 hover:text-primary hover:bg-primary/10 rounded-lg transition-all"
|
||||
title="Редактировать"
|
||||
>
|
||||
<DashboardIcon name="pencil-square" size="4" />
|
||||
</a>
|
||||
<button
|
||||
@click.prevent="deleteDirection(direction)"
|
||||
class="p-2 text-muted-foreground-1 hover:text-rose-600 hover:bg-rose-500/10 rounded-lg transition-all"
|
||||
title="Удалить"
|
||||
>
|
||||
<DashboardIcon name="trash" size="4" />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<EmptyState
|
||||
v-if="directions.data.length === 0"
|
||||
:columns="3"
|
||||
title="Направления не найдены"
|
||||
description="Создайте первое направление дополнительного образования или измените параметры поиска"
|
||||
:action-url="route('dashboard.additional-educations.directions.create')"
|
||||
action-text="Добавить направление"
|
||||
icon-path="M2.25 13.5h3.86a2.25 2.25 0 012.012 1.244l.256.512a2.25 2.25 0 002.013 1.244h3.218a2.25 2.25 0 002.013-1.244l.256-.512a2.25 2.25 0 012.013-1.244h3.859m-19.5.338V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18v-4.162c0-.224-.034-.447-.1-.661L19.24 5.338a2.25 2.25 0 00-2.15-1.588H6.911a2.25 2.25 0 00-2.15 1.588L2.35 13.177a2.25 2.25 0 00-.1.661z"
|
||||
/>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<Pagination :data="directions" />
|
||||
</div>
|
||||
</DashboardLayout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardLayout from '../../Components/DashboardLayout.vue';
|
||||
import DashboardIcon from '../../Components/DashboardIcon.vue';
|
||||
import FlashMessages from '../../Components/shared/FlashMessages.vue';
|
||||
import DataFilters from '../../Components/shared/DataFilters.vue';
|
||||
import SearchInput from '../../Components/shared/SearchInput.vue';
|
||||
import SelectFilter from '../../Components/shared/SelectFilter.vue';
|
||||
import EmptyState from '../../Components/shared/EmptyState.vue';
|
||||
import Pagination from '../../Components/shared/Pagination.vue';
|
||||
|
||||
export default {
|
||||
name: 'DirectionIndex',
|
||||
components: {
|
||||
DashboardLayout,
|
||||
DashboardIcon,
|
||||
FlashMessages,
|
||||
DataFilters,
|
||||
SearchInput,
|
||||
SelectFilter,
|
||||
EmptyState,
|
||||
Pagination
|
||||
},
|
||||
|
||||
props: {
|
||||
directions: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
filters: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
is_active: '',
|
||||
search: ''
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
searchQuery: this.filters?.search || '',
|
||||
isActiveQuery: this.filters?.is_active || ''
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE('Направления ДПО');
|
||||
},
|
||||
|
||||
methods: {
|
||||
search() {
|
||||
this.INERTIA_FILTER('dashboard.additional-educations.directions.index', {
|
||||
search: this.searchQuery,
|
||||
is_active: this.isActiveQuery
|
||||
});
|
||||
},
|
||||
|
||||
filterByActive() {
|
||||
this.search();
|
||||
},
|
||||
|
||||
resetFilters() {
|
||||
this.RESET_FILTERS(
|
||||
['searchQuery', 'isActiveQuery'],
|
||||
'dashboard.additional-educations.directions.index'
|
||||
);
|
||||
},
|
||||
|
||||
refreshPage() {
|
||||
this.search();
|
||||
},
|
||||
|
||||
deleteDirection(direction) {
|
||||
this.CONFIRM_AND_DELETE(direction, 'dashboard.additional-educations.directions.destroy', {
|
||||
message: 'Удалить направление "' + direction.title + '"?'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<div class="min-h-screen bg-background-2">
|
||||
<!-- Header -->
|
||||
<div class="border-b border-line-2 bg-layer/50 backdrop-blur-sm sticky top-0 z-10 h-16">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-full">
|
||||
<div class="flex items-center h-full gap-3">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.index')"
|
||||
class="p-2 text-muted-foreground-1 hover:text-foreground hover:bg-muted-hover rounded-lg transition-all"
|
||||
>
|
||||
<DashboardIcon name="arrow-left" size="5" />
|
||||
</a>
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center">
|
||||
<DashboardIcon name="pencil-square" size="5" class="text-primary" />
|
||||
</div>
|
||||
<div>
|
||||
<h1 class="text-lg font-medium text-foreground">Редактирование программы ДПО</h1>
|
||||
<p class="text-xs text-muted-foreground-1">{{ education?.title }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Main Content -->
|
||||
<div class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
|
||||
<AdditionalEducationForm
|
||||
:education="education"
|
||||
:categories="categories"
|
||||
:education-forms="educationForms"
|
||||
submit-label="Сохранить изменения"
|
||||
submit-route="dashboard.additional-educations.update"
|
||||
submit-method="put"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardIcon from '../Components/DashboardIcon.vue';
|
||||
import AdditionalEducationForm from './AdditionalEducationForm.vue';
|
||||
|
||||
export default {
|
||||
name: 'AdditionalEducationEdit',
|
||||
components: {
|
||||
DashboardIcon,
|
||||
AdditionalEducationForm
|
||||
},
|
||||
|
||||
props: {
|
||||
education: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
categories: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
educationForms: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE(`Редактирование программы ДПО - ${this.education?.title}`);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,321 @@
|
||||
<template>
|
||||
<DashboardLayout>
|
||||
<template #header-icon>
|
||||
<DashboardIcon name="book-open" size="5" class="text-primary" />
|
||||
</template>
|
||||
<template #header-title>Дополнительное образование</template>
|
||||
<template #header-subtitle>Управление программами ДПО</template>
|
||||
<template #header-actions>
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.create')"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 bg-primary text-white text-sm font-medium rounded-lg hover:bg-primary-hover transition-all duration-200 shadow-sm hover:shadow-md"
|
||||
>
|
||||
<DashboardIcon name="plus" size="4" />
|
||||
Добавить программу
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- Flash Messages -->
|
||||
<FlashMessages />
|
||||
|
||||
<!-- Filters Card -->
|
||||
<DataFilters title="Фильтры" @reset="resetFilters">
|
||||
<SearchInput
|
||||
v-model="searchQuery"
|
||||
label="Поиск"
|
||||
placeholder="Введите название или целевую аудиторию..."
|
||||
@search="search"
|
||||
/>
|
||||
|
||||
<SelectFilter
|
||||
v-model="categoryQuery"
|
||||
label="Категория"
|
||||
placeholder="Все категории"
|
||||
@change="filterByCategory"
|
||||
>
|
||||
<option v-for="category in categories" :key="category.id" :value="category.id">
|
||||
{{ category.title }}
|
||||
</option>
|
||||
</SelectFilter>
|
||||
|
||||
<SelectFilter
|
||||
v-model="formEducationQuery"
|
||||
label="Форма обучения"
|
||||
placeholder="Все формы"
|
||||
@change="filterByFormEducation"
|
||||
>
|
||||
<option v-for="form in educationForms" :key="form.value" :value="form.value">
|
||||
{{ EducationForm.fromValue(form.value)?.label || getFormEducationLabel(form.value) }}
|
||||
</option>
|
||||
</SelectFilter>
|
||||
|
||||
<SelectFilter
|
||||
v-model="isActiveQuery"
|
||||
label="Статус"
|
||||
placeholder="Все"
|
||||
@change="filterByActive"
|
||||
>
|
||||
<option value="">Все</option>
|
||||
<option value="1">Активные</option>
|
||||
<option value="0">Неактивные</option>
|
||||
</SelectFilter>
|
||||
</DataFilters>
|
||||
|
||||
<!-- Programs Table -->
|
||||
<div class="bg-layer border border-layer-line rounded-lg shadow-xs overflow-hidden">
|
||||
<!-- Table Header Stats -->
|
||||
<div class="px-6 py-4 border-b border-line-2 bg-surface/50">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center gap-4">
|
||||
<span class="text-sm text-foreground">
|
||||
Всего: <span class="font-medium">{{ educations.total }}</span>
|
||||
</span>
|
||||
<span class="text-xs text-muted-foreground-1 px-2 py-0.5 bg-primary/10 text-primary rounded-full">
|
||||
{{ educations.data.length }} на странице
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
@click="refreshPage"
|
||||
class="p-2 text-muted-foreground-1 hover:text-foreground hover:bg-muted-hover rounded-lg transition-all"
|
||||
title="Обновить"
|
||||
>
|
||||
<DashboardIcon name="arrow-path" size="4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table -->
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full divide-y divide-line-2">
|
||||
<thead class="bg-surface/50">
|
||||
<tr>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Название
|
||||
</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Категория
|
||||
</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Стоимость
|
||||
</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Часов
|
||||
</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Форма обучения
|
||||
</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Статус
|
||||
</th>
|
||||
<th class="px-6 py-3 text-right text-xs font-medium text-muted-foreground-1 uppercase tracking-wider">
|
||||
Действия
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-line-2">
|
||||
<tr
|
||||
v-for="education in educations.data"
|
||||
:key="education.id"
|
||||
class="group hover:bg-muted-hover/50 transition-all duration-200"
|
||||
>
|
||||
<td class="px-6 py-4">
|
||||
<div class="text-sm font-medium text-foreground group-hover:text-primary transition-colors">
|
||||
{{ TEXT_LIMIT(education.title, 50) }}
|
||||
</div>
|
||||
<div class="text-xs text-muted-foreground-1 mt-0.5">
|
||||
{{ TEXT_LIMIT(education.target_group, 40) }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span class="inline-flex items-center px-2.5 py-1 rounded-md text-xs font-medium border bg-primary/10 text-primary border-primary/20">
|
||||
{{ education.category?.title || '—' }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span class="text-sm text-foreground">{{ formatPrice(education.price) }}</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-center">
|
||||
<span class="text-sm text-foreground">{{ education.learning_time }}</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span :class="getFormEducationBadgeClass(education.form_education)">
|
||||
{{ EducationForm.fromValue(education.form_education)?.label || getFormEducationLabel(education.form_education) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span :class="STATUS_BADGE_CLASS(education.is_active)">
|
||||
{{ education.is_active ? 'Активна' : 'Неактивна' }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-right">
|
||||
<div class="flex items-center justify-end gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<a
|
||||
:href="route('dashboard.additional-educations.edit', education.id)"
|
||||
class="p-2 text-muted-foreground-1 hover:text-primary hover:bg-primary/10 rounded-lg transition-all"
|
||||
title="Редактировать"
|
||||
>
|
||||
<DashboardIcon name="pencil-square" size="4" />
|
||||
</a>
|
||||
<button
|
||||
@click.prevent="deleteEducation(education)"
|
||||
class="p-2 text-muted-foreground-1 hover:text-rose-600 hover:bg-rose-500/10 rounded-lg transition-all"
|
||||
title="Удалить"
|
||||
>
|
||||
<DashboardIcon name="trash" size="4" />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Empty State -->
|
||||
<EmptyState
|
||||
v-if="educations.data.length === 0"
|
||||
:columns="7"
|
||||
title="Программы не найдены"
|
||||
description="Создайте первую программу дополнительного образования или измените параметры поиска"
|
||||
:action-url="route('dashboard.additional-educations.create')"
|
||||
action-text="Добавить программу"
|
||||
icon-path="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"
|
||||
/>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
<Pagination :data="educations" />
|
||||
</div>
|
||||
</DashboardLayout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import EducationForm from '@/Enum/EducationForm.js';
|
||||
import DashboardLayout from '../Components/DashboardLayout.vue';
|
||||
import DashboardIcon from '../Components/DashboardIcon.vue';
|
||||
import FlashMessages from '../Components/shared/FlashMessages.vue';
|
||||
import DataFilters from '../Components/shared/DataFilters.vue';
|
||||
import SearchInput from '../Components/shared/SearchInput.vue';
|
||||
import SelectFilter from '../Components/shared/SelectFilter.vue';
|
||||
import EmptyState from '../Components/shared/EmptyState.vue';
|
||||
import Pagination from '../Components/shared/Pagination.vue';
|
||||
|
||||
export default {
|
||||
name: 'AdditionalEducationIndex',
|
||||
components: {
|
||||
DashboardLayout,
|
||||
DashboardIcon,
|
||||
FlashMessages,
|
||||
DataFilters,
|
||||
SearchInput,
|
||||
SelectFilter,
|
||||
EmptyState,
|
||||
Pagination
|
||||
},
|
||||
|
||||
props: {
|
||||
educations: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
filters: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
category_id: '',
|
||||
form_education: '',
|
||||
is_active: '',
|
||||
search: ''
|
||||
})
|
||||
},
|
||||
categories: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
educationForms: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
searchQuery: this.filters?.search || '',
|
||||
categoryQuery: this.filters?.category_id || '',
|
||||
formEducationQuery: this.filters?.form_education || '',
|
||||
isActiveQuery: this.filters?.is_active || '',
|
||||
EducationForm
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE('Дополнительное образование');
|
||||
},
|
||||
|
||||
methods: {
|
||||
getFormEducationBadgeClass(formId) {
|
||||
const eduForm = EducationForm.fromValue(formId);
|
||||
const colorClasses = {
|
||||
1: 'bg-success/10 text-success border-success/20',
|
||||
2: 'bg-info/10 text-info border-info/20',
|
||||
3: 'bg-warning/10 text-warning border-warning/20'
|
||||
};
|
||||
const baseClasses = 'inline-flex items-center px-2.5 py-1 rounded-md text-xs font-medium border';
|
||||
return `${baseClasses} ${colorClasses[formId] || colorClasses[1]}`;
|
||||
},
|
||||
|
||||
getFormEducationLabel(formId) {
|
||||
const eduForm = EducationForm.fromValue(formId);
|
||||
return eduForm ? eduForm.label : '—';
|
||||
},
|
||||
|
||||
formatPrice(price) {
|
||||
if (!price) return '—';
|
||||
return new Intl.NumberFormat('ru-RU', {
|
||||
style: 'currency',
|
||||
currency: 'RUB',
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 0,
|
||||
}).format(price);
|
||||
},
|
||||
|
||||
search() {
|
||||
this.INERTIA_FILTER('dashboard.additional-educations.index', {
|
||||
search: this.searchQuery,
|
||||
category_id: this.categoryQuery,
|
||||
form_education: this.formEducationQuery,
|
||||
is_active: this.isActiveQuery
|
||||
});
|
||||
},
|
||||
|
||||
filterByCategory() {
|
||||
this.search();
|
||||
},
|
||||
|
||||
filterByFormEducation() {
|
||||
this.search();
|
||||
},
|
||||
|
||||
filterByActive() {
|
||||
this.search();
|
||||
},
|
||||
|
||||
resetFilters() {
|
||||
this.RESET_FILTERS(
|
||||
['searchQuery', 'categoryQuery', 'formEducationQuery', 'isActiveQuery'],
|
||||
'dashboard.additional-educations.index'
|
||||
);
|
||||
},
|
||||
|
||||
refreshPage() {
|
||||
this.search();
|
||||
},
|
||||
|
||||
deleteEducation(education) {
|
||||
this.CONFIRM_AND_DELETE(education, 'dashboard.additional-educations.destroy', {
|
||||
message: 'Удалить программу "' + education.title + '"?'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user