changes
This commit is contained in:
@@ -0,0 +1,340 @@
|
||||
<template>
|
||||
<DashboardLayout>
|
||||
<template #header-icon>
|
||||
<DashboardIcon name="plus" size="5" class="text-primary" />
|
||||
</template>
|
||||
<template #header-title>Создание научного журнала</template>
|
||||
<template #header-subtitle>Добавление нового научного журнала</template>
|
||||
<template #header-actions>
|
||||
<a
|
||||
:href="route('dashboard.academic-journals.index')"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 bg-surface text-foreground text-sm font-medium rounded-lg border border-layer-line hover:bg-muted-hover transition-all duration-200"
|
||||
>
|
||||
<DashboardIcon name="arrow-left" size="4" />
|
||||
Назад к списку
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- Flash Messages -->
|
||||
<FlashMessages />
|
||||
|
||||
<!-- Form Card -->
|
||||
<div class="bg-layer border border-layer-line rounded-lg shadow-xs overflow-hidden">
|
||||
<form @submit.prevent="submit">
|
||||
<div class="p-6 space-y-6">
|
||||
<!-- Основные данные -->
|
||||
<div class="space-y-4">
|
||||
<h3 class="text-lg font-medium text-foreground">Основные данные</h3>
|
||||
|
||||
<div class="grid grid-cols-1 gap-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-foreground mb-1">
|
||||
Название журнала <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="form.title"
|
||||
type="text"
|
||||
required
|
||||
maxlength="255"
|
||||
placeholder="Введите полное название журнала"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
@input="generateSlug"
|
||||
/>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Официальное название журнала как в регистрационных документах</p>
|
||||
<p v-if="errors.title" class="mt-1 text-sm text-danger">{{ errors.title }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-foreground mb-1">
|
||||
URL-адрес <span class="text-danger">*</span>
|
||||
</label>
|
||||
<div class="flex items-center">
|
||||
<span class="inline-flex items-center px-3 py-2 border border-r-0 border-layer-line rounded-l-lg bg-muted text-muted-foreground-1 text-sm">
|
||||
{{ baseUrl }}/
|
||||
</span>
|
||||
<input
|
||||
v-model="form.slug"
|
||||
type="text"
|
||||
required
|
||||
readonly
|
||||
class="flex-1 px-3 py-2 border border-layer-line rounded-r-lg bg-muted text-muted-foreground-1 text-sm cursor-not-allowed"
|
||||
/>
|
||||
</div>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Формируется автоматически из названия</p>
|
||||
<p v-if="errors.slug" class="mt-1 text-sm text-danger">{{ errors.slug }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Основная информация (Content Builder) -->
|
||||
<div class="space-y-4">
|
||||
<h3 class="text-lg font-medium text-foreground">Описание журнала</h3>
|
||||
<ContentBuilder
|
||||
v-model="form.main_info"
|
||||
label="Описание журнала"
|
||||
/>
|
||||
<p class="text-xs text-muted-foreground-1">Добавьте полное описание журнала, его историю и основные направления</p>
|
||||
</div>
|
||||
|
||||
<!-- Редакционная коллегия -->
|
||||
<div class="space-y-4">
|
||||
<h3 class="text-lg font-medium text-foreground">Редакционная коллегия</h3>
|
||||
|
||||
<!-- Главный редактор -->
|
||||
<div class="border border-layer-line rounded-lg p-4">
|
||||
<h4 class="text-sm font-medium text-foreground mb-3">Главный редактор</h4>
|
||||
<div class="space-y-3">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
ФИО <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="form.chief_editor[0].name"
|
||||
type="text"
|
||||
maxlength="255"
|
||||
placeholder="Иванов Иван Иванович"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
Учёная степень <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="form.chief_editor[0].academicTitle"
|
||||
type="text"
|
||||
maxlength="255"
|
||||
placeholder="д.т.н., профессор"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
Должность <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="form.chief_editor[0].position"
|
||||
type="text"
|
||||
maxlength="255"
|
||||
placeholder="Главный научный сотрудник"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
Учреждение <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="form.chief_editor[0].institution"
|
||||
type="text"
|
||||
maxlength="255"
|
||||
placeholder="МГУ имени М.В. Ломоносова"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Редакционная коллегия -->
|
||||
<div class="border border-layer-line rounded-lg p-4">
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<h4 class="text-sm font-medium text-foreground">Члены редакционной коллегии</h4>
|
||||
<button
|
||||
type="button"
|
||||
@click="addEditor"
|
||||
class="inline-flex items-center gap-1 px-3 py-1.5 text-xs font-medium text-primary bg-primary/10 rounded-lg hover:bg-primary/20 transition-all"
|
||||
>
|
||||
<DashboardIcon name="plus" size="4" />
|
||||
Добавить редактора
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="space-y-3">
|
||||
<div
|
||||
v-for="(editor, index) in form.editors"
|
||||
:key="index"
|
||||
class="bg-muted/30 border border-layer-line rounded-lg p-3"
|
||||
>
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<span class="text-xs font-medium text-foreground">Редактор #{{ index + 1 }}</span>
|
||||
<button
|
||||
type="button"
|
||||
@click="removeEditor(index)"
|
||||
class="text-muted-foreground-1 hover:text-danger transition-colors"
|
||||
>
|
||||
<DashboardIcon name="x-mark" size="4" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
ФИО <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="editor.name"
|
||||
type="text"
|
||||
required
|
||||
maxlength="255"
|
||||
placeholder="Петров Петр Петрович"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
Учёная степень <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="editor.academicTitle"
|
||||
type="text"
|
||||
required
|
||||
maxlength="255"
|
||||
placeholder="к.ф.-м.н., доцент"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
Должность <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="editor.position"
|
||||
type="text"
|
||||
required
|
||||
maxlength="255"
|
||||
placeholder="Доцент кафедры"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
Учреждение <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="editor.institution"
|
||||
type="text"
|
||||
required
|
||||
maxlength="255"
|
||||
placeholder="СПбГУ"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p v-if="form.editors.length === 0" class="text-xs text-muted-foreground-1 text-center py-4">
|
||||
Добавьте членов редакционной коллегии журнала
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Информация для авторов (Content Builder) -->
|
||||
<div class="space-y-4">
|
||||
<h3 class="text-lg font-medium text-foreground">Информация для авторов</h3>
|
||||
<ContentBuilder
|
||||
v-model="form.for_authors"
|
||||
label="Требования к статьям"
|
||||
/>
|
||||
<p class="text-xs text-muted-foreground-1">Разместите требования к статьям, правила оформления и сроки подачи</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Form Actions -->
|
||||
<div class="px-6 py-4 bg-surface/50 border-t border-layer-line flex items-center justify-end gap-3">
|
||||
<a
|
||||
:href="route('dashboard.academic-journals.index')"
|
||||
class="px-4 py-2 text-sm font-medium text-foreground bg-surface border border-layer-line rounded-lg hover:bg-muted-hover transition-all"
|
||||
>
|
||||
Отмена
|
||||
</a>
|
||||
<button
|
||||
type="submit"
|
||||
:disabled="processing"
|
||||
class="px-4 py-2 text-sm font-medium text-white bg-primary rounded-lg hover:bg-primary-hover transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<svg v-if="processing" class="animate-spin -ml-1 mr-2 h-4 w-4 text-white inline" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<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"></path>
|
||||
</svg>
|
||||
{{ processing ? 'Создание...' : 'Создать журнал' }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</DashboardLayout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardLayout from '../Components/DashboardLayout.vue';
|
||||
import DashboardIcon from '../Components/DashboardIcon.vue';
|
||||
import FlashMessages from '../Components/shared/FlashMessages.vue';
|
||||
import ContentBuilder from '../Components/ContentBuilder/ContentBuilder.vue';
|
||||
|
||||
export default {
|
||||
name: 'AcademicJournalCreate',
|
||||
components: {
|
||||
DashboardLayout,
|
||||
DashboardIcon,
|
||||
FlashMessages,
|
||||
ContentBuilder,
|
||||
},
|
||||
|
||||
props: {
|
||||
errors: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
title: '',
|
||||
slug: '',
|
||||
main_info: [],
|
||||
chief_editor: [{ name: '', academicTitle: '', position: '', institution: '' }],
|
||||
editors: [],
|
||||
for_authors: []
|
||||
},
|
||||
processing: false,
|
||||
baseUrl: this.GET_BASE_URL() + 'academic-journals'
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE('Создание научного журнала');
|
||||
},
|
||||
|
||||
methods: {
|
||||
generateSlug() {
|
||||
if (this.form.title) {
|
||||
this.form.slug = this.GENERATE_SLUG(this.form.title);
|
||||
}
|
||||
},
|
||||
|
||||
addEditor() {
|
||||
this.form.editors.push({
|
||||
name: '',
|
||||
academicTitle: '',
|
||||
position: '',
|
||||
institution: ''
|
||||
});
|
||||
},
|
||||
|
||||
removeEditor(index) {
|
||||
this.form.editors.splice(index, 1);
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.processing = true;
|
||||
this.$inertia.post(route('dashboard.academic-journals.store'), this.form, {
|
||||
onFinish: () => {
|
||||
this.processing = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,346 @@
|
||||
<template>
|
||||
<DashboardLayout>
|
||||
<template #header-icon>
|
||||
<DashboardIcon name="pencil-square" size="5" class="text-primary" />
|
||||
</template>
|
||||
<template #header-title>Редактирование научного журнала</template>
|
||||
<template #header-subtitle>Изменение данных журнала "{{ journal.title }}"</template>
|
||||
<template #header-actions>
|
||||
<a
|
||||
:href="route('dashboard.academic-journals.index')"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 bg-surface text-foreground text-sm font-medium rounded-lg border border-layer-line hover:bg-muted-hover transition-all duration-200"
|
||||
>
|
||||
<DashboardIcon name="arrow-left" size="4" />
|
||||
Назад к списку
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- Flash Messages -->
|
||||
<FlashMessages />
|
||||
|
||||
<!-- Form Card -->
|
||||
<div class="bg-layer border border-layer-line rounded-lg shadow-xs overflow-hidden">
|
||||
<form @submit.prevent="submit">
|
||||
<div class="p-6 space-y-6">
|
||||
<!-- Основные данные -->
|
||||
<div class="space-y-4">
|
||||
<h3 class="text-lg font-medium text-foreground">Основные данные</h3>
|
||||
|
||||
<div class="grid grid-cols-1 gap-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-foreground mb-1">
|
||||
Название журнала <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="form.title"
|
||||
type="text"
|
||||
required
|
||||
maxlength="255"
|
||||
placeholder="Введите полное название журнала"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
@input="generateSlug"
|
||||
/>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Официальное название журнала как в регистрационных документах</p>
|
||||
<p v-if="errors.title" class="mt-1 text-sm text-danger">{{ errors.title }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-foreground mb-1">
|
||||
URL-адрес <span class="text-danger">*</span>
|
||||
</label>
|
||||
<div class="flex items-center">
|
||||
<span class="inline-flex items-center px-3 py-2 border border-r-0 border-layer-line rounded-l-lg bg-muted text-muted-foreground-1 text-sm">
|
||||
{{ baseUrl }}/
|
||||
</span>
|
||||
<input
|
||||
v-model="form.slug"
|
||||
type="text"
|
||||
required
|
||||
readonly
|
||||
class="flex-1 px-3 py-2 border border-layer-line rounded-r-lg bg-muted text-muted-foreground-1 text-sm cursor-not-allowed"
|
||||
/>
|
||||
</div>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Формируется автоматически из названия</p>
|
||||
<p v-if="errors.slug" class="mt-1 text-sm text-danger">{{ errors.slug }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Основная информация (Content Builder) -->
|
||||
<div class="space-y-4">
|
||||
<h3 class="text-lg font-medium text-foreground">Описание журнала</h3>
|
||||
<ContentBuilder
|
||||
v-model="form.main_info"
|
||||
label="Описание журнала"
|
||||
/>
|
||||
<p class="text-xs text-muted-foreground-1">Добавьте полное описание журнала, его историю и основные направления</p>
|
||||
</div>
|
||||
|
||||
<!-- Редакционная коллегия -->
|
||||
<div class="space-y-4">
|
||||
<h3 class="text-lg font-medium text-foreground">Редакционная коллегия</h3>
|
||||
|
||||
<!-- Главный редактор -->
|
||||
<div class="border border-layer-line rounded-lg p-4">
|
||||
<h4 class="text-sm font-medium text-foreground mb-3">Главный редактор</h4>
|
||||
<div class="space-y-3">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
ФИО <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="form.chief_editor[0].name"
|
||||
type="text"
|
||||
maxlength="255"
|
||||
placeholder="Иванов Иван Иванович"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
Учёная степень <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="form.chief_editor[0].academicTitle"
|
||||
type="text"
|
||||
maxlength="255"
|
||||
placeholder="д.т.н., профессор"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
Должность <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="form.chief_editor[0].position"
|
||||
type="text"
|
||||
maxlength="255"
|
||||
placeholder="Главный научный сотрудник"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
Учреждение <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="form.chief_editor[0].institution"
|
||||
type="text"
|
||||
maxlength="255"
|
||||
placeholder="МГУ имени М.В. Ломоносова"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Редакционная коллегия -->
|
||||
<div class="border border-layer-line rounded-lg p-4">
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<h4 class="text-sm font-medium text-foreground">Члены редакционной коллегии</h4>
|
||||
<button
|
||||
type="button"
|
||||
@click="addEditor"
|
||||
class="inline-flex items-center gap-1 px-3 py-1.5 text-xs font-medium text-primary bg-primary/10 rounded-lg hover:bg-primary/20 transition-all"
|
||||
>
|
||||
<DashboardIcon name="plus" size="4" />
|
||||
Добавить редактора
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="space-y-3">
|
||||
<div
|
||||
v-for="(editor, index) in form.editors"
|
||||
:key="index"
|
||||
class="bg-muted/30 border border-layer-line rounded-lg p-3"
|
||||
>
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<span class="text-xs font-medium text-foreground">Редактор #{{ index + 1 }}</span>
|
||||
<button
|
||||
type="button"
|
||||
@click="removeEditor(index)"
|
||||
class="text-muted-foreground-1 hover:text-danger transition-colors"
|
||||
>
|
||||
<DashboardIcon name="x-mark" size="4" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
ФИО <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="editor.name"
|
||||
type="text"
|
||||
required
|
||||
maxlength="255"
|
||||
placeholder="Петров Петр Петрович"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
Учёная степень <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="editor.academicTitle"
|
||||
type="text"
|
||||
required
|
||||
maxlength="255"
|
||||
placeholder="к.ф.-м.н., доцент"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
Должность <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="editor.position"
|
||||
type="text"
|
||||
required
|
||||
maxlength="255"
|
||||
placeholder="Доцент кафедры"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-foreground mb-1">
|
||||
Учреждение <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="editor.institution"
|
||||
type="text"
|
||||
required
|
||||
maxlength="255"
|
||||
placeholder="СПбГУ"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p v-if="form.editors.length === 0" class="text-xs text-muted-foreground-1 text-center py-4">
|
||||
Добавьте членов редакционной коллегии журнала
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Информация для авторов (Content Builder) -->
|
||||
<div class="space-y-4">
|
||||
<h3 class="text-lg font-medium text-foreground">Информация для авторов</h3>
|
||||
<ContentBuilder
|
||||
v-model="form.for_authors"
|
||||
label="Требования к статьям"
|
||||
/>
|
||||
<p class="text-xs text-muted-foreground-1">Разместите требования к статьям, правила оформления и сроки подачи</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Form Actions -->
|
||||
<div class="px-6 py-4 bg-surface/50 border-t border-layer-line flex items-center justify-end gap-3">
|
||||
<a
|
||||
:href="route('dashboard.academic-journals.index')"
|
||||
class="px-4 py-2 text-sm font-medium text-foreground bg-surface border border-layer-line rounded-lg hover:bg-muted-hover transition-all"
|
||||
>
|
||||
Отмена
|
||||
</a>
|
||||
<button
|
||||
type="submit"
|
||||
:disabled="processing"
|
||||
class="px-4 py-2 text-sm font-medium text-white bg-primary rounded-lg hover:bg-primary-hover transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<svg v-if="processing" class="animate-spin -ml-1 mr-2 h-4 w-4 text-white inline" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<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"></path>
|
||||
</svg>
|
||||
{{ processing ? 'Сохранение...' : 'Сохранить изменения' }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</DashboardLayout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardLayout from '../Components/DashboardLayout.vue';
|
||||
import DashboardIcon from '../Components/DashboardIcon.vue';
|
||||
import FlashMessages from '../Components/shared/FlashMessages.vue';
|
||||
import ContentBuilder from '../Components/ContentBuilder/ContentBuilder.vue';
|
||||
|
||||
export default {
|
||||
name: 'AcademicJournalEdit',
|
||||
components: {
|
||||
DashboardLayout,
|
||||
DashboardIcon,
|
||||
FlashMessages,
|
||||
ContentBuilder,
|
||||
},
|
||||
|
||||
props: {
|
||||
journal: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
errors: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
title: this.journal.title || '',
|
||||
slug: this.journal.slug || '',
|
||||
main_info: this.journal.main_info || [],
|
||||
chief_editor: (this.journal.chief_editor && this.journal.chief_editor.length > 0)
|
||||
? this.journal.chief_editor
|
||||
: [{ name: '', academicTitle: '', position: '', institution: '' }],
|
||||
editors: this.journal.editors || [],
|
||||
for_authors: this.journal.for_authors || []
|
||||
},
|
||||
processing: false,
|
||||
baseUrl: this.GET_BASE_URL() + 'academic-journals'
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE('Редактирование научного журнала');
|
||||
},
|
||||
|
||||
methods: {
|
||||
generateSlug() {
|
||||
if (this.form.title) {
|
||||
this.form.slug = this.GENERATE_SLUG(this.form.title);
|
||||
}
|
||||
},
|
||||
|
||||
addEditor() {
|
||||
this.form.editors.push({
|
||||
name: '',
|
||||
academicTitle: '',
|
||||
position: '',
|
||||
institution: ''
|
||||
});
|
||||
},
|
||||
|
||||
removeEditor(index) {
|
||||
this.form.editors.splice(index, 1);
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.processing = true;
|
||||
this.$inertia.put(route('dashboard.academic-journals.update', this.journal.id), this.form, {
|
||||
onFinish: () => {
|
||||
this.processing = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,211 @@
|
||||
<template>
|
||||
<DashboardLayout>
|
||||
<template #header-icon>
|
||||
<DashboardIcon name="beaker" size="5" class="text-primary" />
|
||||
</template>
|
||||
<template #header-title>Научные журналы</template>
|
||||
<template #header-subtitle>Управление научными журналами</template>
|
||||
<template #header-actions>
|
||||
<a
|
||||
:href="route('dashboard.academic-journals.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"
|
||||
/>
|
||||
</DataFilters>
|
||||
|
||||
<!-- Journals 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">{{ journals.total }}</span>
|
||||
</span>
|
||||
<span class="text-xs text-muted-foreground-1 px-2 py-0.5 bg-primary/10 text-primary rounded-full">
|
||||
{{ journals.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">
|
||||
URL
|
||||
</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="journal in journals.data"
|
||||
:key="journal.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">
|
||||
{{ journal.title }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span class="text-sm text-muted-foreground-1 font-mono">
|
||||
{{ journal.slug }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="text-sm text-foreground">{{ FORMAT_DATE(journal.created_at, 'full') }}</div>
|
||||
</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.academic-journals.edit', journal.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>
|
||||
<a
|
||||
:href="route('dashboard.academic-journals.issues.index', journal.id)"
|
||||
class="p-2 text-muted-foreground-1 hover:text-blue-600 hover:bg-blue-500/10 rounded-lg transition-all"
|
||||
title="Выпуски журнала"
|
||||
>
|
||||
<DashboardIcon name="document-text" size="4" />
|
||||
</a>
|
||||
<button
|
||||
@click.prevent="CONFIRM_AND_DELETE(journal, 'dashboard.academic-journals.destroy', {
|
||||
message: 'Удалить журнал «' + journal.title + '»?'
|
||||
})"
|
||||
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="journals.data.length === 0"
|
||||
:columns="4"
|
||||
title="Научные журналы не найдены"
|
||||
description="Создайте первый научный журнал или измените параметры поиска"
|
||||
:action-url="route('dashboard.academic-journals.create')"
|
||||
action-text="Создать журнал"
|
||||
icon-path="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z"
|
||||
/>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
<Pagination :data="journals" />
|
||||
</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 EmptyState from '../Components/shared/EmptyState.vue';
|
||||
import Pagination from '../Components/shared/Pagination.vue';
|
||||
|
||||
export default {
|
||||
name: 'AcademicJournalIndex',
|
||||
components: {
|
||||
DashboardLayout,
|
||||
DashboardIcon,
|
||||
FlashMessages,
|
||||
DataFilters,
|
||||
SearchInput,
|
||||
EmptyState,
|
||||
Pagination
|
||||
},
|
||||
|
||||
props: {
|
||||
journals: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
filters: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
search: ''
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
searchQuery: this.filters?.search || ''
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE('Научные журналы');
|
||||
},
|
||||
|
||||
methods: {
|
||||
search() {
|
||||
this.INERTIA_FILTER('dashboard.academic-journals.index', {
|
||||
search: this.searchQuery
|
||||
});
|
||||
},
|
||||
|
||||
resetFilters() {
|
||||
this.RESET_FILTERS(
|
||||
['searchQuery'],
|
||||
'dashboard.academic-journals.index'
|
||||
);
|
||||
},
|
||||
|
||||
refreshPage() {
|
||||
this.$inertia.get(route('dashboard.academic-journals.index'), {
|
||||
search: this.searchQuery
|
||||
}, {
|
||||
preserveState: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,233 @@
|
||||
<template>
|
||||
<DashboardLayout>
|
||||
<template #header-icon>
|
||||
<DashboardIcon name="plus" size="5" class="text-primary" />
|
||||
</template>
|
||||
<template #header-title>Создание выпуска журнала</template>
|
||||
<template #header-subtitle>{{ journal.title }}</template>
|
||||
<template #header-actions>
|
||||
<a
|
||||
:href="route('dashboard.academic-journals.issues.index', journal.id)"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 bg-surface text-foreground text-sm font-medium rounded-lg border border-layer-line hover:bg-muted-hover transition-all duration-200"
|
||||
>
|
||||
<DashboardIcon name="arrow-left" size="4" />
|
||||
Назад к списку
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- Flash Messages -->
|
||||
<FlashMessages />
|
||||
|
||||
<!-- Form Card -->
|
||||
<div class="bg-layer border border-layer-line rounded-lg shadow-xs overflow-hidden">
|
||||
<form @submit.prevent="submit">
|
||||
<div class="p-6 space-y-6">
|
||||
<!-- Основные поля -->
|
||||
<div class="space-y-4">
|
||||
<h3 class="text-lg font-medium text-foreground">Основная информация</h3>
|
||||
|
||||
<div class="grid grid-cols-1 gap-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-foreground mb-1">
|
||||
Название выпуска <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="form.title"
|
||||
type="text"
|
||||
required
|
||||
maxlength="255"
|
||||
placeholder='Например: "Том 15, №3 (2023)"'
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Например: "Том 15, №3 (2023)" или специальное название выпуска</p>
|
||||
<p v-if="errors.title" class="mt-1 text-sm text-danger">{{ errors.title }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-foreground mb-1">
|
||||
Год публикации <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model.number="form.year_publication"
|
||||
type="number"
|
||||
required
|
||||
:min="1900"
|
||||
:max="maxYear"
|
||||
placeholder="Укажите год выпуска"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Год должен быть в диапазоне от 1900 до {{ maxYear }}</p>
|
||||
<p v-if="errors.year_publication" class="mt-1 text-sm text-danger">{{ errors.year_publication }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-foreground mb-1">
|
||||
Файл выпуска <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
ref="fileInput"
|
||||
type="file"
|
||||
required
|
||||
@change="handleFileChange"
|
||||
accept=".pdf,.docx,.xlsx,.pptx,.zip"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">
|
||||
Максимальный размер файла: 256MB. Допустимые форматы: PDF, DOCX, XLSX, PPTX, ZIP
|
||||
</p>
|
||||
<p v-if="errors.path_file" class="mt-1 text-sm text-danger">{{ errors.path_file }}</p>
|
||||
<p v-if="fileError" class="mt-1 text-sm text-danger">{{ fileError }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-foreground mb-1">
|
||||
Статус
|
||||
</label>
|
||||
<div class="flex items-center mt-2">
|
||||
<input
|
||||
v-model="form.is_active"
|
||||
type="checkbox"
|
||||
class="h-4 w-4 text-primary focus:ring-primary border-layer-line rounded"
|
||||
/>
|
||||
<label class="ml-2 text-sm text-foreground">
|
||||
Активный выпуск
|
||||
</label>
|
||||
</div>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Активные выпуски отображаются на сайте</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Form Actions -->
|
||||
<div class="px-6 py-4 bg-surface/50 border-t border-layer-line flex items-center justify-end gap-3">
|
||||
<a
|
||||
:href="route('dashboard.academic-journals.issues.index', journal.id)"
|
||||
class="px-4 py-2 text-sm font-medium text-foreground bg-surface border border-layer-line rounded-lg hover:bg-muted-hover transition-all"
|
||||
>
|
||||
Отмена
|
||||
</a>
|
||||
<button
|
||||
type="submit"
|
||||
:disabled="processing"
|
||||
class="px-4 py-2 text-sm font-medium text-white bg-primary rounded-lg hover:bg-primary-hover transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<svg v-if="processing" class="animate-spin -ml-1 mr-2 h-4 w-4 text-white inline" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<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"></path>
|
||||
</svg>
|
||||
{{ processing ? 'Создание...' : 'Создать выпуск' }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</DashboardLayout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardLayout from '../../Components/DashboardLayout.vue';
|
||||
import DashboardIcon from '../../Components/DashboardIcon.vue';
|
||||
import FlashMessages from '../../Components/shared/FlashMessages.vue';
|
||||
|
||||
export default {
|
||||
name: 'JournalIssueCreate',
|
||||
components: {
|
||||
DashboardLayout,
|
||||
DashboardIcon,
|
||||
FlashMessages,
|
||||
},
|
||||
|
||||
props: {
|
||||
journal: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
errors: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
title: '',
|
||||
year_publication: new Date().getFullYear(),
|
||||
path_file: null,
|
||||
is_active: true
|
||||
},
|
||||
fileError: null,
|
||||
processing: false,
|
||||
maxYear: new Date().getFullYear() + 1
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE('Создание выпуска журнала');
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleFileChange(event) {
|
||||
const file = event.target.files[0];
|
||||
this.fileError = null;
|
||||
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Проверка размера (256MB)
|
||||
const maxSize = 256 * 1024 * 1024;
|
||||
if (file.size > maxSize) {
|
||||
this.fileError = 'Размер файла не должен превышать 256MB';
|
||||
event.target.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
// Проверка формата
|
||||
const allowedTypes = [
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
];
|
||||
|
||||
const allowedExtensions = ['.pdf', '.docx', '.xlsx', '.pptx', '.zip'];
|
||||
const fileExtension = '.' + file.name.split('.').pop().toLowerCase();
|
||||
|
||||
if (!allowedTypes.includes(file.type) && !allowedExtensions.includes(fileExtension)) {
|
||||
this.fileError = 'Неподдерживаемый формат файла. Допустимые: PDF, DOCX, XLSX, PPTX, ZIP';
|
||||
event.target.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
this.form.path_file = file;
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.processing = true;
|
||||
|
||||
// Создаем FormData для загрузки файла
|
||||
const formData = new FormData();
|
||||
formData.append('title', this.form.title);
|
||||
formData.append('year_publication', this.form.year_publication);
|
||||
formData.append('is_active', this.form.is_active ? 1 : 0);
|
||||
|
||||
if (this.form.path_file instanceof File) {
|
||||
formData.append('path_file', this.form.path_file);
|
||||
}
|
||||
|
||||
this.$inertia.post(
|
||||
route('dashboard.academic-journals.issues.store', this.journal.id),
|
||||
formData,
|
||||
{
|
||||
forceFormData: true,
|
||||
onFinish: () => {
|
||||
this.processing = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<DashboardLayout>
|
||||
<template #header-icon>
|
||||
<DashboardIcon name="pencil-square" size="5" class="text-primary" />
|
||||
</template>
|
||||
<template #header-title>Редактирование выпуска журнала</template>
|
||||
<template #header-subtitle>{{ journal.title }} — {{ issue.title }}</template>
|
||||
<template #header-actions>
|
||||
<a
|
||||
:href="route('dashboard.academic-journals.issues.index', journal.id)"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 bg-surface text-foreground text-sm font-medium rounded-lg border border-layer-line hover:bg-muted-hover transition-all duration-200"
|
||||
>
|
||||
<DashboardIcon name="arrow-left" size="4" />
|
||||
Назад к списку
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- Flash Messages -->
|
||||
<FlashMessages />
|
||||
|
||||
<!-- Form Card -->
|
||||
<div class="bg-layer border border-layer-line rounded-lg shadow-xs overflow-hidden">
|
||||
<form @submit.prevent="submit">
|
||||
<div class="p-6 space-y-6">
|
||||
<!-- Основные поля -->
|
||||
<div class="space-y-4">
|
||||
<h3 class="text-lg font-medium text-foreground">Основная информация</h3>
|
||||
|
||||
<div class="grid grid-cols-1 gap-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-foreground mb-1">
|
||||
Название выпуска <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="form.title"
|
||||
type="text"
|
||||
required
|
||||
maxlength="255"
|
||||
placeholder='Например: "Том 15, №3 (2023)"'
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Например: "Том 15, №3 (2023)" или специальное название выпуска</p>
|
||||
<p v-if="errors.title" class="mt-1 text-sm text-danger">{{ errors.title }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-foreground mb-1">
|
||||
Год публикации <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input
|
||||
v-model.number="form.year_publication"
|
||||
type="number"
|
||||
required
|
||||
:min="1900"
|
||||
:max="maxYear"
|
||||
placeholder="Укажите год выпуска"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground placeholder-muted-foreground-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Год должен быть в диапазоне от 1900 до {{ maxYear }}</p>
|
||||
<p v-if="errors.year_publication" class="mt-1 text-sm text-danger">{{ errors.year_publication }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-foreground mb-1">
|
||||
Файл выпуска <span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<!-- Текущий файл -->
|
||||
<div v-if="form.existing_file" class="mb-2 p-3 bg-muted/30 border border-layer-line rounded-lg">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center gap-2">
|
||||
<DashboardIcon name="document-text" size="5" class="text-muted-foreground-1" />
|
||||
<div>
|
||||
<p class="text-sm font-medium text-foreground">{{ getFileName(form.existing_file) }}</p>
|
||||
<a
|
||||
:href="RESOLVE_ASSET_URL(form.existing_file)"
|
||||
target="_blank"
|
||||
class="text-xs text-primary hover:underline"
|
||||
>
|
||||
Открыть файл
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input
|
||||
ref="fileInput"
|
||||
type="file"
|
||||
@change="handleFileChange"
|
||||
accept=".pdf,.docx,.xlsx,.pptx,.zip"
|
||||
class="w-full px-3 py-2 border border-layer-line rounded-lg bg-white text-foreground focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
||||
/>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">
|
||||
Оставьте пустым, чтобы сохранить текущий файл. Максимальный размер: 256MB.
|
||||
</p>
|
||||
<p v-if="fileError" class="mt-1 text-sm text-danger">{{ fileError }}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-foreground mb-1">
|
||||
Статус
|
||||
</label>
|
||||
<div class="flex items-center mt-2">
|
||||
<input
|
||||
v-model="form.is_active"
|
||||
type="checkbox"
|
||||
class="h-4 w-4 text-primary focus:ring-primary border-layer-line rounded"
|
||||
/>
|
||||
<label class="ml-2 text-sm text-foreground">
|
||||
Активный выпуск
|
||||
</label>
|
||||
</div>
|
||||
<p class="mt-1 text-xs text-muted-foreground-1">Активные выпуски отображаются на сайте</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Form Actions -->
|
||||
<div class="px-6 py-4 bg-surface/50 border-t border-layer-line flex items-center justify-end gap-3">
|
||||
<a
|
||||
:href="route('dashboard.academic-journals.issues.index', journal.id)"
|
||||
class="px-4 py-2 text-sm font-medium text-foreground bg-surface border border-layer-line rounded-lg hover:bg-muted-hover transition-all"
|
||||
>
|
||||
Отмена
|
||||
</a>
|
||||
<button
|
||||
type="submit"
|
||||
:disabled="processing"
|
||||
class="px-4 py-2 text-sm font-medium text-white bg-primary rounded-lg hover:bg-primary-hover transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<svg v-if="processing" class="animate-spin -ml-1 mr-2 h-4 w-4 text-white inline" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<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"></path>
|
||||
</svg>
|
||||
{{ processing ? 'Сохранение...' : 'Сохранить изменения' }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</DashboardLayout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardLayout from '../../Components/DashboardLayout.vue';
|
||||
import DashboardIcon from '../../Components/DashboardIcon.vue';
|
||||
import FlashMessages from '../../Components/shared/FlashMessages.vue';
|
||||
|
||||
export default {
|
||||
name: 'JournalIssueEdit',
|
||||
components: {
|
||||
DashboardLayout,
|
||||
DashboardIcon,
|
||||
FlashMessages,
|
||||
},
|
||||
|
||||
props: {
|
||||
journal: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
issue: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
errors: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
title: this.issue.title || '',
|
||||
year_publication: this.issue.year_publication || new Date().getFullYear(),
|
||||
path_file: null,
|
||||
existing_file: this.issue.path_file || null,
|
||||
is_active: this.issue.is_active ?? true
|
||||
},
|
||||
fileError: null,
|
||||
processing: false,
|
||||
maxYear: new Date().getFullYear() + 1
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE('Редактирование выпуска журнала');
|
||||
},
|
||||
|
||||
methods: {
|
||||
getFileName(path) {
|
||||
if (!path) return '';
|
||||
return path.split('/').pop();
|
||||
},
|
||||
|
||||
handleFileChange(event) {
|
||||
const file = event.target.files[0];
|
||||
this.fileError = null;
|
||||
|
||||
if (!file) {
|
||||
this.form.path_file = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// Проверка размера (256MB)
|
||||
const maxSize = 256 * 1024 * 1024;
|
||||
if (file.size > maxSize) {
|
||||
this.fileError = 'Размер файла не должен превышать 256MB';
|
||||
event.target.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
// Проверка формата
|
||||
const allowedTypes = [
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
];
|
||||
|
||||
const allowedExtensions = ['.pdf', '.docx', '.xlsx', '.pptx', '.zip'];
|
||||
const fileExtension = '.' + file.name.split('.').pop().toLowerCase();
|
||||
|
||||
if (!allowedTypes.includes(file.type) && !allowedExtensions.includes(fileExtension)) {
|
||||
this.fileError = 'Неподдерживаемый формат файла. Допустимые: PDF, DOCX, XLSX, PPTX, ZIP';
|
||||
event.target.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
this.form.path_file = file;
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.processing = true;
|
||||
|
||||
// Создаем FormData для загрузки файла
|
||||
const formData = new FormData();
|
||||
formData.append('title', this.form.title);
|
||||
formData.append('year_publication', this.form.year_publication);
|
||||
formData.append('is_active', this.form.is_active ? 1 : 0);
|
||||
formData.append('_method', 'PUT'); // Laravel method spoofing
|
||||
|
||||
if (this.form.path_file instanceof File) {
|
||||
formData.append('path_file', this.form.path_file);
|
||||
} else if (this.form.existing_file) {
|
||||
formData.append('path_file', this.form.existing_file);
|
||||
}
|
||||
|
||||
this.$inertia.post(
|
||||
route('dashboard.academic-journals.issues.update', {
|
||||
academicJournal: this.journal.id,
|
||||
issue: this.issue.id
|
||||
}),
|
||||
formData,
|
||||
{
|
||||
forceFormData: true,
|
||||
onFinish: () => {
|
||||
this.processing = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,277 @@
|
||||
<template>
|
||||
<DashboardLayout>
|
||||
<template #header-icon>
|
||||
<DashboardIcon name="document-text" size="5" class="text-primary" />
|
||||
</template>
|
||||
<template #header-title>Выпуски журнала</template>
|
||||
<template #header-subtitle>{{ journal.title }}</template>
|
||||
<template #header-actions>
|
||||
<a
|
||||
:href="route('dashboard.academic-journals.index')"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 bg-surface text-foreground text-sm font-medium rounded-lg border border-layer-line hover:bg-muted-hover transition-all duration-200"
|
||||
>
|
||||
<DashboardIcon name="arrow-left" size="4" />
|
||||
Назад к журналам
|
||||
</a>
|
||||
<a
|
||||
:href="route('dashboard.academic-journals.issues.create', journal.id)"
|
||||
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="yearQuery"
|
||||
label="Год выпуска"
|
||||
placeholder="Все годы"
|
||||
@change="filterByYear"
|
||||
>
|
||||
<option v-for="year in years" :key="year" :value="year">
|
||||
{{ year }}
|
||||
</option>
|
||||
</SelectFilter>
|
||||
|
||||
<SelectFilter
|
||||
v-model="activeQuery"
|
||||
label="Статус"
|
||||
placeholder="Все статусы"
|
||||
@change="filterByActive"
|
||||
>
|
||||
<option value="">Все</option>
|
||||
<option value="1">Активные</option>
|
||||
<option value="0">Неактивные</option>
|
||||
</SelectFilter>
|
||||
</DataFilters>
|
||||
|
||||
<!-- Issues 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">{{ issues.total }}</span>
|
||||
</span>
|
||||
<span class="text-xs text-muted-foreground-1 px-2 py-0.5 bg-primary/10 text-primary rounded-full">
|
||||
{{ issues.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-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="issue in issues.data"
|
||||
:key="issue.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">
|
||||
{{ issue.title }}
|
||||
</div>
|
||||
<div class="text-xs text-muted-foreground-1 mt-0.5">
|
||||
{{ issue.path_file }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span class="text-sm text-foreground">{{ issue.year_publication }}</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span :class="STATUS_BADGE_CLASS(issue.is_active)">
|
||||
{{ issue.is_active ? 'Активный' : 'Неактивный' }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="text-sm text-foreground">{{ FORMAT_DATE(issue.created_at, 'full') }}</div>
|
||||
</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.academic-journals.issues.edit', { academicJournal: journal.id, issue: issue.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>
|
||||
<a
|
||||
:href="RESOLVE_ASSET_URL(issue.path_file)"
|
||||
target="_blank"
|
||||
class="p-2 text-muted-foreground-1 hover:text-blue-600 hover:bg-blue-500/10 rounded-lg transition-all"
|
||||
title="Открыть файл"
|
||||
>
|
||||
<DashboardIcon name="eye" size="4" />
|
||||
</a>
|
||||
<button
|
||||
@click.prevent="CONFIRM_AND_DELETE(issue, 'dashboard.academic-journals.issues.destroy', {
|
||||
message: 'Удалить выпуск «' + issue.title + '»?'
|
||||
})"
|
||||
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="issues.data.length === 0"
|
||||
:columns="5"
|
||||
title="Выпуски не найдены"
|
||||
description="Создайте первый выпуск журнала или измените параметры поиска"
|
||||
:action-url="route('dashboard.academic-journals.issues.create', journal.id)"
|
||||
action-text="Создать выпуск"
|
||||
icon-path="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
||||
/>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
<Pagination :data="issues" />
|
||||
</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: 'JournalIssueIndex',
|
||||
components: {
|
||||
DashboardLayout,
|
||||
DashboardIcon,
|
||||
FlashMessages,
|
||||
DataFilters,
|
||||
SearchInput,
|
||||
SelectFilter,
|
||||
EmptyState,
|
||||
Pagination
|
||||
},
|
||||
|
||||
props: {
|
||||
journal: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
issues: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
filters: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
search: '',
|
||||
year_publication: '',
|
||||
is_active: ''
|
||||
})
|
||||
},
|
||||
years: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
searchQuery: this.filters?.search || '',
|
||||
yearQuery: this.filters?.year_publication || '',
|
||||
activeQuery: this.filters?.is_active || ''
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.SET_DOCUMENT_TITLE('Выпуски журнала - ' + this.journal.title);
|
||||
},
|
||||
|
||||
methods: {
|
||||
search() {
|
||||
this.INERTIA_FILTER('dashboard.academic-journals.issues.index', {
|
||||
academicJournal: this.journal.id,
|
||||
search: this.searchQuery,
|
||||
year_publication: this.yearQuery,
|
||||
is_active: this.activeQuery
|
||||
});
|
||||
},
|
||||
|
||||
filterByYear() {
|
||||
this.search();
|
||||
},
|
||||
|
||||
filterByActive() {
|
||||
this.search();
|
||||
},
|
||||
|
||||
resetFilters() {
|
||||
this.RESET_FILTERS(
|
||||
['searchQuery', 'yearQuery', 'activeQuery'],
|
||||
'dashboard.academic-journals.issues.index'
|
||||
);
|
||||
},
|
||||
|
||||
refreshPage() {
|
||||
this.$inertia.get(route('dashboard.academic-journals.issues.index', this.journal.id), {
|
||||
search: this.searchQuery,
|
||||
year_publication: this.yearQuery,
|
||||
is_active: this.activeQuery
|
||||
}, {
|
||||
preserveState: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user