Current File : //home/tradevaly/public_html/resources/views/backend/pages/users/view.blade.php |
@extends('backend.ayaan.master')
@push('title') View {{$user->name}} Profile @endpush
@section('css')
<!-- DataTables -->
<link href="{{ asset('/assets/libs/datatables/datatables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('/assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet"
type="text/css">
@endsection
@section('content')
@component('components.breadcrumb')
@slot('li_1') Dashboards @endslot
@slot('title') View {{$user->name}} Profile @endslot
@endcomponent
<div class="row">
<div class="col-xl-4">
<div class="card overflow-hidden">
<div class="bg-primary bg-soft">
<div class="row">
<div class="col-7">
<div class="text-primary p-3">
<h5 class="text-primary">{{$company->name}}</h5>
<p>{{$company->phone}}</p>
</div>
</div>
<div class="col-5 align-self-end">
<img src="{{asset('assets/images/profile-img.png')}}" alt="" class="img-fluid">
</div>
</div>
</div>
<div class="card-body pt-0">
<div class="row">
<div class="col-sm-4">
<div class="avatar-md profile-user-wid mb-4">
<img src="{{asset('storage/images/user/avatar/'.$company->image.'')}}" alt="" class="img-thumbnail rounded-circle">
</div>
<h5 class="font-size-15">{{$user->name}}</h5>
<p class="text-muted mb-0">@if($user->type == 'seller') Seller @else Buyer @endif</p>
</div>
<div class="col-sm-8">
<div class="pt-4">
<div class="row">
@if($user->type == 'seller')
<div class="col-6">
<h5 class="font-size-15">{{\App\Models\Product::where('supplier_id', $user->id)->count()}}</h5>
<p class="text-muted mb-0">Products</p>
</div>
@else
<div class="col-6">
<h5 class="font-size-15">{{\App\Models\BuyOffer::where('buyer_id', $user->id)->count()}}</h5>
<p class="text-muted mb-0">Buy Offer</p>
</div>
@endif
<div class="col-6">
<h5 class="font-size-15">{{\App\Models\Thread::where('sender_id', $user->id)->where('receiver_id', $user->id)->count()}}</h5>
<p class="text-muted mb-0">Message Queries</p>
</div>
</div>
<div class="mt-4">
<a href="{{ route('supplier.view', $user->username)}}" class="btn btn-primary waves-effect waves-light btn-sm">View Profile <i class="mdi mdi-arrow-right ms-1"></i></a>
<a href="" class="btn btn-primary waves-effect waves-light btn-sm" data-bs-toggle="modal"
data-bs-target=".update-profile">Edit Profile</a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- end card -->
<div class="card">
<div class="card-body">
<h4 class="card-title mb-4">Company Information</h4>
<p class="text-muted mb-4">{!! $company->des !!}</p>
<div class="table-responsive">
<table class="table table-nowrap mb-0">
<tbody>
<tr>
<th scope="row">Name :</th>
<td>{{ $company->name }}</td>
</tr>
<tr>
<th scope="row">Type :</th>
<td>{{ $company->type }}</td>
</tr>
<tr>
<th scope="row">Main Products :</th>
<td>{{ $company->main_products }}</td>
</tr>
<tr>
<th scope="row">Location :</th>
<td>{{ $company->location }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- end card -->
<div class="card">
<div class="card-body">
<h4 class="card-title mb-4">Personal Information</h4>
<div class="table-responsive">
<table class="table table-nowrap mb-0">
<tbody>
<tr>
<th scope="row">Name :</th>
<td>{{ $user->name }}</td>
</tr>
<tr>
<th scope="row">Email :</th>
<td>{{ $user->email }}</td>
</tr>
<tr>
<th scope="row">Country :</th>
<td>{{ $user->country->name }}</td>
</tr>
<tr>
<th scope="row">Package :</th>
<td>{{ $user->package->name }}</td>
</tr>
@if($user->package_id != 0)
<tr>
<th scope="row">Expiring :</th>
<td>{{ $user->next_pay }}</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
<!-- end card -->
</div>
<div class="col-xl-8">
<div class="card">
<div class="card-body">
<div class="row mb-2">
@if($user->type == 'seller')
<div class="col-sm-4">
<div class="search-box me-2 mb-2 d-inline-block">
<div class="position-relative">
<h4 class="card-title mb-4">Product List</h4>
</div>
</div>
</div>
<div class="col-sm-8">
<div class="text-sm-end">
<a href="{{route('admin.product_list.product_list', $user->id) }}" class="btn btn-success btn-rounded waves-effect waves-light mb-2 me-2"><i class="mdi mdi-plus me-1"></i> View All</a>
</div>
</div><!-- end col-->
@else
<div class="col-sm-4">
<div class="search-box me-2 mb-2 d-inline-block">
<div class="position-relative">
<h4 class="card-title mb-4">Offer List</h4>
</div>
</div>
</div>
<div class="col-sm-8">
<div class="text-sm-end">
<a href="{{route('admin.buy_offer.buy_offer', $user->id) }}" class="btn btn-success btn-rounded waves-effect waves-light mb-2 me-2"><i class="mdi mdi-plus me-1"></i> View All</a>
</div>
</div><!-- end col-->
@endif
</div>
<div class="table-responsive">
<table class="table table-nowrap table-hover mb-0">
<thead>
<tr>
<th class="text-center">#</th>
@if($user->type == 'seller')
<th>{{translate("Title")}}</th>
<th>{{translate("Details")}}</th>
<th>{{translate("Stock")}}</th>
<th>{{translate("Processing Time")}}</th>
@else
<th>{{translate("Title")}}</th>
<th>{{translate("details")}}</th>
<th>{{translate("tags")}}</th>
@endif
</tr>
</thead>
<tbody>
@if($user->type == 'seller')
@foreach ($products as $product)
<tr>
<td class="text-center">{{$loop->iteration}}</td>
<td><a href="{{route('product.view', $product->slug)}}">{{$product['title']}}</a></td>
<td>{!!$product['details']!!}</td>
<td>{{$product->stock}}</td>
<td>{{$product->processing_time}}</td>
</tr>
@endforeach
@else
@foreach ($offers as $offer)
<tr>
<td class="text-center">{{$loop->iteration}}</td>
<td><a href="{{route('buy.view', $offer->slug)}}">{{$offer['title']}}</a></td>
<td>{!!$offer['details']!!}</td>
<td>{{$offer->tags}}</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<h4 class="card-title mb-4">Messages Activity</h4>
<div class="table-responsive">
<table class="table table-nowrap table-hover mb-0" id="datatable-buttons">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Subject</th>
<th scope="col">Sender</th>
<th scope="col">Receiver</th>
<th scope="col">Last Reply</th>
<th scope="col">Last Activivity</th>
<th scope="col">View Messages</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
@if(Auth::guard('admin')->check())
@if($user->status==0)
<a class="btn btn-info" href="{{route('admin.user.approve', $user->id)}}">
{{ translate('Approve') }}
</a>
@endif
@if($user->verify !=1)
<a class="btn btn-success" href="{{route('admin.users.verified', $user->id)}}">
{{ translate('Verified') }}
</a>
@endif
<a class="btn btn-danger" href="{{route('admin.users.delete', $user->id)}}">
{{ translate('Delete') }}
</a>
@endif
</div>
</div>
<!-- end row -->
<!-- Update Profile example -->
<div class="modal fade update-profile" tabindex="-1" role="dialog"
aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="myLargeModalLabel">Edit Profile</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="modal-body">
<form class="form-horizontal" method="POST" enctype="multipart/form-data" id="update-profile">
@csrf
<input type="hidden" value="{{ $user->id }}" id="data_id">
<div class="mb-3">
<label for="useremail" class="form-label">Email</label>
<input type="email" class="form-control @error('email') is-invalid @enderror"
id="useremail" value="{{ $user->email }}" name="email"
placeholder="Enter email" autofocus>
<div class="text-danger" id="emailError" data-ajax-feedback="email"></div>
</div>
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control @error('name') is-invalid @enderror"
value="{{ $user->name }}" id="username" name="name" autofocus
placeholder="Enter username">
<div class="text-danger" id="nameError" data-ajax-feedback="name"></div>
</div>
<div class="mb-3">
<label for="username" class="form-label">Password(Keep Empty For Unchage)</label>
<input type="text" class="form-control @error('password') is-invalid @enderror" id="password" name="password" autofocus
placeholder="Enter Password">
<div class="text-danger" id="PasswordError" data-ajax-feedback="password"></div>
</div>
<div class="mt-3 d-grid">
<button class="btn btn-primary waves-effect waves-light UpdateProfile" data-id="{{ $user->id }}"
type="submit">Update</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
@endsection
@section('script')
<!-- Required datatable js -->
<script src="{{ asset('/assets/libs/datatables/datatables.min.js') }}"></script>
<script src="{{ asset('/assets/libs/jszip/jszip.min.js') }}"></script>
<script src="{{ asset('/assets/libs/pdfmake/pdfmake.min.js') }}"></script>
<!-- Datatable init js -->
<script src="{{ asset('/assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
$(function () {
$(document).ready(function () {
var table = $('#datatable-buttons').DataTable({
lengthChange: false,
processing: true,
dom: 'Bfrtip',
serverSide: true,
ajax: "{{ route('admin.users.view', $user->id) }}",
columns: [
{data: 'DT_RowIndex', name: 'DT_RowIndex'},
{data: 'title', name: 'title'},
{data: 'sender', name: 'sender'},
{data: 'receiver', name: 'receiver'},
{data: 'lastreply', name: 'lastreply'},
{data: 'time', name: 'time'},
{data: 'view', name: 'view'},
],
buttons: ['copy', 'excel', 'pdf', 'colvis']
});
table.buttons().container().appendTo('#datatable-buttons_wrapper .col-md-6:eq(0)');
$(".dataTables_length select").addClass('form-select form-select-sm');
});
});
</script>
<script>
$('#update-profile').on('submit',function(event){
event.preventDefault();
var Id = $('#data_id').val();
let formData = new FormData(this);
$('#emailError').text('');
$('#nameError').text('');
$('#PasswordError').text('');
$.ajax({
url: "{{ url('b2b/users/update-profile') }}" + "/" + Id,
type:"POST",
data: formData,
contentType: false,
processData: false,
success:function(response){
$('#emailError').text('');
$('#nameError').text('');
$('#PasswordError').text('');
if(response.isSuccess == false){
alert(response.Message);
}else if(response.isSuccess == true){
setTimeout(function () {
window.location.reload();
}, 1000);
}
},
error: function(response) {
$('#emailError').text(response.responseJSON.errors.email);
$('#nameError').text(response.responseJSON.errors.name);
$('#PasswordError').text(response.responseJSON.errors.dob);
}
});
});
</script>
@endsection