From a9391093225a82ebec92aa95b8f392d323f410a2 Mon Sep 17 00:00:00 2001 From: Sergey Panarin Date: Mon, 22 Jul 2024 16:32:28 +0200 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0?= =?UTF-8?q?=B8=D0=BD=D0=B3=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/EmployerController.php | 8 ++++++++ app/Models/Chat.php | 5 +++++ public/css/style_may2024.css | 19 ++++++++++++++++++- public/images/pin_off.svg | 5 +++++ public/images/pin_on.svg | 5 +++++ public/images/sprite.svg | 2 +- resources/views/employers/messages.blade.php | 14 +++++++++++--- resources/views/svg/pin_off.blade.php | 5 +++++ resources/views/svg/pin_on.blade.php | 5 +++++ resources/views/workers/dialog.blade.php | 4 ---- 10 files changed, 63 insertions(+), 9 deletions(-) create mode 100644 public/images/pin_off.svg create mode 100644 public/images/pin_on.svg create mode 100644 resources/views/svg/pin_off.blade.php create mode 100644 resources/views/svg/pin_on.blade.php diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index eb5e685..4f3dd51 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -343,6 +343,9 @@ class EmployerController extends Controller ->with('worker') ->with('employer') ->with('last_message') + ->withCount(['unread_messages' => function ($query) use($user_id) { + $query->where('to_user_id', '=', $user_id)->where('flag_new', '=', 1); + }]) ->where('user_id', '=', $user_id) ->orderByDesc('is_fixed') ->orderByDesc('last_message_date') @@ -403,6 +406,11 @@ class EmployerController extends Controller //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); $sender = $user1; + Message::where('user_id', '=', $user2->id) + ->where('to_user_id', '=', $user1->id) + ->update(['flag_new' => 0]) + ; + return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); } diff --git a/app/Models/Chat.php b/app/Models/Chat.php index d178f43..5a229b6 100644 --- a/app/Models/Chat.php +++ b/app/Models/Chat.php @@ -35,4 +35,9 @@ class Chat extends Model return $this->belongsTo(Message::class, 'last_message_id'); } + public function unread_messages() + { + return $this->hasMany(Message::class, 'user_id', 'to_user_id'); + } + } diff --git a/public/css/style_may2024.css b/public/css/style_may2024.css index 109cc0f..6a5921a 100644 --- a/public/css/style_may2024.css +++ b/public/css/style_may2024.css @@ -6866,6 +6866,8 @@ main + .news { } .messages__item-buttons{ float: right; + display: flex; + align-items: center; } .messages__item-buttons button{ padding: 0; @@ -6877,9 +6879,18 @@ main + .news { height: 25px; color: gray; } -.messages__item-buttons button svg:hover{ +.messages__item-buttons button svg path{ + stroke: gray; +} +.messages__item-buttons button:hover svg{ color: black; } +.messages__item-buttons button:hover svg path{ + stroke: black; +} +.messages__item-buttons button:hover svg#pin_on path{ + fill: black; +} .messages__item-date { color: #00000070; width: 90px; @@ -9288,3 +9299,9 @@ body .cke_notifications_area{ opacity: 0; display: none !important; } +.unread-messages-count{ + background-color: #377d87; + color: #fff; + padding: 5px 10px; + border-radius: 45px; +} diff --git a/public/images/pin_off.svg b/public/images/pin_off.svg new file mode 100644 index 0000000..68328b8 --- /dev/null +++ b/public/images/pin_off.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/public/images/pin_on.svg b/public/images/pin_on.svg new file mode 100644 index 0000000..64e9bb5 --- /dev/null +++ b/public/images/pin_on.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/public/images/sprite.svg b/public/images/sprite.svg index 691fd62..9786335 100644 --- a/public/images/sprite.svg +++ b/public/images/sprite.svg @@ -287,4 +287,4 @@ - \ No newline at end of file + diff --git a/resources/views/employers/messages.blade.php b/resources/views/employers/messages.blade.php index 9cb56d7..5fd3867 100644 --- a/resources/views/employers/messages.blade.php +++ b/resources/views/employers/messages.blade.php @@ -74,7 +74,7 @@ @if ($chats->count()) @foreach($chats as $chat)
- +