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 @@