add slug column, fix bugs

This commit is contained in:
F4ilji
2025-04-07 14:10:59 +05:00
parent b1d3921ffd
commit f0c526da92
8 changed files with 70 additions and 72 deletions
+1 -2
View File
@@ -124,8 +124,7 @@ class ScheduleResource extends Resource
->trueIcon('heroicon-o-academic-cap') ->trueIcon('heroicon-o-academic-cap')
->falseIcon('heroicon-o-building-office') ->falseIcon('heroicon-o-building-office')
->trueColor('success') ->trueColor('success')
->falseColor('primary') ->falseColor('primary'),
->formatStateUsing(fn ($state) => $state ? 'Заочная' : 'Очная'),
TextColumn::make('updated_at') TextColumn::make('updated_at')
->label('Обновлено') ->label('Обновлено')
@@ -39,12 +39,12 @@ class PagesRelationManager extends RelationManager
Tables\Actions\Action::make('associate') Tables\Actions\Action::make('associate')
->label('Прикрепить страницу') ->label('Прикрепить страницу')
->color('success') ->color('success')
->searchable()
->preload()
->button() ->button()
->form([ ->form([
Forms\Components\Select::make('recordId') Forms\Components\Select::make('recordId')
->label('Страница') ->label('Страница')
->searchable()
->preload()
->options(Page::whereNull('sub_section_id')->whereNotNull('title')->pluck('title', 'id')) ->options(Page::whereNull('sub_section_id')->whereNotNull('title')->pluck('title', 'id'))
->required(), ->required(),
]) ])
@@ -14,7 +14,6 @@ return new class extends Migration
Schema::create('direction_additional_education', function (Blueprint $table) { Schema::create('direction_additional_education', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('title')->unique(); $table->string('title')->unique();
$table->string('slug')->unique();
$table->boolean('is_active'); $table->boolean('is_active');
$table->timestamps(); $table->timestamps();
}); });
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('direction_additional_education', function (Blueprint $table) {
$table->string('slug')->unique()->nullable()->after('title');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('direction_additional_education', function (Blueprint $table) {
$table->dropColumn('slug');
});
}
};
@@ -70,7 +70,8 @@ export default {
<!-- Avatar Media --> <!-- Avatar Media -->
<!-- End Avatar Media --> <!-- End Avatar Media -->
<!-- Content --> <!-- Content -->
<div class="space-y-5 md:space-y-8">
<div class="container max-w-6xl px-2 xl:px-5 lg:py-4 mx-auto space-y-5 md:space-y-8">
<AcademicJournalsItemBreadcrumbs :title="journal.data.title" /> <AcademicJournalsItemBreadcrumbs :title="journal.data.title" />
<AcademicJournalsTitle class="text-center" :header="journal.data.title" /> <AcademicJournalsTitle class="text-center" :header="journal.data.title" />
<div> <div>
@@ -94,7 +95,7 @@ export default {
</nav> </nav>
</div> </div>
<div class="container max-w-4xl px-2 xl:px-5 lg:py-4 md:w-4/5 mx-auto"> <div class="">
<div id="horizontal-alignment-1" role="tabpanel" aria-labelledby="horizontal-alignment-item-1"> <div id="horizontal-alignment-1" role="tabpanel" aria-labelledby="horizontal-alignment-item-1">
<Builder :blocks="journal.data.main_info" /> <Builder :blocks="journal.data.main_info" />
</div> </div>
@@ -32,14 +32,14 @@
</span> </span>
</li> </li>
<li class="text-sm"> <li class="text-sm">
<Link :href="route('client.post.index')" class="flex items-center text-gray-500 hover:text-primary-hover"> <Link :href="route('client.academicJournals.index')" class="flex items-center text-gray-500 hover:text-primary-hover">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400" <svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16" width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14" <path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14"
stroke="currentColor" stroke-width="2" stroke-linecap="round"/> stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg> </svg>
{{ textLimit('Новости', 30) }} {{ textLimit('Научные журналы', 30) }}
</Link> </Link>
</li> </li>
<li class="text-sm"> <li class="text-sm">
@@ -32,14 +32,14 @@
</span> </span>
</li> </li>
<li class="text-sm"> <li class="text-sm">
<Link :href="route('client.post.index')" class="flex items-center text-gray-500 hover:text-primary-light"> <Link :href="route('client.academicJournals.index')" class="flex items-center text-gray-500 hover:text-primary-light">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400" <svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16" width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14" <path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14"
stroke="currentColor" stroke-width="2" stroke-linecap="round"/> stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg> </svg>
{{ textLimit('Новости', 30) }} {{ textLimit('Научные журналы', 30) }}
</Link> </Link>
</li> </li>
</BreadcrumbsWrapper> </BreadcrumbsWrapper>
@@ -3,63 +3,45 @@
<div class="flex w-full sm:items-center gap-x-5 sm:gap-x-3"> <div class="flex w-full sm:items-center gap-x-5 sm:gap-x-3">
<div class="grow"> <div class="grow">
<div class="grid sm:flex sm:justify-between sm:items-center gap-2"> <div class="grid sm:flex sm:justify-between sm:items-center gap-2">
<BreadcrumbsWrapper v-if="breadcrumbs"> <BreadcrumbsWrapper>
<li class="text-sm"> <li class="text-sm">
<Link :href="route('index')" class="flex items-center text-gray-500 hover:text-primary-hover" href="/"> <Link :href="route('index')" class="flex items-center text-gray-500 hover:text-primary-hover" href="/">
<BasicIcon class="size-5" name="home" /> <BasicIcon class="size-5" name="home" />
</Link> </Link>
</li> </li>
<li v-if="breadcrumbs.mainSection" class="text-sm"> <li v-if="breadcrumbs?.mainSection.data.title" class="text-sm">
<span class="flex items-center text-gray-500 hover:text-primary-hover cursor-pointer" @click.prevent="handleSectionClick(breadcrumbs.mainSection)"> <span class="flex items-center text-gray-500 hover:text-primary-hover cursor-pointer" @click.prevent="handleSectionClick(breadcrumbs.mainSection)">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400" <svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16" width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14" <path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14"
stroke="currentColor" stroke-width="2" stroke-linecap="round"/> stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg> </svg>
{{ textLimit(breadcrumbs.mainSection.data.title, 25) }} {{ TEXT_LIMIT(breadcrumbs.mainSection.data.title, 25) }}
</span> </span>
</li> </li>
<li v-if="breadcrumbs.subSection" class="text-sm"> <li v-if="breadcrumbs?.subSection.data.title" class="text-sm">
<span class="flex items-center text-gray-500 hover:text-primary-hover cursor-pointer" @click.prevent="handleSubSectionClick(breadcrumbs.mainSection, breadcrumbs.subSection)"> <span class="flex items-center text-gray-500 hover:text-primary-hover cursor-pointer" @click.prevent="handleSubSectionClick(breadcrumbs.mainSection, breadcrumbs.subSection)">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400" <svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16" width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14" <path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14"
stroke="currentColor" stroke-width="2" stroke-linecap="round"/> stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg> </svg>
{{ textLimit(breadcrumbs.subSection.data.title, 25) }} {{ TEXT_LIMIT(breadcrumbs.subSection.data.title, 25) }}
</span> </span>
</li> </li>
<li class="text-sm"> <li class="text-sm">
<Link :href="route('client.post.index')" class="flex items-center text-gray-500 hover:text-primary-hover"> <Link :href="route('client.post.index')" class="flex items-center text-gray-500 hover:text-primary-hover">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400" <svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16" width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14" <path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14"
stroke="currentColor" stroke-width="2" stroke-linecap="round"/> stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg> </svg>
{{ textLimit('Новости', 30) }} {{ TEXT_LIMIT('Новости', 30) }}
</Link> </Link>
</li> </li>
</BreadcrumbsWrapper>
<BreadcrumbsWrapper v-else>
<li class="text-sm">
<Link :href="route('index')" class="flex items-center text-gray-500 hover:text-primary-hover" href="/">
<BasicIcon class="size-5" name="home" />
</Link>
</li>
<li class="text-sm">
<Link :href="route('client.post.index')" class="flex items-center text-gray-500 hover:text-primary-hover">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14"
stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg>
{{ textLimit('Новости', 30) }}
</Link>
</li>
</BreadcrumbsWrapper> </BreadcrumbsWrapper>
</div> </div>
</div> </div>
@@ -69,25 +51,14 @@
<script> <script>
import {Link} from "@inertiajs/vue3"; import {Link} from "@inertiajs/vue3";
import slugify from "slugify";
import BasicIcon from "@/componentss/ui/icons/BasicIcon.vue"; import BasicIcon from "@/componentss/ui/icons/BasicIcon.vue";
import BreadcrumbsWrapper from "@/componentss/ui/wrappers/BreadcrumbsWrapper.vue"; import BreadcrumbsWrapper from "@/componentss/ui/wrappers/BreadcrumbsWrapper.vue";
import {helpers} from "@/mixins/Helpers.js";
export default { export default {
name: "PostListBreadcrumbs", mixins: [helpers],
name: "PostListBreadcrumbs",
components: {BreadcrumbsWrapper, BasicIcon, Link}, components: {BreadcrumbsWrapper, BasicIcon, Link},
data() {
return {
}
},
methods: { methods: {
textLimit(text, symbols) {
if (text.length > symbols) {
let LimitedText
LimitedText = text.substring(0, symbols)
return LimitedText + "..."
}
return text
},
isMobileDevice() { isMobileDevice() {
return window.innerWidth < 1024; // Задайте порог для мобильных устройств return window.innerWidth < 1024; // Задайте порог для мобильных устройств
}, },