Commit 4df04df2e9fde2ece488cb0d2ecb9a18fc653734

Authored by Андрей Ларионов
1 parent 96681864ee

Обрезание слов у образования - strsub

Showing 2 changed files with 7 additions and 4 deletions Inline Diff

resources/views/admin/education/form.blade.php
1 @csrf 1 @csrf
2 2
3 @isset($education) 3 @isset($education)
4 @method('PUT') 4 @method('PUT')
5 @endisset 5 @endisset
6 6
7 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> 7 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
8 <label class="block text-sm"> 8 <label class="block text-sm">
9 <span class="text-gray-700 dark:text-gray-400">Название учебного заведения</span> 9 <span class="text-gray-700 dark:text-gray-400">Название учебного заведения</span>
10 <input name="name" id="name" 10 <input name="name" id="name"
11 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 11 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
12 placeholder="Название учебного заведения" value="{{ old('name') ?? $education->name ?? '' }}" 12 placeholder="Название учебного заведения" value="{{ old('name') ?? $education->name ?? '' }}"
13 /> 13 />
14 @error('name') 14 @error('name')
15 <span class="text-xs text-red-600 dark:text-red-400"> 15 <span class="text-xs text-red-600 dark:text-red-400">
16 {{ $message }} 16 {{ $message }}
17 </span> 17 </span>
18 @enderror 18 @enderror
19 </label><br> 19 </label><br>
20 20
21 <label class="block text-sm"> 21 <label class="block text-sm">
22 <span class="text-gray-700 dark:text-gray-400">Адрес</span> 22 <span class="text-gray-700 dark:text-gray-400">Адрес</span>
23 <input name="address" id="address" 23 <input name="address" id="address"
24 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 24 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
25 placeholder="Адрес" value="{{ old('address') ?? $education->address ?? '' }}" 25 placeholder="Адрес" value="{{ old('address') ?? $education->address ?? '' }}"
26 /> 26 />
27 @error('address') 27 @error('address')
28 <span class="text-xs text-red-600 dark:text-red-400"> 28 <span class="text-xs text-red-600 dark:text-red-400">
29 {{ $message }} 29 {{ $message }}
30 </span> 30 </span>
31 @enderror 31 @enderror
32 </label><br> 32 </label><br>
33 33
34 <label class="block text-sm"> 34 <label class="block text-sm">
35 <span class="text-gray-700 dark:text-gray-400">Email</span> 35 <span class="text-gray-700 dark:text-gray-400">Email</span>
36 <input name="email" id="email" 36 <input name="email" id="email"
37 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 37 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
38 placeholder="Email" value="{{ old('email') ?? $education->email ?? '' }}" 38 placeholder="Email" value="{{ old('email') ?? $education->email ?? '' }}"
39 /> 39 />
40 @error('email') 40 @error('email')
41 <span class="text-xs text-red-600 dark:text-red-400"> 41 <span class="text-xs text-red-600 dark:text-red-400">
42 {{ $message }} 42 {{ $message }}
43 </span> 43 </span>
44 @enderror 44 @enderror
45 </label><br> 45 </label><br>
46 46
47 <label class="block text-sm"> 47 <label class="block text-sm">
48 <span class="text-gray-700 dark:text-gray-400">Телефон</span> 48 <span class="text-gray-700 dark:text-gray-400">Телефон</span>
49 <input name="telephone" id="telephone" 49 <input name="telephone" id="telephone"
50 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 50 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
51 placeholder="Телефон" value="{{ old('telephone') ?? $education->telephone ?? '' }}" 51 placeholder="Телефон" value="{{ old('telephone') ?? $education->telephone ?? '' }}"
52 /> 52 />
53 @error('telephone') 53 @error('telephone')
54 <span class="text-xs text-red-600 dark:text-red-400"> 54 <span class="text-xs text-red-600 dark:text-red-400">
55 {{ $message }} 55 {{ $message }}
56 </span> 56 </span>
57 @enderror 57 @enderror
58 </label><br> 58 </label><br>
59 59
60 <label class="block text-sm"> 60 <label class="block text-sm">
61 <span class="text-gray-700 dark:text-gray-400">Текст</span> 61 <span class="text-gray-700 dark:text-gray-400">Текст</span>
62 <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text" placeholder="Текст (html)" required 62 <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text" placeholder="Текст (html)" required
63 rows="10">{{ old('text') ?? $education->text ?? '' }}</textarea> 63 rows="10">{{ old('text') ?? $education->text ?? '' }}</textarea>
64 @error('text') 64 @error('text')
65 <span class="text-xs text-red-600 dark:text-red-400"> 65 <span class="text-xs text-red-600 dark:text-red-400">
66 {{ $message }} 66 {{ $message }}
67 </span> 67 </span>
68 @enderror 68 @enderror
69 </label><br> 69 </label><br>
70 70
71 <label class="block text-sm"> 71 <label class="block text-sm">
72 <span class="text-gray-700 dark:text-gray-400">Картинка</span> 72 <span class="text-gray-700 dark:text-gray-400">Картинка</span>
73 <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 73 <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700
74 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple 74 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple
75 dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 75 dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
76 id="image" name="image" accept="image/png, image/jpeg"> 76 id="image" name="image" accept="image/png, image/jpeg">
77 @error('image') 77 @error('image')
78 <span class="text-xs text-red-600 dark:text-red-400"> 78 <span class="text-xs text-red-600 dark:text-red-400">
79 {{ $message }} 79 {{ $message }}
80 </span> 80 </span>
81 @enderror 81 @enderror
82 @isset($education->image) 82 @isset($education->image)
83 <img src="{{asset(Storage::url($education->image))}}" width="100px"/> 83 <img src="{{asset(Storage::url($education->image))}}" width="100px"/>
84 @endisset 84 @endisset
85 </label><br> 85 </label><br>
86 86
87 87
88 @isset($education) 88 @isset($education)
89 <div class="tabs"> 89 <div class="tabs">
90 <input type="radio" name="tab-btn" id="tab-btn-1" value="" checked> 90 <input type="radio" name="tab-btn" id="tab-btn-1" value="" checked>
91 <label for="tab-btn-1">Высшее образование</label> 91 <label for="tab-btn-1">Высшее образование</label>
92 <input type="radio" name="tab-btn" id="tab-btn-2" value=""> 92 <input type="radio" name="tab-btn" id="tab-btn-2" value="">
93 <label for="tab-btn-2">Средне-профессиональное образование</label> 93 <label for="tab-btn-2">Средне-профессиональное образование</label>
94 <input type="radio" name="tab-btn" id="tab-btn-3" value=""> 94 <input type="radio" name="tab-btn" id="tab-btn-3" value="">
95 <label for="tab-btn-3">Дополнительное образование</label> 95 <label for="tab-btn-3">Дополнительное образование</label>
96 <div id="content-1"> 96 <div id="content-1">
97 <a id="add1" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" 97 <a id="add1" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
98 href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 1]) }}" 98 href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 1]) }}"
99 >Добавить специализацию</a><br> 99 >Добавить специализацию</a><br>
100 @if ((isset($program1)) && ($program1->count())) 100 @if ((isset($program1)) && ($program1->count()))
101 @foreach ($program1 as $prog1) 101 @foreach ($program1 as $prog1)
102 <hr>
102 <label class="block text-sm"> 103 <label class="block text-sm">
103 <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog1->name}}</h4> 104 <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog1->name}}</h4>
104 <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog1->text}}</span> 105 <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog1->text}}</span>
105 </label><br><hr> 106 </label><br>
106 @endforeach 107 @endforeach
107 @else 108 @else
108 <span class="text-gray-700 dark:text-gray-400">Нет записей</span> 109 <span class="text-gray-700 dark:text-gray-400">Нет записей</span>
109 @endif 110 @endif
110 </div> 111 </div>
111 <div id="content-2"> 112 <div id="content-2">
112 <a id="add2" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" 113 <a id="add2" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
113 href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 2]) }}" 114 href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 2]) }}"
114 >Добавить специализацию</a><br> 115 >Добавить специализацию</a><br>
115 @if ((isset($program2)) && ($program2->count())) 116 @if ((isset($program2)) && ($program2->count()))
116 @foreach ($program2 as $prog2) 117 @foreach ($program2 as $prog2)
118 <hr>
117 <label class="block text-sm"> 119 <label class="block text-sm">
118 <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog2->name}}</h4> 120 <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog2->name}}</h4>
119 <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog2->text}}</span> 121 <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog2->text}}</span>
120 </label><br><hr> 122 </label><br>
121 @endforeach 123 @endforeach
122 @else 124 @else
123 <span class="text-gray-700 dark:text-gray-400">Нет записей</span> 125 <span class="text-gray-700 dark:text-gray-400">Нет записей</span>
124 @endif 126 @endif
125 </div> 127 </div>
126 <div id="content-3"> 128 <div id="content-3">
127 <a id="add3" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" 129 <a id="add3" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
128 href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 3]) }}" 130 href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 3]) }}"
129 >Добавить специализацию</a><br> 131 >Добавить специализацию</a><br>
130 @if ((isset($program3)) && ($program3->count())) 132 @if ((isset($program3)) && ($program3->count()))
131 @foreach ($program3 as $prog3) 133 @foreach ($program3 as $prog3)
134 <hr>
132 <label class="block text-sm"> 135 <label class="block text-sm">
133 <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog3->name}}</h4> 136 <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog3->name}}</h4>
134 <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog3->text}}</span> 137 <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog3->text}}</span>
135 </label><br><hr> 138 </label><br>
136 @endforeach 139 @endforeach
137 @else 140 @else
138 <span class="text-gray-700 dark:text-gray-400">Нет записей</span> 141 <span class="text-gray-700 dark:text-gray-400">Нет записей</span>
139 @endif 142 @endif
140 </div> 143 </div>
141 </div><br> 144 </div><br>
142 @endisset 145 @endisset
143 146
144 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> 147 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
145 <div> 148 <div>
146 <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> 149 <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
147 Сохранить 150 Сохранить
148 </button> 151 </button>
149 <a href="{{ route('admin.education.index') }}" 152 <a href="{{ route('admin.education.index') }}"
150 class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" 153 class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
151 style="display: -webkit-inline-box; height: 30px!important;" 154 style="display: -webkit-inline-box; height: 30px!important;"
152 >Назад</a> 155 >Назад</a>
153 </div> 156 </div>
154 </div> 157 </div>
155 </div> 158 </div>
156 <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> 159 <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
157 160
158 <!--<script src="{{ asset('./ckeditor/ckeditor.js') }}"></script>--> 161 <!--<script src="{{ asset('./ckeditor/ckeditor.js') }}"></script>-->
159 <script> 162 <script>
160 CKEDITOR.replace( 'text', { 163 CKEDITOR.replace( 'text', {
161 filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", 164 filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
162 filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", 165 filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
163 filebrowserUploadMethod: 'form' 166 filebrowserUploadMethod: 'form'
164 }); 167 });
165 </script> 168 </script>
166 169
resources/views/admin/education/index.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Справочник образование']) 1 @extends('layout.admin', ['title' => 'Админка - Справочник образование'])
2 2
3 @section('script') 3 @section('script')
4 4
5 @endsection 5 @endsection
6 6
7 @section('search') 7 @section('search')
8 8
9 @endsection 9 @endsection
10 10
11 @section('content') 11 @section('content')
12 12
13 <a href="{{ route('admin.education.create') }}" style="width: 195px" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> 13 <a href="{{ route('admin.education.create') }}" style="width: 195px" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
14 Добавить образование 14 Добавить образование
15 </a> 15 </a>
16 <br> 16 <br>
17 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> 17 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
18 18
19 <div class="w-full overflow-x-auto"> 19 <div class="w-full overflow-x-auto">
20 <table class="w-full whitespace-no-wrap"> 20 <table class="w-full whitespace-no-wrap">
21 <thead> 21 <thead>
22 <tr 22 <tr
23 class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" 23 class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800"
24 > 24 >
25 <th class="px-4 py-3">№</th> 25 <th class="px-4 py-3">№</th>
26 <th class="px-4 py-3">Название образования</th> 26 <th class="px-4 py-3">Название образования</th>
27 <th class="px-4 py-3">Редактировать</th> 27 <th class="px-4 py-3">Редактировать</th>
28 <th class="px-4 py-3">Дата создания</th> 28 <th class="px-4 py-3">Дата создания</th>
29 </tr> 29 </tr>
30 </thead> 30 </thead>
31 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 31 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
32 @foreach($education as $cat) 32 @foreach($education as $cat)
33 <tr class="text-gray-700 dark:text-gray-400"> 33 <tr class="text-gray-700 dark:text-gray-400">
34 <td class="px-4 py-3"> 34 <td class="px-4 py-3">
35 {{$cat->id}} 35 {{$cat->id}}
36 </td> 36 </td>
37 <td class="px-4 py-3"> 37 <td class="px-4 py-3">
38 {{mb_strimwidth($cat->name, 0, 65, "...")}} 38 {{ substr($cat->name, 0, 65)}}
39 </td> 39 </td>
40 40
41 <td class="px-4 py-3 text-sm_"> 41 <td class="px-4 py-3 text-sm_">
42 <form action="{{ route('admin.education.destroy', ['education' => $cat->id]) }}" method="POST"> 42 <form action="{{ route('admin.education.destroy', ['education' => $cat->id]) }}" method="POST">
43 <a href="{{ route('admin.education.edit', ['education' => $cat->id]) }}">Изменить</a> | 43 <a href="{{ route('admin.education.edit', ['education' => $cat->id]) }}">Изменить</a> |
44 @csrf 44 @csrf
45 @method('DELETE') 45 @method('DELETE')
46 <input class="btn btn-danger" type="submit" value="Удалить"/> 46 <input class="btn btn-danger" type="submit" value="Удалить"/>
47 </form> 47 </form>
48 </td> 48 </td>
49 <td class="px-4 py-3"> 49 <td class="px-4 py-3">
50 {{ date('d.m.Y', strtotime($cat->created_at))}} 50 {{ date('d.m.Y', strtotime($cat->created_at))}}
51 </td> 51 </td>
52 </tr> 52 </tr>
53 @endforeach 53 @endforeach
54 </tbody> 54 </tbody>
55 </table> 55 </table>
56 </div> 56 </div>
57 57
58 <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800"> 58 <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800">
59 <?=$education->appends($_GET)->links('admin.pagginate'); ?> 59 <?=$education->appends($_GET)->links('admin.pagginate'); ?>
60 </div> 60 </div>
61 </div> 61 </div>
62 @endsection 62 @endsection
63 63