Merge branch 'main' of https://github.com/WDI-Ideas/cheerstothe_season_laravel11 into sayli
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\APIs\RestaurantApi;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\APIs\RestaurantService\RestAuthApiService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class RestAuthApiController extends Controller
|
||||
{
|
||||
protected $RestAuthApiService;
|
||||
|
||||
public function __construct(RestAuthApiService $RestAuthApiService)
|
||||
{
|
||||
$this->RestAuthApiService = $RestAuthApiService;
|
||||
}
|
||||
|
||||
public function viewresyaurant()
|
||||
{
|
||||
try {
|
||||
$response = $this->RestAuthApiService->viewresyaurant();
|
||||
return jsonResponseWithSuccessMessageApi(__('success.data_fetched_successfully'), $response, 200);
|
||||
} catch (\Exception $e) {
|
||||
Log::error('FAW get data controller function failed: ' . $e->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function restRegister(Request $request)
|
||||
{
|
||||
try {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'first_name' => 'required|string|min:2|max:100',
|
||||
'last_name' => 'required|string|min:2|max:100',
|
||||
'role' => 'required|string|min:2|max:100',
|
||||
'restaurant_xid' => 'required',
|
||||
'date_of_birth' => 'required|date',
|
||||
'email_address' => [
|
||||
'required',
|
||||
'string',
|
||||
'email',
|
||||
'max:100',
|
||||
Rule::unique('iam_principal')->where(function ($query) {
|
||||
return $query->where('principal_type_xid', 4)->whereNull('deleted_at');
|
||||
}),
|
||||
],
|
||||
'phone_number' => 'required|min:10',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$validationErrors = $validator->errors()->all();
|
||||
Log::error("Registration validation error: " . implode(", ", $validationErrors));
|
||||
return jsonResponseWithErrorMessageApi($validationErrors, 403);
|
||||
}
|
||||
return $this->RestAuthApiService->restRegister($request);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error("Registration API Failed: " . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessage(__('error_message.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,12 +4,151 @@ namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\IamPrincipal;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\ManageRestaurant;
|
||||
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
// public function showDashboard(){
|
||||
|
||||
|
||||
return view('Admin.dashboard');
|
||||
// return view('Admin.dashboard');
|
||||
// }
|
||||
public function showDashboard()
|
||||
{
|
||||
|
||||
|
||||
// Fetching data for sorting by day
|
||||
// $dailyData = OrderedPassport::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();
|
||||
|
||||
// Ensure that $dailyData contains zeros for days with no data
|
||||
$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();
|
||||
}
|
||||
|
||||
// Default sales chart data (monthly)
|
||||
// $defaultData = OrderedPassport::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();
|
||||
|
||||
// Ensure that $defaultData contains zeros for months with no data
|
||||
$months = range(1, 12);
|
||||
$formattedDefaultData = [];
|
||||
foreach ($months as $month) {
|
||||
$formattedDefaultData[$month] = isset($defaultData[$month]) ? $defaultData[$month] : 0;
|
||||
}
|
||||
|
||||
// $quarterlyData = OrderedPassport::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;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetching data for yearly option
|
||||
// $yearlyData = OrderedPassport::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
|
||||
// ->groupBy(DB::raw("YEAR(created_at)"))
|
||||
// ->pluck('count', 'year')
|
||||
// ->toArray();
|
||||
//
|
||||
// Monthly data
|
||||
$dataMonthlyWithType3 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("MONTH(created_at) as month"))
|
||||
->whereIn('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 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("MONTH(created_at) as month"))
|
||||
->whereIn('principal_type_xid', [4])
|
||||
->whereYear('created_at', date('Y'))
|
||||
->groupBy(DB::raw("MONTH(created_at)"))
|
||||
->orderBy(DB::raw("MONTH(created_at)"))
|
||||
->pluck('count', 'month')
|
||||
->toArray();
|
||||
|
||||
// Quarterly data
|
||||
$dataQuarterlyWithType3 = IamPrincipal::select(
|
||||
DB::raw("COUNT(*) as count"),
|
||||
DB::raw("QUARTER(created_at) as quarter")
|
||||
)
|
||||
->whereIn('principal_type_xid', [3])
|
||||
->groupBy(DB::raw("QUARTER(created_at)"))
|
||||
->orderBy(DB::raw("QUARTER(created_at)"))
|
||||
->pluck('count', 'quarter')
|
||||
->toArray();
|
||||
for ($i = 1; $i <= 4; $i++) {
|
||||
if (!isset($dataQuarterlyWithType3[$i])) {
|
||||
$dataQuarterlyWithType3[$i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$dataQuarterlyWithType4 = IamPrincipal::select(
|
||||
DB::raw("COUNT(*) as count"),
|
||||
DB::raw("QUARTER(created_at) as quarter")
|
||||
)
|
||||
->whereIn('principal_type_xid', [4])
|
||||
->groupBy(DB::raw("QUARTER(created_at)"))
|
||||
->orderBy(DB::raw("QUARTER(created_at)"))
|
||||
->pluck('count', 'quarter')
|
||||
->toArray();
|
||||
for ($i = 1; $i <= 4; $i++) {
|
||||
if (!isset($dataQuarterlyWithType4[$i])) {
|
||||
$dataQuarterlyWithType4[$i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Yearly data
|
||||
$dataYearlyWithType3 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
|
||||
->whereIn('principal_type_xid', [3])
|
||||
->groupBy(DB::raw("YEAR(created_at)"))
|
||||
->pluck('count', 'year')
|
||||
->toArray();
|
||||
// dd($dataYearlyWithType3);
|
||||
|
||||
$dataYearlyWithType4 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
|
||||
->whereIn('principal_type_xid', [4])
|
||||
->groupBy(DB::raw("YEAR(created_at)"))
|
||||
->pluck('count', 'year')
|
||||
->toArray();
|
||||
|
||||
|
||||
$customerCount = IamPrincipal::where('principal_type_xid', '=', 3)->count();
|
||||
// $activePassports = ManagePassport::where('is_active', 1)->take(12)->get();
|
||||
// $restaurantCount = ManageRestaurant::where('is_redeem', 1)->count();
|
||||
$restaurantCount = ManageRestaurant::where('is_active', 1)->count();
|
||||
|
||||
// $recent_transaction = OrderedPassport::with('order', 'order_passport', 'carts.passport', 'iamPrincipal')->get()->toArray();
|
||||
// $datas = MyPassportVoucher::with('passportVouchers', 'passportData', 'customer')->get()->toArray();
|
||||
|
||||
// Pass the data to the view
|
||||
// return view('Admin.dashboard', compact('customerCount', 'activePassports', 'restaurantCount', 'recent_transaction', 'datas', 'formattedDefaultData', 'quarterlyData', 'yearlyData', 'dataMonthlyWithType3', 'dataMonthlyWithType4', 'dataQuarterlyWithType3', 'dataQuarterlyWithType4', 'dataYearlyWithType3', 'dataYearlyWithType4','formattedDailyData'));
|
||||
return view('Admin.dashboard', compact('customerCount','restaurantCount','dataMonthlyWithType3','dataMonthlyWithType4','dataQuarterlyWithType3', 'dataQuarterlyWithType4', 'dataYearlyWithType3', 'dataYearlyWithType4'));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,162 @@ namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Models\ManageModule;
|
||||
use App\Models\IamPrincipal;
|
||||
use App\Models\ManageModuleLink;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\Add_Subadmin;
|
||||
class ManageSubAdminController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
return view('Admin.pages.manage_users.manage_sub_admin.manage_subadmin');
|
||||
$sub_admins_module = ManageModule::latest()->get();
|
||||
$sub_admins_data = IamPrincipal::where('principal_type_xid', 2)->latest()->get();
|
||||
|
||||
return view('Admin.pages.manage_users.manage_sub_admin.manage_subadmin',compact('sub_admins_data','sub_admins_module'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$sub_admins_module = ManageModule::latest()->get();
|
||||
|
||||
return view('Admin.pages.manage_users.manage_sub_admin.create', compact('sub_admins_module'));
|
||||
}
|
||||
|
||||
public function store_subadmin(Request $request)
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
Created By : shailesh Gupta
|
||||
Created at : 29 May 2024
|
||||
Use : To store sub admin form and email
|
||||
*/
|
||||
try {
|
||||
|
||||
// DB::beginTransaction();
|
||||
|
||||
|
||||
$sub_admin = new IamPrincipal();
|
||||
$sub_admin->first_name = $request->input('sub_admin_name');
|
||||
$sub_admin->user_name = 'sub_admin';
|
||||
$sub_admin->principal_type_xid = 2;
|
||||
$sub_admin->principal_source_xid = Auth::guard('admin')->user()->principal_source_xid;
|
||||
$sub_admin->email_address = $request->input('sub_admin_email');
|
||||
$sub_admin->password = bcrypt($request->input('password'));
|
||||
$sub_admin->save();
|
||||
|
||||
|
||||
$moduleIds = $request->input('module_id');
|
||||
|
||||
foreach ($moduleIds as $moduleId) {
|
||||
|
||||
$sub_admin_permission = new ManageModuleLink;
|
||||
$sub_admin_permission->principal_xid = $sub_admin->id;
|
||||
$sub_admin_permission->manage_modules_xid = $moduleId;
|
||||
$sub_admin_permission->save();
|
||||
|
||||
}
|
||||
|
||||
$mailData =[
|
||||
'username'=>$request->input('sub_admin_name'),
|
||||
'password'=>$request->input('password'),
|
||||
];
|
||||
|
||||
|
||||
|
||||
// Mail::to($sub_admin->email_address)->send(new Add_Subadmin($mailData));
|
||||
$mail = Mail::to($request->input('sub_admin_email'))->send(new Add_Subadmin($mailData));
|
||||
// dd($mail);
|
||||
|
||||
// DB::commit();
|
||||
return jsonResponseWithSuccessMessage(__('success.save_data'));
|
||||
// return response()->json(['status'=>200]);
|
||||
// return $voucher_data;
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::error("restaurant Store Page Load Failed " . $e->getMessage());
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
public function edit($id)
|
||||
{
|
||||
// dd($id);
|
||||
$sub_admins_module = ManageModule::latest()->get();
|
||||
$edit_sub_admin = IamPrincipal::with(['moduleLinks' => function ($query) {
|
||||
$query->with('module');
|
||||
}])->find($id);
|
||||
return view('Admin.pages.manage_users.manage_sub_admin.edit', compact('edit_sub_admin', 'sub_admins_module'));
|
||||
}
|
||||
|
||||
public function delete_sub_admin($id)
|
||||
{
|
||||
/*
|
||||
Created By : Megha
|
||||
Created at : 14 Feb 2024
|
||||
Use : To Delete Admin.
|
||||
*/
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$passport = IamPrincipal::find($id);
|
||||
$passport->delete();
|
||||
|
||||
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')]);
|
||||
}
|
||||
}
|
||||
|
||||
public function update_subadmin(Request $request)
|
||||
{
|
||||
/*
|
||||
Created By : Megha
|
||||
Created at : 14 Feb 2024
|
||||
Use : To update sub admin form.
|
||||
*/
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$sub_admin = IamPrincipal::find($request->sub_admin_id);
|
||||
$sub_admin->user_name = 'sub_admin';
|
||||
$sub_admin->first_name = $request->input('sub_admin_name');
|
||||
$sub_admin->principal_type_xid = 2;
|
||||
$sub_admin->principal_source_xid = Auth::guard('admin')->user()->principal_source_xid;
|
||||
$sub_admin->email_address = $request->input('sub_admin_email');
|
||||
// $sub_admin->password = bcrypt($request->input('password'));
|
||||
$sub_admin->save();
|
||||
|
||||
$moduleIds = $request->input('module_id');
|
||||
// dd($moduleIds);
|
||||
$update_module = ManageModuleLink::where('principal_xid', $sub_admin->id)->delete();
|
||||
|
||||
foreach ($moduleIds as $moduleId) {
|
||||
$sub_admin_permission = new ManageModuleLink;
|
||||
$sub_admin_permission->principal_xid = $sub_admin->id;
|
||||
$sub_admin_permission->manage_modules_xid = $moduleId;
|
||||
$sub_admin_permission->save();
|
||||
}
|
||||
|
||||
|
||||
DB::commit();
|
||||
return jsonResponseWithSuccessMessage(__('success.save_data'));
|
||||
// return $voucher_data;
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::error("restaurant Store Page Load Failed " . $e->getMessage());
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
61
app/Mail/Add_Subadmin.php
Normal file
61
app/Mail/Add_Subadmin.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class Add_Subadmin extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $mailData;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($mailData)
|
||||
{
|
||||
$this->mailData = $mailData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
// public function envelope(): Envelope
|
||||
// {
|
||||
// return new Envelope(
|
||||
// subject: 'You add in subadmin ',
|
||||
// );
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get the message content definition.
|
||||
// */
|
||||
// public function content(): Content
|
||||
// {
|
||||
// return new Content(
|
||||
// view: 'mail.subadmin',
|
||||
// );
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get the attachments for the message.
|
||||
// *
|
||||
// * @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
// */
|
||||
// public function attachments(): array
|
||||
// {
|
||||
// return [];
|
||||
// }
|
||||
|
||||
public function build()
|
||||
{
|
||||
// $otp = $this->otp;
|
||||
return $this->subject('OTP From Cheers to the Session')->view('mail.subadmin');
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,9 @@ use Illuminate\Notifications\Notifiable;
|
||||
use Tymon\JWTAuth\Contracts\JWTSubject;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\ManageFeedback;
|
||||
use App\Models\ManageModuleLink;
|
||||
use App\Models\ManageModule;
|
||||
use App\Models\ManageState;
|
||||
|
||||
use App\Models\admin\ManageFeedback;
|
||||
use App\Models\admin\ManageModuleLink;
|
||||
use App\Models\admin\ManageModule;
|
||||
use App\Models\OrderedPassport;
|
||||
|
||||
|
||||
@@ -42,10 +40,6 @@ class IamPrincipal extends Authenticatable implements JWTSubject
|
||||
'notification_status',
|
||||
'deleted_by_admin'
|
||||
];
|
||||
public function state()
|
||||
{
|
||||
return $this->belongsTo(ManageState::class, 'state_xid', 'id');
|
||||
}
|
||||
|
||||
public function moduleLinks()
|
||||
{
|
||||
|
||||
34
app/Models/ManageFeedback.php
Normal file
34
app/Models/ManageFeedback.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\IamPrincipal;
|
||||
use App\Models\admin\FeedbackReaction;
|
||||
|
||||
class ManageFeedback extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
use HasFactory;
|
||||
protected $table = "manage_feedback";
|
||||
protected $fillable = ['principal_xid', 'feedback_reaction_xid', 'comment'];
|
||||
|
||||
public function principal()
|
||||
{
|
||||
return $this->belongsTo(IamPrincipal::class, 'principal_xid', 'id')->withDefault([
|
||||
'id' => null, // Default id value
|
||||
// Add more default attributes as needed
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function feedbackReaction()
|
||||
{
|
||||
return $this->belongsTo(FeedbackReaction::class, 'feedback_reaction_xid', 'feedback_reaction_xid');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -6,16 +6,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
||||
class ManageModule extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
protected $table='manage_modules';
|
||||
protected $table ='manage_module';
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
|
||||
public function moduleLinks()
|
||||
{
|
||||
return $this->hasMany(ManageModuleLink::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,12 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class ManageModuleLink extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table='manage_module_links';
|
||||
protected $table ='manage_module_link';
|
||||
|
||||
protected $fillable =[
|
||||
'principal_xid',
|
||||
'manage_modules_xid'
|
||||
];
|
||||
public function iamprinciple()
|
||||
{
|
||||
return $this->belongsTo(IamPrincipal::class);
|
||||
|
||||
@@ -8,7 +8,30 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class ManageRestaurant extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table='manage_restaurants';
|
||||
protected $fillable=[
|
||||
'id',
|
||||
'name',
|
||||
'description',
|
||||
'restaurant_id',
|
||||
'address',
|
||||
'image',
|
||||
'bio',
|
||||
'try_on_1',
|
||||
'try_on_2',
|
||||
'try_on_3',
|
||||
'try_on_4',
|
||||
'exclusion',
|
||||
'latitude',
|
||||
'longtitude',
|
||||
'is_active',
|
||||
'created_by',
|
||||
'modified_by',
|
||||
'deleted_at',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
|
||||
];
|
||||
public function operatingHours()
|
||||
{
|
||||
return $this->hasMany(OperatingHour::class, 'manage_restaurant_xid');
|
||||
|
||||
248
app/Services/APIs/RestaurantService/RedeemApiService.php
Normal file
248
app/Services/APIs/RestaurantService/RedeemApiService.php
Normal file
@@ -0,0 +1,248 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\APIs\RestaurantService;
|
||||
|
||||
use App\Helpers\onesignalhelper;
|
||||
use App\Models\admin\ManageVoucherModel;
|
||||
use App\Models\IamPrincipal;
|
||||
use App\Models\IamPrincipalRestaurantRole;
|
||||
use App\Models\MyPassportVoucher;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class RedeemApiService
|
||||
{
|
||||
|
||||
public function getRedemedData($restIamId)
|
||||
{
|
||||
try {
|
||||
$rest = IamPrincipal::findOrFail($restIamId);
|
||||
$data['user_detail'] = IamPrincipal::select('id', 'first_name', 'last_name', 'email_address', 'phone_number', 'date_of_birth')->find($rest->id);
|
||||
|
||||
$restaurantRoles = IamPrincipalRestaurantRole::select('id', 'principal_xid', 'restaurant_xid', 'role')->where('principal_xid', $rest->id)->get();
|
||||
|
||||
$restaurantDetail = [];
|
||||
foreach ($restaurantRoles as $role) {
|
||||
$restaurantImage = ManageVoucherModel::select('id', 'coupon_name', 'description', 'thumbnail_image', 'image', 'location_name')->find($role->restaurant_xid);
|
||||
if ($restaurantImage) {
|
||||
$restaurantImage->thumbnail_image = ListingImageUrl('voucher_thumbnail_images', $restaurantImage->thumbnail_image);
|
||||
$restaurantImage->image = ListingImageUrl('voucher_images', $restaurantImage->image);
|
||||
}
|
||||
$restaurantDetail[] = $restaurantImage;
|
||||
|
||||
$redeemedVouchers = [];
|
||||
$redemptionUndoneVouchers = [];
|
||||
|
||||
$vouchers = MyPassportVoucher::select('id', 'order_xid', 'iam_principal_xid', 'manage_passports_xid', 'manage_vouchers_xid', 'is_redeem', 'count', 'redeem_date', 'is_redeemption_undone')
|
||||
->where('manage_vouchers_xid', $role->restaurant_xid)
|
||||
->where('is_redeem', 1)
|
||||
->get();
|
||||
|
||||
$redeemptionUndone = MyPassportVoucher::select('id', 'order_xid', 'iam_principal_xid', 'manage_passports_xid', 'manage_vouchers_xid', 'is_redeem', 'count', 'redeem_date', 'is_redeemption_undone', 'redeemption_undone_date')
|
||||
->where('manage_vouchers_xid', $role->restaurant_xid)
|
||||
->where([['is_redeem', 0], ['is_redeemption_undone', 1]])
|
||||
->get();
|
||||
|
||||
foreach ($vouchers as $voucher) {
|
||||
$userDetail = IamPrincipal::select('id', 'first_name', 'email_address', 'profile_photo', 'address_line1')
|
||||
->where('id', $voucher->iam_principal_xid)
|
||||
->first();
|
||||
|
||||
if ($userDetail) {
|
||||
if ($userDetail->profile_photo) {
|
||||
$userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo);
|
||||
} else {
|
||||
$userDetail->profile_photo = asset('public/assets/img/blankProfile.png');
|
||||
}
|
||||
|
||||
$voucher->user_detail = $userDetail;
|
||||
$redeemedVouchers[] = $voucher;
|
||||
} else {
|
||||
|
||||
Log::error('User detail not found for IAM principal ID: ' . $voucher->iam_principal_xid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($redeemptionUndone as $undone) {
|
||||
$userDetail = IamPrincipal::select('id', 'first_name', 'email_address', 'profile_photo', 'address_line1')
|
||||
->where('id', $undone->iam_principal_xid)
|
||||
->first();
|
||||
|
||||
if ($userDetail) {
|
||||
if ($userDetail->profile_photo) {
|
||||
$userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo);
|
||||
} else {
|
||||
$userDetail->profile_photo = asset('public/assets/img/blankProfile.png');
|
||||
}
|
||||
|
||||
$undone->user_detail = $userDetail;
|
||||
$redemptionUndoneVouchers[] = $undone;
|
||||
} else {
|
||||
|
||||
Log::error('User detail not found for IAM principal ID: ' . $undone->iam_principal_xid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$restaurantDetail['redeemed_vouchers'] = $redeemedVouchers;
|
||||
$restaurantDetail['redemption_undone_vouchers'] = $redemptionUndoneVouchers;
|
||||
}
|
||||
|
||||
return jsonResponseWithSuccessMessageApi(__('auth.User_details_fetch'), $restaurantDetail, 200);
|
||||
} catch (Exception $ex) {
|
||||
Log::error('Restaurant Get data service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function undoRedemption($restIamId, $request)
|
||||
{
|
||||
try {
|
||||
$voucherDetail = MyPassportVoucher::with('passportData', 'voucherData')->where('id', $request->voucher_id)->first();
|
||||
if ($voucherDetail) {
|
||||
$voucherDetail->update([
|
||||
'is_redeem' => 0,
|
||||
'redeem_date' => null,
|
||||
'is_redeemption_undone' => 1,
|
||||
'redeemption_undone_date' => now(),
|
||||
|
||||
]);
|
||||
$imagePath = ListingImageUrl('voucher_images', $voucherDetail->voucherData->image);
|
||||
$customerTitle = "Your voucher was successfully undo redemption for " . $voucherDetail->passportData->passport_name;
|
||||
$customerMessage = $voucherDetail->voucherData->coupon_name . " Voucher Undo Redemption Successfully";
|
||||
$customerContentType = 'Voucher_UndoRedemption';
|
||||
$customerImageUrl = $imagePath;
|
||||
$customerData = IamPrincipal::where('id', $voucherDetail->iam_principal_xid)->where('notification_status', 1)->where('principal_type_xid', 3)->first();
|
||||
if ($customerData) {
|
||||
$pushNotificationToCustomer = onesignalhelper::sendNotificationApi(
|
||||
$customerData->one_signal_player_id,
|
||||
$customerTitle,
|
||||
$customerMessage,
|
||||
$customerContentType,
|
||||
$customerImageUrl,
|
||||
$id = null
|
||||
);
|
||||
|
||||
onesignalhelper::StoreNotificationDetails($customerData->id, $customerContentType, $customerTitle, $customerImageUrl);
|
||||
}
|
||||
$restUser = IamPrincipal::where('id', $restIamId)->where('notification_status', 1)->where('principal_type_xid', 4)->first();
|
||||
if ($restUser) {
|
||||
$restImagePath = ListingImageUrl('voucher_images', $voucherDetail->voucherData->image);
|
||||
$restTitle = "voucher Undo redemption successful for " . $voucherDetail->passportData->passport_name;
|
||||
$restMessage = $voucherDetail->voucherData->coupon_name . " Voucher Undo Redemption Successfully";
|
||||
$restContentType = 'Voucher_UndoRedemption';
|
||||
$restImageUrl = $restImagePath;
|
||||
|
||||
$pushNotificationToCustomer = onesignalhelper::restSendNotificationApi(
|
||||
$restUser->one_signal_player_id,
|
||||
$restTitle,
|
||||
$restMessage,
|
||||
$restContentType,
|
||||
$restImageUrl,
|
||||
$id = null
|
||||
);
|
||||
|
||||
onesignalhelper::StoreNotificationDetails($restUser->id, $restContentType, $restTitle, $restImageUrl);
|
||||
}
|
||||
return jsonResponseWithSuccessMessageApi(__('auth.data_updated_successfully'), 200);
|
||||
} else {
|
||||
return jsonResponseWithErrorMessageApi(__('auth.voucher_not_found'), 404);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error('Restaurant update profile service failed: ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function searchRedemption($restIamId, $request)
|
||||
{
|
||||
try {
|
||||
$searchQuery = $request->input('search_data');
|
||||
|
||||
$rest = IamPrincipal::findOrFail($restIamId);
|
||||
$data['user_detail'] = IamPrincipal::select('id', 'first_name', 'last_name', 'email_address', 'phone_number', 'date_of_birth')->find($rest->id);
|
||||
|
||||
$restaurantRoles = IamPrincipalRestaurantRole::select('id', 'principal_xid', 'restaurant_xid', 'role')->where('principal_xid', $rest->id)->get();
|
||||
|
||||
$restaurantDetail = [];
|
||||
foreach ($restaurantRoles as $role) {
|
||||
$restaurantImage = ManageVoucherModel::select('id', 'coupon_name', 'description', 'thumbnail_image', 'image', 'location_name')->find($role->restaurant_xid);
|
||||
if ($restaurantImage) {
|
||||
$restaurantImage->thumbnail_image = ListingImageUrl('voucher_thumbnail_images', $restaurantImage->thumbnail_image);
|
||||
$restaurantImage->image = ListingImageUrl('voucher_images', $restaurantImage->image);
|
||||
}
|
||||
$restaurantDetail[] = $restaurantImage;
|
||||
|
||||
$redeemedVouchers = [];
|
||||
$redemptionUndoneVouchers = [];
|
||||
|
||||
$vouchers = MyPassportVoucher::select('id', 'order_xid', 'iam_principal_xid', 'manage_passports_xid', 'manage_vouchers_xid', 'is_redeem', 'count', 'redeem_date', 'is_redeemption_undone')
|
||||
->where('manage_vouchers_xid', $role->restaurant_xid)
|
||||
->where('is_redeem', 1)
|
||||
->get();
|
||||
|
||||
foreach ($vouchers as $voucher) {
|
||||
$userDetail = IamPrincipal::select('id', 'first_name', 'email_address', 'profile_photo', 'address_line1')
|
||||
->where('id', $voucher->iam_principal_xid)
|
||||
->first();
|
||||
|
||||
if ($userDetail && (stripos($userDetail->first_name, $searchQuery) !== false || stripos($voucher->id, $searchQuery) !== false || stripos($voucher->redeem_date, $searchQuery) !== false)) {
|
||||
if ($userDetail->profile_photo) {
|
||||
$userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo);
|
||||
} else {
|
||||
$userDetail->profile_photo = asset('public/assets/img/blankProfile.png');
|
||||
}
|
||||
|
||||
$voucher->user_detail = $userDetail;
|
||||
$redeemedVouchers[] = $voucher;
|
||||
} else {
|
||||
|
||||
Log::error('User detail not found for IAM principal ID: ' . $voucher->iam_principal_xid);
|
||||
}
|
||||
}
|
||||
|
||||
$redeemptionUndone = MyPassportVoucher::select('id', 'order_xid', 'iam_principal_xid', 'manage_passports_xid', 'manage_vouchers_xid', 'is_redeem', 'count', 'redeem_date', 'is_redeemption_undone', 'redeemption_undone_date')
|
||||
->where('manage_vouchers_xid', $role->restaurant_xid)
|
||||
->where([['is_redeem', 0], ['is_redeemption_undone', 1]])
|
||||
->get();
|
||||
|
||||
foreach ($redeemptionUndone as $undone) {
|
||||
$userDetail = IamPrincipal::select('id', 'first_name', 'email_address', 'profile_photo', 'address_line1')
|
||||
->where('id', $undone->iam_principal_xid)
|
||||
->first();
|
||||
|
||||
if ($userDetail && (stripos($userDetail->first_name, $searchQuery) !== false || stripos($undone->id, $searchQuery) !== false || stripos($undone->redeemption_undone_date, $searchQuery) !== false)) {
|
||||
if ($userDetail->profile_photo) {
|
||||
$userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo);
|
||||
} else {
|
||||
$userDetail->profile_photo = asset('public/assets/img/blankProfile.png');
|
||||
}
|
||||
|
||||
$undone->user_detail = $userDetail;
|
||||
$redemptionUndoneVouchers[] = $undone;
|
||||
} else {
|
||||
|
||||
Log::error('User detail not found for IAM principal ID: ' . $undone->iam_principal_xid);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($searchQuery)) {
|
||||
$restaurantDetail['redeemed_vouchers'] = $redeemedVouchers;
|
||||
$restaurantDetail['redemption_undone_vouchers'] = $redemptionUndoneVouchers;
|
||||
}
|
||||
|
||||
$restaurantDetail['redeemed_vouchers'] = $redeemedVouchers;
|
||||
$restaurantDetail['redemption_undone_vouchers'] = $redemptionUndoneVouchers;
|
||||
}
|
||||
|
||||
return jsonResponseWithSuccessMessageApi(__('auth.User_details_fetch'), $restaurantDetail, 200);
|
||||
} catch (Exception $ex) {
|
||||
Log::error('Restaurant Get data service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
364
app/Services/APIs/RestaurantService/RestAuthApiService.php
Normal file
364
app/Services/APIs/RestaurantService/RestAuthApiService.php
Normal file
@@ -0,0 +1,364 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\APIs\RestaurantService;
|
||||
|
||||
use App\Models\admin\ManageRestaurant;
|
||||
use App\Models\admin\ManageVoucherModel;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\IamPrincipal;
|
||||
use App\Models\IamPrincipalOtp;
|
||||
use App\Models\IamPrincipalRestaurantRole;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Throwable;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class RestAuthApiService
|
||||
{
|
||||
public function viewresyaurant()
|
||||
{
|
||||
try {
|
||||
$data = ManageVoucherModel::select('id', 'coupon_name')->where('is_active', 1)->get()->toArray();
|
||||
return $data;
|
||||
} catch (Exception $ex) {
|
||||
DB::rollBack();
|
||||
Log::error('Terms and condition Get service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function restRegister($request)
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$restaurantId = $request->input('restaurant_xid');
|
||||
|
||||
// Fetch the restaurant details based on the selected restaurantId
|
||||
$selectedRestaurant = ManageVoucherModel::find($restaurantId);
|
||||
|
||||
if (!$selectedRestaurant) {
|
||||
return jsonResponseWithErrorMessageApi(__('auth.restaurant_data_not_found'), 403);
|
||||
}
|
||||
|
||||
// Create a new restaurant user record
|
||||
$restaurantuser = IamPrincipal::create([
|
||||
'one_signal_player_id' => $request->one_signal_player_id,
|
||||
'first_name' => $request->first_name,
|
||||
'last_name' => $request->last_name,
|
||||
'email_address' => $request->email_address,
|
||||
// 'password' => Hash::make('Cheers@123'),
|
||||
'principal_type_xid' => 4, //4 for restaurant
|
||||
'principal_source_xid' => 2, //2 for mobile
|
||||
'phone_number' => $request->phone_number,
|
||||
'date_of_birth' => $request->date_of_birth,
|
||||
'is_active' => '0',
|
||||
]);
|
||||
|
||||
$restaurantUserRole = IamPrincipalRestaurantRole::create([
|
||||
'principal_xid' => $restaurantuser->id,
|
||||
'role' => $request->role,
|
||||
'restaurant_xid' => $restaurantId,
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
// $token = auth()->login($restaurantuser);
|
||||
|
||||
// Return response with user details, access token, and status
|
||||
$response = [
|
||||
'user' => $restaurantuser,
|
||||
// 'restaurant_details' => $restaurantId,
|
||||
// 'access_token' => $token,
|
||||
'token_type' => 'bearer',
|
||||
'status' => 'Your request has been sent. Kindly check your email.'
|
||||
];
|
||||
return jsonResponseWithSuccessMessage(__('auth.Rest_user_created'), $response, 200);
|
||||
} catch (QueryException $e) {
|
||||
// Rollback transaction in case of an error
|
||||
DB::rollBack();
|
||||
Log::error('Restaurant Registration Failed ' . $e->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.authentication_failed'), 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function login($request)
|
||||
{
|
||||
try {
|
||||
$credentials = [
|
||||
'email_address' => $request->email_address,
|
||||
'password' => $request->password,
|
||||
];
|
||||
|
||||
$isExistEmail = IamPrincipal::where('email_address', $request->email_address)
|
||||
->where('principal_type_xid', 4)
|
||||
->whereNull('deleted_at')
|
||||
->first();
|
||||
if ($isExistEmail == null) {
|
||||
Log::error('Email not exist');
|
||||
return jsonResponseWithErrorMessageApi(__('auth.incorrect_email_passport'), 403);
|
||||
}
|
||||
if ($isExistEmail && !(Hash::check($request->password, $isExistEmail->password))) {
|
||||
Log::error('Entered Password is wrong.');
|
||||
return jsonResponseWithErrorMessageApi(__('auth.incorrect_email_passport'), 403);
|
||||
}
|
||||
if (!$token = auth()->login($isExistEmail)) {
|
||||
Log::error('Customer Login Failed');
|
||||
return jsonResponseWithErrorMessageApi(__('auth.authentication_failed'), 403);
|
||||
}
|
||||
|
||||
$isExistEmail->one_signal_player_id = $request->one_signal_player_id;
|
||||
$isExistEmail->save();
|
||||
$response = [
|
||||
'userId' => $isExistEmail->id,
|
||||
'access_token' => $token,
|
||||
];
|
||||
return jsonResponseWithSuccessMessage(__('auth.data_fetched_successfully'), $response, 200);
|
||||
} catch (QueryException $e) {
|
||||
|
||||
|
||||
Log::error('Customer Login Failed ' . $e->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.authentication_failed'), 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function responseWithToken($token, $isExistEmail)
|
||||
{
|
||||
return [
|
||||
'message' => 'You have logged in successfully',
|
||||
'access_token' => $token,
|
||||
'token_type' => 'bearer',
|
||||
'status' => 'success',
|
||||
'iam_principal_id' => $isExistEmail->id
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function restForgotPassword($request)
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$user = IamPrincipal::where('email_address', $request->email_address)
|
||||
->where('principal_type_xid', 4)
|
||||
->whereNull('deleted_at')
|
||||
->first();
|
||||
//use this for both customer and restaurant just change principal_type_xid 4
|
||||
if ($user == null) {
|
||||
Log::error('Email not exist');
|
||||
return jsonResponseWithErrorMessageApi(__('auth.incorrect_email'), 403);
|
||||
}
|
||||
// Define the generateOTP function
|
||||
$otp = $this->generateOTP();
|
||||
|
||||
IamPrincipalOTP::updateOrCreate(
|
||||
['principal_xid' => $user->id],
|
||||
[
|
||||
'otp_code' => $otp,
|
||||
'otp_purpose' => 'forgot password',
|
||||
'valid_till' => Carbon::now()->addMinutes(2),
|
||||
'is_used' => 0,
|
||||
]
|
||||
);
|
||||
|
||||
// $this->email_address = $user->email_address;
|
||||
|
||||
$mail = Mail::send(
|
||||
'frontend.Mail.customer_forgot_password_mail',
|
||||
[
|
||||
'user' => $user,
|
||||
'otp_code' => $otp,
|
||||
'valid_till' => Carbon::now()->addMinutes(2)
|
||||
],
|
||||
function ($message) use ($user) {
|
||||
$message->to($user->email_address);
|
||||
$message->subject('Forgot Password Mail Page');
|
||||
}
|
||||
);
|
||||
|
||||
//sendmail end
|
||||
$response = ['iam_principal_xid' => $user->id];
|
||||
DB::commit();
|
||||
Log::info('Customer Forgot Password otp sent successfully');
|
||||
return jsonResponseWithSuccessMessage(__('auth.otp_sent_successfully'), $response, 200);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::error('Customer Forgot Password OTP function failed: ' . $e->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function restVerifyOTP($request)
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
// Retrieve the user's OTP record
|
||||
$User = IamPrincipal::where('email_address', $request->email_address)
|
||||
->where('principal_type_xid', 4)
|
||||
->whereNull('deleted_at')
|
||||
->first();
|
||||
|
||||
|
||||
$iamPrincipal = IamPrincipalOTP::where('principal_xid', $User->id)
|
||||
->first();
|
||||
|
||||
// Check if OTP record exists for the user
|
||||
$errors = [];
|
||||
|
||||
if (!$iamPrincipal) {
|
||||
$errors[] = __('auth.failed_to_verify_otp');
|
||||
return jsonResponseWithErrorMessageApi(
|
||||
$errors,403
|
||||
);
|
||||
}
|
||||
|
||||
// Check if the provided OTP matches the stored OTP
|
||||
if ($iamPrincipal->otp_code !== $request->otp) {
|
||||
$errors[] = __('auth.invalid_otp');
|
||||
return jsonResponseWithErrorMessageApi(
|
||||
$errors,403
|
||||
);
|
||||
}
|
||||
|
||||
// Check if the OTP is still valid
|
||||
if (Carbon::now()->gt($iamPrincipal->valid_till)) {
|
||||
$errors[] = __('auth.otp_expired');
|
||||
return jsonResponseWithErrorMessageApi(
|
||||
$errors,403
|
||||
);
|
||||
}
|
||||
|
||||
// Check if the OTP has already been used
|
||||
if ($iamPrincipal->is_used === 1) {
|
||||
$errors[] = __('auth.otp_already_used');
|
||||
return jsonResponseWithErrorMessageApi(
|
||||
$errors,403
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Mark OTP as used
|
||||
$iamPrincipal->is_used = 1;
|
||||
$iamPrincipal->save();
|
||||
DB::commit();
|
||||
$response = [
|
||||
'iam_principal_xid' => $User->id
|
||||
];
|
||||
Log::info('Customer OTP verified successfully');
|
||||
return jsonResponseWithSuccessMessageApi(__('auth.otp_verified'), $response, 200);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function restChangePassword($request)
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$User = IamPrincipal::where('id', $request->iam_principal_xid)
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
|
||||
$User->password = Hash::make($request->password);
|
||||
$User->save();
|
||||
DB::commit();
|
||||
return $User;
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage());
|
||||
return response()->json(__('something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
public function restResendOtp($request)
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
// Retrieve the user's OTP record
|
||||
$iamPrincipal = IamPrincipalOTP::where('principal_xid', $request->iam_principal_xid)
|
||||
->first();
|
||||
$user = IamPrincipal::where('id', $request->iam_principal_xid)
|
||||
->where('is_active', '1')
|
||||
->first();
|
||||
|
||||
// Check if OTP record exists for the user
|
||||
if (!$iamPrincipal) {
|
||||
return jsonResponseWithErrorMessageApi(__('auth.not_found_otp'), 203);
|
||||
}
|
||||
|
||||
// Calculate the allowed resend interval (2 minutes)
|
||||
$allowedResendInterval = Carbon::now()->subMinutes(2);
|
||||
|
||||
// Check if the user can resend OTP only after a 2-minute interval
|
||||
if ($iamPrincipal->updated_at >= $allowedResendInterval) {
|
||||
|
||||
return jsonResponseWithErrorMessageApi(__('auth.try_resend_otp'), 429);
|
||||
}
|
||||
|
||||
// Generate a new OTP for the user
|
||||
$otp = $this->generateOTP();
|
||||
|
||||
// Update the OTP record with the new OTP and validity
|
||||
$iamPrincipal->principal_xid = $request->iam_principal_xid;
|
||||
$iamPrincipal->otp_code = $otp;
|
||||
$iamPrincipal->otp_purpose = $request->otp_purpose;
|
||||
$iamPrincipal->valid_till = Carbon::now()->addMinutes(2);
|
||||
$iamPrincipal->is_used = 0;
|
||||
$iamPrincipal->save();
|
||||
|
||||
|
||||
// $this->email_address = $user->email_address;
|
||||
|
||||
$mail = Mail::send(
|
||||
'frontend.Mail.customer_forgot_password_mail',
|
||||
[
|
||||
'user' => $user,
|
||||
'otp_code' => $otp,
|
||||
'valid_till' => Carbon::now()->addMinutes(2)
|
||||
],
|
||||
function ($message) use ($user) {
|
||||
$message->to($user->email_address);
|
||||
$message->subject('Forgot Password Mail Page');
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
DB::commit();
|
||||
$response = [
|
||||
'iam_principal_xid' => $iamPrincipal->principal_xid,
|
||||
'email_address' => $user->email_address
|
||||
|
||||
];
|
||||
|
||||
return jsonResponseWithSuccessMessageApi(__('auth.otp_resend_sent_successfully'), $response, 200);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
DB::rollBack();
|
||||
Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage());
|
||||
return response()->json(__('something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
function generateOTP()
|
||||
{
|
||||
// Define the length of the OTP
|
||||
$otpLength = 4;
|
||||
|
||||
// Generate a random OTP with $otpLength digits
|
||||
$otp = '';
|
||||
for ($i = 0; $i < $otpLength; $i++) {
|
||||
$otp .= rand(0, 9);
|
||||
}
|
||||
return $otp;
|
||||
}
|
||||
}
|
||||
176
app/Services/APIs/RestaurantService/RestCMSService.php
Normal file
176
app/Services/APIs/RestaurantService/RestCMSService.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\APIs\RestaurantService;
|
||||
|
||||
use App\Models\admin\Aboutus;
|
||||
use App\Models\admin\AboutUsCategory;
|
||||
use App\Models\admin\ManageContactus;
|
||||
use App\Models\admin\NewsArticle;
|
||||
use App\Models\admin\PrivacyPolicy;
|
||||
use App\Models\Faq;
|
||||
use App\Models\IamPrincipal;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Exception;
|
||||
use Throwable;
|
||||
|
||||
class RestCMSService
|
||||
{
|
||||
public function RestGetFaq()
|
||||
{
|
||||
try {
|
||||
$data['customer'] = Faq::select('id', 'question', 'answers')
|
||||
->where([['is_active', '1'], ['faq_category_id', '1']])
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
$data['restaurant'] = Faq::select('id', 'question', 'answers')
|
||||
->where([['is_active', '1'], ['faq_category_id', '2']])
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
} catch (Exception $ex) {
|
||||
DB::rollBack();
|
||||
Log::error('Faq Get service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function RestAboutUs()
|
||||
{
|
||||
try {
|
||||
$data['customer'] = Aboutus::select('id', 'title', 'thumbnail_image', 'description', 'aboutus_category_xid')
|
||||
->where('aboutus_category_xid', '1')
|
||||
->get()
|
||||
->map(function ($item) {
|
||||
$item['description'] = strip_tags($item['description']);
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
|
||||
$data['restaurant'] = Aboutus::select('id', 'title', 'thumbnail_image', 'description', 'aboutus_category_xid')
|
||||
->where('aboutus_category_xid', '2')
|
||||
->get()
|
||||
->map(function ($item) {
|
||||
$item['description'] = strip_tags($item['description']);
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
foreach ($data['customer'] as $k => $val) {
|
||||
$data['customer'][$k]['thumbnail_image'] = ListingImageUrl('about_images', $val['thumbnail_image']);
|
||||
}
|
||||
|
||||
foreach ($data['restaurant'] as $k => $val) {
|
||||
$data['restaurant'][$k]['thumbnail_image'] = ListingImageUrl('about_images', $val['thumbnail_image']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
} catch (Exception $ex) {
|
||||
DB::rollBack();
|
||||
Log::error('About us Get service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function RestPrivacyPolicy()
|
||||
{
|
||||
try {
|
||||
$data['customer'] = PrivacyPolicy::select('id', 'description')
|
||||
->where('terms_category_id', '1')
|
||||
->get()
|
||||
->map(function ($item) {
|
||||
$item['description'] = strip_tags($item['description']);
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
|
||||
$data['restaurant'] = PrivacyPolicy::select('id', 'description')
|
||||
->where('terms_category_id', '2')
|
||||
->get()
|
||||
->map(function ($item) {
|
||||
$item['description'] = strip_tags($item['description']);
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
return $data;
|
||||
} catch (Exception $ex) {
|
||||
DB::rollBack();
|
||||
Log::error('Privacy policy Get service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function RestNewsArticles()
|
||||
{
|
||||
try {
|
||||
$data['customer'] = NewsArticle::select('id', 'name', 'description', 'thumbnail_image', 'image')
|
||||
->where([['is_active', '1'], ['news_articles_category_xid', '1']])
|
||||
->get()
|
||||
->map(function ($item) {
|
||||
$item['description'] = strip_tags($item['description']);
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
|
||||
$data['restaurant'] = NewsArticle::select('id', 'name', 'description', 'thumbnail_image', 'image')
|
||||
->where([['is_active', '1'], ['news_articles_category_xid', '2']])
|
||||
->get()
|
||||
->map(function ($item) {
|
||||
$item['description'] = strip_tags($item['description']);
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
|
||||
//thumbnail_image for 'customer' data
|
||||
foreach ($data['customer'] as $k => $val) {
|
||||
$data['customer'][$k]['thumbnail_image'] = ListingImageUrl('news_article_thumb', $val['thumbnail_image']);
|
||||
$data['customer'][$k]['image'] = ListingImageUrl('news_article', $val['image']);
|
||||
}
|
||||
|
||||
//thumbnail_image for 'restaurant' data
|
||||
foreach ($data['restaurant'] as $k => $val) {
|
||||
$data['restaurant'][$k]['thumbnail_image'] = ListingImageUrl('news_article_thumb', $val['thumbnail_image']);
|
||||
$data['restaurant'][$k]['image'] = ListingImageUrl('news_article', $val['image']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
} catch (Exception $ex) {
|
||||
DB::rollBack();
|
||||
Log::error('News and articles Get service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function RestContactUs($request)
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
//create user_data
|
||||
$user_data = IamPrincipal::where('id', $request['iam_principal_id'])->first();
|
||||
if ($user_data) {
|
||||
// Create a new instance of ManageContactus model
|
||||
$contact = new ManageContactus();
|
||||
$contact->principal_xid = $user_data->id;
|
||||
$contact->name = $request->name;
|
||||
$contact->email = $request->email;
|
||||
$contact->message = $request->message;
|
||||
// Save the contact data
|
||||
$contact->save();
|
||||
|
||||
DB::commit();
|
||||
|
||||
//response data
|
||||
Log::info('Contact form data Created successfully');
|
||||
return jsonResponseWithSuccessMessageApi(__('success.save_data'), [], 201);
|
||||
} else {
|
||||
Log::error('Contact not found in addVendorContactForm.');
|
||||
return jsonResponseWithErrorMessageApi(__('auth.validation_failed'), 403);
|
||||
}
|
||||
} catch (Throwable $ex) {
|
||||
DB::rollBack();
|
||||
Log::error('Contact API failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
213
app/Services/APIs/RestaurantService/RestaurantApiService.php
Normal file
213
app/Services/APIs/RestaurantService/RestaurantApiService.php
Normal file
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\APIs\RestaurantService;
|
||||
|
||||
use App\Models\admin\ManageRestaurant;
|
||||
use App\Models\admin\ManageVoucherModel;
|
||||
use App\Models\IamPrincipal;
|
||||
use App\Models\IamPrincipalRestaurantRole;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Throwable;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class RestaurantApiService
|
||||
{
|
||||
|
||||
public function getRestProfileDetail($restIamId)
|
||||
{
|
||||
try {
|
||||
// Fetch user details
|
||||
$userDetail = IamPrincipal::select('id', 'first_name', 'last_name', 'email_address', 'phone_number', 'date_of_birth', 'profile_photo')
|
||||
->findOrFail($restIamId);
|
||||
|
||||
// Set profile photo
|
||||
if ($userDetail->profile_photo) {
|
||||
$userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo);
|
||||
} else {
|
||||
$userDetail->profile_photo = asset('public/assets/img/blankProfile.png');
|
||||
}
|
||||
|
||||
// Find restaurant roles associated with the user
|
||||
$restaurantRoles = IamPrincipalRestaurantRole::select('id', 'principal_xid', 'restaurant_xid', 'role')
|
||||
->where('principal_xid', $userDetail->id)
|
||||
->get();
|
||||
|
||||
// $restaurantDetails = [];
|
||||
|
||||
foreach ($restaurantRoles as $restaurantRole) {
|
||||
$restaurant = ManageVoucherModel::select('id', 'coupon_name', 'description', 'coupon_id', 'thumbnail_image', 'image', 'location_name', 'bio', 'try_on_1', 'try_on_2', 'try_on_3', 'try_on_4', 'try_on_5', 'phone_number')
|
||||
->where('id', $restaurantRole->restaurant_xid)
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
if ($restaurant) {
|
||||
$restaurant->image = ListingImageUrl('voucher_images', $restaurant->image);
|
||||
$restaurant->thumbnail_image = ListingImageUrl('voucher_thumbnail_images', $restaurant->thumbnail_image);
|
||||
$restaurant->description = strip_tags($restaurant->description);
|
||||
|
||||
// $restaurantDetails[] = $restaurant;
|
||||
}
|
||||
}
|
||||
|
||||
// Construct response
|
||||
$response = [
|
||||
'user_detail' => $userDetail,
|
||||
'restaurant_details' => $restaurant,
|
||||
];
|
||||
|
||||
// Return JSON response with success message
|
||||
return jsonResponseWithSuccessMessageApi(__('auth.User_details_fetch'), $response, 200);
|
||||
} catch (Exception $ex) {
|
||||
// Log error and return error response
|
||||
Log::error('Restaurant Get data service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function updateRestaurantDetail($restIamId, $request)
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$data = IamPrincipal::findOrFail($restIamId);
|
||||
if (!$data) {
|
||||
DB::rollBack();
|
||||
return jsonResponseWithErrorMessageApi(__('auth.user_not_found'), 404);
|
||||
}
|
||||
$restaurantRoles = IamPrincipalRestaurantRole::select('id', 'principal_xid', 'restaurant_xid', 'role')->where('principal_xid', $restIamId)->get();
|
||||
if ($restaurantRoles->isEmpty()) {
|
||||
DB::rollBack();
|
||||
return jsonResponseWithErrorMessageApi(__('auth.restaurant_data_not_found'), 404);
|
||||
}
|
||||
$restaurantRole = $restaurantRoles->first();
|
||||
$restaurant = ManageVoucherModel::findOrFail($restaurantRole->restaurant_xid);
|
||||
if (!$restaurant) {
|
||||
DB::rollBack();
|
||||
return jsonResponseWithErrorMessageApi(__('error_message.restaurant_data_not_found'), 404);
|
||||
}
|
||||
|
||||
$restaurant->update([
|
||||
'coupon_name' => $request['restaurant_name'],
|
||||
'description' => $request['description'],
|
||||
'location_name' => $request['location'],
|
||||
'bio' => $request['bio'],
|
||||
'try_on_1' => $request['try_on_1'],
|
||||
'try_on_2' => $request['try_on_2'],
|
||||
'try_on_3' => $request['try_on_3'],
|
||||
'try_on_4' => $request['try_on_4'],
|
||||
'try_on_5' => $request['try_on_5'],
|
||||
'phone_number' => $request['phone_number'],
|
||||
]);
|
||||
$restaurant->description = strip_tags($restaurant->description);
|
||||
|
||||
DB::commit();
|
||||
return jsonResponseWithSuccessMessageApi(__('auth.data_updated_successfully'), $restaurant, 200);
|
||||
} catch (Exception $ex) {
|
||||
DB::rollBack();
|
||||
Log::error('Restaurant update profile service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function updateRestProfileDetail($restIamId, $request)
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$data = IamPrincipal::select('id', 'first_name', 'last_name', 'email_address', 'phone_number', 'date_of_birth')->findOrFail($restIamId);
|
||||
if (!$data) {
|
||||
DB::rollBack();
|
||||
return jsonResponseWithErrorMessage(__('error_message.user_details_not_found'), 404);
|
||||
}
|
||||
|
||||
if ($request->has('image')) {
|
||||
$image = $request->image;
|
||||
$tnormalImage = saveSingleImageWithoutCrop($image, 'profile_image', null);
|
||||
$data->update(['profile_photo' => $tnormalImage]);
|
||||
DB::commit();
|
||||
|
||||
}
|
||||
if ($request->has('first_name')) {
|
||||
$data->first_name = $request->first_name;
|
||||
$data->save();
|
||||
DB::commit();
|
||||
}
|
||||
if ($request->has('last_name')) {
|
||||
$data->last_name = $request->last_name;
|
||||
$data->save();
|
||||
DB::commit();
|
||||
}
|
||||
if ($request->has('date_of_birth')) {
|
||||
$data->date_of_birth = $request->date_of_birth;
|
||||
$data->save();
|
||||
DB::commit();
|
||||
}
|
||||
if ($request->has('phone_number')) {
|
||||
$data->phone_number = $request->phone_number;
|
||||
$data->save();
|
||||
DB::commit();
|
||||
}
|
||||
|
||||
if ($request->has('email_address')) {
|
||||
$email = $request->input('email_address');
|
||||
if ($email !== $data->email_address) {
|
||||
$existingUser = IamPrincipal::where('email_address', $email)
|
||||
->where('id', '!=', $restIamId)
|
||||
->whereNull('deleted_at')
|
||||
->where('principal_type_xid', 4)
|
||||
->exists();
|
||||
|
||||
if ($existingUser) {
|
||||
DB::rollBack();
|
||||
return jsonResponseWithErrorMessageApi(__('auth.email_already_exist'), 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
// $data->update([
|
||||
// 'first_name' => $request['first_name'],
|
||||
// 'last_name' => $request['last_name'],
|
||||
// 'email_address' => $request['email_address'],
|
||||
// 'phone_number' => $request['phone_number'],
|
||||
// 'date_of_birth' => $request['date_of_birth'],
|
||||
// ]);
|
||||
$data->save();
|
||||
DB::commit();
|
||||
return jsonResponseWithSuccessMessageApi(__('auth.data_updated_successfully'), $data, 200);
|
||||
} catch (Exception $ex) {
|
||||
DB::rollBack();
|
||||
|
||||
Log::error('Restaurant update profile service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function resetRestPassword($restIamId, $request)
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$user = IamPrincipal::findOrFail($restIamId);
|
||||
if (!Hash::check($request->current_password, $user->password)) {
|
||||
DB::rollBack();
|
||||
return jsonResponseWithErrorMessageApi(__('auth.invalid_current_passsword'), 403);
|
||||
} else {
|
||||
$user->update([
|
||||
'password' => Hash::make($request->new_password)
|
||||
]);
|
||||
DB::commit();
|
||||
return jsonResponseWithSuccessMessageApi(__('auth.password_updated_successfully'), $user);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
DB::rollBack();
|
||||
Log::error('Update password service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
56
composer.lock
generated
56
composer.lock
generated
@@ -4617,38 +4617,27 @@
|
||||
"time": "2024-04-27T21:32:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sabberworm/php-css-parser",
|
||||
"version": "v8.5.1",
|
||||
"name": "stella-maris/clock",
|
||||
"version": "0.1.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/MyIntervals/PHP-CSS-Parser.git",
|
||||
"reference": "4a3d572b0f8b28bb6fd016ae8bbfc445facef152"
|
||||
"url": "https://github.com/stella-maris-solutions/clock.git",
|
||||
"reference": "fa23ce16019289a18bb3446fdecd45befcdd94f8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/4a3d572b0f8b28bb6fd016ae8bbfc445facef152",
|
||||
"reference": "4a3d572b0f8b28bb6fd016ae8bbfc445facef152",
|
||||
"url": "https://api.github.com/repos/stella-maris-solutions/clock/zipball/fa23ce16019289a18bb3446fdecd45befcdd94f8",
|
||||
"reference": "fa23ce16019289a18bb3446fdecd45befcdd94f8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-iconv": "*",
|
||||
"php": ">=5.6.20"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.7.27"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "for parsing UTF-8 CSS"
|
||||
"php": "^7.0|^8.0",
|
||||
"psr/clock": "^1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "9.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Sabberworm\\CSS\\": "src/"
|
||||
"StellaMaris\\Clock\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
@@ -4657,29 +4646,22 @@
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Raphael Schweikert"
|
||||
},
|
||||
{
|
||||
"name": "Oliver Klee",
|
||||
"email": "github@oliverklee.de"
|
||||
},
|
||||
{
|
||||
"name": "Jake Hotson",
|
||||
"email": "jake.github@qzdesign.co.uk"
|
||||
"name": "Andreas Heigl",
|
||||
"role": "Maintainer"
|
||||
}
|
||||
],
|
||||
"description": "Parser for CSS Files written in PHP",
|
||||
"homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser",
|
||||
"description": "A pre-release of the proposed PSR-20 Clock-Interface",
|
||||
"homepage": "https://gitlab.com/stella-maris/clock",
|
||||
"keywords": [
|
||||
"css",
|
||||
"parser",
|
||||
"stylesheet"
|
||||
"clock",
|
||||
"datetime",
|
||||
"point in time",
|
||||
"psr20"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues",
|
||||
"source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.5.1"
|
||||
"source": "https://github.com/stella-maris-solutions/clock/tree/0.1.7"
|
||||
},
|
||||
"time": "2024-02-15T16:41:13+00:00"
|
||||
"time": "2022-11-25T16:15:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/clock",
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('manage_module', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('slug');
|
||||
$table->integer('created_by')->nullable();
|
||||
$table->integer('modified_by')->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('manage_module');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('manage_module_link', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('principal_xid');
|
||||
$table->foreign('principal_xid')->references('id')->on('iam_principal')->onDelete('cascade');
|
||||
$table->unsignedBigInteger('manage_modules_xid');
|
||||
$table->foreign('manage_modules_xid')->references('id')->on('manage_module')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('manage_module_link');
|
||||
}
|
||||
};
|
||||
@@ -20,6 +20,9 @@ $(document).on("click", "#add_sub_admin_form_btn", function (e) {
|
||||
password: {
|
||||
required: true
|
||||
}
|
||||
,"module_id[]":{
|
||||
required: true
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
sub_admin_name: {
|
||||
@@ -32,6 +35,9 @@ $(document).on("click", "#add_sub_admin_form_btn", function (e) {
|
||||
},
|
||||
password: {
|
||||
required: 'Please enter this filed'
|
||||
},
|
||||
"module_id[]":{
|
||||
required: 'Please enter this filed'
|
||||
}
|
||||
},
|
||||
errorClass: 'error-message',
|
||||
@@ -58,12 +64,12 @@ $(document).on("click", "#add_sub_admin_form_btn", function (e) {
|
||||
if (result.status_code == 200) {
|
||||
toastr.success('Data Added Sucessfully');
|
||||
setTimeout(function () {
|
||||
window.location.href = base_url + "/manage_sub_admin";
|
||||
window.location.href = base_url + "/manage-sub-admin";
|
||||
}, 2000);
|
||||
} else {
|
||||
toastr.error('Something Went Wrong');
|
||||
setTimeout(function () {
|
||||
window.location.href = base_url + "/manage_sub_admin";
|
||||
window.location.href = base_url + "/manage-sub-admin";
|
||||
}, 2000);
|
||||
}
|
||||
$('#add_sub_admin_form_btn').attr('disabled', false);
|
||||
|
||||
@@ -43,22 +43,22 @@ $('#update_admin_btn').on("click", function (e) {
|
||||
if (result.status_code == 200) {
|
||||
toastr.success('Data Updated Sucessfully');
|
||||
setTimeout(function() {
|
||||
window.location.href = base_url + "/manage_sub_admin";
|
||||
window.location.href = base_url + "/manage-sub-admin";
|
||||
}, 2000);
|
||||
} else {
|
||||
toastr.error('Something Went Wrong');
|
||||
setTimeout(function() {
|
||||
window.location.href = base_url + "/manage_sub_admin";
|
||||
window.location.href = base_url + "/manage-sub-admin";
|
||||
}, 2000);
|
||||
}
|
||||
$('#update_admin_btn').attr('disabled', false);
|
||||
$('#update_admin_btn').text('Submit');
|
||||
},
|
||||
|
||||
|
||||
});
|
||||
|
||||
// $('#update_admin_btn').attr('disabled', false);
|
||||
// $('#update_admin_btn').text('Submit');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,7 +48,7 @@ $(document).on("click", ".admin_delete", function (e) {
|
||||
if (response.status == 200) {
|
||||
toastr.success('Deleted Successfully');
|
||||
setTimeout(function () {
|
||||
window.location.href = base_url + "/manage_sub_admin";
|
||||
window.location.href = base_url + "/manage-sub-admin";
|
||||
}, 1000);
|
||||
} else {
|
||||
toastr.error("Something went wrong");
|
||||
@@ -80,4 +80,4 @@ $(".sub_admin_table").on("change", ".active_admin", function () {
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5>No of Customers</h5>
|
||||
<h2 class="m-0 font-weight-bold">08</h2>
|
||||
<h2 class="m-0 font-weight-bold">{{ $customerCount }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -55,7 +55,7 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5>No of Restaurants</h5>
|
||||
<h2 class="m-0 font-weight-bold">05</h2>
|
||||
<h2 class="m-0 font-weight-bold">{{ $restaurantCount }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -66,7 +66,7 @@
|
||||
<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" name="" id="">
|
||||
<select class="form-control w-25" id="graph-filter">
|
||||
<option value="" selected>Monthly</option>
|
||||
<option value="">Quarterly</option>
|
||||
<option value="">Yearly</option>
|
||||
@@ -664,5 +664,58 @@
|
||||
// --------- Sales chart ends ------------
|
||||
});
|
||||
|
||||
// Add event listener to the filter select element
|
||||
document.getElementById('graph-filter').addEventListener('change', function(event) {
|
||||
var selectedFilter = event.target.value;
|
||||
userChartData = getUserChartData(selectedFilter); // Get data based on selected filter
|
||||
userCategories = getUserChartCategories(selectedFilter); // Update x-axis categories
|
||||
|
||||
userChart.updateSeries(userChartData); // Update chart data
|
||||
userChart.updateOptions({
|
||||
xaxis: {
|
||||
categories: userCategories
|
||||
}
|
||||
}); // Update chart options
|
||||
});
|
||||
// Function to fetch data based on selected filter
|
||||
function getUserChartData(filter) {
|
||||
switch (filter) {
|
||||
case 'monthly':
|
||||
return [{
|
||||
name: 'Customer',
|
||||
data: <?php echo json_encode(array_values($dataMonthlyWithType3)); ?>
|
||||
},
|
||||
{
|
||||
name: 'Restaurant',
|
||||
data: <?php echo json_encode(array_values($dataMonthlyWithType4)); ?>
|
||||
}
|
||||
];
|
||||
case 'quarterly':
|
||||
return [{
|
||||
name: 'Customer',
|
||||
data: <?php echo json_encode(array_values($dataQuarterlyWithType3)); ?>
|
||||
},
|
||||
{
|
||||
name: 'Restaurant',
|
||||
data: <?php echo json_encode(array_values($dataQuarterlyWithType4)); ?>
|
||||
}
|
||||
];
|
||||
case 'yearly':
|
||||
return [{
|
||||
name: 'Customer',
|
||||
data: <?php echo json_encode(array_values($dataYearlyWithType3)); ?>
|
||||
},
|
||||
{
|
||||
name: 'Restaurant',
|
||||
data: <?php echo json_encode(array_values($dataYearlyWithType4)); ?>
|
||||
}
|
||||
];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -30,18 +30,7 @@
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<a href="{{ route('manage.newLetter') }}">
|
||||
<div class="card pointer">
|
||||
<div
|
||||
class="card-body d-flex flex-column justify-content-center align-items-center card-cms">
|
||||
<img width="50" height="50" src="{{ asset('public/assets/img/quill_inbox-newsletter.svg') }}"
|
||||
alt="">
|
||||
<h4 class="m-0">Newsletter</h4>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
<a href="{{ route('manage.aboutUs') }}">
|
||||
<div class="card pointer">
|
||||
@@ -88,6 +77,18 @@
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<!-- <div class="col-4">
|
||||
<a href="{{ route('manage.newLetter') }}">
|
||||
<div class="card pointer">
|
||||
<div
|
||||
class="card-body d-flex flex-column justify-content-center align-items-center card-cms">
|
||||
<img width="50" height="50" src="{{ asset('public/assets/img/quill_inbox-newsletter.svg') }}"
|
||||
alt="">
|
||||
<h4 class="m-0">Newsletter</h4>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<a class="d-flex align-items-center justify-content-center pl-2" href="{{ route('manage.Newarticles') }}">
|
||||
<img class="back-btn" src="{{ asset('assets/img/left-arrow.svg') }}">
|
||||
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
|
||||
<h6 class="card-title p-0">Add News & Articles </h6>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
@extends('Admin.layouts.master')
|
||||
|
||||
@section('content')
|
||||
<?php $currentPage = 'sub-admins'; ?>
|
||||
<style>
|
||||
.error-message {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
form .error-message {
|
||||
color: red;
|
||||
/* Set your desired color here */
|
||||
}
|
||||
|
||||
form .input_class.error-message {
|
||||
color: #0e1726;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="layout-px-spacing">
|
||||
<div class="middle-content container-xxl p-0">
|
||||
<div class="row layout-top-spacing ">
|
||||
<div class="top-tabel">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<!-- <h6 class="card-title">Edit Manage Customers</h6> -->
|
||||
<a class="d-flex align-items-center justify-content-center pl-2" href="">
|
||||
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
|
||||
<h6 class="card-title p-0">Add Sub Admins</h6>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
|
||||
<div class="widget-content widget-content-area br-8 position-btn h-10">
|
||||
<div class="view-details Article">
|
||||
<form id="add_sub_admin_form">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Name</label>
|
||||
<input type="text" class="form-control" name="sub_admin_name">
|
||||
<span class="error-message" id="first_name_error"></span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Email ID</label>
|
||||
<input type="text" class="form-control" name="sub_admin_email">
|
||||
<span class="error-message" id="email_error"></span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="form-group mb-0">
|
||||
<label class="label">Permissions</label>
|
||||
<label id="module_id[]-error" class="error-message" for="module_id[]"></label>
|
||||
</div>
|
||||
<div class="row">
|
||||
@foreach ($sub_admins_module as $sub_admins_modules)
|
||||
<div class="form-group subadmin-option col-md-3">
|
||||
<input id="customers{{ $sub_admins_modules->id }}" type="checkbox"
|
||||
name="module_id[]" class="form-control"
|
||||
value="{{ $sub_admins_modules['id'] }}">
|
||||
<label for="customers{{ $sub_admins_modules->id }}"
|
||||
class="label mb-0">{{ $sub_admins_modules->name }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="label">Password</label>
|
||||
<input type="text" class="form-control" name="password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<button id="add_sub_admin_form_btn" type="submit"
|
||||
class="download-btn-custom mt-3 custom-width-10">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@section('section_script')
|
||||
<script src="{{ asset('public/assets/js/admin/manage_sub_admin/add.js') }}"></script>
|
||||
@endsection
|
||||
@@ -0,0 +1,82 @@
|
||||
@extends('admin.layouts.master')
|
||||
|
||||
@section('content')
|
||||
<?php $currentPage = "sub-admins" ?>
|
||||
|
||||
<div class="layout-px-spacing">
|
||||
<div class="middle-content container-xxl p-0">
|
||||
<div class="row layout-top-spacing ">
|
||||
<div class="top-tabel">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<!-- <h6 class="card-title">Edit Manage Customers</h6> -->
|
||||
<a class="d-flex align-items-center justify-content-center pl-2"
|
||||
href="">
|
||||
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg')}}">
|
||||
<h6 class="card-title p-0">Edit Sub Admins</h6>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
|
||||
<div class="widget-content widget-content-area br-8 position-btn h-10">
|
||||
<div class="view-details Article">
|
||||
<form id="update_sub_admin">
|
||||
<input type="hidden" class="form-control" value="{{$edit_sub_admin->id}}" name="sub_admin_id">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Name</label>
|
||||
<input type="text" class="form-control" value="{{$edit_sub_admin->first_name}}" name="sub_admin_name">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Email ID</label>
|
||||
<input type="text" class="form-control" value="{{$edit_sub_admin->email_address}}" name="sub_admin_email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="label">Password</label>
|
||||
<input type="text" class="form-control" value="{{$edit_sub_admin->password}}" disabled>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group mb-0">
|
||||
<label class="label">Permissions</label>
|
||||
</div>
|
||||
<div class="row">
|
||||
@foreach ($sub_admins_module as $sub_admin_module)
|
||||
<div class="form-group subadmin-option col-md-3">
|
||||
<input id="customers{{$sub_admin_module->id}}" type="checkbox" name="module_id[]" class="form-control" value="{{$sub_admin_module->id}}"
|
||||
@if($edit_sub_admin->moduleLinks->contains('manage_modules_xid', $sub_admin_module->id)) checked @endif>
|
||||
<label for="customers{{$sub_admin_module->id}}" class="label mb-0">{{ $sub_admin_module->name }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<button class="download-btn-custom mt-3 custom-width-10" id="update_admin_btn" type="submit">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
|
||||
@section('section_script')
|
||||
<script src="{{ asset('assets/js/admin/manage_customer/main.js')}}"></script>
|
||||
<script src="{{ asset('public/assets/js/admin/manage_sub_admin/edit.js')}}"></script>
|
||||
|
||||
@endsection
|
||||
@@ -39,6 +39,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-center">
|
||||
@foreach ( $sub_admins_data as $sub_admins)
|
||||
<tr>
|
||||
<td>
|
||||
<div class="form-check form-check-sm form-check-custom form-check-solid">
|
||||
@@ -46,11 +47,11 @@
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-start">1</td>
|
||||
<td class="text-start">Akanksha</td>
|
||||
<td class="text-start">akanksha@gmail.com</td>
|
||||
<td class="text-start">08/22/2023</td>
|
||||
<td class="text-start">{{ $sub_admins->first_name }}</td>
|
||||
<td class="text-start">{{ $sub_admins->email_address }}</td>
|
||||
<td class="text-start">{{ \Carbon\Carbon::parse($sub_admins->created_at)->format('d/m/y') }}</td>
|
||||
<td class="text-start">
|
||||
<a class="view-btn m-0 pointer" data-toggle="modal" data-target="#premission-modal">View</a>
|
||||
<a class="view-btn m-0 pointer" data-toggle="modal" data-target="#premission-modal" data-id="{{$sub_admins['id']}}">View</a>
|
||||
</td>
|
||||
<td>
|
||||
<div class="dropout">
|
||||
@@ -62,19 +63,19 @@
|
||||
<ul>
|
||||
<li>
|
||||
<div class="switch-btn">
|
||||
<input type="checkbox" id="switch18" switch="bool" checked />
|
||||
<label for="switch18" data-on-label="Active" data-off-label="Expired"></label>
|
||||
<input data-id="{{ $sub_admins->id }}" {{ $sub_admins->is_active ? 'checked' : '' }} class="active_admin" type="checkbox" id="switch{{ $sub_admins->id }}" switch="bool" checked />
|
||||
<label for="switch{{ $sub_admins->id }}" data-on-label="Active" data-off-label="Expired"></label>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<a href="manage-subadmins-edit.php">
|
||||
<img src="../src/assets/img/edit.svg" />
|
||||
<a href="{{ url('/edit_sub_admin/' . $sub_admins->id)}}">
|
||||
<img src="{{ asset('public/assets/img/edit.svg')}}" />
|
||||
<span>Edit</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="" data-toggle="modal" data-target="#delete-modal">
|
||||
<img src="../src/assets/img/delete-recycle.svg" />
|
||||
<a href="" data-toggle="modal" data-target="#delete-modal" class="admin_delete_btn" data-id="{{ $sub_admins->id }}">
|
||||
<img src="{{ asset('public/assets/img/delete-recycle.svg')}}" />
|
||||
<span>Delete</span>
|
||||
</a>
|
||||
</li>
|
||||
@@ -82,49 +83,7 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="form-check form-check-sm form-check-custom form-check-solid">
|
||||
<input class="form-check-input" type="checkbox" value="1" />
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-start">1</td>
|
||||
<td class="text-start">Akanksha</td>
|
||||
<td class="text-start">akanksha@gmail.com</td>
|
||||
<td class="text-start">08/22/2023</td>
|
||||
<td class="text-start">
|
||||
<a class="view-btn m-0 pointer" data-toggle="modal" data-target="#premission-modal" data-toggle="modal" data-target="#premission-modal">View</a>
|
||||
</td>
|
||||
<td>
|
||||
<div class="dropout">
|
||||
<button class="more">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</button>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="manage-restraunts-details.php">
|
||||
<img src="../src/assets/img/view.svg" />
|
||||
<span>View</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="" data-toggle="modal" data-target="#archive-modal">
|
||||
<img src="../src/assets/img/archive.svg" />
|
||||
<span>Archive</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="manage-restraunts-edit.php">
|
||||
<img src="../src/assets/img/edit.svg" />
|
||||
<span>Edit</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
|
||||
</tbody>
|
||||
@@ -134,32 +93,85 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- Premission-modal --}}
|
||||
<div class="modal fade" id="premission-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document" style="max-width: 850px;">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="modal-header d-flex justify-content-between modal-title">
|
||||
<h5>View premission</h5>
|
||||
<button type="button pointer" class="btn-close" data-dismiss="modal" aria-label="Close">
|
||||
x
|
||||
</button>
|
||||
</div>
|
||||
<div class="row" style="padding: 0px 10px;">
|
||||
@foreach($sub_admins_module as $sub_admins_modules)
|
||||
<div class="form-group subadmin-option col-md-4">
|
||||
<input id="customers{{ $sub_admins_modules->id}}" value="{{ $sub_admins_modules->id}}" type="checkbox" class="form-control" name="module_id[]" disabled>
|
||||
<label for="customers{{ $sub_admins_modules->id}}" class="label mb-0">{{ $sub_admins_modules->name}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- Premission-modal End--}}
|
||||
|
||||
{{-- Delete-modal --}}
|
||||
<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close">
|
||||
x
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="modal-text">Are you sure you want to<br>Delete </p>
|
||||
<input type="hidden" id="sub_admin_delete">
|
||||
<div class="modal-btn d-flex ">
|
||||
<a class="extra-btn" href="#" data-dismiss="modal">No</a>
|
||||
<a class="download-btn-custom admin_delete" data-dismiss="modal">Yes</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- Delete-modal --}}
|
||||
@endsection
|
||||
|
||||
|
||||
|
||||
@section('section_script')
|
||||
<script src="{{ asset('public/assets/js/admin/manage_customer/main.js')}}"></script>
|
||||
<script src="{{ asset('public/assets/js/admin/manage_sub_admin/main.js')}}"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../src/plugins/src/table/datatable/datatables.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
|
||||
});
|
||||
// $('#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>
|
||||
$(document).ready(function () {
|
||||
$('<button><a class="extra-btn width-max-content" href="manage-subadmins-add.php">Add</a></button>').insertBefore("#zero-config_filter label");
|
||||
$('<button><a class="extra-btn width-max-content" href="{{ route('manage.sub_admin_create') }}">Add</a></button>').insertBefore("#zero-config_filter label");
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
244
resources/views/mail/subadmin.blade.php
Normal file
244
resources/views/mail/subadmin.blade.php
Normal file
@@ -0,0 +1,244 @@
|
||||
<html>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="description" content="" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" />
|
||||
|
||||
<head>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700;800;900&display=swap");
|
||||
@media only screen and (max-width: 767px) {
|
||||
.main {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.top-image {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.inside-footer {
|
||||
width: 320px !important;
|
||||
}
|
||||
|
||||
table[class="contenttable"] {
|
||||
width: 320px !important;
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
td[class="force-col"] {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
td[class="rm-col"] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.mt {
|
||||
margin-top: 15px !important;
|
||||
}
|
||||
|
||||
*[class].width300 {
|
||||
width: 255px !important;
|
||||
}
|
||||
|
||||
*[class].block {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
*[class].blockcol {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.emailButton {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.emailButton a {
|
||||
display: block !important;
|
||||
font-size: 18px !important;
|
||||
}
|
||||
|
||||
.side p {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td.border {
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
tfoot td {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.mktEditable p {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 600px) {
|
||||
.main {
|
||||
width: 320px !important;
|
||||
}
|
||||
|
||||
.top-image {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.inside-footer {
|
||||
width: 320px !important;
|
||||
}
|
||||
|
||||
table[class="contenttable"] {
|
||||
width: 320px !important;
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
td[class="force-col"] {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
td[class="rm-col"] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.mt {
|
||||
margin-top: 15px !important;
|
||||
}
|
||||
|
||||
*[class].width300 {
|
||||
width: 255px !important;
|
||||
}
|
||||
|
||||
*[class].block {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
*[class].blockcol {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.emailButton {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.emailButton a {
|
||||
display: block !important;
|
||||
font-size: 18px !important;
|
||||
}
|
||||
|
||||
.side p {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td.border {
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
tfoot td {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.mktEditable p {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table class="main contenttable"
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="border"
|
||||
style="
|
||||
display: flex;
|
||||
border: 1px solid #9d9a9a !important;
|
||||
width: 535px;
|
||||
">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" class="side title">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="head-title"
|
||||
style="
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
background-color: #fcf6e4;
|
||||
">
|
||||
<div class="mktEditable" id="main_title">
|
||||
{{-- <img
|
||||
src="{{ asset('public/assets/img/frontend/logo-webs.png')}}"
|
||||
style="
|
||||
margin-top: 18px;
|
||||
margin-bottom: 18px;
|
||||
width: 122px;
|
||||
height: 75px;
|
||||
"
|
||||
/> --}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="grey-block"
|
||||
style="
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
padding: 20px 20px 0 20px;
|
||||
color: #000;
|
||||
font-size: 15px;
|
||||
">
|
||||
<div class="mktEditable" id="cta">
|
||||
<p style="font-weight: 500">
|
||||
</p>
|
||||
{{-- <p>Dear {{ $data['first_name'] }},</p> --}}
|
||||
<p>Dear {{$mailData['username']}},</p>
|
||||
|
||||
<p>Congratulations! Your sub-admin account with Cheers to the session
|
||||
has been successfully approved.</p>
|
||||
|
||||
<p>Your login credentials are as follows:</p>
|
||||
<ul>
|
||||
<li><strong>User Name:</strong> {{$mailData['username']}}</li>
|
||||
|
||||
<li><strong>Password:</strong> {{$mailData['password']}}</li>
|
||||
</ul>
|
||||
|
||||
<p>You can now log in to your sub-admin dashboard to access your
|
||||
account .</p>
|
||||
|
||||
<p>Please click on the link below to access your dashboard:</p>
|
||||
<p><a
|
||||
href="https://ctts.betadelivery.com">https://ctts.betadelivery.com</a>
|
||||
</p>
|
||||
|
||||
<p>If you have any questions or need further assistance, please
|
||||
feel free to contact us.</p>
|
||||
`
|
||||
<p>Best regards,<br> Cheers to the session</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js"></script>
|
||||
|
||||
</html>
|
||||
54
routes/restaurant_api.php
Normal file
54
routes/restaurant_api.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\APIs\RestaurantApi\RedeemControllerApi;
|
||||
use App\Http\Controllers\APIs\RestaurantApi\RestaurantControllerApi;
|
||||
use App\Http\Controllers\APIs\RestaurantApi\RestAuthApiController;
|
||||
use App\Http\Controllers\APIs\RestaurantApi\RestCMSController;
|
||||
use App\Http\Controllers\APIs\RestaurantApi\RestNotificationController;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
|
||||
Route::middleware(['restaurantApiBasicAuth'])->group(function () {
|
||||
// Define your routes here
|
||||
Route::get('/v1/list-restaurant', [RestAuthApiController::class, 'viewresyaurant']);
|
||||
Route::post('/v1/rest-register', [RestAuthApiController::class, 'restRegister']);
|
||||
Route::post('/v1/rest-login', [RestAuthApiController::class, 'login']);
|
||||
Route::post('/v1/rest-forgot-password', [RestAuthApiController::class, 'restForgotPassword']);
|
||||
Route::post('/v1/rest-verify-otp', [RestAuthApiController::class, 'restVerifyOTP']);
|
||||
Route::post('/v1/rest-change-password', [RestAuthApiController::class, 'restChangePassword']);
|
||||
Route::post('/v1/rest-resend-otp', [RestAuthApiController::class, 'restResendOtp']);
|
||||
|
||||
// Route::group(['middleware' => ['restaurant.jwt.verify']], function () {
|
||||
// //*******************************************************Restaurant profile********************************************************
|
||||
// Route::get('/v1/fetch-restaurant-profile', [RestaurantControllerApi::class, 'getRestProfileDetail']);
|
||||
// Route::post('/v1/update-restaurant-profile', [RestaurantControllerApi::class, 'updateRestProfileDetail']);
|
||||
// Route::post('/v1/update-restaurant-detail', [RestaurantControllerApi::class, 'updateRestaurantDetail']);
|
||||
// Route::post('/v1/reset-restaurant-password', [RestaurantControllerApi::class, 'resetRestPassword']);
|
||||
// Route::post('/v1/restaurant-logout', [RestaurantControllerApi::class, 'restaurantLogout']);
|
||||
// Route::post('/v1/restaurant-delete_account', [RestaurantControllerApi::class, 'restDeleteAccount']);
|
||||
|
||||
|
||||
|
||||
|
||||
// //*******************************************************Redeemption Data********************************************************
|
||||
|
||||
// Route::get('/v1/fetch-redeem-data', [RedeemControllerApi::class, 'getRedemedData']);
|
||||
// Route::post('/v1/undo-redemption', [RedeemControllerApi::class, 'undoRedemption']);
|
||||
// Route::post('/v1/search-Redemption-data', [RedeemControllerApi::class, 'searchRedemption']);
|
||||
|
||||
// //*******************************************************CMS********************************************************
|
||||
|
||||
// Route::get('/v1/list-of-restaurant-faqs', [RestCMSController::class, 'RestGetFaq']);
|
||||
// Route::get('/v1/list-of-restaurant-about-us', [RestCMSController::class, 'RestAboutUs']);
|
||||
// Route::get('/v1/list-of-restaurant-privacy-policy', [RestCMSController::class, 'RestPrivacyPolicy']);
|
||||
// Route::get('/v1/list-of-restaurant-news-articles', [RestCMSController::class, 'RestNewsArticles']);
|
||||
// Route::post('/v1/restaurant-contact-us', [RestCMSController::class, 'RestContactUs']);
|
||||
|
||||
|
||||
// //*******************************************************notification********************************************************
|
||||
// Route::get('/v1/get-notification', [RestNotificationController::class, 'getRestNotificationApi']);
|
||||
// Route::post('/v1/send-notification', [RestNotificationController::class, 'sendRestNotificationApi']);
|
||||
// Route::post('/v1/alert-notification', [RestNotificationController::class, 'sendAlertNotificationApi']);
|
||||
// });
|
||||
});
|
||||
@@ -35,7 +35,8 @@ Route::get('/logout', [LoginController::class, 'logout'])->name('logout');
|
||||
Route::group(['middleware' => ['checkStatus']], function () {
|
||||
|
||||
|
||||
Route::get('/dashboard', [DashboardController ::class, 'index'])->name('dashboard');
|
||||
// Route::get('/dashboard', [DashboardController ::class, 'index'])->name('dashboard');
|
||||
Route::get('/dashboard', [DashboardController::class, 'showDashboard'])->name('dashboard');
|
||||
|
||||
Route::get('/profile', [ManageProfileController ::class, 'index'])->name('profile');
|
||||
|
||||
@@ -59,6 +60,12 @@ Route::post('/update_restraunt', [ManageRestrauntController::class, 'update']);
|
||||
|
||||
//*******************************************************manage subadmin********************************************************
|
||||
Route::get('/manage-sub-admin', [ ManageSubAdminController ::class, 'index'])->name('manage.subAdmin');
|
||||
Route::get('/create_sub_admin', [ManageSubAdminController::class, 'create'])->name('manage.sub_admin_create');
|
||||
Route::post('/insert_sub_admin', [ManageSubAdminController::class, 'store_subadmin']);
|
||||
Route::delete('/manage_sub_admin/{id}', [ManageSubAdminController::class, 'delete_sub_admin']);
|
||||
Route::get('/edit_sub_admin/{id}', [ManageSubAdminController::class, 'edit'])->name('sub_admin_edit');
|
||||
Route::post('/update_sub_admin', [ManageSubAdminController::class, 'update_subadmin']);
|
||||
Route::get('/change_admin_status', [ManageSubAdminController::class, 'change_admin_status']);
|
||||
//*******************************************************manage passport********************************************************
|
||||
Route::get('/manage-passport', [ ManagePassportController ::class, 'index'])->name('manage.passport');
|
||||
//*******************************************************manage voucher********************************************************
|
||||
|
||||
Reference in New Issue
Block a user