Commit c9a440a1d1de17965a5cee22ec89c89c6df12d61

Authored by Андрей Ларионов
1 parent 22f5df84fd

Образование, табы, 2-часть

Showing 4 changed files with 50 additions and 34 deletions Inline Diff

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