Commit 28d8b80241343b864602d8d49f68de74f030a979
Exists in
master
Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su
Showing 13 changed files Side-by-side Diff
- app/Http/Controllers/Admin/CompanyController.php
- app/Http/Controllers/EmployerController.php
- app/Http/Controllers/WorkerController.php
- app/Models/Message.php
- database/migrations/2024_08_16_172341_alter_table_messages.php
- public/css/general.css
- public/css/style_may2024.css
- resources/views/admin/employer_main/index.blade.php
- resources/views/admin/employer_main/index_ajax.blade.php
- resources/views/admin/employer_main/table.blade.php
- resources/views/employers/dialog.blade.php
- resources/views/workers/dialog.blade.php
- routes/web.php
app/Http/Controllers/Admin/CompanyController.php
... | ... | @@ -138,12 +138,46 @@ class CompanyController extends Controller |
138 | 138 | $list_employers = Employer::query()->active()->orderBy('name_company')->get(); |
139 | 139 | |
140 | 140 | if ($request->ajax()) { |
141 | - return view('admin.employer_main.index_ajax', compact('employers', 'list_employers')); | |
141 | + return view('admin.employer_main.table', compact('employers', 'list_employers')); | |
142 | 142 | } else { |
143 | 143 | return view('admin.employer_main.index', compact('employers', 'list_employers')); |
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | + public function employers_main_add(Request $request) | |
148 | + { | |
149 | + $page = $request->get('page', 1); | |
150 | + $page = intval($page); | |
151 | + | |
152 | + employers_main::insert([ | |
153 | + 'employer_id' => 0, | |
154 | + 'sort' => 100 | |
155 | + ]); | |
156 | + | |
157 | + $pageSize = 10; | |
158 | + $offset = ($page - 1) * $pageSize; | |
159 | + $employers = employers_main::query()->OrderBy('sort')->offset($offset)->limit($pageSize)->get(); | |
160 | + $list_employers = Employer::query()->active()->orderBy('name_company')->get(); | |
161 | + return view('admin.employer_main.table', compact('employers', 'list_employers')); | |
162 | + } | |
163 | + | |
164 | + public function employers_main_remove(Request $request) | |
165 | + { | |
166 | + $id = $request->get('id', 0); | |
167 | + $page = $request->get('page', 1); | |
168 | + $page = intval($page); | |
169 | + | |
170 | + if ($id !== 0) { | |
171 | + employers_main::where('id', $id)->delete(); | |
172 | + } | |
173 | + | |
174 | + $pageSize = 10; | |
175 | + $offset = ($page - 1) * $pageSize; | |
176 | + $employers = employers_main::query()->OrderBy('sort')->offset($offset)->limit($pageSize)->get(); | |
177 | + $list_employers = Employer::query()->active()->orderBy('name_company')->get(); | |
178 | + return view('admin.employer_main.table', compact('employers', 'list_employers')); | |
179 | + } | |
180 | + | |
147 | 181 | //////////// кабинет - редактор seo-сайта ///////////////////////////// |
148 | 182 | public function editor_seo() { |
149 | 183 | $pages = SEO::query()->OrderBy('url')->paginate(15); |
app/Http/Controllers/EmployerController.php
... | ... | @@ -496,15 +496,13 @@ class EmployerController extends Controller |
496 | 496 | $params = $request->all(); |
497 | 497 | $user1 = $params['user_id']; |
498 | 498 | $user2 = $params['to_user_id']; |
499 | - $id_vacancy = $params['ad_employer_id']; | |
500 | - $ad_name = $params['ad_name']; | |
501 | 499 | |
502 | 500 | $rules = [ |
503 | - 'text' => 'required|min:1|max:150000', | |
504 | - 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | |
501 | + 'text' => 'nullable|required_without:file|min:1|max:150000', | |
502 | + 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | |
505 | 503 | ]; |
506 | 504 | $messages = [ |
507 | - 'required' => 'Укажите обязательное поле', | |
505 | + 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', | |
508 | 506 | 'min' => [ |
509 | 507 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
510 | 508 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
... | ... | @@ -526,8 +524,7 @@ class EmployerController extends Controller |
526 | 524 | ->first() |
527 | 525 | ; |
528 | 526 | if ($chat->id){ |
529 | - return redirect()->route('employer.dialog', ['chat' => $chat->id]) | |
530 | - ->withErrors($validator); | |
527 | + return redirect()->route('employer.dialog', ['chat' => $chat->id])->withErrors($validator); | |
531 | 528 | } else { |
532 | 529 | return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); |
533 | 530 | } |
app/Http/Controllers/WorkerController.php
... | ... | @@ -1033,15 +1033,13 @@ class WorkerController extends Controller |
1033 | 1033 | $params = $request->all(); |
1034 | 1034 | $user1 = $params['user_id']; |
1035 | 1035 | $user2 = $params['to_user_id']; |
1036 | - $id_vacancy = $params['ad_employer_id']; | |
1037 | - $ad_name = $params['ad_name']; | |
1038 | 1036 | |
1039 | 1037 | $rules = [ |
1040 | - 'text' => 'required|min:1|max:150000', | |
1041 | - 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | |
1038 | + 'text' => 'nullable|required_without:file|min:1|max:150000', | |
1039 | + 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | |
1042 | 1040 | ]; |
1043 | 1041 | $messages = [ |
1044 | - 'required' => 'Укажите обязательное поле', | |
1042 | + 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', | |
1045 | 1043 | 'min' => [ |
1046 | 1044 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
1047 | 1045 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
... | ... | @@ -1057,8 +1055,17 @@ class WorkerController extends Controller |
1057 | 1055 | $validator = Validator::make($request->all(), $rules, $messages); |
1058 | 1056 | |
1059 | 1057 | if ($validator->fails()) { |
1060 | - return redirect()->route('worker.dialog', ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]) | |
1061 | - ->withErrors($validator); | |
1058 | + $chat = Chat::where('user_id', $user1) | |
1059 | + ->where('to_user_id', $user2) | |
1060 | + ->where('is_removed', 0) | |
1061 | + ->first() | |
1062 | + ; | |
1063 | + | |
1064 | + if ($chat->id){ | |
1065 | + return redirect()->route('worker.dialog', ['chat' => $chat->id])->withErrors($validator); | |
1066 | + } else { | |
1067 | + return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); | |
1068 | + } | |
1062 | 1069 | } else { |
1063 | 1070 | $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); |
1064 | 1071 |
app/Models/Message.php
... | ... | @@ -24,6 +24,7 @@ class Message extends Model |
24 | 24 | 'chat_id_from', |
25 | 25 | 'chat_id_to', |
26 | 26 | 'reply_message_id', |
27 | + 'original_file_name', | |
27 | 28 | ]; |
28 | 29 | |
29 | 30 | |
... | ... | @@ -57,7 +58,9 @@ class Message extends Model |
57 | 58 | $message_params['user_id'] = $user_id; |
58 | 59 | $message_params['to_user_id'] = $to_user_id; |
59 | 60 | if ($request && $request->has('file')) { |
60 | - $message_params['file'] = $request->file('file')->store($file_store_path, 'public'); | |
61 | + $file = $request->file('file'); | |
62 | + $message_params['file'] = $file->store($file_store_path, 'public'); | |
63 | + $message_params['original_file_name'] = $file->getClientOriginalName(); | |
61 | 64 | } |
62 | 65 | |
63 | 66 | $chat_form = Chat::firstOrCreate([ |
database/migrations/2024_08_16_172341_alter_table_messages.php
... | ... | @@ -0,0 +1,32 @@ |
1 | +<?php | |
2 | + | |
3 | +use Illuminate\Database\Migrations\Migration; | |
4 | +use Illuminate\Database\Schema\Blueprint; | |
5 | +use Illuminate\Support\Facades\Schema; | |
6 | + | |
7 | +return new class extends Migration | |
8 | +{ | |
9 | + /** | |
10 | + * Run the migrations. | |
11 | + * | |
12 | + * @return void | |
13 | + */ | |
14 | + public function up() | |
15 | + { | |
16 | + Schema::table('messages', function (Blueprint $table) { | |
17 | + $table->string('original_file_name', 255)->nullable(true)->after('file'); | |
18 | + }); | |
19 | + } | |
20 | + | |
21 | + /** | |
22 | + * Reverse the migrations. | |
23 | + * | |
24 | + * @return void | |
25 | + */ | |
26 | + public function down() | |
27 | + { | |
28 | + Schema::table('messages', function (Blueprint $table) { | |
29 | + $table->dropColumn('original_file_name'); | |
30 | + }); | |
31 | + } | |
32 | +}; |
public/css/general.css
public/css/style_may2024.css
... | ... | @@ -7214,6 +7214,29 @@ main + .news { |
7214 | 7214 | padding: 10px; |
7215 | 7215 | line-height: 1.6; |
7216 | 7216 | } |
7217 | +.chatbox__item-body-file-name-wrap{ | |
7218 | + display: flex; | |
7219 | + align-items: center; | |
7220 | +} | |
7221 | +.chatbox__item-body-file-name-wrap svg{ | |
7222 | + height: 20px; | |
7223 | + width: 20px; | |
7224 | +} | |
7225 | +.chatbox__item-body-file-name-wrap a{ | |
7226 | + margin-left: 20px; | |
7227 | + border-radius: 8px; | |
7228 | + padding: 2px 8px; | |
7229 | + -webkit-box-shadow: inset 0px 0px 14px -7px rgba(66, 68, 90, 1); | |
7230 | + -moz-box-shadow: inset 0px 0px 14px -7px rgba(66, 68, 90, 1); | |
7231 | + box-shadow: inset 0px 0px 14px -7px rgba(66, 68, 90, 1); | |
7232 | +} | |
7233 | +.chatbox__item_reverse .chatbox__item-body-file-name-wrap a{ | |
7234 | + margin-left: 0px; | |
7235 | + margin-right: 20px; | |
7236 | +} | |
7237 | +.chatbox__item-body-file-name-wrap a:hover{ | |
7238 | + box-shadow: 0px 0px 5px 1px rgb(139 136 136); | |
7239 | +} | |
7217 | 7240 | .chatbox__item-text .admin-chat-answer{ |
7218 | 7241 | padding: 2px 5px; |
7219 | 7242 | height: auto; |
resources/views/admin/employer_main/index.blade.php
... | ... | @@ -5,20 +5,18 @@ |
5 | 5 | $(document).ready(function() { |
6 | 6 | $(document).on('change', '.check_js', function () { |
7 | 7 | var this_ = $(this); |
8 | - var id = this_.attr('id'); | |
8 | + var wrap = this_.closest('tr'); | |
9 | + var id = wrap.data('id'); | |
9 | 10 | var field = this_.attr('data-field'); |
10 | 11 | var value = this_.val(); |
11 | 12 | var ajax_block = $('#ajax_block'); |
12 | 13 | var str ="id=" + id + "&"+ field + "=" + value; |
13 | - console.log(str); | |
14 | + | |
14 | 15 | $.ajax({ |
15 | 16 | type: "GET", |
16 | 17 | url: "{{ url()->full()}}", |
17 | 18 | data: str, |
18 | 19 | success: function (data) { |
19 | - console.log('Обновление таблицы пользователей '); | |
20 | - //data = JSON.parse(data); | |
21 | - //console.log(data); | |
22 | 20 | ajax_block.html(data); |
23 | 21 | }, |
24 | 22 | headers: { |
... | ... | @@ -30,39 +28,66 @@ |
30 | 28 | }); |
31 | 29 | }); |
32 | 30 | |
31 | + $(document).on('click', '.employers-main-remove-button', function(){ | |
32 | + spinStart($(this)); | |
33 | + var this_btn = $(this); | |
34 | + var wrap = this_btn.closest('tr'); | |
35 | + var id = wrap.data('id'); | |
36 | + | |
37 | + @php | |
38 | + $page = request()->get('page'); | |
39 | + @endphp | |
40 | + | |
41 | + $.ajax({ | |
42 | + type: "POST", | |
43 | + url: "{{ route('admin.employers-main-remove')}}", | |
44 | + data: { | |
45 | + id: id, | |
46 | + page: {{ $page }} | |
47 | + }, | |
48 | + success: function (data) { | |
49 | + $('#ajax_block').html(data); | |
50 | + }, | |
51 | + headers: { | |
52 | + 'X-CSRF-TOKEN': $('[name="_token"]').val() | |
53 | + }, | |
54 | + error: function (data) { | |
55 | + console.log('Error: ' + data); | |
56 | + } | |
57 | + }); | |
58 | + }); | |
59 | + | |
60 | + $(document).on('click', '.employers-main-add-button', function(){ | |
61 | + spinStart($(this)); | |
62 | + var this_btn = $(this); | |
63 | + | |
64 | + @php | |
65 | + $page = request()->get('page'); | |
66 | + @endphp | |
67 | + | |
68 | + $.ajax({ | |
69 | + type: "POST", | |
70 | + url: "{{ route('admin.employers-main-add')}}", | |
71 | + data:{ | |
72 | + page: {{ $page }} | |
73 | + }, | |
74 | + success: function (data) { | |
75 | + spinStop(this_btn); | |
76 | + $('#ajax_block').html(data); | |
77 | + }, | |
78 | + headers: { | |
79 | + 'X-CSRF-TOKEN': $('[name="_token"]').val() | |
80 | + }, | |
81 | + error: function (data) { | |
82 | + console.log('Error: ' + data); | |
83 | + } | |
84 | + }); | |
85 | + }); | |
86 | + | |
33 | 87 | }); |
34 | 88 | </script> |
35 | 89 | @endsection |
36 | 90 | |
37 | -@section('search') | |
38 | - <!--<div class="absolute inset-y-0 flex items-center pl-2"> | |
39 | - <svg | |
40 | - class="w-4 h-4" | |
41 | - aria-hidden="true" | |
42 | - fill="currentColor" | |
43 | - viewBox="0 0 20 20" | |
44 | - > | |
45 | - <path | |
46 | - fill-rule="evenodd" | |
47 | - d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" | |
48 | - clip-rule="evenodd" | |
49 | - ></path> | |
50 | - </svg> | |
51 | - </div> | |
52 | - <form action="" method="POST"> | |
53 | - <div style="float:left;"><input | |
54 | - class="w-full pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input" | |
55 | - style="width: 400px" | |
56 | - type="text" | |
57 | - placeholder="Искать..." | |
58 | - aria-label="Search" | |
59 | - /></div> | |
60 | - <div style="float: left"> | |
61 | - <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button> | |
62 | - </div> | |
63 | - </form>--> | |
64 | -@endsection | |
65 | - | |
66 | 91 | @section('content') |
67 | 92 | <style> |
68 | 93 | .col { |
... | ... | @@ -71,69 +96,17 @@ |
71 | 96 | word-break: break-all; |
72 | 97 | } |
73 | 98 | </style> |
99 | + @csrf | |
100 | + <div class="mb-10"> | |
101 | + <button class="employers-main-add-button flex px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-green-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> | |
102 | + Добавить работодателя на главную | |
103 | + </button> | |
104 | + </div> | |
74 | 105 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> |
75 | - <div class="w-full overflow-x-auto"> | |
76 | - <table class="w-full whitespace-no-wrap"> | |
77 | - <thead> | |
78 | - <tr | |
79 | - 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" | |
80 | - > | |
81 | - <th class="px-4 py-3">№</th> | |
82 | - <th class="px-4 py-3">Название пункта</th> | |
83 | - <th class="px-4 py-3">Название компании</th> | |
84 | - <th class="px-4 py-3">Сортировка</th> | |
85 | - </tr> | |
86 | - </thead> | |
87 | - <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
88 | - @foreach($employers as $emp) | |
89 | - <tr class="text-gray-700 dark:text-gray-400"> | |
90 | - <td class="px-4 py-3"> | |
91 | - {{$emp->id}} | |
92 | - </td> | |
93 | - <td class="px-4 py-3"> | |
94 | - {{$emp->name}} | |
95 | - </td> | |
96 | - <td class="px-4 py-3"> | |
97 | - <select name="employer_id{{$emp->employer_id}}" id="{{$emp->id}}" data-field="employer_id" class="form-control check_js"> | |
98 | - <option value="0" | |
99 | - @if($emp->employer_id == 0) | |
100 | - selected | |
101 | - @endif | |
102 | - >Не указано</option> | |
103 | - @isset($list_employers) | |
104 | - @foreach($list_employers as $lemp) | |
105 | - <option value="{{ $lemp->id }}" | |
106 | - @if($lemp->id == $emp->employer_id) | |
107 | - selected | |
108 | - @endif | |
109 | - >{{ $lemp->name_company }} ({{ $lemp->id }})</option> | |
110 | - @endforeach | |
111 | - @endisset | |
112 | - </select> | |
113 | - </td> | |
114 | - <td class="px-4 py-3 text-sm"> | |
115 | - <select name="sort{{$emp->employer_id}}" id="{{$emp->id}}" data-field="sort" class="form-control check_js"> | |
116 | - <option value="100" @if($emp->sort == '100') selected @endif>100</option> | |
117 | - <option value="110" @if($emp->sort == '110') selected @endif>110</option> | |
118 | - <option value="120" @if($emp->sort == '120') selected @endif>120</option> | |
119 | - <option value="130" @if($emp->sort == '130') selected @endif>130</option> | |
120 | - <option value="140" @if($emp->sort == '140') selected @endif>140</option> | |
121 | - <option value="150" @if($emp->sort == '150') selected @endif>150</option> | |
122 | - <option value="160" @if($emp->sort == '160') selected @endif>160</option> | |
123 | - <option value="170" @if($emp->sort == '170') selected @endif>170</option> | |
124 | - <option value="180" @if($emp->sort == '180') selected @endif>180</option> | |
125 | - <option value="190" @if($emp->sort == '190') selected @endif>190</option> | |
126 | - <option value="200" @if($emp->sort == '200') selected @endif>200</option> | |
127 | - </select> | |
128 | - </td> | |
129 | - </tr> | |
130 | - @endforeach | |
131 | - </tbody> | |
132 | - </table> | |
133 | - </div> | |
134 | - | |
135 | - <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"> | |
136 | - <?=$employers->appends($_GET)->links('admin.pagginate'); ?> | |
137 | - </div> | |
106 | + @include('admin.employer_main.table') | |
138 | 107 | </div> |
108 | + <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"> | |
109 | + <?=$employers->appends($_GET)->links('admin.pagginate'); ?> | |
110 | + </div> | |
111 | + | |
139 | 112 | @endsection |
resources/views/admin/employer_main/index_ajax.blade.php
... | ... | @@ -1,63 +0,0 @@ |
1 | -<div class="w-full overflow-x-auto"> | |
2 | - <table class="w-full whitespace-no-wrap"> | |
3 | - <thead> | |
4 | - <tr | |
5 | - 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" | |
6 | - > | |
7 | - <th class="px-4 py-3">№</th> | |
8 | - <th class="px-4 py-3">Название пункта</th> | |
9 | - <th class="px-4 py-3">Название компании</th> | |
10 | - <th class="px-4 py-3">Сортировка</th> | |
11 | - </tr> | |
12 | - </thead> | |
13 | - <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
14 | - <? foreach($employers as $emp) {?> | |
15 | - <tr class="text-gray-700 dark:text-gray-400"> | |
16 | - <td class="px-4 py-3"> | |
17 | - {{$emp->id}} | |
18 | - </td> | |
19 | - <td class="px-4 py-3"> | |
20 | - {{$emp->name}} | |
21 | - </td> | |
22 | - <td class="px-4 py-3"> | |
23 | - <select name="employer_id{{$emp->employer_id}}" id="{{$emp->id}}" data-field="employer_id" class="form-control check_js"> | |
24 | - <option value="0" | |
25 | - @if($emp->employer_id == 0) | |
26 | - selected | |
27 | - @endif | |
28 | - >Не указано</option> | |
29 | - @isset($list_employers) | |
30 | - @foreach($list_employers as $lemp) | |
31 | - <option value="{{ $lemp->id }}" | |
32 | - @if($lemp->id == $emp->employer_id) | |
33 | - selected | |
34 | - @endif | |
35 | - >{{ $lemp->name_company }} ({{ $lemp->id }})</option> | |
36 | - @endforeach | |
37 | - @endisset | |
38 | - </select> | |
39 | - </td> | |
40 | - <td class="px-4 py-3 text-sm"> | |
41 | - <select name="sort{{$emp->employer_id}}" id="{{$emp->id}}" data-field="sort" class="form-control check_js"> | |
42 | - <option value="100" @if($emp->sort == '100') selected @endif>100</option> | |
43 | - <option value="110" @if($emp->sort == '110') selected @endif>110</option> | |
44 | - <option value="120" @if($emp->sort == '120') selected @endif>120</option> | |
45 | - <option value="130" @if($emp->sort == '130') selected @endif>130</option> | |
46 | - <option value="140" @if($emp->sort == '140') selected @endif>140</option> | |
47 | - <option value="150" @if($emp->sort == '150') selected @endif>150</option> | |
48 | - <option value="160" @if($emp->sort == '160') selected @endif>160</option> | |
49 | - <option value="170" @if($emp->sort == '170') selected @endif>170</option> | |
50 | - <option value="180" @if($emp->sort == '180') selected @endif>180</option> | |
51 | - <option value="190" @if($emp->sort == '190') selected @endif>190</option> | |
52 | - <option value="200" @if($emp->sort == '200') selected @endif>200</option> | |
53 | - </select> | |
54 | - </td> | |
55 | - </tr> | |
56 | - <? } ?> | |
57 | - </tbody> | |
58 | - </table> | |
59 | -</div> | |
60 | - | |
61 | -<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"> | |
62 | - <?=$employers->appends($_GET)->links('admin.pagginate'); ?> | |
63 | -</div> |
resources/views/admin/employer_main/table.blade.php
... | ... | @@ -0,0 +1,53 @@ |
1 | +<div class="w-full overflow-x-auto"> | |
2 | + <table class="w-full whitespace-no-wrap"> | |
3 | + <thead> | |
4 | + <tr | |
5 | + 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" | |
6 | + > | |
7 | + <th class="px-4 py-3">Название компании</th> | |
8 | + <th class="px-4 py-3">Сортировка</th> | |
9 | + <th class="px-4 py-3"></th> | |
10 | + </tr> | |
11 | + </thead> | |
12 | + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
13 | + @foreach($employers as $emp) | |
14 | + <tr class="text-gray-700 dark:text-gray-400" data-id="{{$emp->id}}"> | |
15 | + <td class="px-4 py-3"> | |
16 | + <select name="employer_id{{$emp->employer_id}}" data-field="employer_id" class="form-control check_js"> | |
17 | + <option value="0" | |
18 | + @if($emp->employer_id == 0) | |
19 | + selected | |
20 | + @endif | |
21 | + >Не указано</option> | |
22 | + @isset($list_employers) | |
23 | + @foreach($list_employers as $lemp) | |
24 | + <option value="{{ $lemp->id }}" | |
25 | + @if($lemp->id == $emp->employer_id) | |
26 | + selected | |
27 | + @endif | |
28 | + >{{ $lemp->name_company }} ({{ $lemp->id }})</option> | |
29 | + @endforeach | |
30 | + @endisset | |
31 | + </select> | |
32 | + </td> | |
33 | + <td class="px-4 py-3 text-sm"> | |
34 | + <select name="sort{{$emp->employer_id}}" data-field="sort" class="form-control check_js"> | |
35 | + @for($i = 0; $i <= 30; $i++) | |
36 | + @php | |
37 | + $value = $i * 10 + 100; | |
38 | + @endphp | |
39 | + | |
40 | + <option value="{{ $value }}" @if($emp->sort == $value) selected @endif>{{ $value }}</option> | |
41 | + @endfor | |
42 | + </select> | |
43 | + </td> | |
44 | + <td class="px-4 py-3" style="width:150px;" > | |
45 | + <button class="employers-main-remove-button flex px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-red-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> | |
46 | + Удалить | |
47 | + </button> | |
48 | + </td> | |
49 | + </tr> | |
50 | + @endforeach | |
51 | + </tbody> | |
52 | + </table> | |
53 | +</div> |
resources/views/employers/dialog.blade.php
... | ... | @@ -5,6 +5,11 @@ |
5 | 5 | $(function(){ |
6 | 6 | var chatbox_div = $('.chatbox__list'); |
7 | 7 | chatbox_div.scrollTop(chatbox_div.prop("scrollHeight")); |
8 | + | |
9 | + $('form.chatbox__bottom [name="file"]').on('change', function() { | |
10 | + var fileName = $(this).val().split('\\').pop(); | |
11 | + $('.chatbox-file-name-wrap').text('Добавлен файл: ' + fileName); | |
12 | + }); | |
8 | 13 | }); |
9 | 14 | |
10 | 15 | $(document).on('change', '#send_btn', function() { |
... | ... | @@ -173,14 +178,33 @@ |
173 | 178 | |
174 | 179 | </div> |
175 | 180 | <div class="chatbox__item-body"> |
176 | - <div class="chatbox__item-text"> | |
177 | - {{ $it->text }} | |
178 | - @if($it->reply_message_id) | |
179 | - <div class="reply-message"> | |
180 | - {{ $it->reply_message->text }} | |
181 | + @if($it->text || $it->reply_message_id) | |
182 | + <div class="chatbox__item-text"> | |
183 | + {{ $it->text ?? '' }} | |
184 | + | |
185 | + @if($it->reply_message_id) | |
186 | + <div class="reply-message"> | |
187 | + {{ $it->reply_message->text }} | |
188 | + </div> | |
189 | + @endif | |
190 | + </div> | |
191 | + @endif | |
192 | + @if ((isset($it->file)) && (!empty($it->file))) | |
193 | + <div class="chatbox__item-text chatbox__item-body-file-name-wrap"> | |
194 | + <div class=""> | |
195 | + @if($it->original_file_name) | |
196 | + {{ $it->original_file_name }} | |
197 | + @else | |
198 | + <svg> | |
199 | + <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | |
200 | + </svg> | |
201 | + @endif | |
181 | 202 | </div> |
182 | - @endif | |
183 | - </div> | |
203 | + <a href="{{ asset(Storage::url($it->file)) }}" class=""> | |
204 | + Скачать | |
205 | + </a> | |
206 | + </div> | |
207 | + @endif | |
184 | 208 | </div> |
185 | 209 | <div class="chatbox__item-time">{{ $it->created_at }}</div> |
186 | 210 | </div> |
... | ... | @@ -209,13 +233,24 @@ |
209 | 233 | |
210 | 234 | </div> |
211 | 235 | <div class="chatbox__item-body"> |
212 | - <div class="chatbox__item-text">{{ $it->text }}</div> | |
236 | + @if($it->text) | |
237 | + <div class="chatbox__item-text">{{ $it->text }}</div> | |
238 | + @endif | |
213 | 239 | @if ((isset($it->file)) && (!empty($it->file))) |
214 | - <a href="{{ asset(Storage::url($it->file)) }}" class="chatbox__item-text"> | |
215 | - <svg> | |
216 | - <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | |
217 | - </svg> | |
218 | - </a> | |
240 | + <div class="chatbox__item-text chatbox__item-body-file-name-wrap"> | |
241 | + <a href="{{ asset(Storage::url($it->file)) }}" class=""> | |
242 | + Скачать | |
243 | + </a> | |
244 | + <div class=""> | |
245 | + @if($it->original_file_name) | |
246 | + {{ $it->original_file_name }} | |
247 | + @else | |
248 | + <svg> | |
249 | + <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | |
250 | + </svg> | |
251 | + @endif | |
252 | + </div> | |
253 | + </div> | |
219 | 254 | @endif |
220 | 255 | </div> |
221 | 256 | <div class="chatbox__item-time">{{ $it->created_at }}</div> |
... | ... | @@ -225,26 +260,29 @@ |
225 | 260 | @endforeach |
226 | 261 | @endif |
227 | 262 | </div> |
228 | - <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" > | |
229 | - @csrf | |
230 | - <label class="chatbox__bottom-file"> | |
231 | - <input id="file" name="file" type="file"> | |
232 | - <svg> | |
233 | - <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | |
234 | - </svg> | |
235 | - </label> | |
236 | - <input type="hidden" name="_token" value="{{ csrf_token() }}"/> | |
237 | - <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/> | |
238 | - <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/> | |
239 | - <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/> | |
240 | - <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/> | |
241 | - <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить"> | |
242 | - <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send"> | |
243 | - <svg> | |
244 | - <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> | |
245 | - </svg> | |
246 | - </button> | |
247 | - </form> | |
263 | + <div> | |
264 | + <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" > | |
265 | + @csrf | |
266 | + <label class="chatbox__bottom-file"> | |
267 | + <input id="file" name="file" type="file"> | |
268 | + <svg> | |
269 | + <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | |
270 | + </svg> | |
271 | + </label> | |
272 | + <input type="hidden" name="_token" value="{{ csrf_token() }}"/> | |
273 | + <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/> | |
274 | + <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/> | |
275 | + <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/> | |
276 | + <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/> | |
277 | + <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить"> | |
278 | + <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send"> | |
279 | + <svg> | |
280 | + <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> | |
281 | + </svg> | |
282 | + </button> | |
283 | + </form> | |
284 | + <div class="chatbox-file-name-wrap mt-5 fw600"></div> | |
285 | + </div> | |
248 | 286 | </div> |
249 | 287 | </div> |
250 | 288 | </div> |
resources/views/workers/dialog.blade.php
... | ... | @@ -6,6 +6,11 @@ |
6 | 6 | var chatbox_div = $('.chatbox__list'); |
7 | 7 | chatbox_div.scrollTop(chatbox_div.prop("scrollHeight")); |
8 | 8 | |
9 | + $('form.chatbox__bottom [name="file"]').on('change', function() { | |
10 | + var fileName = $(this).val().split('\\').pop(); | |
11 | + $('.chatbox-file-name-wrap').text('Добавлен файл: ' + fileName); | |
12 | + }); | |
13 | + | |
9 | 14 | $('.admin-chat-answer').click(function(){ |
10 | 15 | var modal = $('#answer_from_admin_chat_modal'); |
11 | 16 | |
... | ... | @@ -182,7 +187,25 @@ |
182 | 187 | @endif |
183 | 188 | </div> |
184 | 189 | <div class="chatbox__item-body"> |
185 | - <div class="chatbox__item-text">{{ $it->text }}</div> | |
190 | + @if($it->text) | |
191 | + <div class="chatbox__item-text">{{ $it->text }}</div> | |
192 | + @endif | |
193 | + @if ((isset($it->file)) && (!empty($it->file))) | |
194 | + <div class="chatbox__item-text chatbox__item-body-file-name-wrap"> | |
195 | + <div class=""> | |
196 | + @if($it->original_file_name) | |
197 | + {{ $it->original_file_name }} | |
198 | + @else | |
199 | + <svg> | |
200 | + <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | |
201 | + </svg> | |
202 | + @endif | |
203 | + </div> | |
204 | + <a href="{{ asset(Storage::url($it->file)) }}" class=""> | |
205 | + Скачать | |
206 | + </a> | |
207 | + </div> | |
208 | + @endif | |
186 | 209 | </div> |
187 | 210 | <div class="chatbox__item-time">{{ $it->created_at }}</div> |
188 | 211 | </div> |
... | ... | @@ -214,6 +237,7 @@ |
214 | 237 | @endif |
215 | 238 | </div> |
216 | 239 | <div class="chatbox__item-body"> |
240 | + @if($chat->is_admin_chat || $it->text || $it->reply_message_id) | |
217 | 241 | <div class="chatbox__item-text"> |
218 | 242 | @if($chat->is_admin_chat) |
219 | 243 | <button class="button admin-chat-answer" data-fancybox data-src="#answer_from_admin_chat_modal" |
... | ... | @@ -223,7 +247,9 @@ |
223 | 247 | </button> |
224 | 248 | @endif |
225 | 249 | |
226 | - {{ $it->text }} | |
250 | + @if($it->text) | |
251 | + {{ $it->text }} | |
252 | + @endif | |
227 | 253 | |
228 | 254 | @if($it->reply_message_id) |
229 | 255 | <div class="reply-message"> |
... | ... | @@ -231,12 +257,22 @@ |
231 | 257 | </div> |
232 | 258 | @endif |
233 | 259 | </div> |
260 | + @endif | |
234 | 261 | @if ((isset($it->file)) && (!empty($it->file))) |
235 | - <a href="{{ asset(Storage::url($it->file)) }}" class="chatbox__item-text"> | |
236 | - <svg> | |
237 | - <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | |
238 | - </svg> | |
239 | - </a> | |
262 | + <div class="chatbox__item-text chatbox__item-body-file-name-wrap"> | |
263 | + <a href="{{ asset(Storage::url($it->file)) }}" class=""> | |
264 | + Скачать | |
265 | + </a> | |
266 | + <div class=""> | |
267 | + @if($it->original_file_name) | |
268 | + {{ $it->original_file_name }} | |
269 | + @else | |
270 | + <svg> | |
271 | + <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | |
272 | + </svg> | |
273 | + @endif | |
274 | + </div> | |
275 | + </div> | |
240 | 276 | @endif |
241 | 277 | </div> |
242 | 278 | <div class="chatbox__item-time">{{ $it->created_at }}</div> |
... | ... | @@ -247,26 +283,29 @@ |
247 | 283 | @endif |
248 | 284 | </div> |
249 | 285 | @if(!$chat->is_admin_chat) |
250 | - <form action="{{ route('worker.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" > | |
251 | - @csrf | |
252 | - <label class="chatbox__bottom-file"> | |
253 | - <input id="file" name="file" type="file"> | |
254 | - <svg> | |
255 | - <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | |
256 | - </svg> | |
257 | - </label> | |
258 | - <input type="hidden" name="_token" value="{{ csrf_token() }}"/> | |
259 | - <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/> | |
260 | - <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/> | |
261 | - <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/> | |
262 | - <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/> | |
263 | - <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить"> | |
264 | - <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send"> | |
265 | - <svg> | |
266 | - <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> | |
267 | - </svg> | |
268 | - </button> | |
269 | - </form> | |
286 | + <div> | |
287 | + <form action="{{ route('worker.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" > | |
288 | + @csrf | |
289 | + <label class="chatbox__bottom-file"> | |
290 | + <input id="file" name="file" type="file"> | |
291 | + <svg> | |
292 | + <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | |
293 | + </svg> | |
294 | + </label> | |
295 | + <input type="hidden" name="_token" value="{{ csrf_token() }}"/> | |
296 | + <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/> | |
297 | + <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/> | |
298 | + <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/> | |
299 | + <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/> | |
300 | + <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить"> | |
301 | + <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send"> | |
302 | + <svg> | |
303 | + <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> | |
304 | + </svg> | |
305 | + </button> | |
306 | + </form> | |
307 | + <div class="chatbox-file-name-wrap mt-5 fw600"></div> | |
308 | + </div> | |
270 | 309 | @endif |
271 | 310 | </div> |
272 | 311 | </div> |
routes/web.php
... | ... | @@ -337,6 +337,8 @@ Route::group([ |
337 | 337 | |
338 | 338 | // кабинет - редактор работодатели на главной |
339 | 339 | Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); |
340 | + Route::post('employers-main-add', [CompanyController::class, 'employers_main_add'])->name('employers-main-add'); | |
341 | + Route::post('employers-main-remove', [CompanyController::class, 'employers_main_remove'])->name('employers-main-remove'); | |
340 | 342 | |
341 | 343 | |
342 | 344 | // кабинет - редактор seo-сайта |