Merge branch 'main' of bitbucket.org:venbaittech/tstat_be
This commit is contained in:
commit
bf4e66ff54
@ -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,12 +94,16 @@ $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
|
||||
$routes->post('plans/approvePlan', 'PlanController::approvePlan'); // Org admin, Travel admin,user
|
||||
$routes->post('plans/rejectPlan', 'PlanController::rejectPlan'); // Org admin, Travel admin,user
|
||||
$routes->get('plans/findApprovalList', 'PlanController::findApprovalList'); // Org admin, Travel admin,user
|
||||
$routes->get('plans', 'PlanController::userPlans');
|
||||
|
||||
|
||||
});
|
||||
@ -160,6 +164,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) {
|
||||
@ -171,6 +177,7 @@ $routes->group('api', ['filter' => ["jwtAuth:Org Admin","appSignature"] ], funct
|
||||
$routes->put('organizations/org-status/(:num)', 'OrganizationController::updateOrganizationStatus/$1');
|
||||
$routes->post('organizations/testMail', 'OrganizationController::testMail'); // Org admin,
|
||||
|
||||
|
||||
});
|
||||
|
||||
$routes->group('api', ['filter' => ["jwtAuth:Travel Agent","appSignature"] ], function ($routes) {
|
||||
@ -178,13 +185,14 @@ $routes->group('api', ['filter' => ["jwtAuth:Travel Agent","appSignature"] ], fu
|
||||
$routes->get('plans/findTravelAgentPlanList', 'PlanController::findTravelAgentPlanList');//Travel agent
|
||||
$routes->post('plans/addOrEditPlanRemark', 'PlanController::addOrEditPlanRemark');//Travel agent
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//api's with token
|
||||
// $routes->group('api', ['filter' => ["jwtAuth","appSignature"] ], function ($routes) {
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ use App\Models\MailTemplateModel;
|
||||
use App\Models\ReportsModel;
|
||||
use App\Models\GroupModel;
|
||||
use App\Models\PolicyModel;
|
||||
use App\Models\TravellerModel;
|
||||
use Mpdf\Mpdf;
|
||||
|
||||
class PlanController extends ResourceController
|
||||
@ -54,6 +55,7 @@ class PlanController extends ResourceController
|
||||
protected $reportsModel;
|
||||
protected $groupModel;
|
||||
protected $policyModel;
|
||||
protected $travellerModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -80,23 +82,35 @@ class PlanController extends ResourceController
|
||||
$this->reportsModel = new ReportsModel();
|
||||
$this->groupModel = new GroupModel();
|
||||
$this->policyModel = new PolicyModel();
|
||||
$this->travellerModel = new TravellerModel();
|
||||
|
||||
}
|
||||
|
||||
|
||||
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']);
|
||||
}
|
||||
@ -1307,7 +1321,8 @@ class PlanController extends ResourceController
|
||||
->where('c_user_visa_details.valid_upto >=', date('Y-m-d'))
|
||||
->findAll();
|
||||
|
||||
$userId = $plan['user_id'] ?? $plan['traveller_id'];
|
||||
$userId = !empty($plan['user_id']) ? $plan['user_id'] : $plan['traveller_id'];
|
||||
|
||||
|
||||
//current plan status
|
||||
$status = getCurrentPlanStatus($planId);
|
||||
@ -1315,7 +1330,14 @@ class PlanController extends ResourceController
|
||||
$plan['status_details'] = $status;
|
||||
|
||||
//get user data
|
||||
$plan['user_data'] = $this->userModel->where('user_id', $userId)->first();
|
||||
if($plan['user_id'] != 0){
|
||||
$plan['user_data'] = $this->userModel->where('user_id', $userId)->first();
|
||||
}else{
|
||||
$plan['user_data'] = $this->travellerModel->select('first_name,last_name,email,mobile as mobile_no')->where('traveller_id', $userId)->first();
|
||||
}
|
||||
|
||||
// dd($plan['user_data']);
|
||||
|
||||
$plan['view'] = $view;
|
||||
$data['data'] = $plan;
|
||||
// dd($data);
|
||||
@ -1467,6 +1489,7 @@ class PlanController extends ResourceController
|
||||
public function canclePlan()
|
||||
{
|
||||
$plan_id = $this->request->getGet('plan_id') ?? null;
|
||||
$updated_by = $this->request->getGet('updated_by') ?? null;
|
||||
log_message('error', "Recived plan_id: {$plan_id} in update()");
|
||||
|
||||
|
||||
@ -1475,7 +1498,7 @@ class PlanController extends ResourceController
|
||||
return $this->failNotFound('Plan ID is required');
|
||||
}
|
||||
|
||||
$return = $this->planModel->where('plan_id', $plan_id)->set(['status' => 7])->update();
|
||||
$return = $this->planModel->where('plan_id', $plan_id)->set(['status' => 7,'updated_by'=>$updated_by])->update();
|
||||
|
||||
if($return){
|
||||
|
||||
@ -1521,7 +1544,7 @@ class PlanController extends ResourceController
|
||||
// echo getUserPlanCreationRestrictionStatus($user); die;
|
||||
// print_r(getPlanApproverAction(126)); die;
|
||||
|
||||
return $this->generatePlanPdf(174, true);
|
||||
return $this->generatePlanPdf(223, true);
|
||||
die;
|
||||
|
||||
// updatePlanStatus(57); die;
|
||||
@ -1697,22 +1720,25 @@ class PlanController extends ResourceController
|
||||
return false;
|
||||
}
|
||||
|
||||
$userId = $planData['user_id'] ?? $planData['traveller_id'];
|
||||
// $userId = $planData['user_id'] ?? $planData['traveller_id'];
|
||||
$userId = !empty($planData['user_id']) ? $planData['user_id'] : $planData['created_by'];
|
||||
$userData = $this->userModel->where('user_id', $userId)->first();
|
||||
if (!$userData) {
|
||||
log_message('error', "User data not found for user_id: {$userId}");
|
||||
return false;
|
||||
}
|
||||
|
||||
$groupId = $userData['group_id'];
|
||||
|
||||
|
||||
$planStatusData = $this->planStatusModel->where('plan_id', $plan_id)->where('is_active', 1)->first();
|
||||
|
||||
$groupId = $planStatusData['group_id'];
|
||||
$groupData = $this->groupModel->where('group_id', $groupId)->first();
|
||||
if (!$groupData) {
|
||||
log_message('error', "Group data not found for group_id: {$groupId}");
|
||||
return false;
|
||||
}
|
||||
|
||||
$planStatusData = $this->planStatusModel->where('plan_id', $plan_id)->where('is_active', 1)->first();
|
||||
|
||||
|
||||
$result['traveller'] = $userData['first_name'].' '.$userData['last_name'];
|
||||
$result['group_name'] = $groupData['name'];
|
||||
|
||||
@ -42,7 +42,8 @@ if (!function_exists('palnStatusHandler')) {
|
||||
|
||||
log_message('debug', "Plan services found: " . json_encode($planServices));
|
||||
|
||||
$userId = $planData['user_id'] ?? $planData['traveller_id'];
|
||||
// $userId = $planData['user_id'] ?? $planData['traveller_id'];
|
||||
$userId = !empty($planData['user_id']) ? $planData['user_id'] : $planData['created_by'];
|
||||
$userData = $userModel->where('user_id', $userId)->first();
|
||||
if (!$userData) {
|
||||
log_message('error', "User data not found for user_id: {$userId}");
|
||||
@ -157,7 +158,9 @@ if (!function_exists('palnStatusHandler')) {
|
||||
'a4_action' => $policyA4Action,
|
||||
'is_a4_action_done' => ($policyA4Action == 'None') ? 1 : 0,
|
||||
'parallel_process_from' => $policyParallelAction,
|
||||
'policy_action' => $policyAction
|
||||
'policy_action' => $policyAction,
|
||||
'group_id'=> $groupId,
|
||||
'policy_id'=> $policyId,
|
||||
];
|
||||
|
||||
// dd($data);
|
||||
|
||||
@ -18,6 +18,8 @@ class PlanStatusModel extends Model
|
||||
'a4_id', 'a4_action', 'is_a4_action_done', 'a4_reject_reason', 'a4_action_done_on','a4_action_done_by','is_a4_mail_send',
|
||||
'parallel_process_from',
|
||||
'policy_action',
|
||||
'group_id',
|
||||
'policy_id',
|
||||
'is_active',
|
||||
'created_on', 'created_by'
|
||||
];
|
||||
|
||||
@ -192,7 +192,7 @@
|
||||
<tr class="invoice-section">
|
||||
<td class="quotation-company">
|
||||
<div>
|
||||
<span class="user-name"><?= esc($data['user_data']['first_name']) ?> <?= esc($data['user_data']['last_name']) ?> <?php if($data['user_data']['employee_code']){ echo '- '.$data['user_data']['employee_code']; } ?> </span>
|
||||
<span class="user-name"><?= esc($data['user_data']['first_name']) ?> <?= esc($data['user_data']['last_name']) ?> <?php if(isset($data['user_data']['employee_code'])){ echo '- '.$data['user_data']['employee_code']; } ?> </span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="user-email" ><?= esc($data['user_data']['email']) ?></span>,
|
||||
@ -209,7 +209,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left; border-bottom:1px solid #ddd; border-right:1px solid #ddd;">Expiry Date</td>
|
||||
<td style="text-align:left; border-bottom:1px solid #ddd; color:#6b6b6b;"><?= $data['user_data']['date_of_expiry'] ? date('d, M y', strtotime($data['user_data']['date_of_expiry'])) : '' ?></td>
|
||||
<td style="text-align:left; border-bottom:1px solid #ddd; color:#6b6b6b;"><?= !empty($data['user_data']['date_of_expiry']) ? date('d, M y', strtotime($data['user_data']['date_of_expiry'])) : '' ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left; border-bottom:1px solid #ddd; border-right:1px solid #ddd;">Place Of Issue</td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user