Compare commits
10 Commits
bfc6890b95
...
f8f6d10579
| Author | SHA1 | Date | |
|---|---|---|---|
| f8f6d10579 | |||
| 9a7140f5ad | |||
| 3837fd0b9b | |||
| 8586d6555a | |||
| 0b626d6297 | |||
|
|
51a079504c | ||
|
|
bf4e66ff54 | ||
|
|
5ca3f32f72 | ||
| 8816f2f323 | |||
| 562fcd943b |
@ -133,7 +133,7 @@ class App extends BaseConfig
|
||||
* @see https://www.php.net/manual/en/timezones.php for list of timezones
|
||||
* supported by PHP.
|
||||
*/
|
||||
public string $appTimezone = 'UTC';
|
||||
public $appTimezone = 'Asia/Kolkata';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
|
||||
@ -89,6 +89,7 @@ $routes->group('api', ['filter' => ["jwtAuth:Org Admin,Travel Admin,Travel Agent
|
||||
$routes->get('plans/view', 'PlanController::viewPlan');
|
||||
$routes->get('plans/plan_pdf', 'PlanController::plan_pdf');
|
||||
$routes->get('plans/plan_policy_action_status', 'PlanController::plan_policy_action_status');
|
||||
$routes->get('getHotels', 'MasterController::getHotels');
|
||||
|
||||
|
||||
|
||||
@ -103,6 +104,7 @@ $routes->group('api', ['filter' => ["jwtAuth:Org Admin,Travel Admin,User","appSi
|
||||
$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');
|
||||
|
||||
|
||||
});
|
||||
@ -143,7 +145,6 @@ $routes->group('api', ['filter' => ["jwtAuth:Org Admin,Travel Admin","appSignatu
|
||||
$routes->post('forex_signature_upload', 'MasterController::forex_signature_upload');// Org admin, Travel admin,
|
||||
$routes->get('getForexSignaturePath', 'MasterController::getForexSignaturePath');// Org admin, Travel admin,
|
||||
// Hotels Master
|
||||
$routes->get('getHotels', 'MasterController::getHotels');// Org admin, Travel admin,
|
||||
$routes->post('createHotels', 'MasterController::createHotels');// Org admin, Travel admin,
|
||||
$routes->get('findHotels', 'MasterController::findHotels');// Org admin, Travel admin,
|
||||
$routes->put('updateHotels/(:num)', 'MasterController::updateHotels/$1');// Org admin, Travel admin,
|
||||
@ -176,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) {
|
||||
@ -183,15 +185,9 @@ $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
|
||||
|
||||
|
||||
});
|
||||
|
||||
$routes->group('api', ['filter' => ["jwtAuth:User","appSignature"] ], function ($routes) {
|
||||
|
||||
$routes->get('plans', 'PlanController::userPlans');
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
@ -115,6 +115,9 @@ class AuthController extends ResourceController
|
||||
return $this->failUnauthorized($msg);
|
||||
}
|
||||
|
||||
//store last login
|
||||
$lastLoginBeforeUpdate = $user['last_login_at'];
|
||||
|
||||
// Reset failed attempts after successful login
|
||||
$this->userModel->update($user['user_id'], [
|
||||
'failed_attempts' => 0,
|
||||
@ -123,11 +126,16 @@ class AuthController extends ResourceController
|
||||
]);
|
||||
|
||||
// Format date for FE
|
||||
$user = $this->userModel->select('user_id,first_name,last_name,role_id,org_id,group_id,last_login_at')->where('email', $data->email)->first();
|
||||
$user['last_login_at'] = !empty($user['last_login_at'])
|
||||
? date('d, M-Y h:iA', strtotime($user['last_login_at']))
|
||||
: null;
|
||||
$user = $this->userModel->select('user_id,first_name,last_name,role_id,org_id,group_id,last_login_at,agent_supported_service_ids')->where('email', $data->email)->first();
|
||||
$user['last_login_at'] = empty($lastLoginBeforeUpdate)
|
||||
? null
|
||||
: date('d, M-Y h:iA', strtotime($lastLoginBeforeUpdate));
|
||||
|
||||
//get role
|
||||
$user['role'] = $this->userModel->getRole($user['role_id']);
|
||||
|
||||
if($user['role_id'] != 5)
|
||||
{
|
||||
|
||||
//get service for the organization
|
||||
$orgService = $this->organizationModel->find($user['org_id']);
|
||||
@ -140,12 +148,25 @@ class AuthController extends ResourceController
|
||||
$user['service'][$key]['order'] = $serviceData['order'];
|
||||
}
|
||||
|
||||
//get role
|
||||
$user['role'] = $this->userModel->getRole($user['role_id']);
|
||||
|
||||
//find user has the all access
|
||||
$user['plan_action'] = getUserPlanCreationRestrictionStatus($user);
|
||||
|
||||
}else{
|
||||
|
||||
$user['service'] = json_decode($user['agent_supported_service_ids'],true);
|
||||
foreach ($user['service'] as $key => $value)
|
||||
{
|
||||
$serviceData = $this->serviceModel->find($value['service_id']);
|
||||
$user['service'][$key]['name'] = $serviceData['name'];
|
||||
$user['service'][$key]['icon'] = $serviceData['icon'];
|
||||
$user['service'][$key]['order'] = $serviceData['order'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Generate JWT Token
|
||||
$token = generateJWT($user);
|
||||
|
||||
|
||||
@ -637,6 +637,8 @@ class MasterController extends ResourceController
|
||||
public function forex_signature_upload()
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
$data = $this->request->getPost();
|
||||
|
||||
// Handle file upload
|
||||
@ -657,14 +659,14 @@ class MasterController extends ResourceController
|
||||
return $this->failValidationErrors(['passport_document' => 'Invalid file upload']);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
|
||||
$this->mailTemplateModel->set(['image_location' => $newName])->where('template_name','forex')->update();
|
||||
|
||||
|
||||
return $this->respondCreated([
|
||||
return $this->respond([
|
||||
'status' => 201,
|
||||
'message' => 'organization created successfully',
|
||||
'message' => 'uploaded successfully',
|
||||
'data' => $data
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@ -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,6 +82,7 @@ class PlanController extends ResourceController
|
||||
$this->reportsModel = new ReportsModel();
|
||||
$this->groupModel = new GroupModel();
|
||||
$this->policyModel = new PolicyModel();
|
||||
$this->travellerModel = new TravellerModel();
|
||||
|
||||
}
|
||||
|
||||
@ -1318,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);
|
||||
@ -1326,7 +1330,14 @@ class PlanController extends ResourceController
|
||||
$plan['status_details'] = $status;
|
||||
|
||||
//get user data
|
||||
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);
|
||||
@ -1478,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()");
|
||||
|
||||
|
||||
@ -1486,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){
|
||||
|
||||
@ -1532,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;
|
||||
@ -1708,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'];
|
||||
|
||||
@ -43,10 +43,10 @@ class ReportsController extends BaseController
|
||||
}
|
||||
|
||||
// Separate domestic
|
||||
$domestic = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'domestic'));
|
||||
$domestic = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'Domestic'));
|
||||
|
||||
// Separate international
|
||||
$international = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'international'));
|
||||
$international = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'International'));
|
||||
|
||||
if(isset($data['export']))
|
||||
{
|
||||
@ -108,10 +108,10 @@ class ReportsController extends BaseController
|
||||
}
|
||||
|
||||
// Separate domestic
|
||||
$domestic = array_values(array_filter($flat_result, fn($row) => $row['plan_trip_type'] === 'domestic'));
|
||||
$domestic = array_values(array_filter($flat_result, fn($row) => $row['plan_trip_type'] === 'Domestic'));
|
||||
|
||||
// Separate international
|
||||
$international = array_values(array_filter($flat_result, fn($row) => $row['plan_trip_type'] === 'international'));
|
||||
$international = array_values(array_filter($flat_result, fn($row) => $row['plan_trip_type'] === 'International'));
|
||||
|
||||
|
||||
|
||||
@ -167,10 +167,10 @@ class ReportsController extends BaseController
|
||||
}
|
||||
|
||||
// Separate domestic
|
||||
$domestic = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'domestic'));
|
||||
$domestic = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'Domestic'));
|
||||
|
||||
// Separate international
|
||||
$international = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'international'));
|
||||
$international = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'International'));
|
||||
|
||||
if(isset($data['export']))
|
||||
{
|
||||
@ -222,10 +222,10 @@ class ReportsController extends BaseController
|
||||
}
|
||||
|
||||
// Separate domestic
|
||||
$domestic = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'domestic'));
|
||||
$domestic = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'Domestic'));
|
||||
|
||||
// Separate international
|
||||
$international = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'international'));
|
||||
$international = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'International'));
|
||||
|
||||
|
||||
if(isset($data['export']))
|
||||
@ -324,10 +324,10 @@ class ReportsController extends BaseController
|
||||
}
|
||||
|
||||
// Separate domestic
|
||||
$domestic = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'domestic'));
|
||||
$domestic = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'Domestic'));
|
||||
|
||||
// Separate international
|
||||
$international = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'international'));
|
||||
$international = array_values(array_filter($result, fn($row) => $row['plan_trip_type'] === 'International'));
|
||||
|
||||
if(isset($data['export']))
|
||||
{
|
||||
|
||||
@ -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'
|
||||
];
|
||||
|
||||
@ -21,8 +21,8 @@ class ReportsModel extends Model
|
||||
m_plan.so_number,
|
||||
m_cost_center.name AS cost_center,
|
||||
CASE
|
||||
WHEN m_plan.trip_type = 1 THEN 'domestic'
|
||||
WHEN m_plan.trip_type = 2 THEN 'international'
|
||||
WHEN m_plan.trip_type = 1 THEN 'Domestic'
|
||||
WHEN m_plan.trip_type = 2 THEN 'International'
|
||||
ELSE 'unknown'
|
||||
END AS plan_trip_type,
|
||||
al.Service,
|
||||
@ -124,8 +124,8 @@ class ReportsModel extends Model
|
||||
'{$serviceAlias}' As 'Service',
|
||||
COUNT(*) AS service_count,
|
||||
CASE
|
||||
WHEN m_plan.trip_type = 1 THEN 'domestic'
|
||||
WHEN m_plan.trip_type = 2 THEN 'international'
|
||||
WHEN m_plan.trip_type = 1 THEN 'Domestic'
|
||||
WHEN m_plan.trip_type = 2 THEN 'International'
|
||||
ELSE 'unknown'
|
||||
END AS plan_trip_type
|
||||
FROM
|
||||
@ -169,8 +169,8 @@ class ReportsModel extends Model
|
||||
m_cost_center.name AS cost_center,
|
||||
c_flight.trip_type AS flight_trip_type,
|
||||
CASE
|
||||
WHEN m_plan.trip_type = 1 THEN 'domestic'
|
||||
WHEN m_plan.trip_type = 2 THEN 'international'
|
||||
WHEN m_plan.trip_type = 1 THEN 'Domestic'
|
||||
WHEN m_plan.trip_type = 2 THEN 'International'
|
||||
ELSE 'unknown'
|
||||
END AS plan_trip_type,
|
||||
-- CONCAT_WS(' - ',
|
||||
@ -230,8 +230,8 @@ class ReportsModel extends Model
|
||||
m_plan.so_number,
|
||||
m_cost_center.name AS cost_center,
|
||||
CASE
|
||||
WHEN m_plan.trip_type = 1 THEN 'domestic'
|
||||
WHEN m_plan.trip_type = 2 THEN 'international'
|
||||
WHEN m_plan.trip_type = 1 THEN 'Domestic'
|
||||
WHEN m_plan.trip_type = 2 THEN 'International'
|
||||
ELSE 'unknown'
|
||||
END AS plan_trip_type,
|
||||
c_accomodation.hotel_name AS hotel_name,
|
||||
@ -331,8 +331,8 @@ class ReportsModel extends Model
|
||||
m_cost_center.name AS cost_center,
|
||||
c_flight.trip_type AS flight_trip_type,
|
||||
CASE
|
||||
WHEN m_plan.trip_type = 1 THEN 'domestic'
|
||||
WHEN m_plan.trip_type = 2 THEN 'international'
|
||||
WHEN m_plan.trip_type = 1 THEN 'Domestic'
|
||||
WHEN m_plan.trip_type = 2 THEN 'International'
|
||||
ELSE 'unknown'
|
||||
END AS plan_trip_type,
|
||||
CONCAT_WS(' - ',
|
||||
|
||||
@ -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