Add province id and municipality id #540

This commit is contained in:
Kendrick Chan 2021-03-31 17:15:27 +08:00
parent 6133b44d9a
commit fd6860442f
2 changed files with 43 additions and 1 deletions

View file

@ -199,6 +199,8 @@ class CustomerWarrantyController extends APIController
'vmodel' => $warr->getVehicleModelYear(), 'vmodel' => $warr->getVehicleModelYear(),
'dealer_name' => $warr->getDealerName(), 'dealer_name' => $warr->getDealerName(),
'dealer_address' => $warr->getDealerAddress(), 'dealer_address' => $warr->getDealerAddress(),
'province_id' => $warr->getProvinceID(),
'municipality_id' => $warr->getMunicipalityID(),
]; ];
} }
else else
@ -224,6 +226,8 @@ class CustomerWarrantyController extends APIController
'vmodel' => '', 'vmodel' => '',
'dealer_name' => '', 'dealer_name' => '',
'dealer_address' => '', 'dealer_address' => '',
'province_id' => '',
'municipality_id' => '',
]; ];
} }
@ -263,6 +267,8 @@ class CustomerWarrantyController extends APIController
'vmodel' => $other_data['vmodel'], 'vmodel' => $other_data['vmodel'],
'dealer_name' => $other_data['dealer_name'], 'dealer_name' => $other_data['dealer_name'],
'dealer_address' => $other_data['dealer_address'], 'dealer_address' => $other_data['dealer_address'],
'province_id' => $other_data['province_id'],
'municipality_id' => $other_data['municipality_id'],
]; ];
return new APIResponse(true, 'Warranty found.', $data); return new APIResponse(true, 'Warranty found.', $data);
@ -467,7 +473,11 @@ class CustomerWarrantyController extends APIController
->setDealerName($req->request->get('dealer_name')) ->setDealerName($req->request->get('dealer_name'))
->setDealerAddress($req->request->get('dealer_address')) ->setDealerAddress($req->request->get('dealer_address'))
->setCustomer($cust) ->setCustomer($cust)
->setValidated(false); ->setValidated(false)
// and more new fields
->setProvinceID($req->request->get('province_id'))
->setMunicipalityID($req->request->get('municipality_id'));
// TODO: check for date purchase and date expire // TODO: check for date purchase and date expire

View file

@ -222,6 +222,16 @@ class Warranty
*/ */
protected $customer; protected $customer;
/**
* @ORM\Column(type="string", length=11, nullable=true)
*/
protected $province_id;
/**
* @ORM\Column(type="string", length=11, nullable=true)
*/
protected $municipality_id;
public function __construct() public function __construct()
{ {
$this->date_create = new DateTime(); $this->date_create = new DateTime();
@ -626,4 +636,26 @@ class Warranty
{ {
return $this->customer; return $this->customer;
} }
public function setProvinceID($province_id)
{
$this->province_id = $province_id;
return $this;
}
public function getProvinceID()
{
return $this->province_id;
}
public function setMunicipalityID($municipality_id)
{
$this->municipality_id = $municipality_id;
return $this;
}
public function getMunicipalityID()
{
return $this->municipality_id;
}
} }