diff --git a/app/Http/Controllers/Admin/MsgAnswersController.php b/app/Http/Controllers/Admin/MsgAnswersController.php index c4c6a37..3ec1d32 100644 --- a/app/Http/Controllers/Admin/MsgAnswersController.php +++ b/app/Http/Controllers/Admin/MsgAnswersController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Models\Message; +use App\Models\MessagesRequests; use App\Models\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\Request; @@ -107,23 +108,16 @@ class MsgAnswersController extends Controller $id_admin = Auth::user()->id; $users = User::query()->OrderBy('name')->where('is_bd', '=', '0')->get(); - $Msgs = Message::with('user_from')->with('user_to') //->with('response') - ->where(function($query) use ($id_admin) { - $query->where('user_id', '=', $id_admin) - ->orWhere('to_user_id', '=', $id_admin); - }); - - $find_key = ''; - $find_cat = ''; - - $Msgs = $this->filter($Msgs, $request, $find_key, $find_cat); - - $Msgs = $Msgs->orderByDesc('created_at')->paginate(5); + $Msgs = MessagesRequests::query() + ->with('user') + ->orderByDesc('created_at') + ->paginate(10) + ; if ($request->ajax()) return view('admin.message.index_ajax', compact('Msgs', 'id_admin', 'users')); else - return view('admin.message.index', compact('Msgs', 'id_admin', 'users', 'find_key', 'find_cat')); + return view('admin.message.index', compact('Msgs', 'id_admin', 'users')); } public function messages_sql(Request $request) { diff --git a/app/Models/MessagesRequests.php b/app/Models/MessagesRequests.php index 83d334f..320387c 100644 --- a/app/Models/MessagesRequests.php +++ b/app/Models/MessagesRequests.php @@ -16,4 +16,14 @@ class MessagesRequests extends Model 'is_rejected', 'is_sent' ]; + + public function getJobsAttribute() + { + $job_titles_ids = json_decode($this->attributes['job_titles'], true); + return Job_title::whereIn('id', $job_titles_ids)->get(); + } + + public function user() { + return $this->belongsTo(User::class, 'user_id'); + } } diff --git a/public/assets/css/tailwind.output_new.css b/public/assets/css/tailwind.output_new.css index cdc8905..fb8b334 100644 --- a/public/assets/css/tailwind.output_new.css +++ b/public/assets/css/tailwind.output_new.css @@ -521,6 +521,10 @@ img, video { background-color: #047481; background-color: rgba(4, 116, 129, var(--bg-opacity)) } +.bg-green-600 { + --bg-opacity: 1; + background-color: #44a32b; +} .bg-blue-100 { --bg-opacity: 1; background-color: #e1effe; diff --git a/public/css/general.css b/public/css/general.css new file mode 100644 index 0000000..0f631a2 --- /dev/null +++ b/public/css/general.css @@ -0,0 +1,51 @@ +/* Диалог модал */ +.modal-dialog{ + border-radius: 10px; +} +.modal-dialog .modal-dialog-footer{ + display: flex; + justify-content: space-between; +} +.modal-dialog .modal-dialog-footer.center{ + display: flex; + justify-content: center; +} +.modal-dialog .modal-dialog-title h2{ + font-weight: bold; + font-size: 24px; + text-align: center; +} +.modal-dialog .modal-dialog-body{ + padding-top: 20px; + padding-bottom: 20px; +} +.modal-dialog .modal-dialog-footer .button-admin{ + padding: 5px 10px; + border: 1px #000 solid; + border-radius: 8px; +} +/* Конец Диалог модал */ + +.button-loader { + border: 2px solid #f3f3f3; + -webkit-animation: spin 1s linear infinite; + animation: spin 1s linear infinite; + border-top: 2px solid #555; + border-radius: 50%; + width: 20px; + height: 20px; + margin-right: 10px; +} +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} +.error-block{ + color:red; + padding: 0; + width: 100%; +} + +.review-image-modal{ + cursor: pointer; +} diff --git a/public/css/style_may2024.css b/public/css/style_may2024.css index d18fd86..8dfc0b4 100644 --- a/public/css/style_may2024.css +++ b/public/css/style_may2024.css @@ -10,6 +10,7 @@ @import url(jquery.select2.css); @import url(star-rating.min.css); @import url(swiper.css); +@import url(general.css); html { line-height: 1.15; /* 1 */ -webkit-text-size-adjust: 100%; /* 2 */ @@ -9296,42 +9297,6 @@ body .cke_notifications_area{ border-radius: 45px; } -/* Диалог модал */ -.modal-dialog{ - border-radius: 10px; -} -.modal-dialog .modal-dialog-footer{ - display: flex; - justify-content: space-between; -} -.modal-dialog .modal-dialog-footer.center{ - display: flex; - justify-content: center; -} - -.button-loader { - border: 2px solid #f3f3f3; - -webkit-animation: spin 1s linear infinite; - animation: spin 1s linear infinite; - border-top: 2px solid #555; - border-radius: 50%; - width: 20px; - height: 20px; -} -@keyframes spin { - 0% { transform: rotate(0deg); } - 100% { transform: rotate(360deg); } -} -.error-block{ - color:red; - padding: 0; - width: 100%; -} - -.review-image-modal{ - cursor: pointer; -} - .flot-one-ship .flot-label{ font-weight: bold; display: flex; diff --git a/resources/views/admin/message/index.blade.php b/resources/views/admin/message/index.blade.php index 2dd9c10..0d95e63 100644 --- a/resources/views/admin/message/index.blade.php +++ b/resources/views/admin/message/index.blade.php @@ -3,6 +3,16 @@ @section('script') @endsection -@section('search') - @include('admin.find_message') -@endsection - @section('content')
@@ -52,7 +58,7 @@ > № От юзера - К юзеру + Должности Текст Дата Прочтено @@ -60,44 +66,54 @@ @foreach($Msgs as $msg) - user_to->id)) - @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1)) - style="background-color: #403998;" - @endif - @endif> + - {{$msg->id}} + {{ $msg->id }} - @if (isset($msg->user_from->name)) - {{$msg->user_from->name}} ({{$msg->user_from->id}}) - @else - Пользователь удален - @endif +
+ @if (isset($msg->user->name)) + {{$msg->user->name}} ({{$msg->user->id}}) + @else + Пользователь удален + @endif +
- @if (isset($msg->user_to->name)) - {{$msg->user_to->name}} ({{$msg->user_to->id}}) - @else - Пользователь удален - @endif + @if($msg->job_titles) + @foreach($msg->jobs as $job) + {{ $job->name }} + @if(!$loop->last) +
+ @endif + @endforeach + @endif - {{$msg->title}} -
- +
+ {{ $msg->text }}
{{ date('d.m.Y h:i:s', strtotime($msg->created_at)) }} - - @if (isset($msg->user_to->id)) - @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1)) - + + @if($msg->is_rejected) + Отклонено + @elseif($msg->is_sent) + Отправлено + @else +
+ + +
@endif - @endif @endforeach @@ -177,4 +193,6 @@
+ + @include('modals.admin.messages.rejecte_message') @endsection diff --git a/resources/views/layout/admin.blade.php b/resources/views/layout/admin.blade.php index 578f85a..8d65ab1 100644 --- a/resources/views/layout/admin.blade.php +++ b/resources/views/layout/admin.blade.php @@ -21,6 +21,11 @@ + + + + +
diff --git a/resources/views/modals/admin/messages/rejecte_message.blade.php b/resources/views/modals/admin/messages/rejecte_message.blade.php new file mode 100644 index 0000000..03dc368 --- /dev/null +++ b/resources/views/modals/admin/messages/rejecte_message.blade.php @@ -0,0 +1,43 @@ +
+ +
+ +