Blame view
resources/views/admin/education/form.blade.php
22.5 KB
00652ea57 Оптимизация запро... |
1 |
|
00652ea57 Оптимизация запро... |
2 |
<div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> |
eb8596db6 Правки вакансии, ... |
3 |
<form method="POST" action="{{ route('admin.education.update', ['education' => $education->id]) }}" enctype="multipart/form-data"> |
049e0c124 Фиксы для страниц... |
4 5 6 |
@csrf @method('PUT') |
00652ea57 Оптимизация запро... |
7 |
<label class="block text-sm"> |
01e6816d2 Добавление модели... |
8 |
<span class="text-gray-700 dark:text-gray-400">Название учебного заведения</span> |
00652ea57 Оптимизация запро... |
9 10 |
<input name="name" id="name" 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" |
01e6816d2 Добавление модели... |
11 |
placeholder="Название учебного заведения" value="{{ old('name') ?? $education->name ?? '' }}" |
00652ea57 Оптимизация запро... |
12 13 14 15 16 17 18 |
/> @error('name') <span class="text-xs text-red-600 dark:text-red-400"> {{ $message }} </span> @enderror </label><br> |
01e6816d2 Добавление модели... |
19 |
<label class="block text-sm"> |
01e6816d2 Добавление модели... |
20 |
<span class="text-gray-700 dark:text-gray-400">Текст</span> |
eb8596db6 Правки вакансии, ... |
21 |
<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 |
01e6816d2 Добавление модели... |
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
rows="10">{{ old('text') ?? $education->text ?? '' }}</textarea> @error('text') <span class="text-xs text-red-600 dark:text-red-400"> {{ $message }} </span> @enderror </label><br> <label class="block text-sm"> <span class="text-gray-700 dark:text-gray-400">Картинка</span> <input type="file" 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" id="image" name="image" accept="image/png, image/jpeg"> @error('image') <span class="text-xs text-red-600 dark:text-red-400"> {{ $message }} </span> @enderror @isset($education->image) <img src="{{asset(Storage::url($education->image))}}" width="100px"/> @endisset </label><br> |
567d6161f Редакция работода... |
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
<hr> <h5 class="text-gray-700 dark:text-gray-400">Контакты: </h5> <label class="block text-sm"> <span class="text-gray-700 dark:text-gray-400">Адрес</span> <input name="address" id="address" 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" placeholder="Адрес" value="{{ old('address') ?? $education->address ?? '' }}" /> @error('address') <span class="text-xs text-red-600 dark:text-red-400"> {{ $message }} </span> @enderror </label><br> <label class="block text-sm"> <span class="text-gray-700 dark:text-gray-400">Email</span> <input name="email" id="email" 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" placeholder="Email" value="{{ old('email') ?? $education->email ?? '' }}" /> @error('email') <span class="text-xs text-red-600 dark:text-red-400"> {{ $message }} </span> @enderror </label><br> <label class="block text-sm"> <span class="text-gray-700 dark:text-gray-400">Телефон</span> <input name="telephone" id="telephone" 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" placeholder="Телефон" value="{{ old('telephone') ?? $education->telephone ?? '' }}" /> @error('telephone') <span class="text-xs text-red-600 dark:text-red-400"> {{ $message }} </span> @enderror </label><br> |
00652ea57 Оптимизация запро... |
85 86 87 88 89 90 91 92 93 94 95 |
<div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> <div> <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"> Сохранить </button> <a href="{{ route('admin.education.index') }}" 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" style="display: -webkit-inline-box; height: 30px!important;" >Назад</a> </div> </div> |
eb8596db6 Правки вакансии, ... |
96 97 98 |
</form> @isset($education) |
22f5df84f Образование табы |
99 100 101 102 103 104 105 106 107 108 109 110 111 |
<div class="tabs_ js_tabs px-4 py-3 bg-white rounded-lg shadow-md dark:bg-gray-800"> <h2 class="my-6 text-2xl font-semibold text-gray-700 dark:text-gray-200"> Программы образования </h2> <form class="tabs__form js_tabs_form" method="GET" action="{{ route('admin.add-program-education') }}"> <label class="tabs__label block mt-4 text-sm"> <div class="relative text-gray-500 focus-within:text-purple-600"> <input type="hidden" name="id" value="{{ $education->id }}"/> <input name="level" class="tabs__input js_tabs_input block w-full pr-20 text-sm text-black dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray form-input" placeholder="Введите название таба"/> <!-- For disabled buttons ADD these classes: opacity-50 cursor-not-allowed And REMOVE these classes: active:bg-purple-600 hover:bg-purple-700 focus:shadow-outline-purple --> <button class="tabs__submit-btn js_tabs_submit_btn absolute inset-y-0 right-0 px-4 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-r-md focus:outline-none opacity-50 cursor-not-allowed" disabled>+</button> <!-- <button class="tabs__submit-btn js_tabs_submit_btn absolute inset-y-0 right-0 px-4 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-r-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">+</button> --> |
eb8596db6 Правки вакансии, ... |
112 |
</div> |
22f5df84f Образование табы |
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
</label> </form> <div class="tabs__buttons js_tabs_buttons flex flex-col flex-wrap mb-4 md:flex-row md:space-x-4"> @if ($program->count()) @php $bool = true; $i = 1; $level = ""; @endphp @foreach ($program as $pro) @if ((!empty($level)) && ($level <> $pro->level )) @php $bool = true; $i++; @endphp @endif @if ($bool == true) <div> <button class="tabs__btn js_tabs_btn mt-4 px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" data-btn="{{ $pro->level }}" data-id="{{$i}}">{{ $pro->level }}</button> </div> @php $bool = false; $level = $pro->level; @endphp @endif @endforeach @endif </div> <div class="tabs__content js_tabs_content"> @if ($program->count()) @php $bool = true; $i = 1; $level = ""; @endphp @foreach ($program as $pro) |
c9a440a1d Образование, табы... |
145 |
@php $name_tab = $pro->level; @endphp |
22f5df84f Образование табы |
146 147 148 149 150 151 152 153 154 |
@if ((!empty($level)) && ($level <> $pro->level)) </tbody> </table> </div> @php $bool = true; $i++; @endphp @endif @if ($bool == true) <div class="tabs__item js_tabs_item @php echo($i>1) ? 'hidden' : ''; @endphp" data-id="{{$i}}"> |
c9a440a1d Образование, табы... |
155 156 157 158 159 160 161 162 |
<form action="{{ route('admin.add-program-education') }}" method="GET" class="flex flex-col flex-wrap mb-4 md:flex-row md:space-x-4"> <div> <input type="hidden" name="id" value="{{ $education->id }}"/> <input type="hidden" name="level" value="{{$name_tab}}"/> <button type="submit" class="mt-4 px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">Добавить</button> </div> </form> <table class="mb-4 w-full whitespace-no-wrap"> |
22f5df84f Образование табы |
163 164 165 166 167 168 169 |
<thead> <tr 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" > <th class="px-4 py-3">Специализация</th> <th class="px-4 py-3">Описание</th> <th class="px-4 py-3">Редактирование</th> |
eb8596db6 Правки вакансии, ... |
170 |
|
22f5df84f Образование табы |
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
</tr> </thead> <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800" > @php $bool = false; $level = $pro->level; @endphp @endif <tr class="text-gray-700 dark:text-gray-400"> <td class="px-4 py-3"> <div class="flex items-center text-sm"> <div> <p class="font-semibold">Специальность: </p> <p class="text-xs text-gray-600 dark:text-gray-400"> |
c9a440a1d Образование, табы... |
186 |
{{ mb_strimwidth($pro->name, 0, 50, "...") }} |
22f5df84f Образование табы |
187 188 189 190 191 |
</p> </div> </div> </td> <td class="px-4 py-3 text-sm"> |
c9a440a1d Образование, табы... |
192 |
<span class="text-gray-700 dark:text-gray-400">Описание: {{ mb_strimwidth($pro->text, 0, 100, "...")}}</span> |
22f5df84f Образование табы |
193 194 195 196 |
</td> <td class="px-4 py-3 text-xs"> <a href="{{ route('admin.edit-program-education', ['program' => $pro->id, 'education' => $education->id]) }}">Изменить</a> | <a href="{{ route('admin.delete-program-education', ['program' => $pro->id, 'education' => $education->id]) }}">Удалить</a> |
22f5df84f Образование табы |
197 198 199 200 201 202 203 |
</td> </tr> @endforeach @endif </div> </div> @endisset |
00652ea57 Оптимизация запро... |
204 |
</div> |
22f5df84f Образование табы |
205 |
|
8018b0795 Баг в ckeditor |
206 |
<script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> |
180e53f58 Редактор ckeditor |
207 |
|
8018b0795 Баг в ckeditor |
208 |
<!--<script src="{{ asset('./ckeditor/ckeditor.js') }}"></script>--> |
01e6816d2 Добавление модели... |
209 210 211 212 213 214 215 |
<script> CKEDITOR.replace( 'text', { filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", filebrowserUploadMethod: 'form' }); </script> |
22f5df84f Образование табы |
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
<script> window.addEventListener('DOMContentLoaded', () => { setTabs(3); function setTabs(qty) { const tabs = document.querySelector('.js_tabs'); const tabsForm = tabs.querySelector('.js_tabs_form'); const tabsInput = tabs.querySelector('.js_tabs_input'); const tabsSubmitBtn = tabs.querySelector('.js_tabs_submit_btn'); const tabsButtons = tabs.querySelector('.js_tabs_buttons'); const tabsContent = tabs.querySelector('.js_tabs_content'); tabsForm.addEventListener('submit', (e) => { //e.preventDefault(); const tabsInputValue = tabsInput.value; const tabsBtns = tabsButtons.querySelectorAll('.js_tabs_btn'); const id = Date.now(); |
c9a440a1d Образование, табы... |
237 238 239 240 241 |
if (tabsBtns.length >= qty) { console.log('Ветка выполнена'); e.preventDefault(); } |
636d814c5 Редактор табов об... |
242 |
if (tabsInput.dataset.edit) { |
22f5df84f Образование табы |
243 244 245 |
tabsBtns.forEach(btn => { if (tabsInput.dataset.edit === btn.dataset.id) { |
636d814c5 Редактор табов об... |
246 247 248 249 250 251 252 253 254 255 |
console.log('oldname: '+btn.textContent+' newname: '+tabsInputValue+' id_education: '+<?=$education->id?>+''); $.ajax({ url: '{{ route('admin.rename-program-education') }}', method: 'get', /* Метод запроса (post или get) */ dataType: 'html', /* Тип данных в ответе (xml, json, script, html). */ data: {oldname: btn.textContent, newname:tabsInputValue, id_education: <?=$education->id?>}, /* Данные передаваемые в массиве */ success: function(data){ /* функция которая будет выполнена после успешного запроса. */ console.log(data); /* В переменной data содержится ответ от index.php. */ } }); |
22f5df84f Образование табы |
256 257 258 259 260 261 262 263 264 265 266 |
btn.textContent = tabsInputValue; btn.dataset.btn = tabsInputValue; } }); console.log('Эта ветка выполнилась'); tabsInput.removeAttribute('data-edit'); } else { if (!tabsBtns.length) { tabsButtons.innerHTML += getTabsBtnTemplate(tabsInputValue, id); |
636d814c5 Редактор табов об... |
267 |
//tabsContent.innerHTML += getTabsItemTemplate(id); |
22f5df84f Образование табы |
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
} if (tabsBtns.length && tabsBtns.length < qty) { let isMatch = false; tabsBtns.forEach(btn => { if (tabsInputValue === btn.dataset.btn) { isMatch = true; } }); console.log('Альтернативная ветка!'); if (!isMatch) { tabsButtons.innerHTML += getTabsBtnTemplate(tabsInputValue, id); tabsContent.innerHTML += getTabsItemTemplate(id, 'hidden'); } } |
636d814c5 Редактор табов об... |
286 |
} |
22f5df84f Образование табы |
287 |
|
b1a7d3c76 Баг в форме-табов... |
288 |
//tabsInput.value = ''; |
22f5df84f Образование табы |
289 290 291 292 293 |
addDisabledBtnStatus(tabsSubmitBtn); }); tabsInput.addEventListener('input', () => { |
c9a440a1d Образование, табы... |
294 295 296 297 298 |
if (tabsInput.value !== '') { removeDisabledBtnStatus(tabsSubmitBtn); } else { addDisabledBtnStatus(tabsSubmitBtn); } |
22f5df84f Образование табы |
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
}); tabsButtons.addEventListener('click', (e) => { const target = e.target.closest('.js_tabs_btn'); if (target) { const tabsItems = tabs.querySelectorAll('.js_tabs_item'); tabsItems.forEach(item => { item.classList.add('hidden'); if (target.dataset.id === item.dataset.id) { item.classList.remove('hidden'); } }); } }); tabsButtons.addEventListener('dblclick', (e) => { |
c9a440a1d Образование, табы... |
322 |
const target = e.target.closest('.js_tabs_btn'); |
22f5df84f Образование табы |
323 |
|
c9a440a1d Образование, табы... |
324 325 326 327 328 |
if (target) { tabsInput.value = target.dataset.btn; tabsInput.dataset.edit = target.dataset.id; removeDisabledBtnStatus(tabsSubmitBtn); } |
22f5df84f Образование табы |
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
}); function getTabsBtnTemplate(btnName, id) { return ` <div> <button class="tabs__btn js_tabs_btn mt-4 px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" data-btn="${btnName}" data-id="${id}">${btnName}</button> </div> `; } function getTabsItemTemplate(id, className = '') { return ` <div class="tabs__item js_tabs_item ${className}" data-id="${id}"> <div class="mb-4">${id}</div> <table class="mb-4 w-full whitespace-no-wrap"> <thead> <tr 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" > <th class="px-4 py-3">Client</th> <th class="px-4 py-3">Amount</th> <th class="px-4 py-3">Status</th> <th class="px-4 py-3">Date</th> </tr> </thead> <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800" > <tr class="text-gray-700 dark:text-gray-400"> <td class="px-4 py-3"> <div class="flex items-center text-sm"> <!-- Avatar with inset shadow --> <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block" > <img class="object-cover w-full h-full rounded-full" src="https://images.unsplash.com/flagged/photo-1570612861542-284f4c12e75f?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max&ixid=eyJhcHBfaWQiOjE3Nzg0fQ" alt="" loading="lazy" /> <div class="absolute inset-0 rounded-full shadow-inner" aria-hidden="true" ></div> </div> <div> <p class="font-semibold">Hans Burger</p> <p class="text-xs text-gray-600 dark:text-gray-400"> 10x Developer </p> </div> </div> </td> <td class="px-4 py-3 text-sm"> $ 863.45 </td> <td class="px-4 py-3 text-xs"> <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100" > Approved </span> </td> <td class="px-4 py-3 text-sm"> 6/10/2020 </td> </tr> <tr class="text-gray-700 dark:text-gray-400"> <td class="px-4 py-3"> <div class="flex items-center text-sm"> <!-- Avatar with inset shadow --> <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block" > <img class="object-cover w-full h-full rounded-full" src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&facepad=3&fit=facearea&s=707b9c33066bf8808c934c8ab394dff6" alt="" loading="lazy" /> <div class="absolute inset-0 rounded-full shadow-inner" aria-hidden="true" ></div> </div> <div> <p class="font-semibold">Jolina Angelie</p> <p class="text-xs text-gray-600 dark:text-gray-400"> Unemployed </p> </div> </div> </td> <td class="px-4 py-3 text-sm"> $ 369.95 </td> <td class="px-4 py-3 text-xs"> <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600" > Pending </span> </td> <td class="px-4 py-3 text-sm"> 6/10/2020 </td> </tr> </tbody> </table> <div class="flex flex-col flex-wrap mb-4 md:flex-row md:space-x-4"> <div> <a href="#" class="mt-4 px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">Редактировать</a> </div> <div> <a href="#" class="mt-4 px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">Удалить</a> </div> </div> </div> `; } function addDisabledBtnStatus(btn) { |
c9a440a1d Образование, табы... |
454 455 456 |
btn.disabled = true; btn.classList.add('opacity-50', 'cursor-not-allowed'); btn.classList.remove('active:bg-purple-600', 'hover:bg-purple-700', 'focus:shadow-outline-purple'); |
22f5df84f Образование табы |
457 458 459 |
} function removeDisabledBtnStatus(btn) { |
c9a440a1d Образование, табы... |
460 461 462 |
btn.disabled = false; btn.classList.remove('opacity-50', 'cursor-not-allowed'); btn.classList.add('active:bg-purple-600', 'hover:bg-purple-700', 'focus:shadow-outline-purple'); |
22f5df84f Образование табы |
463 464 465 |
} } |
22f5df84f Образование табы |
466 467 468 |
console.log('main.js init'); }); |
c9a440a1d Образование, табы... |
469 |
|
22f5df84f Образование табы |
470 |
</script> |