codigo actual del servidor, con avances de joan
This commit is contained in:
BIN
resources/views/frontend/user/conversations/desktop.ini
Normal file
BIN
resources/views/frontend/user/conversations/desktop.ini
Normal file
Binary file not shown.
103
resources/views/frontend/user/conversations/index.blade.php
Normal file
103
resources/views/frontend/user/conversations/index.blade.php
Normal file
@@ -0,0 +1,103 @@
|
||||
@extends('frontend.layouts.user_panel')
|
||||
|
||||
@section('panel_content')
|
||||
<div class="aiz-titlebar mb-4">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-md-6">
|
||||
<h5 class="fs-20 fw-700 text-dark">{{ translate('Conversations')}}</h5>
|
||||
<p class="fs-14 fw-400 text-secondary">{{ translate('Select a conversation to view all messages')}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Conversations -->
|
||||
@if (count($conversations) > 0)
|
||||
<div class="p-0">
|
||||
<ul class="list-group list-group-flush p-0">
|
||||
@foreach ($conversations as $key => $conversation)
|
||||
@if ($conversation->receiver != null && $conversation->sender != null)
|
||||
<li class="list-group-item p-4 has-transition hov-bg-light border mb-3">
|
||||
<div class="row gutters-10">
|
||||
<!-- Receiver/Shop Image -->
|
||||
<div class="col-auto">
|
||||
<div class="media">
|
||||
<span class="avatar avatar-sm flex-shrink-0 border">
|
||||
@if (Auth::user()->id == $conversation->sender_id)
|
||||
@if ($conversation->receiver->shop != null)
|
||||
<a href="{{ route('shop.visit', $conversation->receiver->shop->slug) }}" class="">
|
||||
<img src="{{ uploaded_asset($conversation->receiver->shop->logo) }}"
|
||||
onerror="this.onerror=null;this.src='{{ static_asset('assets/img/avatar-place.png') }}';">
|
||||
</a>
|
||||
@else
|
||||
<img @if ($conversation->receiver->avatar_original == null) src="{{ static_asset('assets/img/avatar-place.png') }}"
|
||||
@else src="{{ uploaded_asset($conversation->receiver->avatar_original) }}" @endif
|
||||
onerror="this.onerror=null;this.src='{{ static_asset('assets/img/avatar-place.png') }}';">
|
||||
@endif
|
||||
@else
|
||||
<img @if ($conversation->sender->avatar_original == null) src="{{ static_asset('assets/img/avatar-place.png') }}" @else src="{{ uploaded_asset($conversation->sender->avatar_original) }}" @endif class="rounded-circle" onerror="this.onerror=null;this.src='{{ static_asset('assets/img/avatar-place.png') }}';">
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Receiver/Shop Name & Time -->
|
||||
<div class="col-auto col-lg-3">
|
||||
@if (Auth::user()->id == $conversation->sender_id)
|
||||
<h6 class="text-dark mb-2">
|
||||
@if ($conversation->receiver->shop != null)
|
||||
<a href="{{ route('shop.visit', $conversation->receiver->shop->slug) }}" class="text-reset hov-text-primary fw-700 fs-14">{{ $conversation->receiver->shop->name }}</a>
|
||||
@else
|
||||
<span class="text-dark fw-700 fs-14 mb-2">{{ $conversation->receiver->name }}</span>
|
||||
@endif
|
||||
</h6>
|
||||
@else
|
||||
<h6 class="text-dark fw-700 fs-14 mb-2">{{ $conversation->sender->name }}</h6>
|
||||
@endif
|
||||
<small class="text-secondary fs-12">
|
||||
{{ date('d.m.Y h:i:m', strtotime($conversation->messages->last()->created_at)) }}
|
||||
</small>
|
||||
</div>
|
||||
<!-- conversation -->
|
||||
<div class="col-12 col-lg">
|
||||
<div class="block-body">
|
||||
<div class="block-body-inner pb-3">
|
||||
<!-- Title -->
|
||||
<div class="row no-gutters">
|
||||
<div class="col">
|
||||
<h6 class="mt-0">
|
||||
<a href="{{ route('conversations.show', encrypt($conversation->id)) }}" class="text-reset hov-text-primary fs-14 fw-700">
|
||||
{{ $conversation->title }}
|
||||
</a>
|
||||
@if ((Auth::user()->id == $conversation->sender_id && $conversation->sender_viewed == 0) || (Auth::user()->id == $conversation->receiver_id && $conversation->receiver_viewed == 0))
|
||||
<span class="badge badge-inline badge-danger">{{ translate('New') }}</span>
|
||||
@endif
|
||||
</h6>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Last Message -->
|
||||
<p class="mb-0 text-secondary fs-14">
|
||||
{{ $conversation->messages->last()->message }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@endif
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@else
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="text-center bg-white p-4 border">
|
||||
<img class="mw-100 h-200px" src="{{ static_asset('assets/img/nothing.svg') }}" alt="Image">
|
||||
<h5 class="mb-0 h5 mt-3">{{ translate("There isn't anything added yet")}}</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<!-- Pagination -->
|
||||
<div class="aiz-pagination">
|
||||
{{ $conversations->links() }}
|
||||
</div>
|
||||
@endsection
|
||||
100
resources/views/frontend/user/conversations/show.blade.php
Normal file
100
resources/views/frontend/user/conversations/show.blade.php
Normal file
@@ -0,0 +1,100 @@
|
||||
@extends('frontend.layouts.user_panel')
|
||||
|
||||
@section('panel_content')
|
||||
<div class="aiz-titlebar mb-4">
|
||||
<div class="h6 fw-700">
|
||||
<span>{{ translate('Conversations With ')}}</span>
|
||||
@if ($conversation->sender_id == Auth::user()->id && $conversation->receiver->shop != null)
|
||||
<a href="{{ route('shop.visit', $conversation->receiver->shop->slug) }}" class="">{{ $conversation->receiver->shop->name }}</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="card rounded-0 shadow-none border">
|
||||
<div class="card-header bg-light">
|
||||
<div>
|
||||
<!-- Conversation title -->
|
||||
<h5 class="card-title fs-14 fw-700 mb-1">{{ $conversation->title }}</h5>
|
||||
<!-- Conversation Woth -->
|
||||
<p class="mb-0 fs-14 text-secondary fw-400">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" class="mr-2">
|
||||
<g id="Group_24976" data-name="Group 24976" transform="translate(1053.151 256.688)">
|
||||
<path id="Path_3012" data-name="Path 3012" d="M134.849,88.312h-8a2,2,0,0,0-2,2v5a2,2,0,0,0,2,2v3l2.4-3h5.6a2,2,0,0,0,2-2v-5a2,2,0,0,0-2-2m1,7a1,1,0,0,1-1,1h-8a1,1,0,0,1-1-1v-5a1,1,0,0,1,1-1h8a1,1,0,0,1,1,1Z" transform="translate(-1178 -341)" fill="#b5b5bf"/>
|
||||
<path id="Path_3013" data-name="Path 3013" d="M134.849,81.312h8a1,1,0,0,1,1,1v5a1,1,0,0,1-1,1h-.5a.5.5,0,0,0,0,1h.5a2,2,0,0,0,2-2v-5a2,2,0,0,0-2-2h-8a2,2,0,0,0-2,2v.5a.5.5,0,0,0,1,0v-.5a1,1,0,0,1,1-1" transform="translate(-1182 -337)" fill="#b5b5bf"/>
|
||||
<path id="Path_3014" data-name="Path 3014" d="M131.349,93.312h5a.5.5,0,0,1,0,1h-5a.5.5,0,0,1,0-1" transform="translate(-1181 -343.5)" fill="#b5b5bf"/>
|
||||
<path id="Path_3015" data-name="Path 3015" d="M131.349,99.312h5a.5.5,0,1,1,0,1h-5a.5.5,0,1,1,0-1" transform="translate(-1181 -346.5)" fill="#b5b5bf"/>
|
||||
</g>
|
||||
</svg>
|
||||
{{ translate('Between you and') }}
|
||||
@if ($conversation->sender_id == Auth::user()->id)
|
||||
{{ $conversation->receiver->shop ? $conversation->receiver->shop->name : $conversation->receiver->name }}
|
||||
@else
|
||||
{{ $conversation->sender->name }}
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<!-- Conversations -->
|
||||
<ul class="list-group list-group-flush">
|
||||
@foreach($conversation->messages as $message)
|
||||
<li class="list-group-item px-0">
|
||||
<div class="media mb-2">
|
||||
@if (Auth::user()->id != $message->user_id && $message->user->shop != null)
|
||||
<a href="{{ route('shop.visit', $message->user->shop->slug) }}" class="">
|
||||
<img class="avatar avatar-sm mr-3" src="{{ uploaded_asset($message->user->shop->logo) }}"
|
||||
onerror="this.onerror=null;this.src='{{ static_asset('assets/img/avatar-place.png') }}';">
|
||||
</a>
|
||||
@else
|
||||
<img class="avatar avatar-sm mr-3" @if($message->user != null) src="{{ uploaded_asset($message->user->avatar_original) }}" @endif
|
||||
onerror="this.onerror=null;this.src='{{ static_asset('assets/img/avatar-place.png') }}';">
|
||||
@endif
|
||||
<div class="media-body">
|
||||
<h6 class="mb-0 fw-600 mb-2">
|
||||
@if (Auth::user()->id != $message->user_id && $message->user->shop != null)
|
||||
<a href="{{ route('shop.visit', $message->user->shop->slug) }}" class="text-reset hov-text-primary">{{ $message->user->shop->name }}</a>
|
||||
@else
|
||||
{{ $message->user ? $message->user->name : '' }}
|
||||
@endif
|
||||
</h6>
|
||||
<p class="fs-12 text-secondary">
|
||||
{{ date('d.m.Y h:i:m', strtotime($message->created_at)) }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="fs-14 fw-400">
|
||||
{{ $message->message }}
|
||||
</p>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
||||
<!-- Send message -->
|
||||
<form class="pt-4" action="{{ route('messages.store') }}" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="conversation_id" value="{{ $conversation->id }}">
|
||||
<div class="form-group">
|
||||
<textarea class="form-control rounded-0" rows="4" name="message" placeholder="{{ translate('Type your reply') }}" required></textarea>
|
||||
</div>
|
||||
<div class="form-group mb-0 text-right">
|
||||
<button type="submit" class="btn btn-primary rounded-0 w-150px">{{ translate('Send') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<script type="text/javascript">
|
||||
function refresh_messages(){
|
||||
$.post('{{ route('conversations.refresh') }}', {_token:'{{ @csrf_token() }}', id:'{{ encrypt($conversation->id) }}'}, function(data){
|
||||
$('#messages').html(data);
|
||||
})
|
||||
}
|
||||
|
||||
refresh_messages(); // This will run on page load
|
||||
setInterval(function(){
|
||||
refresh_messages() // this will run after every 4 seconds
|
||||
}, 4000);
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user