This commit is contained in:
Gowtham M 2025-10-17 10:02:00 +05:30
parent 9708498fce
commit bfc6890b95
2 changed files with 31 additions and 8 deletions

View File

@ -84,7 +84,7 @@ $routes->group('api', ['filter' => ["jwtAuth:Org Admin,Travel Admin,Travel Agent
$routes->get('travellers/find/name/(:any)', 'TravellerController::findByName/$1');
$routes->get('travellers/find/email/(:any)', 'TravellerController::findByEmail/$1');
$routes->get('travellers/find/mobile/(:any)', 'TravellerController::findByMobile/$1');
$routes->get('plans', 'PlanController::index');
$routes->put('plans/find/(:num)', 'PlanController::find/$1');
$routes->get('plans/view', 'PlanController::viewPlan');
$routes->get('plans/plan_pdf', 'PlanController::plan_pdf');
@ -94,6 +94,9 @@ $routes->group('api', ['filter' => ["jwtAuth:Org Admin,Travel Admin,Travel Agent
});
$routes->group('api', ['filter' => ["jwtAuth:Org Admin,Travel Admin,User","appSignature"] ], function ($routes) {
$routes->post('travellers/create', 'TravellerController::create'); // Org admin, Travel admin,user
@ -160,6 +163,8 @@ $routes->group('api', ['filter' => ["jwtAuth:Org Admin,Travel Admin","appSignatu
$routes->post('misForexReport', 'ReportsController::misForexReport');// Org admin, Travel admin,
$routes->post('guestHouseReport', 'ReportsController::guestHouseReport');// Org admin, Travel admin,
$routes->get('allPlans', 'PlanController::allPlans');
});
$routes->group('api', ['filter' => ["jwtAuth:Org Admin","appSignature"] ], function ($routes) {
@ -181,6 +186,13 @@ $routes->group('api', ['filter' => ["jwtAuth:Travel Agent","appSignature"] ], fu
});
$routes->group('api', ['filter' => ["jwtAuth:User","appSignature"] ], function ($routes) {
$routes->get('plans', 'PlanController::userPlans');
});

View File

@ -84,19 +84,30 @@ class PlanController extends ResourceController
}
public function index()
public function userPlans()
{
$org_id = $this->request->getGet('org_id');
$user_id = $this->request->getVar('user_id');
if (isset($user_id))
{
$plans = $this->planModel->getActivePlan($org_id, 'USER', $user_id);
}else{
$plans = $this->planModel->getActivePlan($org_id);
$plans = $this->planModel->getActivePlan($org_id, 'USER', $user_id);
if (!$plans) {
return $this->respond(['status' => 200,'message' => 'failed','data' => 'No Plans found']);
}
return $this->respond(['status' => 200,'message' => 'success','data' => $plans]);
}
public function allPlans()
{
$org_id = $this->request->getGet('org_id');
$plans = $this->planModel->getActivePlan($org_id);
if (!$plans) {
return $this->respond(['status' => 200,'message' => 'failed','data' => 'No Plans found']);
}