This commit is contained in:
2025-07-09 10:47:12 +05:45
parent aefd8fd38c
commit 608f63cc87
4 changed files with 268 additions and 270 deletions

View File

@ -1,135 +1,139 @@
@extends('backend.template') @extends('backend.template')
@section('content') @section('content')
<!-- start page title --> <!-- start page title -->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between"> <div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">Welcome to Dashboard</h4> <h4 class="mb-sm-0">Welcome to Dashboard</h4>
<div class="page-title-right"> <div class="page-title-right">
<ol class="breadcrumb m-0"> <ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboard</a></li> <li class="breadcrumb-item"><a href="javascript: void(0);">Dashboard</a></li>
</ol> </ol>
</div>
</div>
</div> </div>
</div>
</div> </div>
</div> <!-- end page title -->
<!-- end page title --> <div class="row project-wrapper">
<div class="row project-wrapper"> <div class="col-xxl-12">
<div class="col-xxl-12"> <div class="row">
<div class="row"> <div class="col-xl-3">
<div class="col-xl-3"> <div class="card card-animate">
<div class="card card-animate"> <div class="card-body">
<div class="card-body"> <div class="d-flex align-items-center">
<div class="d-flex align-items-center"> <div class="avatar-sm flex-shrink-0">
<div class="avatar-sm flex-shrink-0"> <span class="avatar-title bg-soft-primary text-primary rounded-2 fs-2">
<span class="avatar-title bg-soft-primary text-primary rounded-2 fs-2"> <i data-feather="users" class="text-primary"></i>
<i data-feather="users" class="text-primary"></i> </span>
</span> </div>
</div> <div class="flex-grow-1 ms-3 overflow-hidden">
<div class="flex-grow-1 ms-3 overflow-hidden"> <p class="text-uppercase fw-medium text-muted text-truncate mb-3">Total Enquiries</p>
<p class="text-uppercase fw-medium text-muted text-truncate mb-3">Total Enquiries</p> <div class="d-flex align-items-center mb-3">
<div class="d-flex align-items-center mb-3"> <h4 class="fs-4 flex-grow-1 mb-0"><span class="counter-value"
<h4 class="fs-4 flex-grow-1 mb-0"><span class="counter-value" data-target="{{ $totalEnquiries }}">0</span></h4>
data-target="{{ $totalEnquiries }}">0</span></h4> </div>
</div> </div>
</div> </div>
</div> </div><!-- end card body -->
</div><!-- end card body --> </div>
</div> </div><!-- end col -->
</div><!-- end col --> </div><!-- end row -->
</div><!-- end row -->
<div class="row"> <div class="row">
<div class="col-xl-8"> <div class="col-xl-8">
<div class="card card-height-100"> <div class="card card-height-100">
<div class="card-header d-flex align-items-center"> <div class="card-header d-flex align-items-center">
<h4 class="card-title flex-grow-1 mb-0">Recent Enquiries</h4> <h4 class="card-title flex-grow-1 mb-0">Recent Enquiries</h4>
</div><!-- end cardheader --> </div><!-- end cardheader -->
<div class="card-body"> <div class="card-body">
<div class="table-responsive table-card"> <div class="table-responsive table-card">
<table class="table-centered table align-middle"> <table class="table-centered table align-middle">
<thead class="bg-light text-muted"> <thead class="bg-light text-muted">
<tr> <tr>
<th scope="col" style="width: 10%;">Date</th> <th scope="col" style="width: 10%;">Date</th>
<th scope="col">Name</th> <th scope="col">Name</th>
<th scope="col">Email</th> <th scope="col">Email</th>
<th scope="col">Phone</th> <th scope="col">Phone</th>
<th scope="col">Service</th> <th scope="col">Service</th>
<th scope="col">Message</th> <th scope="col">Message</th>
<th scope="col">Status</th> <th scope="col">Status</th>
<th scope="col">Action</th> <th scope="col">Action</th>
</tr><!-- end tr --> </tr><!-- end tr -->
</thead><!-- thead --> </thead><!-- thead -->
<tbody> <tbody>
@forelse ($enquiries as $enquiry) @forelse ($enquiries as $enquiry)
<tr> <tr>
<td class="text-muted">{{ $enquiry->created_at->diffForHumans() }}</td> <td class="text-muted">{{ $enquiry->created_at->diffForHumans() }}</td>
<td> <td>
<a href="javascript: void(0);" class="text-reset">{{ $enquiry->name }}</a> <a href="javascript: void(0);"
</td> class="text-reset">{{ $enquiry->name }}</a>
<td> </td>
<a href="javascript: void(0);" class="text-reset">{{ $enquiry->email }}</a> <td>
</td> <a href="javascript: void(0);"
<td> class="text-reset">{{ $enquiry->email }}</a>
<a href="javascript: void(0);" class="text-reset">{{ $enquiry->phone }}</a> </td>
</td> <td>
<td> <a href="javascript: void(0);"
<a href="javascript: void(0);" class="text-reset">{{ $enquiry->service?->title }}</a> class="text-reset">{{ $enquiry->phone }}</a>
</td> </td>
<td class="fw-medium">{{ $enquiry->message }}</td> <td>
<td><span class="badge badge-soft-danger">New</span></td> <a href="javascript: void(0);"
<td> class="text-reset">{{ $enquiry->service?->title }}</a>
<a href="{{ route('enquiry.markAsRead', ['id' => $enquiry->id]) }}" </td>
<td class="fw-medium">{{ $enquiry->message }}</td>
<td><span class="badge badge-soft-danger">New</span></td>
<td>
{{-- <a href="{{ route('enquiry.markAsRead', ['id' => $enquiry->id]) }}"
onclick="confirmRead(this.href)"><i onclick="confirmRead(this.href)"><i
class="ri-mail-check-line fs-17 lh-1 text-warning align-middle" data-bs-toggle="tooltip" class="ri-mail-check-line fs-17 lh-1 text-warning align-middle" data-bs-toggle="tooltip"
data-bs-placement="top" data-bs-custom-class="custom-tooltip" title="Mark as Read"></i></a> data-bs-placement="top" data-bs-custom-class="custom-tooltip" title="Mark as Read"></i></a> --}}
</td> </td>
</tr> </tr>
@empty @empty
@endforelse @endforelse
<!-- end tr --> <!-- end tr -->
</tbody><!-- end tbody --> </tbody><!-- end tbody -->
</table><!-- end table --> </table><!-- end table -->
</div> </div>
</div><!-- end card body --> </div><!-- end card body -->
</div><!-- end card --> </div><!-- end card -->
</div><!-- end col -->
</div><!-- end row -->
</div><!-- end col --> </div><!-- end col -->
</div><!-- end row --> </div><!-- end row -->
</div><!-- end col -->
</div><!-- end row -->
@endsection @endsection
@push('js') @push('js')
<script> <script>
function confirmRead(url) { function confirmRead(url) {
event.preventDefault(); event.preventDefault();
Swal.fire({ Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'It will be marked as read', text: 'It will be marked as read',
icon: 'warning', icon: 'warning',
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'Mark as read', confirmButtonText: 'Mark as read',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'post', type: 'post',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Mark!', 'The item has been marked as read.', 'success'); Swal.fire('Mark!', 'The item has been marked as read.', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred while marking the item.', 'error'); Swal.fire('Error!', 'An error occurred while marking the item.', 'error');
} }
}); });
}
});
} }
}); </script>
}
</script>
@endpush @endpush

View File

@ -1,167 +1,161 @@
@extends('backend.template') @extends('backend.template')
@section('content') @section('content')
<div class="card"> <div class="card">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label('Enquiries List') }}</h2> <h2>{{ label('Enquiries List') }}</h2>
</div> </div>
<div class="card-body"> <div class="card-body">
<table class="dataTable table" id="tbl_enquiries"> <table class="dataTable table" id="tbl_enquiries">
<thead class="table-light"> <thead class="table-light">
<tr> <tr>
<th class="tb-col"><span class="overline-title">{{ label('S.N') }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('S.N') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Name') }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('Name') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Email') }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('Email') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('contact') }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('contact') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Service') }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('Score') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Message') }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('Passed Year') }}</span></th>
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span> <th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@php @php
$i = 1; $i = 1;
@endphp @endphp
@foreach ($data as $item) @foreach ($data as $item)
@php @php
$isRead = $item->is_read == 0 ? true : false; $isRead = $item->is_read == 0 ? true : false;
@endphp @endphp
<tr data-id="{{ $item->id }}" data-display_order="{{ $item->display_order }}" class="draggable-row"> <tr data-id="{{ $item->id }}" data-display_order="{{ $item->display_order }}"
<td class="tb-col {{ $isRead ? 'text-success' : 'text-muted' }}">{{ $i++ }}</td> class="draggable-row">
<td class="tb-col {{ $isRead ? 'text-success' : 'text-muted' }}">{{ $item->name }}</td> <td class="tb-col {{ $isRead ? 'text-success' : 'text-muted' }}">{{ $i++ }}</td>
<td class="tb-col {{ $isRead ? 'text-success' : 'text-muted' }}">{{ $item->email }}</td> <td class="tb-col {{ $isRead ? 'text-success' : 'text-muted' }}">{{ $item->name }}</td>
<td class="tb-col {{ $isRead ? 'text-success' : 'text-muted' }}">{{ $item->phone }}</td> <td class="tb-col {{ $isRead ? 'text-success' : 'text-muted' }}">{{ $item->email }}</td>
<td class="tb-col {{ $isRead ? 'text-success' : 'text-muted' }}">{{ $item->service?->title }}</td> <td class="tb-col {{ $isRead ? 'text-success' : 'text-muted' }}">{{ $item->phone }}</td>
<td class="tb-col {{ $isRead ? 'text-success' : 'text-muted' }}">{{ $item->score }}</td>
@if ($item->message) <td class="tb-col {{ $isRead ? 'text-success' : 'text-muted' }}">{{ $item->passed_year }}</td>
<td class="tb-col {{ $isRead ? 'text-success' : 'text-muted' }}">{{ $item->message }}</td> <td class="tb-col">
@else <div class="dropdown d-inline-block">
<td class="tb-col {{ $isRead ? 'text-success' : 'text-muted' }}"> <button class="btn btn-soft-secondary btn-sm dropdown" type="button"
- data-bs-toggle="dropdown" aria-expanded="false">
</td> <i class="ri-more-fill align-middle"></i>
@endif </button>
<td class="tb-col"> <ul class="dropdown-menu dropdown-menu-end">
<div class="dropdown d-inline-block"> <li>
<button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown" {{-- <a href="{{ route('enquiry.destroy', $item->id) }}" class="dropdown-item"
aria-expanded="false"> onclick="confirmDelete(this.href)">
<i class="ri-more-fill align-middle"></i> <i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i>
</button> {{ label('Delete') }}
<ul class="dropdown-menu dropdown-menu-end"> </a> --}}
<li> {{-- @if ($item->is_read == 0)
<a href="{{ route('enquiry.destroy', ['id' => $item->id]) }}" class="dropdown-item" <a href="{{ route('enquiry.markAsRead', ['id' => $item->id]) }}"
onclick="confirmDelete(this.href)"> class="dropdown-item" onclick="confirmRead(this.href)">
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> <i class="ri-mail-check-line text-muted me-2 align-bottom"></i>
{{ label('Delete') }} {{ label('Mark as read') }}
</a> </a>
@if ($item->is_read == 0) @endif --}}
<a href="{{ route('enquiry.markAsRead', ['id' => $item->id]) }}" class="dropdown-item" </li>
onclick="confirmRead(this.href)"> {{-- <li>
<i class="ri-mail-check-line text-muted me-2 align-bottom"></i>
{{ label('Mark as read') }}
</a>
@endif
</li>
{{-- <li>
<a href="{{ route('enquiry.markread', ['id' => $item->id]) }}" <a href="{{ route('enquiry.markread', ['id' => $item->id]) }}"
class="dropdown-item remove-item-btn"> class="dropdown-item remove-item-btn">
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> <i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i>
{{ label('Mark Read') }} {{ label('Mark Read') }}
</a> </a>
</li> --}} </li> --}}
</ul> </ul>
</div> </div>
</td> </td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div>
</div>
</div> </div>
</div>
</div>
@endsection @endsection
@push('css') @push('css')
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
@endpush @endpush
@push('js') @push('js')
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script> <script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
var mytable = $(".dataTable").DataTable({ var mytable = $(".dataTable").DataTable({
ordering: true, ordering: true,
rowReorder: { rowReorder: {
//selector: 'tr' //selector: 'tr'
}, },
}); });
}) })
function confirmDelete(url) { function confirmDelete(url) {
event.preventDefault(); event.preventDefault();
Swal.fire({ Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'You will not be able to recover this item!', text: 'You will not be able to recover this item!',
icon: 'warning', icon: 'warning',
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'Delete', confirmButtonText: 'Delete',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'DELETE', type: 'DELETE',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Deleted!', 'The item has been deleted.', 'success'); Swal.fire('Deleted!', 'The item has been deleted.', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error'); Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
} }
}); });
}
});
} }
});
}
function confirmRead(url) { function confirmRead(url) {
event.preventDefault(); event.preventDefault();
Swal.fire({ Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'It will be marked as read', text: 'It will be marked as read',
icon: 'warning', icon: 'warning',
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'Mark as read', confirmButtonText: 'Mark as read',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'post', type: 'post',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Mark!', 'The item has been marked as read.', 'success'); Swal.fire('Mark!', 'The item has been marked as read.', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred while marking the item.', 'error'); Swal.fire('Error!', 'An error occurred while marking the item.', 'error');
} }
}); });
}
});
} }
}); </script>
}
</script>
@endpush @endpush

View File

@ -1,6 +1,6 @@
@use('App\Models\Enquiries') @use('App\Models\Enquiries')
@php @php
$enquiryList = Enquiries::where('status', 1)->where('is_read', 0)->latest()->get(); $enquiryList = Enquiries::where('status', 1)->latest()->get();
$enquiryCount = $enquiryList->count(); $enquiryCount = $enquiryList->count();
@endphp @endphp
<div class="dropdown topbar-head-dropdown header-item ms-1" id="notificationDropdown"> <div class="dropdown topbar-head-dropdown header-item ms-1" id="notificationDropdown">

View File

@ -99,8 +99,8 @@ Route::middleware('auth')->group(function () {
return view('backend.enquiries-list', compact('data')); return view('backend.enquiries-list', compact('data'));
})->name('enquiries-list'); })->name('enquiries-list');
Route::delete('/enquiry/destory/{id}', function ($id) { Route::delete('/enquiry/destroy/{id}', function ($id) {
$data = Enquiries::where('enquiry_id', $id)->firstOrFail()->delete(); Enquiries::where('enquiry_id', $id)->firstOrFail()->delete();
return response()->json(['status' => true, 'Deleted successfully']); return response()->json(['status' => true, 'Deleted successfully']);
})->name('enquiry.destroy'); })->name('enquiry.destroy');