This commit is contained in:
F4ilji
2026-04-07 17:54:26 +05:00
parent 04adba6682
commit 936b1fb5b0
468 changed files with 43498 additions and 4176 deletions
@@ -0,0 +1,19 @@
<template>
<EditForm
:admission-campaigns="admissionCampaigns"
:educational-programs="educationalPrograms"
/>
</template>
<script>
import EditForm from './Edit.vue';
export default {
name: 'AdmissionPlanCreate',
components: { EditForm },
props: {
admissionCampaigns: { type: Array, required: true },
educationalPrograms: { type: Array, required: true }
}
}
</script>
@@ -0,0 +1,312 @@
<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.admission-plans.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="isEdit ? 'pencil-square' : 'plus'" size="5" class="text-primary" />
</div>
<div>
<h1 class="text-lg font-medium text-foreground">{{ isEdit ? 'Редактирование плана приема' : 'Создание плана приема' }}</h1>
<p class="text-xs text-muted-foreground-1">{{ isEdit ? plan?.educational_program?.name : 'Заполните все необходимые поля' }}</p>
</div>
</div>
</div>
</div>
</div>
<div class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
<FlashMessages />
<form @submit.prevent="submit" class="space-y-6">
<!-- Main Selection -->
<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="information-circle" size="5" class="text-primary" />
<h2 class="text-base font-medium text-foreground">Основные настройки</h2>
</div>
</div>
<div class="p-6 space-y-6">
<div>
<label for="educational_programs_id" class="block text-sm font-medium text-foreground mb-2">
Образовательная программа <span class="text-rose-500">*</span>
</label>
<select id="educational_programs_id" v-model="form.educational_programs_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.educational_programs_id ? 'border-rose-500' : 'border-layer-line focus:border-primary']">
<option value="">Выберите образовательную программу</option>
<option v-for="program in educationalPrograms" :key="program.id" :value="program.id">{{ program.name }}</option>
</select>
<p v-if="errors.educational_programs_id" class="mt-1.5 text-xs text-rose-500">{{ errors.educational_programs_id }}</p>
</div>
<div>
<label for="admission_campaigns_id" class="block text-sm font-medium text-foreground mb-2">
Приемная кампания <span class="text-rose-500">*</span>
</label>
<select id="admission_campaigns_id" v-model="form.admission_campaigns_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.admission_campaigns_id ? 'border-rose-500' : 'border-layer-line focus:border-primary']">
<option value="">Выберите приемную кампанию</option>
<option v-for="campaign in admissionCampaigns" :key="campaign.id" :value="campaign.id">{{ campaign.name }} ({{ campaign.academic_year }})</option>
</select>
<p v-if="errors.admission_campaigns_id" class="mt-1.5 text-xs text-rose-500">{{ errors.admission_campaigns_id }}</p>
</div>
</div>
</div>
<!-- Exams Repeater -->
<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 justify-between">
<div class="flex items-center gap-2">
<DashboardIcon name="document-check" size="5" class="text-primary" />
<h2 class="text-base font-medium text-foreground">Вступительные испытания</h2>
</div>
<button type="button" @click="addExam" 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 shadow-sm">
<DashboardIcon name="plus" size="4" />
Добавить испытание
</button>
</div>
<p class="text-xs text-muted-foreground-1 mt-1">Добавьте все необходимые вступительные испытания</p>
</div>
<div class="p-6">
<div v-if="form.exams.length === 0" class="text-center py-8 bg-surface border border-layer-line rounded-lg">
<DashboardIcon name="document-check" size="10" class="text-muted-foreground-2 mx-auto mb-3" />
<p class="text-foreground font-medium">Нет вступительных испытаний</p>
<button type="button" @click="addExam" class="mt-3 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">
<DashboardIcon name="plus" size="4" />
Добавить первое испытание
</button>
</div>
<div v-else class="space-y-4">
<div v-for="(exam, eIdx) in form.exams" :key="eIdx" class="group bg-layer border border-layer-line rounded-lg overflow-hidden">
<div class="flex items-center justify-between px-4 py-3 bg-surface/50 border-b border-line-2">
<div class="flex items-center gap-2">
<span class="px-2 py-0.5 bg-surface-muted text-muted-foreground-1 text-xs font-medium rounded">#{{ eIdx + 1 }}</span>
<span class="text-sm font-medium text-foreground">{{ exam.title || 'Новое испытание' }}</span>
</div>
<div class="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
<button type="button" @click="duplicateExam(eIdx)" class="p-1.5 text-muted-foreground-1 hover:text-primary hover:bg-primary/10 rounded transition-all" title="Дублировать">
<DashboardIcon name="square-2-stack" size="4" />
</button>
<button type="button" @click="removeExam(eIdx)" class="p-1.5 text-muted-foreground-1 hover:text-rose-600 hover:bg-rose-500/10 rounded transition-all" title="Удалить">
<DashboardIcon name="trash" size="4" />
</button>
</div>
</div>
<div class="p-4 space-y-4">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-xs font-medium text-muted-foreground-1 mb-1.5">Название предмета <span class="text-rose-500">*</span></label>
<input v-model="exam.title" type="text" placeholder="Например: Математика" class="w-full px-3 py-2 bg-surface border border-layer-line rounded-lg text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all" />
</div>
<div>
<label class="block text-xs font-medium text-muted-foreground-1 mb-1.5">Приоритет <span class="text-rose-500">*</span></label>
<input v-model.number="exam.priority" type="number" min="0" class="w-full px-3 py-2 bg-surface border border-layer-line rounded-lg text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all" />
</div>
</div>
<!-- Exam Types -->
<div>
<div class="flex items-center justify-between mb-2">
<label class="block text-xs font-medium text-muted-foreground-1">Виды вступительного испытания</label>
<button type="button" @click="addExamType(eIdx)" :disabled="(exam.types || []).length >= 2" class="text-xs text-primary hover:text-primary-hover disabled:opacity-50 disabled:cursor-not-allowed">
+ Добавить вид
</button>
</div>
<div v-for="(type, tIdx) in (exam.types || [])" :key="tIdx" class="flex items-center gap-3 p-3 bg-surface border border-layer-line rounded-lg mb-2">
<select v-model="type.type" class="flex-1 px-3 py-2 bg-surface border border-layer-line rounded-lg text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all">
<option value="">Тип испытания</option>
<option :value="1">ЕГЭ</option>
<option :value="2">ВИ, проводимое организацией самостоятельно</option>
<option :value="3">Ср. балл документа об образовании</option>
<option :value="4">Аккредитация</option>
</select>
<input v-model.number="type.min_ball" type="number" min="0" max="100" placeholder="Мин. балл" class="w-24 px-3 py-2 bg-surface border border-layer-line rounded-lg text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all" />
<button type="button" @click="removeExamType(eIdx, tIdx)" class="p-1.5 text-muted-foreground-1 hover:text-rose-600 hover:bg-rose-500/10 rounded transition-all">
<DashboardIcon name="x-mark" size="4" />
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Contests Repeater -->
<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 justify-between">
<div class="flex items-center gap-2">
<DashboardIcon name="trophy" size="5" class="text-primary" />
<h2 class="text-base font-medium text-foreground">Условия поступления</h2>
</div>
<button type="button" @click="addContest" 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 shadow-sm">
<DashboardIcon name="plus" size="4" />
Добавить группу
</button>
</div>
<p class="text-xs text-muted-foreground-1 mt-1">Добавьте группы с условиями поступления</p>
</div>
<div class="p-6">
<div v-if="form.contests.length === 0" class="text-center py-8 bg-surface border border-layer-line rounded-lg">
<DashboardIcon name="trophy" size="10" class="text-muted-foreground-2 mx-auto mb-3" />
<p class="text-foreground font-medium">Нет условий поступления</p>
<button type="button" @click="addContest" class="mt-3 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">
<DashboardIcon name="plus" size="4" />
Добавить первую группу
</button>
</div>
<div v-else class="space-y-4">
<div v-for="(contest, cIdx) in form.contests" :key="cIdx" class="group bg-layer border border-layer-line rounded-lg overflow-hidden">
<div class="flex items-center justify-between px-4 py-3 bg-surface/50 border-b border-line-2">
<div class="flex items-center gap-2">
<span class="px-2 py-0.5 bg-surface-muted text-muted-foreground-1 text-xs font-medium rounded">#{{ cIdx + 1 }}</span>
<span class="text-sm font-medium text-foreground">{{ getFormEducationLabel(contest.form_education) || 'Условия поступления' }}</span>
</div>
<div class="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
<button type="button" @click="duplicateContest(cIdx)" class="p-1.5 text-muted-foreground-1 hover:text-primary hover:bg-primary/10 rounded transition-all" title="Дублировать">
<DashboardIcon name="square-2-stack" size="4" />
</button>
<button type="button" @click="removeContest(cIdx)" class="p-1.5 text-muted-foreground-1 hover:text-rose-600 hover:bg-rose-500/10 rounded transition-all" title="Удалить">
<DashboardIcon name="trash" size="4" />
</button>
</div>
</div>
<div class="p-4 space-y-4">
<div>
<label class="block text-xs font-medium text-muted-foreground-1 mb-1.5">Форма обучения <span class="text-rose-500">*</span></label>
<select v-model="contest.form_education" class="w-full px-3 py-2 bg-surface border border-layer-line rounded-lg text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all">
<option value="">Выберите форму</option>
<option :value="1">Очная форма обучения</option>
<option :value="2">Очно-заочная форма обучения</option>
<option :value="3">Заочная форма обучения</option>
</select>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-xs font-medium text-muted-foreground-1 mb-1.5">Форма финансирования <span class="text-rose-500">*</span></label>
<select v-model="contest.places.form_budget" class="w-full px-3 py-2 bg-surface border border-layer-line rounded-lg text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all">
<option value="">Выберите тип</option>
<option :value="1">Основные места</option>
<option :value="2">Целевая квота</option>
<option :value="3">Особая квота</option>
<option :value="4">С оплатой обучения</option>
<option :value="5">За счёт иных средств</option>
<option :value="6">Отдельная квота</option>
</select>
</div>
<div>
<label class="block text-xs font-medium text-muted-foreground-1 mb-1.5">Количество мест <span class="text-rose-500">*</span></label>
<input v-model.number="contest.places.count" type="number" min="0" class="w-full px-3 py-2 bg-surface border border-layer-line rounded-lg text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Submit Buttons -->
<div class="flex items-center justify-end gap-3">
<a :href="route('dashboard.admission-plans.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 ? 'Сохранение...' : (isEdit ? 'Сохранить изменения' : 'Создать план') }}
</button>
</div>
</form>
</div>
</div>
</template>
<script>
import DashboardIcon from '../Components/DashboardIcon.vue';
import FlashMessages from '../Components/shared/FlashMessages.vue';
export default {
name: 'AdmissionPlanForm',
components: { DashboardIcon, FlashMessages },
props: {
plan: { type: Object, default: null },
admissionCampaigns: { type: Array, required: true },
educationalPrograms: { type: Array, required: true }
},
data() {
return {
form: {
educational_programs_id: this.plan?.educational_programs_id || '',
admission_campaigns_id: this.plan?.admission_campaigns_id || '',
exams: this.plan?.exams ? JSON.parse(JSON.stringify(this.plan.exams)) : [],
contests: this.plan?.contests ? JSON.parse(JSON.stringify(this.plan.contests)) : []
},
errors: {},
processing: false
}
},
computed: {
isEdit() { return !!this.plan; }
},
mounted() {
this.SET_DOCUMENT_TITLE(this.isEdit ? `Редактирование плана приема` : 'Создание плана приема');
},
methods: {
getFormEducationLabel(value) {
const labels = { 1: 'Очная', 2: 'Очно-заочная', 3: 'Заочная' };
return labels[value] || null;
},
// Exams
addExam() { this.form.exams.push({ title: '', priority: 0, types: [] }); },
removeExam(idx) { this.form.exams.splice(idx, 1); },
duplicateExam(idx) {
const item = JSON.parse(JSON.stringify(this.form.exams[idx]));
this.form.exams.splice(idx + 1, 0, item);
},
addExamType(examIdx) {
if (!this.form.exams[examIdx].types) this.form.exams[examIdx].types = [];
if (this.form.exams[examIdx].types.length < 2) {
this.form.exams[examIdx].types.push({ type: '', min_ball: 0 });
}
},
removeExamType(examIdx, typeIdx) {
this.form.exams[examIdx].types.splice(typeIdx, 1);
},
// Contests
addContest() { this.form.contests.push({ form_education: '', places: { form_budget: '', count: 0 } }); },
removeContest(idx) { this.form.contests.splice(idx, 1); },
duplicateContest(idx) {
const item = JSON.parse(JSON.stringify(this.form.contests[idx]));
this.form.contests.splice(idx + 1, 0, item);
},
submit() {
this.processing = true;
this.errors = {};
const url = this.isEdit
? route('dashboard.admission-plans.update', this.plan.id)
: route('dashboard.admission-plans.store');
const method = this.isEdit ? 'put' : 'post';
this.$inertia[method](url, this.form, {
onFinish: () => { this.processing = false; },
onError: (errors) => { this.errors = errors; }
});
}
}
}
</script>
@@ -0,0 +1,199 @@
<template>
<DashboardLayout>
<template #header-icon>
<DashboardIcon name="rectangle-stack" size="5" class="text-primary" />
</template>
<template #header-title>Планы приема</template>
<template #header-subtitle>Управление планами приема</template>
<template #header-actions>
<a
:href="route('dashboard.admission-plans.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">
<SelectFilter
v-model="campaignQuery"
label="Приемная кампания"
placeholder="Все кампании"
@change="filterByCampaign"
>
<option v-for="campaign in admissionCampaigns" :key="campaign.id" :value="campaign.id">
{{ campaign.name }} ({{ campaign.academic_year }})
</option>
</SelectFilter>
<SelectFilter
v-model="programQuery"
label="Образовательная программа"
placeholder="Все программы"
@change="filterByProgram"
>
<option v-for="program in educationalPrograms" :key="program.id" :value="program.id">
{{ program.name }}
</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">{{ plans.total }}</span>
</span>
<span class="text-xs text-muted-foreground-1 px-2 py-0.5 bg-primary/10 text-primary rounded-full">
{{ plans.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-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="plan in plans.data"
:key="plan.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(plan.educational_program?.name || '—', 60) }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="text-sm text-foreground">
{{ plan.admission_campaign?.academic_year || '—' }}
</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.admission-plans.edit', plan.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="deletePlan(plan)"
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="plans.data.length === 0"
:columns="3"
title="Планы приема не найдены"
description="Создайте первый план приема или измените параметры поиска"
:action-url="route('dashboard.admission-plans.create')"
action-text="Добавить план"
icon-path="M3.375 4.5C2.339 4.5 1.5 5.34 1.5 6.375v13.5c0 1.036.84 1.875 1.875 1.875h16.5c1.036 0 1.875-.84 1.875-1.875V6.375c0-1.036-.84-1.875-1.875-1.875H3.375z"
/>
</tbody>
</table>
</div>
<Pagination :data="plans" />
</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 SelectFilter from '../Components/shared/SelectFilter.vue';
import EmptyState from '../Components/shared/EmptyState.vue';
import Pagination from '../Components/shared/Pagination.vue';
export default {
name: 'AdmissionPlanIndex',
components: {
DashboardLayout,
DashboardIcon,
FlashMessages,
DataFilters,
SelectFilter,
EmptyState,
Pagination
},
props: {
plans: { type: Object, required: true },
filters: {
type: Object,
default: () => ({ admission_campaigns_id: '', educational_programs_id: '' })
},
admissionCampaigns: { type: Array, required: true },
educationalPrograms: { type: Array, required: true }
},
data() {
return {
campaignQuery: this.filters?.admission_campaigns_id || '',
programQuery: this.filters?.educational_programs_id || ''
}
},
mounted() { this.SET_DOCUMENT_TITLE('Планы приема'); },
methods: {
search() {
this.INERTIA_FILTER('dashboard.admission-plans.index', {
admission_campaigns_id: this.campaignQuery,
educational_programs_id: this.programQuery
});
},
filterByCampaign() { this.search(); },
filterByProgram() { this.search(); },
resetFilters() {
this.RESET_FILTERS(['campaignQuery', 'programQuery'], 'dashboard.admission-plans.index');
},
refreshPage() { this.search(); },
deletePlan(plan) {
this.CONFIRM_AND_DELETE(plan, 'dashboard.admission-plans.destroy', {
message: 'Удалить план приема для "' + (plan.educational_program?.name || '') + '"?'
});
}
}
}
</script>