FIX_VEHICLE_TYPE_ISSUE
This commit is contained in:
parent
dc2a945a06
commit
a8410eef37
@ -12,6 +12,57 @@ class PolicyController extends ResourceController
|
|||||||
protected $QuotationModel;
|
protected $QuotationModel;
|
||||||
protected $EnquiryModel;
|
protected $EnquiryModel;
|
||||||
|
|
||||||
|
protected $tier1VehicleTypeMap = [
|
||||||
|
|
||||||
|
/* ---------------- Two Wheeler ---------------- */
|
||||||
|
'two wheeler' => 'Two Wheeler',
|
||||||
|
'2 wheeler' => 'Two Wheeler',
|
||||||
|
'2w' => 'Two Wheeler',
|
||||||
|
'motorcycle' => 'Two Wheeler',
|
||||||
|
'bike' => 'Two Wheeler',
|
||||||
|
'scooter' => 'Two Wheeler',
|
||||||
|
'moped' => 'Two Wheeler',
|
||||||
|
|
||||||
|
/* ---------------- Four Wheeler ---------------- */
|
||||||
|
'four wheeler' => 'Four Wheeler',
|
||||||
|
'4 wheeler' => 'Four Wheeler',
|
||||||
|
'4w' => 'Four Wheeler',
|
||||||
|
'private car' => 'Four Wheeler',
|
||||||
|
'car' => 'Four Wheeler',
|
||||||
|
'jeep' => 'Four Wheeler',
|
||||||
|
|
||||||
|
/* ---------------- Goods Vehicle ---------------- */
|
||||||
|
'goods vehicle' => 'Goods Vehicle',
|
||||||
|
'good vehicle' => 'Goods Vehicle',
|
||||||
|
'goods carrier' => 'Goods Vehicle',
|
||||||
|
'goods carrying vehicle' => 'Goods Vehicle',
|
||||||
|
'cargo vehicle' => 'Goods Vehicle',
|
||||||
|
'lorry' => 'Goods Vehicle',
|
||||||
|
'truck' => 'Goods Vehicle',
|
||||||
|
'transport vehicle goods'=> 'Goods Vehicle',
|
||||||
|
|
||||||
|
/* ---------------- Commercial Vehicle ---------------- */
|
||||||
|
'commercial vehicle' => 'Commercial Vehicle',
|
||||||
|
'commercial car' => 'Commercial Vehicle',
|
||||||
|
'taxi' => 'Commercial Vehicle',
|
||||||
|
'cab' => 'Commercial Vehicle',
|
||||||
|
'hire vehicle' => 'Commercial Vehicle',
|
||||||
|
'passenger commercial' => 'Commercial Vehicle',
|
||||||
|
|
||||||
|
/* ---------------- Bus ---------------- */
|
||||||
|
'bus' => 'Bus',
|
||||||
|
'passenger bus' => 'Bus',
|
||||||
|
'school bus' => 'Bus',
|
||||||
|
'private bus' => 'Bus',
|
||||||
|
'stage carriage' => 'Bus',
|
||||||
|
|
||||||
|
/* ---------------- Tractor ---------------- */
|
||||||
|
'tractor' => 'Tractor',
|
||||||
|
'agricultural tractor' => 'Tractor',
|
||||||
|
'farm tractor' => 'Tractor',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->PolicyModel = new PolicyModel();
|
$this->PolicyModel = new PolicyModel();
|
||||||
@ -477,6 +528,15 @@ class PolicyController extends ResourceController
|
|||||||
|
|
||||||
$data = $readDoc['data'];
|
$data = $readDoc['data'];
|
||||||
|
|
||||||
|
$vehicleType = $data['vehicle']['vehicle_type'] ?? null;
|
||||||
|
if($vehicleType !== null)
|
||||||
|
{
|
||||||
|
$vehicleType = $this->resolveVehicleTypeTier1($vehicleType);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$vehicleType = 'UN_IDEN_DOC'
|
||||||
|
}
|
||||||
//update data in to policy table
|
//update data in to policy table
|
||||||
$policyData['policy_number'] = $data['policy']['policy_number'] ?? null;
|
$policyData['policy_number'] = $data['policy']['policy_number'] ?? null;
|
||||||
$policyData['issued_date'] = $data['policy']['issue_date'] ?? null;
|
$policyData['issued_date'] = $data['policy']['issue_date'] ?? null;
|
||||||
@ -501,7 +561,7 @@ class PolicyController extends ResourceController
|
|||||||
$policyData['make'] = $data['vehicle']['make'] ?? null;
|
$policyData['make'] = $data['vehicle']['make'] ?? null;
|
||||||
$policyData['model'] = $data['vehicle']['model'] ?? null;
|
$policyData['model'] = $data['vehicle']['model'] ?? null;
|
||||||
$policyData['cubic_capacity'] = $data['vehicle']['cubic_capacity'] ?? null;
|
$policyData['cubic_capacity'] = $data['vehicle']['cubic_capacity'] ?? null;
|
||||||
$policyData['vehicle_type'] = $data['vehicle']['vehicle_type'] ?? null;
|
$policyData['vehicle_type'] = $vehicleType;
|
||||||
$policyData['rc_no'] = $data['vehicle']['reg_no'] ?? null;
|
$policyData['rc_no'] = $data['vehicle']['reg_no'] ?? null;
|
||||||
|
|
||||||
|
|
||||||
@ -953,6 +1013,17 @@ class PolicyController extends ResourceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function resolveVehicleTypeTier1(string $incoming)
|
||||||
|
{
|
||||||
|
|
||||||
|
$value = strtolower(trim($incoming));
|
||||||
|
$value = preg_replace('/\s+/', ' ', $value); // normalize spaces
|
||||||
|
|
||||||
|
return $this->phraseMap[$value] ?? 'UN_IDEN_TYPE';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user