changes
This commit is contained in:
@@ -29,7 +29,9 @@ class customer_export implements FromCollection, WithHeadings
|
||||
|
||||
$serial = 1;
|
||||
return $customers->map(function ($customer) use (&$serial) {
|
||||
$isSubscribed = $customer->isSubscribed->count() > 0 ? 'Subscribed' : 'Unsubscribed';
|
||||
$subscription = $customer->isSubscribed->first();
|
||||
$isSubscribed = $subscription && $subscription->status == 'complete' ? 'Subscribed' : 'Unsubscribed';
|
||||
|
||||
return [
|
||||
'Sr No.' => $serial++, // Increment serial number
|
||||
'id' => $customer->id,
|
||||
@@ -44,6 +46,7 @@ class customer_export implements FromCollection, WithHeadings
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Function to provide the headings in Excel
|
||||
public function headings(): array
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
@@ -40,7 +41,8 @@ class customer_export_selected implements FromCollection, WithHeadings
|
||||
|
||||
$serial = 1;
|
||||
$mappedCustomers = $selected_customers->map(function ($customer) use (&$serial) {
|
||||
$isSubscribed = $customer->isSubscribed->isNotEmpty() ? 'Subscribed' : 'Unsubscribed';
|
||||
$subscription = $customer->isSubscribed->first();
|
||||
$isSubscribed = $subscription && $subscription->status == 'complete' ? 'Subscribed' : 'Unsubscribed';
|
||||
return [
|
||||
'Sr No.' => $serial++, // Increment serial number
|
||||
'id' => $customer->id,
|
||||
|
||||
@@ -304,7 +304,6 @@ class ManageCustomerController extends Controller
|
||||
{
|
||||
try {
|
||||
$redeemDetails = RedeemRestaurant::with('restaurant', 'customer')->where('iam_principal_xid', $id)->get();
|
||||
// return $redeemDetails;
|
||||
return view('Admin.pages.manage_users.manage_customer.customer_restaurants', compact('redeemDetails'));
|
||||
} catch (Exception $e) {
|
||||
Log::error("Error getting restaurant details: " . $e->getMessage());
|
||||
|
||||
@@ -19,6 +19,11 @@ $('#zero-config').DataTable({
|
||||
]
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('<button><ul class="navbar-item flex-row ms-lg-auto ms-0"><li class="nav-item dropdown action-dropdown order-lg-0 order-1"><a href="javascript:void(0);" class="nav-link dropdown-toggle user extra-btn" id="actionDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><div class="avatar-container"><div class="avatar avatar-sm avatar-indicators avatar-online"><h3>Export</h3></div></div></a><div class="dropdown-menu position-absolute" aria-labelledby="actionDropdown"><div class="dropdown-item"><a href="javascript:void(0)" id="download_all"><span>Download Overview</span></a></div><div class="dropdown-item"><a href="javascript:void(0)" id="download-selected"><span id="export">Download Selected</span></a></div></div></li></ul></button>')
|
||||
.insertBefore("#zero-config_filter label");
|
||||
});
|
||||
|
||||
$(document).on("click", ".cust_archive_btn", function () {
|
||||
var data_id = $(this).data('id');
|
||||
$('#archive_id').val(data_id);
|
||||
@@ -126,9 +131,6 @@ $(function (e) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).on("click", "#download_all", function (e) {
|
||||
$('#all_id').prop('disabled', false);
|
||||
$('#ids').prop('disabled', true);
|
||||
@@ -142,12 +144,78 @@ $(document).on("click", ".more", function (e) {
|
||||
});
|
||||
|
||||
|
||||
$(document).on('click', "#delete_customer_user_id", function() {
|
||||
var delete_customer_user_id = $(this).data('id');
|
||||
$("#customer_delete").val(delete_customer_user_id);
|
||||
})
|
||||
|
||||
$(document).on('click', '#delete_customer_user', function(e) {
|
||||
let base_url = url_path;
|
||||
e.preventDefault();
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
|
||||
var id = $('#customer_delete').val();
|
||||
|
||||
$('#delete_customer_user').text('Please wait...');
|
||||
$('#delete_customer_user').attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'delete_customer_user/' + id,
|
||||
success: function(result) {
|
||||
if (result.status == 200) {
|
||||
toastr.success('Customer Deleted Sucessfully');
|
||||
setTimeout(function() {
|
||||
window.location.href = base_url + "/manage-customer";
|
||||
}, 2000);
|
||||
} else {
|
||||
toastr.error('Something Went Wrong');
|
||||
setTimeout(function() {
|
||||
window.location.href = base_url + "/manage-customer";
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', "#unsubscribe_id", function() {
|
||||
var unsubscribe_id = $(this).data('id');
|
||||
$("#unsubscribe_id").val(unsubscribe_id);
|
||||
})
|
||||
|
||||
$(document).on('click', '#unsubscibed', function(e) {
|
||||
let base_url = url_path;
|
||||
e.preventDefault();
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
|
||||
var id = $('#unsubscribe_id').val();
|
||||
|
||||
$('#unsubscibed').text('Please wait...');
|
||||
$('#unsubscibed').attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'unsubscibed/' + id,
|
||||
success: function(result) {
|
||||
if (result.status == 200) {
|
||||
toastr.success('Customer Unsubscribed Sucessfully');
|
||||
setTimeout(function() {
|
||||
window.location.href = base_url + "/manage-customer";
|
||||
}, 2000);
|
||||
} else {
|
||||
toastr.error('Something Went Wrong');
|
||||
setTimeout(function() {
|
||||
window.location.href = base_url + "/manage-customer";
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -151,8 +151,9 @@
|
||||
title="Edit" />
|
||||
</a>
|
||||
@if ($customer['is_subscribed'])
|
||||
<a class="cust_unsubscribe_btn" id="unsubscribe_id" data-id="{{ $customer->id }}"
|
||||
data-toggle="modal" data-target="#unsubscribe-modal">
|
||||
<a class="cust_unsubscribe_btn" id="unsubscribe_id"
|
||||
data-id="{{ $customer->id }}" data-toggle="modal"
|
||||
data-target="#unsubscribe-modal">
|
||||
<img src="{{ asset('public/assets/img/archive.svg') }}"
|
||||
alt="Unsubscribe" title="Unsubscribe" />
|
||||
</a>
|
||||
@@ -164,7 +165,8 @@
|
||||
@endif
|
||||
<a href="#" id="delete_customer_user_id"
|
||||
data-id="{{ $customer->id }}" data-toggle="modal"
|
||||
data-target="#delete-customer-user-modal" alt="Delete" title="Delete"><img
|
||||
data-target="#delete-customer-user-modal" alt="Delete"
|
||||
title="Delete"><img
|
||||
src="{{ asset('public/assets/img/delete-recycle.svg') }}" />
|
||||
</a>
|
||||
</td>
|
||||
@@ -219,7 +221,8 @@
|
||||
<p class="modal-text" style="text-align:center;">Are you sure you want to<br>Unsubscribed?</p>
|
||||
<div class="modal-btn d-flex ">
|
||||
<a class="extra-btn pointer" data-dismiss="modal">No</a>
|
||||
<a class="download-btn-custom customer_unsubscribe" id="unsubscibed" href="{{ route('manage.customer') }}">Yes</a>
|
||||
<a class="download-btn-custom customer_unsubscribe" id="unsubscibed"
|
||||
href="{{ route('manage.customer') }}">Yes</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -231,116 +234,4 @@
|
||||
|
||||
@section('section_script')
|
||||
<script src="{{ asset('public/assets/js/admin/manage_customer/main.js') }}"></script>
|
||||
<!-- <script>
|
||||
$('#zero-config').DataTable({
|
||||
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
|
||||
"<'table-responsive'tr>" +
|
||||
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
|
||||
"oLanguage": {
|
||||
"oPaginate": {
|
||||
"sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
|
||||
"sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>'
|
||||
},
|
||||
"sInfo": "Showing page _PAGE_ of _PAGES_",
|
||||
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
|
||||
"sSearchPlaceholder": "Search...",
|
||||
"sLengthMenu": "Results : _MENU_",
|
||||
},
|
||||
"stripeClasses": [],
|
||||
"lengthMenu": [7, 10, 20, 50],
|
||||
"pageLength": 10
|
||||
});
|
||||
</script> -->
|
||||
|
||||
<script>
|
||||
//old code which have the archieve button
|
||||
// $(document).ready(function() {
|
||||
// $('<button><a class="extra-btn width-max-content" href="{{ route('customer_archive') }}">View Archive List</a></button><button><ul class="navbar-item flex-row ms-lg-auto ms-0"><li class="nav-item dropdown action-dropdown order-lg-0 order-1"><a href="javascript:void(0);"class="nav-link dropdown-toggle user extra-btn" id="actionDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><div class="avatar-container"><div class="avatar avatar-sm avatar-indicators avatar-online"><h3>Export</h3></div></div></a><div class="dropdown-menu position-absolute" aria-labelledby="actionDropdown"><div class="dropdown-item"><a href="javascript:void(0)" id="download_all"><span>Download Overview</span></a></div><div class="dropdown-item"><a href="javascript:void(0)" id="download-selected"><span id="export">Download Selected</span></a></div></div></li></ul></button>')
|
||||
// .insertBefore("#zero-config_filter label");
|
||||
// });
|
||||
|
||||
//below script don't have the archieve button
|
||||
$(document).ready(function() {
|
||||
$('<button><ul class="navbar-item flex-row ms-lg-auto ms-0"><li class="nav-item dropdown action-dropdown order-lg-0 order-1"><a href="javascript:void(0);" class="nav-link dropdown-toggle user extra-btn" id="actionDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><div class="avatar-container"><div class="avatar avatar-sm avatar-indicators avatar-online"><h3>Export</h3></div></div></a><div class="dropdown-menu position-absolute" aria-labelledby="actionDropdown"><div class="dropdown-item"><a href="javascript:void(0)" id="download_all"><span>Download Overview</span></a></div><div class="dropdown-item"><a href="javascript:void(0)" id="download-selected"><span id="export">Download Selected</span></a></div></div></li></ul></button>')
|
||||
.insertBefore("#zero-config_filter label");
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).on('click', "#delete_customer_user_id", function() {
|
||||
var delete_customer_user_id = $(this).data('id');
|
||||
$("#customer_delete").val(delete_customer_user_id);
|
||||
})
|
||||
|
||||
$(document).on('click', '#delete_customer_user', function(e) {
|
||||
let base_url = url_path;
|
||||
e.preventDefault();
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
|
||||
var id = $('#customer_delete').val();
|
||||
|
||||
$('#delete_customer_user').text('Please wait...');
|
||||
$('#delete_customer_user').attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'delete_customer_user/' + id,
|
||||
success: function(result) {
|
||||
if (result.status == 200) {
|
||||
toastr.success('Customer Deleted Sucessfully');
|
||||
setTimeout(function() {
|
||||
window.location.href = base_url + "/manage-customer";
|
||||
}, 2000);
|
||||
} else {
|
||||
toastr.error('Something Went Wrong');
|
||||
setTimeout(function() {
|
||||
window.location.href = base_url + "/manage-customer";
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).on('click', "#unsubscribe_id", function() {
|
||||
var unsubscribe_id = $(this).data('id');
|
||||
$("#unsubscribe_id").val(unsubscribe_id);
|
||||
})
|
||||
|
||||
$(document).on('click', '#unsubscibed', function(e) {
|
||||
let base_url = url_path;
|
||||
e.preventDefault();
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
|
||||
var id = $('#unsubscribe_id').val();
|
||||
|
||||
$('#unsubscibed').text('Please wait...');
|
||||
$('#unsubscibed').attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'unsubscibed/' + id,
|
||||
success: function(result) {
|
||||
if (result.status == 200) {
|
||||
toastr.success('Customer Unsubscribed Sucessfully');
|
||||
setTimeout(function() {
|
||||
window.location.href = base_url + "/manage-customer";
|
||||
}, 2000);
|
||||
} else {
|
||||
toastr.error('Something Went Wrong');
|
||||
setTimeout(function() {
|
||||
window.location.href = base_url + "/manage-customer";
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
@foreach ($redeemDetails as $redeemDetail)
|
||||
<tr>
|
||||
<td class="text-start">{{ $loop->iteration }}</td>
|
||||
<td class="text-start">{{ $redeemDetail->restaurant->name }}</td>
|
||||
<td><img src="{{ ListingImageUrl('restaurant_images', $redeemDetail->restaurant->image) }}"
|
||||
<td class="text-start">{{ $redeemDetail->restaurant->name ?? 'N/A' }}</td>
|
||||
<td><img src="{{ ListingImageUrl('restaurant_images', $redeemDetail->restaurant->image ?? 'N/A') }}"
|
||||
height="50px" width="80px"></td>
|
||||
<td>
|
||||
@if (!is_null($redeemDetail->redeem_date))
|
||||
@@ -70,9 +70,12 @@
|
||||
|
||||
<td class="text-center">
|
||||
<div class="switch-btn">
|
||||
<input type="checkbox" id="switch{{ $redeemDetail['id'] }}" switch="bool" data-id="{{ $redeemDetail['id'] }}"
|
||||
name="status" value="1" {{ $redeemDetail['is_redeem'] ? 'checked' : '' }} disabled />
|
||||
<label for="switch{{ $redeemDetail['id'] }}" data-on-label="Active" data-off-label="Inactive"></label>
|
||||
<input type="checkbox" id="switch{{ $redeemDetail['id'] }}"
|
||||
switch="bool" data-id="{{ $redeemDetail['id'] }}" name="status"
|
||||
value="1" {{ $redeemDetail['is_redeem'] ? 'checked' : '' }}
|
||||
disabled />
|
||||
<label for="switch{{ $redeemDetail['id'] }}" data-on-label="Active"
|
||||
data-off-label="Inactive"></label>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user