Commit b2d6fbf8432f1c151cb79912da66dc538449dbe3
1 parent
7f346848df
Exists in
master
fix chat
Showing 2 changed files with 3 additions and 5 deletions Inline Diff
app/Models/Chat.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Models; | 3 | namespace App\Models; |
4 | 4 | ||
5 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
6 | use Illuminate\Database\Eloquent\Model; | 6 | use Illuminate\Database\Eloquent\Model; |
7 | use Carbon\Carbon; | 7 | use Carbon\Carbon; |
8 | 8 | ||
9 | class Chat extends Model | 9 | class Chat extends Model |
10 | { | 10 | { |
11 | use HasFactory; | 11 | use HasFactory; |
12 | 12 | ||
13 | protected $fillable = [ | 13 | protected $fillable = [ |
14 | 'user_id', | 14 | 'user_id', |
15 | 'to_user_id', | 15 | 'to_user_id', |
16 | 'is_removed', | 16 | 'is_removed', |
17 | 'is_fixed', | 17 | 'is_fixed', |
18 | 'last_message_date', | 18 | 'last_message_date', |
19 | 'last_message_id', | 19 | 'last_message_id', |
20 | 'fixed_time', | 20 | 'fixed_time', |
21 | 'is_admin_chat' | 21 | 'is_admin_chat' |
22 | ]; | 22 | ]; |
23 | 23 | ||
24 | public function user() { | 24 | public function user() { |
25 | return $this->belongsTo(User::class, 'to_user_id'); | 25 | return $this->belongsTo(User::class, 'to_user_id'); |
26 | } | 26 | } |
27 | 27 | ||
28 | public function worker() { | 28 | public function worker() { |
29 | return $this->belongsTo(Worker::class, 'to_user_id', 'user_id'); | 29 | return $this->belongsTo(Worker::class, 'to_user_id', 'user_id'); |
30 | } | 30 | } |
31 | 31 | ||
32 | public function employer() { | 32 | public function employer() { |
33 | return $this->belongsTo(Employer::class, 'to_user_id', 'user_id'); | 33 | return $this->belongsTo(Employer::class, 'to_user_id', 'user_id'); |
34 | } | 34 | } |
35 | 35 | ||
36 | public function last_message() { | 36 | public function last_message() { |
37 | return $this->belongsTo(Message::class, 'last_message_id'); | 37 | return $this->belongsTo(Message::class, 'last_message_id'); |
38 | } | 38 | } |
39 | 39 | ||
40 | public function unread_messages() | 40 | public function unread_messages() |
41 | { | 41 | { |
42 | return $this->hasMany(Message::class, 'user_id', 'to_user_id'); | 42 | return $this->hasMany(Message::class, 'user_id', 'to_user_id'); |
43 | } | 43 | } |
44 | 44 | ||
45 | public function admin_chat_unread_messages() | 45 | public function admin_chat_unread_messages() |
46 | { | 46 | { |
47 | return $this->hasMany(Message::class, 'to_user_id', 'to_user_id'); | 47 | return $this->hasMany(Message::class, 'to_user_id', 'to_user_id'); |
48 | } | 48 | } |
49 | 49 | ||
50 | public static function pin_chat(int $chat_id, $fixed) | 50 | public static function pin_chat(int $chat_id, $fixed) |
51 | { | 51 | { |
52 | $chat = self::query()->find($chat_id); | 52 | $chat = self::query()->find($chat_id); |
53 | $chat->update([ | 53 | $chat->update([ |
54 | 'is_fixed' => !empty($fixed) ? 1 : 0, | 54 | 'is_fixed' => !empty($fixed) ? 1 : 0, |
55 | 'fixation_date' => !empty($fixed) ? Carbon::now() : null | 55 | 'fixation_date' => !empty($fixed) ? Carbon::now() : null |
56 | ]); | 56 | ]); |
57 | return $chat; | 57 | return $chat; |
58 | } | 58 | } |
59 | 59 | ||
60 | public static function remove_chat(int $chat_id) | 60 | public static function remove_chat(int $chat_id) |
61 | { | 61 | { |
62 | return self::where('id', '=', $chat_id) | 62 | return self::where('id', '=', $chat_id) |
63 | ->update(['is_removed' => 1]); | 63 | ->update(['is_removed' => 1]); |
64 | } | 64 | } |
65 | 65 | ||
66 | public static function get_user_chats(int $user_id){ | 66 | public static function get_user_chats(int $user_id){ |
67 | return Chat::query() | 67 | return Chat::query() |
68 | ->with('user') | 68 | ->with(['user', 'worker', 'employer', 'last_message']) |
69 | ->with('worker') | ||
70 | ->with('employer') | ||
71 | ->with('last_message') | ||
72 | ->withCount(['unread_messages' => function ($query) use($user_id) { | 69 | ->withCount(['unread_messages' => function ($query) use($user_id) { |
73 | $query | 70 | $query |
74 | ->where('to_user_id', '=', $user_id) | 71 | ->where('to_user_id', '=', $user_id) |
75 | ->whereNotNull('chat_id_from') | 72 | ->whereNotNull('chat_id_from') |
76 | ->where('flag_new', '=', 1) | 73 | ->where('flag_new', '=', 1) |
77 | ; | 74 | ; |
78 | }]) | 75 | }]) |
76 | ->whereHas('user') | ||
79 | ->where('user_id', '=', $user_id) | 77 | ->where('user_id', '=', $user_id) |
80 | ->where('is_removed', '=', 0) | 78 | ->where('is_removed', '=', 0) |
81 | ->orderByDesc('is_fixed') | 79 | ->orderByDesc('is_fixed') |
82 | ->orderByDesc('fixation_date') | 80 | ->orderByDesc('fixation_date') |
83 | ->orderByDesc('last_message_date') | 81 | ->orderByDesc('last_message_date') |
84 | ->paginate(5) | 82 | ->paginate(5) |
85 | ; | 83 | ; |
86 | } | 84 | } |
87 | 85 | ||
88 | public static function get_user_admin_chat(int $user_id) | 86 | public static function get_user_admin_chat(int $user_id) |
89 | { | 87 | { |
90 | return Chat::query() | 88 | return Chat::query() |
91 | ->with('last_message') | 89 | ->with('last_message') |
92 | ->withCount(['unread_messages' => function ($query) use($user_id) { | 90 | ->withCount(['unread_messages' => function ($query) use($user_id) { |
93 | $query->where('to_user_id', '=', $user_id)->where('flag_new', '=', 1); | 91 | $query->where('to_user_id', '=', $user_id)->where('flag_new', '=', 1); |
94 | }]) | 92 | }]) |
95 | ->where('user_id', '=', $user_id) | 93 | ->where('user_id', '=', $user_id) |
96 | ->where('is_admin_chat', 1) | 94 | ->where('is_admin_chat', 1) |
97 | ->first() | 95 | ->first() |
98 | ; | 96 | ; |
99 | } | 97 | } |
100 | 98 | ||
101 | public static function get_chat_messages(Chat $chat){ | 99 | public static function get_chat_messages(Chat $chat){ |
102 | 100 | ||
103 | return Message::query() | 101 | return Message::query() |
104 | ->where(function ($query) use ($chat) { | 102 | ->where(function ($query) use ($chat) { |
105 | $query->where('chat_id_from', $chat->id)->orWhere('chat_id_to', $chat->id); | 103 | $query->where('chat_id_from', $chat->id)->orWhere('chat_id_to', $chat->id); |
106 | }) | 104 | }) |
107 | ->where(function($query) use ($chat) { | 105 | ->where(function($query) use ($chat) { |
108 | $query | 106 | $query |
109 | ->where(function($query) use ($chat) { | 107 | ->where(function($query) use ($chat) { |
110 | $query->where('user_id', $chat->user_id)->where('to_user_id', $chat->to_user_id); | 108 | $query->where('user_id', $chat->user_id)->where('to_user_id', $chat->to_user_id); |
111 | }) | 109 | }) |
112 | ->orWhere(function($query) use ($chat) { | 110 | ->orWhere(function($query) use ($chat) { |
113 | $query->where('user_id', $chat->to_user_id)->where('to_user_id', $chat->user_id); | 111 | $query->where('user_id', $chat->to_user_id)->where('to_user_id', $chat->user_id); |
114 | }) | 112 | }) |
115 | ; | 113 | ; |
116 | }) | 114 | }) |
117 | ->OrderBy('created_at') | 115 | ->OrderBy('created_at') |
118 | ->get() | 116 | ->get() |
119 | ; | 117 | ; |
120 | } | 118 | } |
121 | 119 | ||
122 | } | 120 | } |
resources/views/employers/cabinet.blade.php
1 | @extends('layout.frontend', ['title' => 'Образование и образовательные программы - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Образование и образовательные программы - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | $(document).on('click', '.die_black', function() { | 5 | $(document).on('click', '.die_black', function() { |
6 | var this_ = $(this); | 6 | var this_ = $(this); |
7 | var ajax_ = $('#ajax_flot_div'); | 7 | var ajax_ = $('#ajax_flot_div'); |
8 | var id_ = this_.attr('data-test'); | 8 | var id_ = this_.attr('data-test'); |
9 | var url_ = this_.attr('data-link'); | 9 | var url_ = this_.attr('data-link'); |
10 | 10 | ||
11 | console.log(url_); | 11 | console.log(url_); |
12 | $.ajax({ | 12 | $.ajax({ |
13 | type: "GET", | 13 | type: "GET", |
14 | url: url_, | 14 | url: url_, |
15 | success: function (data) { | 15 | success: function (data) { |
16 | console.log('Ответка'); | 16 | console.log('Ответка'); |
17 | ajax_.html(data); | 17 | ajax_.html(data); |
18 | }, | 18 | }, |
19 | headers: { | 19 | headers: { |
20 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 20 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
21 | }, | 21 | }, |
22 | error: function (data) { | 22 | error: function (data) { |
23 | console.log('Error: ' + data); | 23 | console.log('Error: ' + data); |
24 | } | 24 | } |
25 | }); | 25 | }); |
26 | 26 | ||
27 | }); | 27 | }); |
28 | </script> | 28 | </script> |
29 | @endsection | 29 | @endsection |
30 | @section('content') | 30 | @section('content') |
31 | <section class="cabinet"> | 31 | <section class="cabinet"> |
32 | <div class="container"> | 32 | <div class="container"> |
33 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 33 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
34 | <li><a href="{{ route('index') }}">Главная</a></li> | 34 | <li><a href="{{ route('index') }}">Главная</a></li> |
35 | <li><b>Личный кабинет</b></li> | 35 | <li><b>Личный кабинет</b></li> |
36 | </ul> | 36 | </ul> |
37 | <div class="cabinet__wrapper"> | 37 | <div class="cabinet__wrapper"> |
38 | <div class="cabinet__side"> | 38 | <div class="cabinet__side"> |
39 | <div class="cabinet__side-toper"> | 39 | <div class="cabinet__side-toper"> |
40 | <div class="cabinet__side-toper-pic"> | 40 | <div class="cabinet__side-toper-pic"> |
41 | @if (isset($Employer[0]->logo)) | 41 | @if (isset($Employer[0]->logo)) |
42 | <img src="{{ asset(Storage::url($Employer[0]->logo)) }}" width="150" alt="{{ $Employer[0]->name_company }}"> | 42 | <img src="{{ asset(Storage::url($Employer[0]->logo)) }}" width="150" alt="{{ $Employer[0]->name_company }}"> |
43 | @else | 43 | @else |
44 | <img src="{{ asset('images/logo_emp.png') }}" width="150" alt="{{ $Employer[0]->name_company }}"/> | 44 | <img src="{{ asset('images/logo_emp.png') }}" width="150" alt="{{ $Employer[0]->name_company }}"/> |
45 | @endif | 45 | @endif |
46 | </div> | 46 | </div> |
47 | <b>{{ $Employer[0]->name_company }}</b> | 47 | <b>{{ $Employer[0]->name_company }}</b> |
48 | </div> | 48 | </div> |
49 | 49 | ||
50 | @include('employers.menu') | 50 | @include('employers.menu') |
51 | 51 | ||
52 | </div> | 52 | </div> |
53 | <div class="cabinet__body"> | 53 | <div class="cabinet__body"> |
54 | @include('messages_error') | 54 | @include('messages_error') |
55 | 55 | ||
56 | <form action="{{ route('employer.cabinet_save', ['Employer' => $Employer[0]->id]) }}" method="POST" enctype="multipart/form-data"> | 56 | <form action="{{ route('employer.cabinet_save', ['Employer' => $Employer[0]->id]) }}" method="POST" enctype="multipart/form-data"> |
57 | @csrf | 57 | @csrf |
58 | <div class="cabinet__body-item"> | 58 | <div class="cabinet__body-item"> |
59 | <div class="cabinet__descr"> | 59 | <div class="cabinet__descr"> |
60 | <h2 class="title cabinet__title">Мой профиль</h2> | 60 | <h2 class="title cabinet__title">Мой профиль</h2> |
61 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> | 61 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> |
62 | </div> | 62 | </div> |
63 | <div class="cabinet__avatar"> | 63 | <div class="cabinet__avatar"> |
64 | <div class="cabinet__avatar-pic"> | 64 | <div class="cabinet__avatar-pic"> |
65 | @if (isset($Employer[0]->logo)) | 65 | @if (isset($Employer[0]->logo)) |
66 | <img src="{{ asset(Storage::url($Employer[0]->logo)) }}" width="150" alt="{{ $Employer[0]->name_company }}"> | 66 | <img src="{{ asset(Storage::url($Employer[0]->logo)) }}" width="150" alt="{{ $Employer[0]->name_company }}"> |
67 | @else | 67 | @else |
68 | <img src="{{ asset('images/logo_emp.png') }}" width="150" alt="{{ $Employer[0]->name_company }}"/> | 68 | <img src="{{ asset('images/logo_emp.png') }}" width="150" alt="{{ $Employer[0]->name_company }}"/> |
69 | @endif | 69 | @endif |
70 | </div> | 70 | </div> |
71 | <div class="cabinet__avatar-form"> | 71 | <div class="cabinet__avatar-form"> |
72 | <label class="file"> | 72 | <label class="file"> |
73 | <span class="file__input"> | 73 | <span class="file__input"> |
74 | <input type="file" name="logo"> | 74 | <input type="file" name="logo" accept=".svg, .jpg, .png или .jpeg" capture="camera"> |
75 | <span class="button"> | 75 | <span class="button"> |
76 | <svg> | 76 | <svg> |
77 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> | 77 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> |
78 | </svg> | 78 | </svg> |
79 | Загрузить | 79 | Загрузить |
80 | </span> | 80 | </span> |
81 | </span> | 81 | </span> |
82 | </label> | 82 | </label> |
83 | <p class="cabinet__text">Загрузите логотип в формате .svg, .jpg, .png или .jpeg</p> | 83 | <p class="cabinet__text">Загрузите логотип в формате .svg, .jpg, .png или .jpeg</p> |
84 | </div> | 84 | </div> |
85 | </div> | 85 | </div> |
86 | <div class="cabinet__inputs"> | 86 | <div class="cabinet__inputs"> |
87 | <div class="cabinet__inputs-item form-group"> | 87 | <div class="cabinet__inputs-item form-group"> |
88 | <label class="form-group__label">Название судоходной компании</label> | 88 | <label class="form-group__label">Название судоходной компании</label> |
89 | <div class="form-group__item"> | 89 | <div class="form-group__item"> |
90 | <input type="text" class="input" name="name_company" id="name_company" placeholder="ООО Река Море" value="{{ old('name_company') ?? $Employer[0]->name_company ?? '' }}" required> | 90 | <input type="text" class="input" name="name_company" id="name_company" placeholder="ООО Река Море" value="{{ old('name_company') ?? $Employer[0]->name_company ?? '' }}" required> |
91 | @error('name_company') | 91 | @error('name_company') |
92 | <span class="text-xs text-red-600"> | 92 | <span class="text-xs text-red-600"> |
93 | {{ $message }} | 93 | {{ $message }} |
94 | </span> | 94 | </span> |
95 | @enderror | 95 | @enderror |
96 | </div> | 96 | </div> |
97 | </div> | 97 | </div> |
98 | <div class="cabinet__inputs-item form-group"> | 98 | <div class="cabinet__inputs-item form-group"> |
99 | <label class="form-group__label">Электронная почта</label> | 99 | <label class="form-group__label">Электронная почта</label> |
100 | <div class="form-group__item"> | 100 | <div class="form-group__item"> |
101 | <input type="email" name="email" class="input" placeholder="info@rekamore.su" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" required> | 101 | <input type="email" name="email" class="input" placeholder="info@rekamore.su" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" required> |
102 | @error('email') | 102 | @error('email') |
103 | <span class="text-xs text-red-600"> | 103 | <span class="text-xs text-red-600"> |
104 | {{ $message }} | 104 | {{ $message }} |
105 | </span> | 105 | </span> |
106 | @enderror | 106 | @enderror |
107 | </div> | 107 | </div> |
108 | </div> | 108 | </div> |
109 | <div class="cabinet__inputs-item form-group"> | 109 | <div class="cabinet__inputs-item form-group"> |
110 | <label class="form-group__label">Номер телефона</label> | 110 | <label class="form-group__label">Номер телефона</label> |
111 | <div class="form-group__item"> | 111 | <div class="form-group__item"> |
112 | <input type="tel" name="telephone" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" required> | 112 | <input type="tel" name="telephone" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" required> |
113 | @error('telephone') | 113 | @error('telephone') |
114 | <span class="text-xs text-red-600"> | 114 | <span class="text-xs text-red-600"> |
115 | {{ $message }} | 115 | {{ $message }} |
116 | </span> | 116 | </span> |
117 | @enderror | 117 | @enderror |
118 | </div> | 118 | </div> |
119 | </div> | 119 | </div> |
120 | <div class="cabinet__inputs-item form-group"> | 120 | <div class="cabinet__inputs-item form-group"> |
121 | <label class="form-group__label">Адрес компании</label> | 121 | <label class="form-group__label">Адрес компании</label> |
122 | <div class="form-group__item"> | 122 | <div class="form-group__item"> |
123 | <input type="text" name="address" class="input" value="{{ old('address') ?? $Employer[0]->address ?? '' }}" placeholder="692904, Приморский край, г. Находка, ул. Портовая 3А, 5 этаж"> | 123 | <input type="text" name="address" class="input" value="{{ old('address') ?? $Employer[0]->address ?? '' }}" placeholder="692904, Приморский край, г. Находка, ул. Портовая 3А, 5 этаж"> |
124 | @error('address') | 124 | @error('address') |
125 | <span class="text-xs text-red-600"> | 125 | <span class="text-xs text-red-600"> |
126 | {{ $message }} | 126 | {{ $message }} |
127 | </span> | 127 | </span> |
128 | @enderror | 128 | @enderror |
129 | </div> | 129 | </div> |
130 | </div> | 130 | </div> |
131 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 131 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
132 | <label class="form-group__label">Ссылка на сайт</label> | 132 | <label class="form-group__label">Ссылка на сайт</label> |
133 | <div class="form-group__item"> | 133 | <div class="form-group__item"> |
134 | <input type="url" name="site" class="input" value="{{ old('site') ?? $Employer[0]->site ?? '' }}" placeholder="https://rekamore.su"> | 134 | <input type="url" name="site" class="input" value="{{ old('site') ?? $Employer[0]->site ?? '' }}" placeholder="https://rekamore.su"> |
135 | @error('site') | 135 | @error('site') |
136 | <span class="text-xs text-red-600"> | 136 | <span class="text-xs text-red-600"> |
137 | {{ $message }} | 137 | {{ $message }} |
138 | </span> | 138 | </span> |
139 | @enderror | 139 | @enderror |
140 | </div> | 140 | </div> |
141 | </div> | 141 | </div> |
142 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 142 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
143 | <label class="form-group__label">О компании</label> | 143 | <label class="form-group__label">О компании</label> |
144 | <div class="form-group__item"> | 144 | <div class="form-group__item"> |
145 | <textarea name="text" class="textarea" required>{{ old('text') ?? $Employer[0]->text ?? '' }}</textarea> | 145 | <textarea name="text" class="textarea" required>{{ old('text') ?? $Employer[0]->text ?? '' }}</textarea> |
146 | @error('text') | 146 | @error('text') |
147 | <span class="text-xs text-red-600"> | 147 | <span class="text-xs text-red-600"> |
148 | {{ $message }} | 148 | {{ $message }} |
149 | </span> | 149 | </span> |
150 | @enderror | 150 | @enderror |
151 | </div> | 151 | </div> |
152 | </div> | 152 | </div> |
153 | </div> | 153 | </div> |
154 | </div><br> | 154 | </div><br> |
155 | <button type="submit" class="button cabinet__submit">Сохранить изменения</button> | 155 | <button type="submit" class="button cabinet__submit">Сохранить изменения</button> |
156 | </form> | 156 | </form> |
157 | 157 | ||
158 | <div class="cabinet__body-item"> | 158 | <div class="cabinet__body-item"> |
159 | <div class="cabinet__descr"> | 159 | <div class="cabinet__descr"> |
160 | <h2 class="title cabinet__title">Мой флот</h2> | 160 | <h2 class="title cabinet__title">Мой флот</h2> |
161 | </div> | 161 | </div> |
162 | 162 | ||
163 | <form action="{{ route('employer.save_add_flot') }}" method="POST" class="cabinet__add" enctype="multipart/form-data"> | 163 | <form action="{{ route('employer.save_add_flot') }}" method="POST" class="cabinet__add" enctype="multipart/form-data"> |
164 | @csrf | 164 | @csrf |
165 | <label class="cabinet__add-pic" style="vertical-align: top"> | 165 | <label class="cabinet__add-pic" style="vertical-align: top"> |
166 | <input type="file" name="image" id="image"> | 166 | <input type="file" name="image" id="image"> |
167 | <input type="hidden" name="employer_id" id="employer_id" value="{{ $Employer[0]->id }}"/> | 167 | <input type="hidden" name="employer_id" id="employer_id" value="{{ $Employer[0]->id }}"/> |
168 | <svg> | 168 | <svg> |
169 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 169 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
170 | </svg> | 170 | </svg> |
171 | <span> | 171 | <span> |
172 | <svg> | 172 | <svg> |
173 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> | 173 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> |
174 | </svg> | 174 | </svg> |
175 | Загрузить фото | 175 | Загрузить фото |
176 | </span> | 176 | </span> |
177 | </label> | 177 | </label> |
178 | 178 | ||
179 | <div class="cabinet__add-body"> | 179 | <div class="cabinet__add-body"> |
180 | <div class="form-group"> | 180 | <div class="form-group"> |
181 | <label class="form-group__label">Название корабля</label> | 181 | <label class="form-group__label">Название корабля</label> |
182 | <div class="form-group__item"> | 182 | <div class="form-group__item"> |
183 | <input type="text" name="name" id="flot_name" class="input" placeholder="Корабль №000001" required> | 183 | <input type="text" name="name" id="flot_name" class="input" placeholder="Корабль №000001" required> |
184 | </div> | 184 | </div> |
185 | </div> | 185 | </div> |
186 | <div class="form-group"> | 186 | <div class="form-group"> |
187 | <label class="form-group__label">Описание</label> | 187 | <label class="form-group__label">Описание</label> |
188 | <div class="form-group__item"> | 188 | <div class="form-group__item"> |
189 | <input type="text" name="text" id="flot_text" class="input" placeholder="Это судно находится..." required> | 189 | <input type="text" name="text" id="flot_text" class="input" placeholder="Это судно находится..." required> |
190 | </div> | 190 | </div> |
191 | </div> | 191 | </div> |
192 | <div class="form-group"> | 192 | <div class="form-group"> |
193 | <label class="form-group__label">Регион</label> | 193 | <label class="form-group__label">Регион</label> |
194 | <div class="form-group__item"> | 194 | <div class="form-group__item"> |
195 | <input type="text" name="region" id="region" class="input" placeholder="Мурманск" required> | 195 | <input type="text" name="region" id="region" class="input" placeholder="Мурманск" required> |
196 | </div> | 196 | </div> |
197 | </div> | 197 | </div> |
198 | <div class="form-group"> | 198 | <div class="form-group"> |
199 | <label class="form-group__label">Мощность</label> | 199 | <label class="form-group__label">Мощность</label> |
200 | <div class="form-group__item"> | 200 | <div class="form-group__item"> |
201 | <input type="text" name="power" id="flot_power" class="input" placeholder="Dw 40000 9000Kw" required> | 201 | <input type="text" name="power" id="flot_power" class="input" placeholder="Dw 40000 9000Kw" required> |
202 | </div> | 202 | </div> |
203 | </div> | 203 | </div> |
204 | <button type="submit" class="button" id="ajax_flot" name="ajax_flot">Добавить флот</button> | 204 | <button type="submit" class="button" id="ajax_flot" name="ajax_flot">Добавить флот</button> |
205 | </div> | 205 | </div> |
206 | 206 | ||
207 | </form> | 207 | </form> |
208 | 208 | ||
209 | <div class="cabinet__fleet" id="ajax_flot_div" name="ajax_flot_div"> | 209 | <div class="cabinet__fleet" id="ajax_flot_div" name="ajax_flot_div"> |
210 | @if (isset($Employer[0]->flots)) | 210 | @if (isset($Employer[0]->flots)) |
211 | @if ($Employer[0]->flots->count()) | 211 | @if ($Employer[0]->flots->count()) |
212 | @foreach ($Employer[0]->flots as $it) | 212 | @foreach ($Employer[0]->flots as $it) |
213 | <div class="cabinet__fleet-item main__employer-page-one-item"> | 213 | <div class="cabinet__fleet-item main__employer-page-one-item"> |
214 | <div class="del die_black" data-test="{{ $it->id }}" data-link="{{ route('employer.delete_flot', ['Flot' => $it->id]) }}"> | 214 | <div class="del die_black" data-test="{{ $it->id }}" data-link="{{ route('employer.delete_flot', ['Flot' => $it->id]) }}"> |
215 | <svg> | 215 | <svg> |
216 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> | 216 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> |
217 | </svg> | 217 | </svg> |
218 | </div> | 218 | </div> |
219 | @if (!empty($it->image)) | 219 | @if (!empty($it->image)) |
220 | <img src="{{ asset(Storage::url($it->image)) }}" alt="{{ $it->name }}"> | 220 | <img src="{{ asset(Storage::url($it->image)) }}" alt="{{ $it->name }}"> |
221 | @else | 221 | @else |
222 | <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $it->name }}"/> | 222 | <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $it->name }}"/> |
223 | @endif | 223 | @endif |
224 | <b>{{ $it->name }}</b> | 224 | <b>{{ $it->name }}</b> |
225 | <span>{{ $it->text }}</span> | 225 | <span>{{ $it->text }}</span> |
226 | </div> | 226 | </div> |
227 | @endforeach | 227 | @endforeach |
228 | @endif | 228 | @endif |
229 | @endif | 229 | @endif |
230 | </div> | 230 | </div> |
231 | </div> | 231 | </div> |
232 | </div> | 232 | </div> |
233 | </div> | 233 | </div> |
234 | </div> | 234 | </div> |
235 | </section> | 235 | </section> |
236 | </div> <!-- END TOP WRAPPER --> | 236 | </div> <!-- END TOP WRAPPER --> |
237 | @endsection | 237 | @endsection |
238 | 238 |