Merge branch 'main' of https://github.com/WDI-Ideas/cheerstothe_season_laravel11 into HritikCheers
This commit is contained in:
@@ -22,148 +22,149 @@ class DashboardController extends Controller
|
||||
* Use : To show the dashboard.
|
||||
*/
|
||||
|
||||
public function showDashboard()
|
||||
{
|
||||
public function showDashboard()
|
||||
{
|
||||
|
||||
|
||||
$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();
|
||||
$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')] = $dailyData[$start_date->format('Y-m-d')] ?? 0;
|
||||
$start_date->addDay();
|
||||
}
|
||||
$start_date = now()->subDays(7)->startOfDay();
|
||||
$end_date = now()->endOfDay();
|
||||
$formattedDailyData = [];
|
||||
while ($start_date <= $end_date) {
|
||||
$formattedDailyData[$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();
|
||||
$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] = $defaultData[$month] ?? 0;
|
||||
}
|
||||
$months = range(1, 12);
|
||||
$formattedDefaultData = [];
|
||||
foreach ($months as $month) {
|
||||
$formattedDefaultData[$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();
|
||||
$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();
|
||||
|
||||
for ($i = 1; $i <= 4; $i++) {
|
||||
$quarterlyData[$i] = $quarterlyData[$i] ?? 0;
|
||||
}
|
||||
for ($i = 1; $i <= 4; $i++) {
|
||||
$quarterlyData[$i] = $quarterlyData[$i] ?? 0;
|
||||
}
|
||||
|
||||
ksort($quarterlyData);
|
||||
ksort($quarterlyData);
|
||||
|
||||
$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();
|
||||
$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'))
|
||||
->groupBy(DB::raw("MONTH(created_at)"))
|
||||
->orderBy(DB::raw("MONTH(created_at)"))
|
||||
->pluck('count', 'month')
|
||||
->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'))
|
||||
->groupBy(DB::raw("MONTH(created_at)"))
|
||||
->orderBy(DB::raw("MONTH(created_at)"))
|
||||
->pluck('count', 'month')
|
||||
->toArray();
|
||||
|
||||
$dataMonthlyWithType4 = 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();
|
||||
$dataMonthlyWithType4 = 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();
|
||||
|
||||
$dataMonthlyWithType3 = array_replace(array_fill_keys($months, 0), $dataMonthlyWithType3);
|
||||
$dataMonthlyWithType4 = array_replace(array_fill_keys($months, 0), $dataMonthlyWithType4);
|
||||
$dataMonthlyWithType3 = array_replace(array_fill_keys($months, 0), $dataMonthlyWithType3);
|
||||
$dataMonthlyWithType4 = array_replace(array_fill_keys($months, 0), $dataMonthlyWithType4);
|
||||
|
||||
$dataQuarterlyWithType3 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("QUARTER(created_at) as quarter"))
|
||||
->where('principal_type_xid', 3)
|
||||
->groupBy(DB::raw("QUARTER(created_at)"))
|
||||
->orderBy(DB::raw("QUARTER(created_at)"))
|
||||
->pluck('count', 'quarter')
|
||||
->toArray();
|
||||
$dataQuarterlyWithType3 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("QUARTER(created_at) as quarter"))
|
||||
->where('principal_type_xid', 3)
|
||||
->groupBy(DB::raw("QUARTER(created_at)"))
|
||||
->orderBy(DB::raw("QUARTER(created_at)"))
|
||||
->pluck('count', 'quarter')
|
||||
->toArray();
|
||||
|
||||
$dataQuarterlyWithType4 = Subscriptions::select(DB::raw("COUNT(*) as count"), DB::raw("QUARTER(created_at) as quarter"))
|
||||
->groupBy(DB::raw("QUARTER(created_at)"))
|
||||
->orderBy(DB::raw("QUARTER(created_at)"))
|
||||
->pluck('count', 'quarter')
|
||||
->toArray();
|
||||
$dataQuarterlyWithType4 = Subscriptions::select(DB::raw("COUNT(*) as count"), DB::raw("QUARTER(created_at) as quarter"))
|
||||
->groupBy(DB::raw("QUARTER(created_at)"))
|
||||
->orderBy(DB::raw("QUARTER(created_at)"))
|
||||
->pluck('count', 'quarter')
|
||||
->toArray();
|
||||
|
||||
// Fill missing quarters with zeros
|
||||
$quarters = range(1, 4);
|
||||
$dataQuarterlyWithType3 = array_replace(array_fill_keys($quarters, 0), $dataQuarterlyWithType3);
|
||||
$dataQuarterlyWithType4 = array_replace(array_fill_keys($quarters, 0), $dataQuarterlyWithType4);
|
||||
|
||||
$dataYearlyWithType3 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
|
||||
->where('principal_type_xid', 3)
|
||||
->groupBy(DB::raw("YEAR(created_at)"))
|
||||
->pluck('count', 'year')
|
||||
->toArray();
|
||||
$dataYearlyWithType3 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
|
||||
->where('principal_type_xid', 3)
|
||||
->groupBy(DB::raw("YEAR(created_at)"))
|
||||
->pluck('count', 'year')
|
||||
->toArray();
|
||||
|
||||
$dataYearlyWithType4 = Subscriptions::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
|
||||
->groupBy(DB::raw("YEAR(created_at)"))
|
||||
->pluck('count', 'year')
|
||||
->toArray();
|
||||
$dataYearlyWithType4 = Subscriptions::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
|
||||
->groupBy(DB::raw("YEAR(created_at)"))
|
||||
->pluck('count', 'year')
|
||||
->toArray();
|
||||
|
||||
$customerCount = IamPrincipal::where('principal_type_xid', 3)->count();
|
||||
$restaurantCount = Subscriptions::where('is_active', 1)->count();
|
||||
$formattedDateTime = now()->format('Y-m-d H:i:s');
|
||||
$customerCount = IamPrincipal::where('principal_type_xid', 3)->count();
|
||||
$restaurantCount = Subscriptions::where('is_active', 1)->count();
|
||||
$formattedDateTime = now()->format('Y-m-d H:i:s');
|
||||
|
||||
$recent_transactions = Subscriptions::where('next_payment_date', '>=', $formattedDateTime)
|
||||
->with('subscription')
|
||||
->orderBy('id', 'desc')
|
||||
->get();
|
||||
$recent_transactions = Subscriptions::where('next_payment_date', '>=', $formattedDateTime)
|
||||
->with('subscription')
|
||||
->orderBy('id', 'desc')
|
||||
->get();
|
||||
|
||||
$formatted_transactions = $recent_transactions->map(function ($transaction) {
|
||||
return [
|
||||
'id' => $transaction->id,
|
||||
'subscription' => [
|
||||
'first_name' => $transaction->subscription->first_name,
|
||||
'last_name' => $transaction->subscription->last_name,
|
||||
'id' => $transaction->subscription->id,
|
||||
],
|
||||
'amount' => $transaction->amount,
|
||||
'subscription_id' => $transaction->subscription_id,
|
||||
'stripe_customer_id' => $transaction->stripe_customer_id,
|
||||
'subscription_status' => $transaction->subscription_status,
|
||||
'current_period_start' => Carbon::parse($transaction->current_period_start)->format('m/d/y'),
|
||||
'current_period_end' => Carbon::parse($transaction->current_period_end)->format('m/d/y'),
|
||||
'next_payment_date' => Carbon::parse($transaction->next_payment_date)->format('m/d/y'),
|
||||
];
|
||||
})->toArray();
|
||||
$formatted_transactions = $recent_transactions->map(function ($transaction) {
|
||||
return [
|
||||
'id' => $transaction->id,
|
||||
'subscription' => $transaction->subscription ? [
|
||||
'first_name' => $transaction->subscription->first_name,
|
||||
'last_name' => $transaction->subscription->last_name,
|
||||
'id' => $transaction->subscription->id,
|
||||
] : null,
|
||||
'amount' => $transaction->amount,
|
||||
'subscription_id' => $transaction->subscription_id,
|
||||
'stripe_customer_id' => $transaction->stripe_customer_id,
|
||||
'status' => $transaction->status,
|
||||
'current_period_start' => $transaction->current_period_start ? Carbon::parse($transaction->current_period_start)->format('m/d/Y') : null,
|
||||
'current_period_end' => $transaction->current_period_end ? Carbon::parse($transaction->current_period_end)->format('m/d/Y') : null,
|
||||
'next_payment_date' => $transaction->next_payment_date ? Carbon::parse($transaction->next_payment_date)->format('m/d/Y') : null,
|
||||
];
|
||||
})->toArray();
|
||||
|
||||
return view('Admin.dashboard', compact(
|
||||
'customerCount',
|
||||
'restaurantCount',
|
||||
'dataMonthlyWithType3',
|
||||
'dataMonthlyWithType4',
|
||||
'dataQuarterlyWithType3',
|
||||
'dataQuarterlyWithType4',
|
||||
'dataYearlyWithType3',
|
||||
'dataYearlyWithType4',
|
||||
'formatted_transactions',
|
||||
'dailyData',
|
||||
'formattedDailyData',
|
||||
'defaultData',
|
||||
'formattedDefaultData',
|
||||
'quarterlyData',
|
||||
'yearlyData'
|
||||
));
|
||||
}
|
||||
|
||||
return view('Admin.dashboard', compact(
|
||||
'customerCount',
|
||||
'restaurantCount',
|
||||
'dataMonthlyWithType3',
|
||||
'dataMonthlyWithType4',
|
||||
'dataQuarterlyWithType3',
|
||||
'dataQuarterlyWithType4',
|
||||
'dataYearlyWithType3',
|
||||
'dataYearlyWithType4',
|
||||
'formatted_transactions',
|
||||
'dailyData',
|
||||
'formattedDailyData',
|
||||
'defaultData',
|
||||
'formattedDefaultData',
|
||||
'quarterlyData',
|
||||
'yearlyData'
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -30,37 +30,37 @@ use PDF;
|
||||
class ManageCustomerController extends Controller
|
||||
{
|
||||
|
||||
/*
|
||||
/*
|
||||
Created By : Sayali Parab
|
||||
Created at : 28 May 2024
|
||||
Use : To Get User Page.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
$customers = IamPrincipal::with(['isSubscribed', 'state'])
|
||||
->where('principal_type_xid', 3)
|
||||
->orderBy('created_at', 'desc')
|
||||
->get();
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
$customers = IamPrincipal::with(['isSubscribed', 'state'])
|
||||
->where('principal_type_xid', 3)
|
||||
->orderBy('created_at', 'desc')
|
||||
->get();
|
||||
|
||||
$dateTime = now();
|
||||
$formattedDateTime = $dateTime->format('Y-m-d H:i:s');
|
||||
$dateTime = now();
|
||||
$formattedDateTime = $dateTime->format('Y-m-d H:i:s');
|
||||
|
||||
foreach ($customers as $customer) {
|
||||
$customer->is_subscribed = $customer->isSubscribed->contains(function ($subscription) use ($formattedDateTime) {
|
||||
return $subscription->subscription_status == 'active' && $subscription->next_payment_date >= $formattedDateTime;
|
||||
});
|
||||
}
|
||||
|
||||
return view('Admin.pages.manage_users.manage_customer.customer', compact('customers'));
|
||||
} catch (Exception $e) {
|
||||
Log::error("Manage Voucher Page Not Load " . $e->getMessage());
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
foreach ($customers as $customer) {
|
||||
$customer->is_subscribed = $customer->isSubscribed->contains(function ($subscription) use ($formattedDateTime) {
|
||||
return $subscription->status == 'complete' && $subscription->next_payment_date >= $formattedDateTime;
|
||||
});
|
||||
}
|
||||
|
||||
return view('Admin.pages.manage_users.manage_customer.customer', compact('customers'));
|
||||
} catch (Exception $e) {
|
||||
Log::error("Manage Voucher Page Not Load " . $e->getMessage());
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
Created By : Sayali Parab
|
||||
Created at : 28 May 2024
|
||||
Use : To Get Passport Page.
|
||||
@@ -68,7 +68,7 @@ class ManageCustomerController extends Controller
|
||||
public function view_customer($id)
|
||||
{
|
||||
try {
|
||||
$customers_data = IamPrincipal::with('state', 'contactMessages','isSubscribed')->findOrFail($id);
|
||||
$customers_data = IamPrincipal::with('state', 'contactMessages', 'isSubscribed')->findOrFail($id);
|
||||
if ($customers_data->contactMessages->isEmpty()) {
|
||||
Log::info('No contact messages found for customer with ID: ' . $id);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ class ManageCustomerController extends Controller
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
/*
|
||||
/*
|
||||
Created By : Sayali Parab
|
||||
Created at : 28 May 2024
|
||||
Use : To Get Customer data.
|
||||
@@ -100,7 +100,7 @@ class ManageCustomerController extends Controller
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
/*
|
||||
/*
|
||||
Created By : Sayali Parab
|
||||
Created at : 28 May 2024
|
||||
Use : To Update Customer Form.
|
||||
@@ -213,7 +213,7 @@ class ManageCustomerController extends Controller
|
||||
return response()->json(['success' => false, 'status' => 500, 'message' => __('auth.something_went_wrong')]);
|
||||
}
|
||||
}
|
||||
/*
|
||||
/*
|
||||
Created By : Sayali Parab
|
||||
Created at : 28 May 2024
|
||||
Use : To Get pdf.
|
||||
@@ -234,7 +234,7 @@ class ManageCustomerController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
Created By : Sayali Parab
|
||||
Created at : 28 May 2024
|
||||
Use : To Get Excel.
|
||||
@@ -249,7 +249,7 @@ class ManageCustomerController extends Controller
|
||||
|
||||
$ids = $request->selected_id;
|
||||
|
||||
|
||||
|
||||
if (empty($ids)) {
|
||||
return response()->json(['error' => 'No IDs provided for export.'], 400);
|
||||
}
|
||||
@@ -272,7 +272,7 @@ class ManageCustomerController extends Controller
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
Created By : Sayali Parab
|
||||
Created at : 28 May 2024
|
||||
Use : To Deleted Data Restore.
|
||||
@@ -322,8 +322,44 @@ class ManageCustomerController extends Controller
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$deleteCustomer = IamPrincipal::find($id);
|
||||
// dd($id );
|
||||
$stripeSecret = (config('constants.subscription.stripe_secret_key'));
|
||||
// $stripeSecret = env('STRIPE_SECRET');
|
||||
|
||||
$stripe = new \Stripe\StripeClient($stripeSecret);
|
||||
$userId = $id;
|
||||
|
||||
// dd($id,$stripeSecret);
|
||||
|
||||
$getSubscriptionData = Subscriptions::where('iam_principal_xid', $userId)->where('subscription_status', 'active')->first();
|
||||
if ($getSubscriptionData) {
|
||||
$subscriptionId = $getSubscriptionData->subscription_id;
|
||||
|
||||
$cancelledSubscription = $stripe->subscriptions->update(
|
||||
$subscriptionId,
|
||||
['cancel_at_period_end' => true]
|
||||
);
|
||||
|
||||
$subscriptionFromDatabase = Subscriptions::where('subscription_id', $subscriptionId)->first();
|
||||
$subscriptionFromDatabase->cancelled_at = date('Y-m-d H:i:s', $cancelledSubscription->canceled_at);
|
||||
|
||||
$subscriptionFromDatabase->subscription_status = $cancelledSubscription->status;
|
||||
$subscriptionFromDatabase->is_cancelled_subscription = 1;
|
||||
$subscriptionFromDatabase->status = "cancelled";
|
||||
|
||||
$subscriptionFromDatabase->save();
|
||||
|
||||
|
||||
$getSubscription = $stripe->subscriptions->retrieve($subscriptionFromDatabase->subscription_id, []);
|
||||
|
||||
|
||||
$getSubscribeCustomer = $stripe->customers->retrieve(
|
||||
$subscriptionFromDatabase->stripe_customer_id,
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$deleteCustomer = IamPrincipal::find($userId);
|
||||
$deleteCustomer->delete();
|
||||
DB::commit();
|
||||
return response()->json(['sucess' => true, 'status' => 200]);
|
||||
@@ -333,4 +369,55 @@ class ManageCustomerController extends Controller
|
||||
return response()->json(['success' => false, 'status' => 500, 'message' => __('auth.something_went_wrong')]);
|
||||
}
|
||||
}
|
||||
|
||||
public function unsubscibed($id)
|
||||
{
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$stripeSecret = (config('constants.subscription.stripe_secret_key'));
|
||||
// $stripeSecret = env('STRIPE_SECRET');
|
||||
|
||||
$stripe = new \Stripe\StripeClient($stripeSecret);
|
||||
$userId = $id;
|
||||
|
||||
// dd($id,$stripeSecret);
|
||||
|
||||
$getSubscriptionData = Subscriptions::where('iam_principal_xid', $userId)->where('subscription_status', 'active')->first();
|
||||
|
||||
$subscriptionId = $getSubscriptionData->subscription_id;
|
||||
|
||||
$cancelledSubscription = $stripe->subscriptions->update(
|
||||
$subscriptionId,
|
||||
['cancel_at_period_end' => true]
|
||||
);
|
||||
|
||||
$subscriptionFromDatabase = Subscriptions::where('subscription_id', $subscriptionId)->first();
|
||||
$subscriptionFromDatabase->cancelled_at = date('Y-m-d H:i:s', $cancelledSubscription->canceled_at);
|
||||
|
||||
$subscriptionFromDatabase->subscription_status = $cancelledSubscription->status;
|
||||
$subscriptionFromDatabase->is_cancelled_subscription = 1;
|
||||
$subscriptionFromDatabase->status = "cancelled";
|
||||
|
||||
$subscriptionFromDatabase->save();
|
||||
|
||||
|
||||
$getSubscription = $stripe->subscriptions->retrieve($subscriptionFromDatabase->subscription_id, []);
|
||||
|
||||
|
||||
$getSubscribeCustomer = $stripe->customers->retrieve(
|
||||
$subscriptionFromDatabase->stripe_customer_id,
|
||||
[]
|
||||
);
|
||||
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::error("delete_passport function Load Failed " . $e->getMessage());
|
||||
return response()->json(['success' => false, 'status' => 500, 'message' => __('auth.something_went_wrong')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class IamPrincipal extends Authenticatable implements JWTSubject
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function getJWTIdentifier()
|
||||
{
|
||||
@@ -172,10 +172,10 @@ class IamPrincipal extends Authenticatable implements JWTSubject
|
||||
|
||||
public function isSubscribed()
|
||||
{
|
||||
return $this->hasMany(Subscriptions::class, 'iam_principal_xid', 'id')->where('is_cancelled_subscription',0);
|
||||
return $this->hasMany(Subscriptions::class, 'iam_principal_xid', 'id');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -123,6 +123,7 @@
|
||||
<th class="text-start">Name</th>
|
||||
<th class="text-start">Customer Id</th>
|
||||
<th class="text-start">Amount</th>
|
||||
<th class="text-start">Status</th>
|
||||
<th class="text-start">payment Details</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -139,23 +140,24 @@
|
||||
</td>
|
||||
<td class="text-start">{{ $loop->iteration }}</td>
|
||||
<td class="text-start">
|
||||
{{ $transaction['subscription']['first_name'] }}
|
||||
{{ $transaction['subscription']['last_name'] }}
|
||||
{{ $transaction['subscription']['first_name'] ?? 'Deleted' }}
|
||||
{{ $transaction['subscription']['last_name'] ?? 'User' }}
|
||||
</td>
|
||||
<td class="text-start">{{ $transaction['subscription']['id'] }}</td>
|
||||
<td class="text-start">$ {{ $transaction['amount'] }}</td>
|
||||
<td class="text-start">{{ $transaction['subscription']['id'] ?? 'Deleted User' }}</td>
|
||||
<td class="text-start">$ {{ $transaction['amount'] ?? 'Deleted User'}}</td>
|
||||
<td class="text-start"> {{ $transaction['status'] ?? 'Deleted User'}}</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="{{ $transaction['id'] }}"
|
||||
data-name="{{ $transaction['subscription']['first_name'] }}"
|
||||
data-price="{{ $transaction['amount'] }}"
|
||||
data-subscription-id="{{ $transaction['subscription_id'] }}"
|
||||
data-customer-id="{{ $transaction['stripe_customer_id'] }}"
|
||||
data-subscription-status="{{ $transaction['subscription_status'] }}"
|
||||
data-start-date="{{ $transaction['current_period_start'] }}"
|
||||
data-end-date="{{ $transaction['current_period_end'] }}"
|
||||
data-next-date="{{ $transaction['next_payment_date'] }}">View</a>
|
||||
data-id="{{ $transaction['id'] ?? 'Deleted User'}}"
|
||||
data-name="{{ $transaction['subscription']['first_name'] ?? 'Deleted User' }}"
|
||||
data-price="{{ $transaction['amount'] ?? 'Deleted User' }}"
|
||||
data-subscription-id="{{ $transaction['subscription_id'] ?? 'Deleted User' }}"
|
||||
data-customer-id="{{ $transaction['stripe_customer_id'] ?? 'Deleted User' }}"
|
||||
data-subscription-status="{{ $transaction['status'] ?? 'Deleted User'}}"
|
||||
data-start-date="{{ $transaction['current_period_start'] ?? 'Deleted User'}}"
|
||||
data-end-date="{{ $transaction['current_period_end'] ?? 'Deleted User'}}"
|
||||
data-next-date="{{ $transaction['next_payment_date']?? 'Deleted User' }}">View</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no">
|
||||
<title>Cheers To Seasons</title>
|
||||
<title>Cheers To The Seasons</title>
|
||||
<link rel="icon" type="image/x-icon" href="{{ asset('public/assets/img/seasons_logo.png')}}" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" />
|
||||
<link href="../layouts/modern-light-menu/css/light/loader.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@extends('Admin.layouts.app_login')
|
||||
@section('title', 'Cheers To Season - login')
|
||||
@section('title', 'Cheers To The Season - login')
|
||||
@section('content')
|
||||
<div class="row w-100" style="height: 100vh;">
|
||||
<div class=" col-md-6 m-auto h-100 d-flex flex-column align-itms-center justify-content-center"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@extends('Admin.layouts.app_login')
|
||||
@section('title', 'Cheers To Season - Otp')
|
||||
@section('title', 'Cheers To The Season - Otp')
|
||||
@section('content')
|
||||
<div class="row w-100" style="height: 100vh;">
|
||||
<div class=" col-md-6 m-auto h-100 d-flex flex-column align-itms-center justify-content-center"
|
||||
@@ -52,7 +52,7 @@ $(document).on('click', '#otp_verify_button', function(e) {
|
||||
var otp = $('.otp').map(function() {
|
||||
return this.value;
|
||||
}).get().join('');
|
||||
|
||||
|
||||
if (otp === '') {
|
||||
toastr.error('Please enter OTP');
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@extends('Admin.layouts.app_login')
|
||||
@section('title', 'Cheers To Season - Password Reset')
|
||||
@section('title', 'Cheers To The Season - Password Reset')
|
||||
@section('content')
|
||||
<style>
|
||||
/* Target the label element with the id 'confirm_password-error' and class 'error' */
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
<td class="text-start">{{ $querie->customer?->first_name ?? 'N/A' }}</td>
|
||||
<td class="text-start">{{ $querie->customer?->last_name ?? 'N/A' }}</td>
|
||||
<td class="text-start">{{ $querie['email'] }}</td>
|
||||
<td class="text-start">{{ $querie['created_at']->format('m/d/y') }}</td>
|
||||
<td class="text-start">{{ $querie['created_at']->format('m/d/Y') }}</td>
|
||||
<td class="text-start">
|
||||
@if ($querie->customer)
|
||||
@if ($querie->customer->principal_type_xid == 3)
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<td>{{ $notification->type }}</td>
|
||||
<td>{{ $notification->description }}</td>
|
||||
|
||||
<td>{{ \Carbon\Carbon::parse($notification->date_added)->format('m/d/y') }}
|
||||
<td>{{ \Carbon\Carbon::parse($notification->date_added)->format('m/d/Y') }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -114,13 +114,8 @@
|
||||
<td class="text-start">{{ $loop->iteration }}</td>
|
||||
<!-- <td class="text-start">{{ $customer->first_name }}</td> -->
|
||||
<td class="text-start">{{ $customer->first_name }}
|
||||
|
||||
</td>
|
||||
<td class="text-start">{{ $customer->last_name }}</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="text-start">{{ $customer->id }}</td>
|
||||
<td class="text-start">{{ $customer->email_address }}</td>
|
||||
<td class="text-start">
|
||||
@@ -155,9 +150,18 @@
|
||||
<img src="{{ asset('public/assets/img/edit.svg') }}" alt="Edit"
|
||||
title="Edit" />
|
||||
</a>
|
||||
<!-- <a class="cust_archive_btn" data-id="{{ $customer->id }}" data-toggle="modal" data-target="#archive-modal">
|
||||
<img src="{{ asset('public/assets/img/archive.svg') }}" alt="Archive" title="Archive" />
|
||||
</a> -->
|
||||
@if ($customer['is_subscribed'])
|
||||
<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>
|
||||
@else
|
||||
<a class="cust_unsubscribe_btn" data-id="{{ $customer->id }}">
|
||||
<img src="{{ asset('public/assets/img/archive.svg') }}"
|
||||
alt="Unsubscribe" title="Unsubscribe" />
|
||||
</a>
|
||||
@endif
|
||||
<a href="#" id="delete_customer_user_id"
|
||||
data-id="{{ $customer->id }}" data-toggle="modal"
|
||||
data-target="#delete-customer-user-modal"><img
|
||||
@@ -201,7 +205,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="archive-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
|
||||
<div class="modal fade" id="unsubscribe-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
@@ -211,12 +215,11 @@
|
||||
x
|
||||
</button>
|
||||
</div>
|
||||
<input type="hidden" id="archive_id" name="customer_id">
|
||||
<p class="modal-text">Are you sure you want to<br>archive?</p>
|
||||
<input type="hidden" id="unsubscribe_id" name="customer_id">
|
||||
<p class="modal-text">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_archive" href="{{ route('manage.customer') }}">Yes,
|
||||
archive</a>
|
||||
<a class="download-btn-custom customer_unsubscribe" id="unsubscibed" href="{{ route('manage.customer') }}">Yes</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -301,4 +304,43 @@
|
||||
});
|
||||
});
|
||||
</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
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
height="50px" width="80px"></td>
|
||||
<td>
|
||||
@if (!is_null($redeemDetail->redeem_date))
|
||||
{{ \Carbon\Carbon::parse($redeemDetail->redeem_date)->format('m/d/y H:i:s') }}
|
||||
{{ \Carbon\Carbon::parse($redeemDetail->redeem_date)->format('m/d/Y H:i:s') }}
|
||||
@else
|
||||
<span>No date</span>
|
||||
@endif
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<tr class="w-100">
|
||||
<td>{{ $customers_data->state->name }}</td>
|
||||
<td>{{ $customers_data->email_address }}</td>
|
||||
<td>{{ \Carbon\Carbon::parse($customers_data->created_at)->format('m/d/y') }}
|
||||
<td>{{ \Carbon\Carbon::parse($customers_data->created_at)->format('m/d/Y') }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -139,7 +139,7 @@
|
||||
<td>Amount :</td>
|
||||
<td>Stripe Customer Id :</td>
|
||||
<td>Subscription Id :</td>
|
||||
<td>Subscription Status :</td>
|
||||
<td>Status :</td>
|
||||
<td>Current Start Period </td>
|
||||
<td>Current End Period :</td>
|
||||
<td>Next Payment Date :</td>
|
||||
@@ -152,13 +152,13 @@
|
||||
</td>
|
||||
<td>{{ $subscribe->subscription_id }}
|
||||
</td>
|
||||
<td>{{ $subscribe->subscription_status }}
|
||||
<td>{{ $subscribe->status }}
|
||||
</td>
|
||||
<td>{{ \Carbon\Carbon::parse($subscribe->current_period_start)->format('m/d/y') }}
|
||||
<td>{{ \Carbon\Carbon::parse($subscribe->current_period_start)->format('m/d/Y') }}
|
||||
</td>
|
||||
<td>{{ \Carbon\Carbon::parse($subscribe->current_period_end)->format('m/d/y') }}
|
||||
<td>{{ \Carbon\Carbon::parse($subscribe->current_period_end)->format('m/d/Y') }}
|
||||
</td>
|
||||
<td>{{ \Carbon\Carbon::parse($subscribe->next_payment_date)->format('m/d/y') }}
|
||||
<td>{{ \Carbon\Carbon::parse($subscribe->next_payment_date)->format('m/d/Y') }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<!-- <td class="text-start">{{ $sub_admins->last_name }}</td> -->
|
||||
|
||||
<td class="text-start">{{ $sub_admins->email_address }}</td>
|
||||
<td class="text-start">{{ \Carbon\Carbon::parse($sub_admins->created_at)->format('m/d/y') }}</td>
|
||||
<td class="text-start">{{ \Carbon\Carbon::parse($sub_admins->created_at)->format('m/d/Y') }}</td>
|
||||
<td class="text-start">
|
||||
<a class="view-btn m-0 pointer sub_admin_permission" data-toggle="modal" data-target="#premission-modal" data-id="{{$sub_admins['id']}}">View</a>
|
||||
</td>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
<td>{{ $restdata->restaurant->name ?? 'NA' }}</td>
|
||||
<td>{{ $restdata->restaurant->restaurant_id ?? 'NA' }}</td>
|
||||
<td>{{ $restdata->customer->created_at->format('m/d/y') ?? 'NA' }}</td>
|
||||
<td>{{ $restdata->customer->created_at->format('m/d/Y') ?? 'NA' }}</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ Route::group(['middleware' => ['checkStatus']], function () {
|
||||
Route::get('/manage_customer_edit/{id}', [ManageCustomerController::class, 'edit_customer']);
|
||||
Route::post('/update_customer', [ManageCustomerController::class, 'update']);
|
||||
Route::get('/manage_customer_archive', [ManageCustomerController::class, 'archive_customer'])->name('customer_archive');
|
||||
Route::post('/unsubscibed/{id}', [ManageCustomerController::class, 'unsubscibed'])->name('customer_unsubscribe');
|
||||
Route::delete('/manage_customer_archive/{id}', [ManageCustomerController::class, 'delete_customer']);
|
||||
Route::get('/create-pdf-file/{id}', [ManageCustomerController::class, 'download_pdf']);
|
||||
Route::post('/export_selected_customer', [ManageCustomerController::class, 'exportSelectedCustomer'])->name('export-selected-customer');
|
||||
@@ -219,19 +220,19 @@ Route::group(['middleware' => ['checkStatus']], function () {
|
||||
Route::get('/change_location_status', [ManageLocationController::class, 'change_location_status']);
|
||||
Route::delete('/delete_location/{id}', [ManageLocationController::class, 'delete_location']);
|
||||
Route::post('/update_location', [ManageLocationController::class, 'update_location']);
|
||||
|
||||
|
||||
//*******************************************************Rules and regulation********************************************************
|
||||
//*******************************************************manage redemptions rules********************************************************
|
||||
Route::get('/manage_rules', [ManageRulesController::class, 'index'])->name('manage_rules');
|
||||
Route::get('/rules_edit/{id}', [ManageRulesController::class, 'edit'])->name('rules_edit');
|
||||
Route::post('/update_rules', [ManageRulesController::class, 'update']);
|
||||
|
||||
|
||||
|
||||
//*******************************************************manage referral rules********************************************************
|
||||
Route::get('/manage_referral_rules', [ ManageReferralController::class, 'index'])->name('manage_referral');
|
||||
Route::get('/referral_rules_edit/{id}', [ManageReferralController::class, 'editReferral'])->name('edit.referralRules');
|
||||
Route::post('/update_referral_rules', [ManageReferralController::class, 'updateReferral'])->name('update_referral_rules');
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user