You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
135 lines
5.0 KiB
135 lines
5.0 KiB
@extends('layouts.vendor.app')
|
|
|
|
@section('title', translate('Messages'))
|
|
|
|
@section('content')
|
|
|
|
<div class="content container-fluid">
|
|
<!-- Page Header -->
|
|
<div class="page-header">
|
|
<h1 class="page-header-title">{{ translate('messages.conversation') }} {{ translate('messages.list') }}</h1>
|
|
</div>
|
|
<!-- End Page Header -->
|
|
|
|
<div class="row g-3">
|
|
<div class="col-lg-4 col-md-6">
|
|
<!-- Card -->
|
|
<div class="card">
|
|
<div class="card-header border-0">
|
|
<div class="input-group input---group">
|
|
<div class="input-group-prepend border-inline-end-0">
|
|
<span class="input-group-text border-inline-end-0" id="basic-addon1"><i class="tio-search"></i></span>
|
|
</div>
|
|
<input type="text" class="form-control border-inline-start-0 pl-1" id="serach" placeholder="{{ translate('messages.search') }}" aria-label="Username"
|
|
aria-describedby="basic-addon1" autocomplete="off">
|
|
</div>
|
|
</div>
|
|
<!-- Body -->
|
|
<div class="card-body p-0 initial-19" id="conversation-list">
|
|
<div class="border-bottom"></div>
|
|
@include('vendor-views.messages.data')
|
|
</div>
|
|
<!-- End Body -->
|
|
</div>
|
|
<!-- End Card -->
|
|
</div>
|
|
<div class="col-lg-8 col-nd-6" id="view-conversation">
|
|
<center class="mt-3">
|
|
<h4 class="color-8a8a8a">{{ translate('messages.view') }} {{ translate('messages.conversation') }}
|
|
</h4>
|
|
</center>
|
|
{{-- view here --}}
|
|
</div>
|
|
</div>
|
|
<!-- End Row -->
|
|
</div>
|
|
|
|
@endsection
|
|
|
|
@push('script_2')
|
|
<script src="{{ asset('public/assets/admin/js/spartan-multi-image-picker.js') }}"></script>
|
|
<script>
|
|
function viewConvs(url, id_to_active, conv_id, sender_id) {
|
|
$('.customer-list').removeClass('conv-active');
|
|
$('#' + id_to_active).addClass('conv-active');
|
|
let new_url= "{{ route('vendor.message.list') }}" + '?conversation=' + conv_id+ '&user=' + sender_id;
|
|
$.get({
|
|
url: url,
|
|
success: function(data) {
|
|
window.history.pushState('', 'New Page Title', new_url);
|
|
$('#view-conversation').html(data.view);
|
|
converationList();
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
// function replyConvs(url) {
|
|
// $.ajaxSetup({
|
|
// headers: {
|
|
// 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
// }
|
|
// });
|
|
// $.post({
|
|
// url: url,
|
|
// data: $('#reply-form').serialize(),
|
|
// success: function(data) {
|
|
// toastr.success('Message sent', {
|
|
// CloseButton: true,
|
|
// ProgressBar: true
|
|
// });
|
|
// $('#view-conversation').html(data.view);
|
|
// },
|
|
// error() {
|
|
// toastr.error('Reply message is required!', {
|
|
// CloseButton: true,
|
|
// ProgressBar: true
|
|
// });
|
|
// }
|
|
// });
|
|
// }
|
|
|
|
var page = 1;
|
|
$('#conversation-list').scroll(function() {
|
|
if ($('#conversation-list').scrollTop() + $('#conversation-list').height() >= $('#conversation-list')
|
|
.height()) {
|
|
page++;
|
|
loadMoreData(page);
|
|
}
|
|
});
|
|
|
|
function loadMoreData(page) {
|
|
$.ajax({
|
|
url: "{{ route('vendor.message.list') }}" + '?page=' + page,
|
|
type: "get",
|
|
beforeSend: function() {
|
|
|
|
}
|
|
})
|
|
.done(function(data) {
|
|
if (data.html == " ") {
|
|
return;
|
|
}
|
|
$("#conversation-list").append(data.html);
|
|
})
|
|
.fail(function(jqXHR, ajaxOptions, thrownError) {
|
|
alert('server not responding...');
|
|
});
|
|
}
|
|
|
|
function fetch_data(page, query) {
|
|
$.ajax({
|
|
url: "{{ route('vendor.message.list') }}" + '?page=' + page + "&key=" + query,
|
|
success: function(data) {
|
|
$('#conversation-list').empty();
|
|
$("#conversation-list").append(data.html);
|
|
}
|
|
})
|
|
}
|
|
|
|
$(document).on('keyup', '#serach', function() {
|
|
var query = $('#serach').val();
|
|
fetch_data(page, query);
|
|
});
|
|
</script>
|
|
@endpush
|
|
|