DashboardExcel
This commit is contained in:
@@ -92,7 +92,14 @@ class StripeWebhookController extends Controller
|
||||
Log::info("Referral User Subscription Updating Function Starts");
|
||||
|
||||
$referralUserSubscriptionData = Subscriptions::where('iam_principal_xid', $referralUserId)->where('subscription_status', '=', 'active')->first();
|
||||
|
||||
$stripe->subscriptions->update(
|
||||
$referralUserSubscriptionData->subscription_id,
|
||||
['proration_behavior' => 'none']
|
||||
);
|
||||
if ($referralUserSubscriptionData && $referralUserSubscriptionData->is_cancelled_subscription == 0) {
|
||||
|
||||
|
||||
//update subscription add 30 days trial period to this subscription
|
||||
$nextPaymentDate = $referralUserSubscriptionData->next_payment_date;
|
||||
$date = new DateTime($nextPaymentDate);
|
||||
@@ -129,6 +136,14 @@ class StripeWebhookController extends Controller
|
||||
//checkout store in db
|
||||
$subscriptionData = $stripe->checkout->sessions->retrieve($session->id, []);
|
||||
$SubscriptionObject = $stripe->subscriptions->retrieve($subscriptionData->subscription, []);
|
||||
//update proration behavior
|
||||
$stripe->subscriptions->update(
|
||||
$subscriptionData->subscription,
|
||||
['proration_behavior' => 'none']
|
||||
);
|
||||
|
||||
//update proration behavior
|
||||
|
||||
$priceObject = $stripe->prices->retrieve($SubscriptionObject->plan->id, []);
|
||||
|
||||
$amountSubtotalDollars = $subscriptionData->amount_total / 100;
|
||||
|
||||
@@ -21,14 +21,64 @@ class DashboardController extends Controller
|
||||
* Use : To show the dashboard.
|
||||
*/
|
||||
|
||||
// public function showDashboard(){
|
||||
|
||||
|
||||
// return view('Admin.dashboard');
|
||||
// }
|
||||
public function showDashboard()
|
||||
{
|
||||
// Monthly data
|
||||
|
||||
$dailyData = Subscriptions::select(DB::raw("COUNT(*) as count"), DB::raw("DATE(created_at) as date"))
|
||||
->whereBetween('created_at', [now()->subDays(7), now()]) // Fetch data for the last 7 days
|
||||
->groupBy(DB::raw("DATE(created_at)"))
|
||||
->orderBy(DB::raw("DATE(created_at)"))
|
||||
->pluck('count', 'date')
|
||||
->toArray();
|
||||
|
||||
$start_date = now()->subDays(7)->startOfDay();
|
||||
$end_date = now()->endOfDay();
|
||||
$formattedDailyData = [];
|
||||
while ($start_date <= $end_date) {
|
||||
$formattedDailyData[$start_date->format('Y-m-d')] = isset($dailyData[$start_date->format('Y-m-d')]) ? $dailyData[$start_date->format('Y-m-d')] : 0;
|
||||
$start_date->addDay();
|
||||
}
|
||||
|
||||
|
||||
$defaultData = Subscriptions::select(DB::raw("COUNT(*) as count"), DB::raw("MONTH(created_at) as month"))
|
||||
->whereYear('created_at', date('Y'))
|
||||
->groupBy(DB::raw("MONTH(created_at)"))
|
||||
->orderBy(DB::raw("MONTH(created_at)"))
|
||||
->pluck('count', 'month')
|
||||
->toArray();
|
||||
|
||||
$months = range(1, 12);
|
||||
$formattedDefaultData = [];
|
||||
foreach ($months as $month) {
|
||||
$formattedDefaultData[$month] = isset($defaultData[$month]) ? $defaultData[$month] : 0;
|
||||
}
|
||||
$quarterlyData = Subscriptions::select(
|
||||
DB::raw("COUNT(*) as count"),
|
||||
DB::raw("QUARTER(created_at) as quarter")
|
||||
)
|
||||
->whereYear('created_at', date('Y'))
|
||||
->groupBy(DB::raw("QUARTER(created_at)"))
|
||||
->orderBy(DB::raw("QUARTER(created_at)"))
|
||||
->pluck('count', 'quarter')
|
||||
->toArray();
|
||||
|
||||
// Ensure that $quarterlyData contains zeros for quarters with no data
|
||||
for ($i = 1; $i <= 4; $i++) {
|
||||
if (!isset($quarterlyData[$i])) {
|
||||
$quarterlyData[$i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the array by quarter keys
|
||||
ksort($quarterlyData);
|
||||
|
||||
// Fetching data for yearly option
|
||||
$yearlyData = Subscriptions::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
|
||||
->groupBy(DB::raw("YEAR(created_at)"))
|
||||
->pluck('count', 'year')
|
||||
->toArray();
|
||||
|
||||
|
||||
$dataMonthlyWithType3 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("MONTH(created_at) as month"))
|
||||
->where('principal_type_xid', 3)
|
||||
->whereYear('created_at', date('Y'))
|
||||
@@ -82,7 +132,9 @@ class DashboardController extends Controller
|
||||
|
||||
$customerCount = IamPrincipal::where('principal_type_xid', '=', 3)->count();
|
||||
$restaurantCount = Subscriptions::where('is_active', 1)->count();
|
||||
$recent_transaction = Subscriptions::with('subscription')->get()->toArray();
|
||||
$dateTime = now();
|
||||
$formattedDateTime = $dateTime->format('Y-m-d H:i:s');
|
||||
$recent_transaction = Subscriptions::where('next_payment_date', '>=', $formattedDateTime)->with('subscription')->get()->toArray();
|
||||
|
||||
|
||||
return view('Admin.dashboard', compact(
|
||||
@@ -94,7 +146,13 @@ class DashboardController extends Controller
|
||||
'dataQuarterlyWithType4',
|
||||
'dataYearlyWithType3',
|
||||
'dataYearlyWithType4',
|
||||
'recent_transaction'
|
||||
'recent_transaction',
|
||||
'dailyData',
|
||||
'formattedDailyData',
|
||||
'defaultData',
|
||||
'formattedDefaultData',
|
||||
'quarterlyData',
|
||||
'yearlyData'
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Helpers\onesignalhelper;
|
||||
use App\Models\ManageState;
|
||||
use App\Models\Subscriptions;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ManageNotificationsController extends Controller
|
||||
@@ -83,6 +84,7 @@ class ManageNotificationsController extends Controller
|
||||
public function store_notificaton_data(Request $request)
|
||||
{
|
||||
try {
|
||||
|
||||
$request->validate([
|
||||
'image' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
|
||||
]);
|
||||
@@ -102,6 +104,10 @@ class ManageNotificationsController extends Controller
|
||||
|
||||
$states = $request->states;
|
||||
|
||||
// $dateTime = now();
|
||||
// $formattedDateTime = $dateTime->format('Y-m-d H:i:s');
|
||||
// $unsubscribe = Subscriptions::select('iam_principal_xid')->where('next_payment_date', '>=', $formattedDateTime)->get();
|
||||
|
||||
$userQuery = IamPrincipal::where('is_active', 1)
|
||||
->where('notification_status', 1)
|
||||
->where('principal_type_xid', 3)
|
||||
|
||||
@@ -66,13 +66,6 @@ class onesignalhelper
|
||||
try {
|
||||
$currentUtcTime = Carbon::now();
|
||||
|
||||
// $data = new NotificationDetails();
|
||||
// $data->principal_xid = $customerId;
|
||||
// $data->type = $type;
|
||||
// $data->date_added = $currentUtcTime;
|
||||
// $data->description = $description;
|
||||
// $data->save();
|
||||
|
||||
$newRecord = NotificationDetails::create([
|
||||
'principal_xid' => $customerId,
|
||||
'type' => $type,
|
||||
|
||||
@@ -11,7 +11,7 @@ class NotificationDetails extends Model
|
||||
protected $table = "notification_details";
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'principal_xid', 'type', 'description', 'image', 'date_added'
|
||||
'principal_xid', 'type', 'description', 'image', 'date_added','is_schedule','delivery_schedule'
|
||||
];
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
@@ -40,28 +40,40 @@ class RestaurantApi_Service
|
||||
->where('principal_xid', $userDetail->id)
|
||||
->get();
|
||||
|
||||
// $restaurantDetails = [];
|
||||
$restaurantDetails = [];
|
||||
$isActive = true;
|
||||
$inactiveMessage = "";
|
||||
|
||||
foreach ($restaurantRoles as $restaurantRole) {
|
||||
$restaurant = ManageRestaurant::select('id', 'name', 'description', 'restaurant_id', 'address', 'image', 'bio', 'try_on_1', 'phone_number', 'try_on_2', 'try_on_3', 'try_on_4', 'exclusion', 'latitude', 'longtitude', 'is_active', 'created_by', 'modified_by', 'deleted_at', 'created_at', 'updated_at')
|
||||
->where('id', $restaurantRole->restaurant_xid)
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
if ($restaurant) {
|
||||
$restaurant->image = ListingImageUrl('restaurant_images', $restaurant->image);
|
||||
$restaurant->description = strip_tags($restaurant->description);
|
||||
|
||||
// $restaurantDetails[] = $restaurant;
|
||||
if ($restaurant->is_active == 0) {
|
||||
$isActive = false;
|
||||
$inactiveMessage = "Your restaurant is currently not participating in Cheers to the Season. Please reach out to contact@cheerstotheseason.com to re-enroll.";
|
||||
}
|
||||
|
||||
// Add restaurant details to the array
|
||||
$restaurantDetails[] = $restaurant;
|
||||
}
|
||||
}
|
||||
|
||||
// Construct response
|
||||
$response = [
|
||||
'user_detail' => $userDetail,
|
||||
'restaurant_details' => $restaurant,
|
||||
'restaurant_details' => $restaurantDetails,
|
||||
'is_active' => $isActive,
|
||||
];
|
||||
|
||||
if (!$isActive) {
|
||||
$response['message'] = $inactiveMessage;
|
||||
}
|
||||
|
||||
// Return JSON response with success message
|
||||
return jsonResponseWithSuccessMessageApi(__('auth.User_details_fetch'), $response, 200);
|
||||
} catch (Exception $ex) {
|
||||
@@ -74,6 +86,7 @@ class RestaurantApi_Service
|
||||
|
||||
|
||||
|
||||
|
||||
public function updateRestaurantDetail($restIamId, $request)
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -52,37 +52,37 @@ $currentPage = 'dashboard';
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
<div class="col-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<a href="{{ route('manage.restaurants') }}">
|
||||
<h5>No of Restaurants</h5>
|
||||
<h2 class="m-0 font-weight-bold">{{ $restaurantCount }}</h2>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 d-flex align-items-center p-0 mb-4">
|
||||
<div class="col-12 d-flex align-items-center p-0 mb-4">
|
||||
<div class="col-md-6">
|
||||
<div class="col-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h5>User Graph</h5>
|
||||
<select class="form-control w-25" id="graph-filter">
|
||||
<option value="monthly" selected>Monthly</option>
|
||||
<option value="quarterly">Quarterly</option>
|
||||
<option value="yearly">Yearly</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="user-chart"></div>
|
||||
<a href="{{ route('manage.restaurants') }}">
|
||||
<h5>No of Restaurants</h5>
|
||||
<h2 class="m-0 font-weight-bold">{{ $restaurantCount }}</h2>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 d-flex align-items-center p-0 mb-4">
|
||||
<div class="col-12 d-flex align-items-center p-0 mb-4">
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h5>User Graph</h5>
|
||||
<select class="form-control w-25" id="graph-filter">
|
||||
<option value="monthly" selected>Monthly</option>
|
||||
<option value="quarterly">Quarterly</option>
|
||||
<option value="yearly">Yearly</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="user-chart"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- <div class="col-md-6">
|
||||
{{-- <div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
@@ -99,62 +99,76 @@ $currentPage = 'dashboard';
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
</div>
|
||||
<div class="col-12 d-flex align-items-center p-0 mb-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5>Recent Transactions</h5>
|
||||
<form action ="{{ route('export.recent.transactions') }}" method="POST" id="customer-form">
|
||||
@csrf
|
||||
<input type="hidden" name="selected_id" id="ids" disabled>
|
||||
<input type="hidden" name="all_id" id="all_id" value="all" disabled>
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<table id="zero-config" class="table dt-table-hover location_table" style="width:100%">
|
||||
<thead class="text-center">
|
||||
<tr>
|
||||
<th class="w-10px pe-2">
|
||||
<div class="form-check form-check-sm form-check-custom form-check-solid me-3">
|
||||
<input class="form-check-input" type="checkbox" name="customer_ids" id="select-all-ids" />
|
||||
</div>
|
||||
</th>
|
||||
<th class="text-start">Sr no</th>
|
||||
<th class="text-start">Name</th>
|
||||
<th class="text-start">Customer Id</th>
|
||||
<th class="text-start">Amount</th>
|
||||
<th class="text-start">payment Details</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-center">
|
||||
@foreach ($recent_transaction as $recent_transactions)
|
||||
<tr>
|
||||
<td>
|
||||
<div class="form-check form-check-sm form-check-custom form-check-solid">
|
||||
<input class="form-check-input" type="checkbox" id="customer_checkbox_ids" name="customer_ids" value="{{ $recent_transactions['id'] }}" />
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-start">{{ $loop->iteration }}</td>
|
||||
<td class="text-start">
|
||||
{{ $recent_transactions['subscription']['first_name'] }}
|
||||
{{ $recent_transactions['subscription']['last_name'] }}
|
||||
</td>
|
||||
<td class="text-start">
|
||||
|
||||
{{ $recent_transactions['subscription']['id'] }}
|
||||
</td>
|
||||
<td class="text-start">$ {{ $recent_transactions['amount'] }}</td>
|
||||
<td class="text-start">
|
||||
<a class="view-btn m-0 pointer sub_admin_permission" data-toggle="modal" data-target="#payment-details-modal" data-id="{{ $recent_transactions['id'] }}" data-name="{{ $recent_transactions['subscription']['first_name'] }}" data-price="{{ $recent_transactions['amount'] }}" data-subscription-id="{{ $recent_transactions['subscription_id'] }}" data-customer-id="{{ $recent_transactions['stripe_customer_id'] }}" data-subscription-status="{{ $recent_transactions['subscription_status'] }}" data-start-date="{{ $recent_transactions['current_period_start'] }}" data-end-date="{{ $recent_transactions['current_period_end'] }}" data-next-date="{{ $recent_transactions['next_payment_date'] }}">View</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-12 d-flex align-items-center p-0 mb-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5>Recent Transactions</h5>
|
||||
<form method="POST" id="customer-form">
|
||||
@csrf
|
||||
<input type="hidden" name="selected_id" id="ids" disabled>
|
||||
<input type="hidden" name="all_id" id="all_id" value="all" disabled>
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<table id="zero-config" class="table dt-table-hover location_table"
|
||||
style="width:100%">
|
||||
<thead class="text-center">
|
||||
<tr>
|
||||
<th class="w-10px pe-2">
|
||||
<div
|
||||
class="form-check form-check-sm form-check-custom form-check-solid me-3">
|
||||
<input class="form-check-input" type="checkbox"
|
||||
name="customer_ids" id="select-all-ids" />
|
||||
</div>
|
||||
</th>
|
||||
<th class="text-start">Sr no</th>
|
||||
<th class="text-start">Name</th>
|
||||
<th class="text-start">Customer Id</th>
|
||||
<th class="text-start">Amount</th>
|
||||
<th class="text-start">payment Details</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-center">
|
||||
@foreach ($recent_transaction as $recent_transactions)
|
||||
<tr>
|
||||
<td>
|
||||
<div
|
||||
class="form-check form-check-sm form-check-custom form-check-solid">
|
||||
<input class="form-check-input" type="checkbox"
|
||||
id="customer_checkbox_ids" name="customer_ids"
|
||||
value="{{ $recent_transactions['id'] }}" />
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-start">{{ $loop->iteration }}</td>
|
||||
<td class="text-start">
|
||||
{{ $recent_transactions['subscription']['first_name'] }}
|
||||
{{ $recent_transactions['subscription']['last_name'] }}
|
||||
</td>
|
||||
<td class="text-start">
|
||||
{{ $recent_transactions['subscription']['id'] }}</td>
|
||||
<td class="text-start">$ {{ $recent_transactions['amount'] }}</td>
|
||||
<td class="text-start">
|
||||
<a class="view-btn m-0 pointer sub_admin_permission"
|
||||
data-toggle="modal" data-target="#payment-details-modal"
|
||||
data-id="{{ $recent_transactions['id'] }}"
|
||||
data-name="{{ $recent_transactions['subscription']['first_name'] }}"
|
||||
data-price="{{ $recent_transactions['amount'] }}"
|
||||
data-subscription-id="{{ $recent_transactions['subscription_id'] }}"
|
||||
data-customer-id="{{ $recent_transactions['stripe_customer_id'] }}"
|
||||
data-subscription-status="{{ $recent_transactions['subscription_status'] }}"
|
||||
data-start-date="{{ $recent_transactions['current_period_start'] }}"
|
||||
data-end-date="{{ $recent_transactions['current_period_end'] }}"
|
||||
data-next-date="{{ $recent_transactions['next_payment_date'] }}">View</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="payment-details-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
@@ -364,23 +378,23 @@ $currentPage = 'dashboard';
|
||||
var nextDate = $(this).data('next-date');
|
||||
var formattedPrice = '$' + Price;
|
||||
|
||||
$('.subadmin-option span').eq(0).text(Name);
|
||||
$('.subadmin-option span').eq(1).text(formattedPrice);
|
||||
$('.subadmin-option span').eq(2).text(SubID);
|
||||
$('.subadmin-option span').eq(3).text(CustID);
|
||||
$('.subadmin-option span').eq(4).text(SubStatus);
|
||||
$('.subadmin-option span').eq(5).text(startDate);
|
||||
$('.subadmin-option span').eq(6).text(endDate);
|
||||
$('.subadmin-option span').eq(7).text(nextDate); // Corrected index for next-date
|
||||
$('.subadmin-option span').eq(0).text(Name);
|
||||
$('.subadmin-option span').eq(1).text(formattedPrice);
|
||||
$('.subadmin-option span').eq(2).text(SubID);
|
||||
$('.subadmin-option span').eq(3).text(CustID);
|
||||
$('.subadmin-option span').eq(4).text(SubStatus);
|
||||
$('.subadmin-option span').eq(5).text(startDate);
|
||||
$('.subadmin-option span').eq(6).text(endDate);
|
||||
$('.subadmin-option span').eq(7).text(nextDate); // Corrected index for next-date
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
// Initial data and categories
|
||||
var userChartData = getUserChartData('monthly');
|
||||
var userCategories = getUserChartCategories('monthly');
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
// Initial data and categories
|
||||
var userChartData = getUserChartData('monthly');
|
||||
var userCategories = getUserChartCategories('monthly');
|
||||
|
||||
// Chart options
|
||||
var userOptions = {
|
||||
@@ -413,51 +427,51 @@ $currentPage = 'dashboard';
|
||||
userChartData = getUserChartData(selectedFilter);
|
||||
userCategories = getUserChartCategories(selectedFilter);
|
||||
|
||||
userChart.updateSeries(userChartData);
|
||||
userChart.updateOptions({
|
||||
xaxis: {
|
||||
categories: userCategories
|
||||
}
|
||||
userChart.updateSeries(userChartData);
|
||||
userChart.updateOptions({
|
||||
xaxis: {
|
||||
categories: userCategories
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function getUserChartData(filter) {
|
||||
switch (filter) {
|
||||
case 'monthly':
|
||||
return [{
|
||||
name: 'Total Accounts',
|
||||
data: <?php echo json_encode(array_values($dataMonthlyWithType3)); ?>
|
||||
},
|
||||
{
|
||||
name: 'Total Subscribed',
|
||||
data: <?php echo json_encode(array_values($dataMonthlyWithType4)); ?>
|
||||
}
|
||||
];
|
||||
case 'quarterly':
|
||||
return [{
|
||||
name: 'Total Accounts',
|
||||
data: <?php echo json_encode(array_values($dataQuarterlyWithType3)); ?>
|
||||
},
|
||||
{
|
||||
name: 'Total Subscribed',
|
||||
data: <?php echo json_encode(array_values($dataQuarterlyWithType4)); ?>
|
||||
}
|
||||
];
|
||||
case 'yearly':
|
||||
return [{
|
||||
name: 'Total Accounts',
|
||||
data: <?php echo json_encode(array_values($dataYearlyWithType3)); ?>
|
||||
},
|
||||
{
|
||||
name: 'Total Subscribed',
|
||||
data: <?php echo json_encode(array_values($dataYearlyWithType4)); ?>
|
||||
}
|
||||
];
|
||||
default:
|
||||
return [];
|
||||
function getUserChartData(filter) {
|
||||
switch (filter) {
|
||||
case 'monthly':
|
||||
return [{
|
||||
name: 'Total Accounts',
|
||||
data: <?php echo json_encode(array_values($dataMonthlyWithType3)); ?>
|
||||
},
|
||||
{
|
||||
name: 'Total Subscribed',
|
||||
data: <?php echo json_encode(array_values($dataMonthlyWithType4)); ?>
|
||||
}
|
||||
];
|
||||
case 'quarterly':
|
||||
return [{
|
||||
name: 'Total Accounts',
|
||||
data: <?php echo json_encode(array_values($dataQuarterlyWithType3)); ?>
|
||||
},
|
||||
{
|
||||
name: 'Total Subscribed',
|
||||
data: <?php echo json_encode(array_values($dataQuarterlyWithType4)); ?>
|
||||
}
|
||||
];
|
||||
case 'yearly':
|
||||
return [{
|
||||
name: 'Total Accounts',
|
||||
data: <?php echo json_encode(array_values($dataYearlyWithType3)); ?>
|
||||
},
|
||||
{
|
||||
name: 'Total Subscribed',
|
||||
data: <?php echo json_encode(array_values($dataYearlyWithType4)); ?>
|
||||
}
|
||||
];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getUserChartCategories(filter) {
|
||||
switch (filter) {
|
||||
|
||||
@@ -140,32 +140,29 @@
|
||||
<h6>Delivery Schedule</h6>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h6>When should this message start sending ?</h6>
|
||||
<div class="form-group radio-btn ">
|
||||
<h6>When should this message start sending?</h6>
|
||||
<div class="form-group radio-btn">
|
||||
<input type="radio" class="form-control" name="schedule_radio1"
|
||||
id="push_schedule_radi01" value="0">
|
||||
<label for="push_schedule_radi01"
|
||||
class="label">Immediately</label>
|
||||
</div>
|
||||
<div class="form-group radio-btn ">
|
||||
<div class="form-group radio-btn">
|
||||
<input type="radio" class="form-control" name="schedule_radio1"
|
||||
id="push_schedule_radi02" value="1">
|
||||
<label for="push_schedule_radi02" class="label">Specific
|
||||
Time</label>
|
||||
</div>
|
||||
<div class="form-group checkbox-btsss">
|
||||
<div class="form-group checkbox-btsss" style="display: none;">
|
||||
<input type="datetime-local" class="form-control"
|
||||
name="schedule_date" min="{{ date('Y-m-d\TH:i') }}">
|
||||
</div>
|
||||
|
||||
<label id="schedule_radio1-error" class="error-message"
|
||||
for="schedule_radio1"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<button class="download-btn-custom mt-3 custom-width-10" type="submit"
|
||||
id="store_notification_btn">
|
||||
@@ -283,36 +280,46 @@
|
||||
});
|
||||
|
||||
|
||||
$('#push_user_radi01').click(function() {
|
||||
$('.radio-btn-checkbox').hide();
|
||||
$('.radio-btn-checkbox input[type="radio"]').prop('checked', false);
|
||||
});
|
||||
// Hide date and time input by default
|
||||
$('.checkbox-btsss').hide();
|
||||
|
||||
$('#push_user_radi02').click(function() {
|
||||
$('.radio-btn-checkbox').show();
|
||||
});
|
||||
|
||||
// Select specific time zone script
|
||||
// Show/hide date and time input based on radio button selection
|
||||
$('#push_schedule_radi01').click(function() {
|
||||
$('.checkbox-btsss').hide();
|
||||
$('#specificTime').val('');
|
||||
$('input[name="schedule_date"]').val(''); // Clear date and time input
|
||||
});
|
||||
|
||||
$('#push_schedule_radi02').click(function() {
|
||||
$('.checkbox-btsss').show();
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
function handleUserTypeChange() {
|
||||
var dropdown1 = document.getElementById('dropdown-1');
|
||||
var dropdown2 = document.getElementById('dropdown-2');
|
||||
var dropdown3 = document.getElementById('dropdown-3');
|
||||
var dropdowns = [
|
||||
document.getElementById('dropdown-1'),
|
||||
document.getElementById('dropdown-2'),
|
||||
document.getElementById('dropdown-3')
|
||||
];
|
||||
|
||||
dropdown1.style.display = this.value === '1' ? 'block' : 'none';
|
||||
dropdown2.style.display = this.value === '2' ? 'block' : 'none';
|
||||
dropdown3.style.display = this.value === '3' ? 'block' : 'none';
|
||||
dropdowns.forEach(function(dropdown, index) {
|
||||
if (index + 1 == this.value) {
|
||||
dropdown.style.display = 'block';
|
||||
toggleCheckboxes(dropdown, false);
|
||||
} else {
|
||||
dropdown.style.display = 'none';
|
||||
toggleCheckboxes(dropdown, true);
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
function toggleCheckboxes(dropdown, disable) {
|
||||
var checkboxes = dropdown.querySelectorAll('.form-check-input');
|
||||
for (var i = 0; i < checkboxes.length; i++) {
|
||||
checkboxes[i].disabled = disable;
|
||||
}
|
||||
}
|
||||
|
||||
var userTypeRadios = document.getElementsByName('user_type');
|
||||
|
||||
Reference in New Issue
Block a user