diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index 3367a365..08a90c5a 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -635,7 +635,7 @@ class APIController extends Controller 'size_id' => $batt->getSize()->getID(), 'size_name' => $batt->getSize()->getName(), 'price' => $batt->getSellingPrice(), - 'wty_personal' => $batt->getWarrantyPersonal(), + 'wty_private' => $batt->getWarrantyPrivate(), 'wty_commercial' => $batt->getWarrantyCommercial(), ]; } diff --git a/src/Controller/BatteryController.php b/src/Controller/BatteryController.php index 9991d5d5..238738f7 100644 --- a/src/Controller/BatteryController.php +++ b/src/Controller/BatteryController.php @@ -116,7 +116,7 @@ class BatteryController extends BaseController $row['size_name'] = $orow['size_name']; $row['prod_code'] = $orow[0]->getProductCode(); $row['sell_price'] = $orow[0]->getSellingPrice(); - $row['warr_personal'] = $orow[0]->getWarrantyPersonal(); + $row['warr_private'] = $orow[0]->getWarrantyPrivate(); $row['warr_commercial'] = $orow[0]->getWarrantyCommercial(); $row['res_capacity'] = $orow[0]->getReserveCapacity(); $row['length'] = $orow[0]->getLength(); @@ -176,7 +176,7 @@ class BatteryController extends BaseController // set and save values $row->setProductCode($req->request->get('prod_code')) - ->setWarrantyPersonal($req->request->get('warr_personal')) + ->setWarrantyPrivate($req->request->get('warr_private')) ->setWarrantyCommercial($req->request->get('warr_commercial')) ->setReserveCapacity($req->request->get('res_capacity')) ->setLength($req->request->get('length')) @@ -296,7 +296,7 @@ class BatteryController extends BaseController // set and save values $row->setProductCode($req->request->get('prod_code')) - ->setWarrantyPersonal($req->request->get('warr_personal')) + ->setWarrantyPrivate($req->request->get('warr_private')) ->setWarrantyCommercial($req->request->get('warr_commercial')) ->setReserveCapacity($req->request->get('res_capacity')) ->setLength($req->request->get('length')) diff --git a/src/Controller/BatteryManufacturerController.php b/src/Controller/BatteryManufacturerController.php index e0836c5d..d68b96f3 100644 --- a/src/Controller/BatteryManufacturerController.php +++ b/src/Controller/BatteryManufacturerController.php @@ -289,7 +289,10 @@ class BatteryManufacturerController extends BaseController 'mfg_name' => $battery->getManufacturer()->getName(), 'model_name' => $battery->getModel()->getName(), 'size_name' => $battery->getSize()->getName(), - 'prod_code' => $battery->getProductCode() + 'prod_code' => $battery->getProductCode(), + 'sell_price' => $battery->getSellingPrice(), + 'warr_private' => $battery->getWarrantyPrivate(), + 'warr_commercial' => $battery->getWarrantyCommercial(), ]; } diff --git a/src/Controller/CustomerController.php b/src/Controller/CustomerController.php index e93f867f..0081d61e 100644 --- a/src/Controller/CustomerController.php +++ b/src/Controller/CustomerController.php @@ -3,6 +3,7 @@ namespace App\Controller; use App\Ramcar\BaseController; +use App\Ramcar\CustomerClassification; use App\Ramcar\FuelType; use App\Ramcar\VehicleStatusCondition; use App\Entity\Customer; @@ -103,10 +104,19 @@ class CustomerController extends BaseController // process rows $rows = []; foreach ($obj_rows as $orow) { + $classifications = CustomerClassification::getCollection(); + // add row data $row['id'] = $orow->getID(); $row['first_name'] = $orow->getFirstName(); $row['last_name'] = $orow->getLastName(); + $row['customer_classification'] = $classifications[$orow->getCustomerClassification()]; + $row['flag_mobile_app'] = $orow->hasMobileApp(); + $row['app_mobile_number'] = $orow->hasMobileApp() && !empty($orow->getMobileSessions()) ? $orow->getMobileSessions()[0]->getPhoneNumber() : ''; + + // TODO: properly add mobile numbers and plate numbers as searchable/sortable fields, use doctrine events + $row['mobile_numbers'] = implode("
", $orow->getMobileNumberList()); + $row['plate_numbers'] = implode("
", $orow->getPlateNumberList()); // add row metadata $row['meta'] = [ @@ -143,6 +153,7 @@ class CustomerController extends BaseController // get parent associations $params['bmfgs'] = $em->getRepository(BatteryManufacturer::class)->findAll(); $params['vmfgs'] = $em->getRepository(VehicleManufacturer::class)->findAll(); + $params['classifications'] = CustomerClassification::getCollection(); $params['fuel_types'] = FuelType::getCollection(); $params['status_conditions'] = VehicleStatusCondition::getCollection(); @@ -163,8 +174,8 @@ class CustomerController extends BaseController // set and save values $row->setFirstName($req->request->get('first_name')) ->setLastName($req->request->get('last_name')) - ->setCustomerNotes($req->request->get('customer_notes')) - ->setConfirmed(false); + ->setCustomerClassification($req->request->get('customer_classification')) + ->setCustomerNotes($req->request->get('customer_notes')); // initialize error lists $error_array = []; @@ -317,6 +328,7 @@ class CustomerController extends BaseController // get parent associations $params['bmfgs'] = $em->getRepository(BatteryManufacturer::class)->findAll(); $params['vmfgs'] = $em->getRepository(VehicleManufacturer::class)->findAll(); + $params['classifications'] = CustomerClassification::getCollection(); $params['fuel_types'] = FuelType::getCollection(); $params['status_conditions'] = VehicleStatusCondition::getCollection(); @@ -343,6 +355,7 @@ class CustomerController extends BaseController // set and save values $row->setFirstName($req->request->get('first_name')) ->setLastName($req->request->get('last_name')) + ->setCustomerClassification($req->request->get('customer_classification')) ->setCustomerNotes($req->request->get('customer_notes')); // initialize error lists @@ -716,6 +729,7 @@ class CustomerController extends BaseController if (isset($datatable['query']['data-rows-search']) && !empty($datatable['query']['data-rows-search'])) { $query->where('q.first_name LIKE :filter') ->orWhere('q.last_name LIKE :filter') + ->orWhere('q.customer_classification LIKE :filter') ->setParameter('filter', '%' . $datatable['query']['data-rows-search'] . '%'); } } diff --git a/src/Controller/HubController.php b/src/Controller/HubController.php index 8df4f6d4..5d361eee 100644 --- a/src/Controller/HubController.php +++ b/src/Controller/HubController.php @@ -84,6 +84,7 @@ class HubController extends BaseController // add row data $row['id'] = $orow->getID(); $row['name'] = $orow->getName(); + $row['branch'] = $orow->getBranch(); $row['address'] = $orow->getAddress(); $row['contact_nums'] = $orow->getContactNumbers(); $row['time_open'] = $orow->getTimeOpen()->format('g:i A'); @@ -135,6 +136,7 @@ class HubController extends BaseController // set and save values $obj->setName($req->request->get('name')) + ->setBranch($req->request->get('branch')) ->setAddress($req->request->get('address')) ->setContactNumbers($req->request->get('contact_nums')) ->setTimeOpen($time_open) diff --git a/src/Controller/JobOrderController.php b/src/Controller/JobOrderController.php index cda7fa32..5f101732 100644 --- a/src/Controller/JobOrderController.php +++ b/src/Controller/JobOrderController.php @@ -5,6 +5,7 @@ namespace App\Controller; use App\Ramcar\BaseController; use App\Ramcar\ServiceType; use App\Ramcar\JOStatus; +use App\Ramcar\WarrantyClass; use App\Entity\JobOrder; use App\Entity\BatteryManufacturer; use App\Entity\Customer; @@ -43,6 +44,7 @@ class JobOrderController extends BaseController $params['outlet'] = $em->getRepository(Outlet::class)->findAll(); $params['rider'] = $em->getRepository(Rider::class)->findAll(); $params['service_types'] = ServiceType::getCollection(); + $params['warranty_classes'] = WarrantyClass::getCollection(); $params['statuses'] = JOStatus::getCollection(); // response @@ -88,6 +90,7 @@ class JobOrderController extends BaseController ->setAdvanceOrder($req->request->get('flag_advance') ?? false) ->setCreatedBy($this->getUser()) ->setServiceType($req->request->get('service_type')) + ->setWarrantyClass($req->request->get('warranty_class')) ->setCustomer($cust_vehicle->getCustomer()) ->setCustomerVehicle($cust_vehicle) ->setSource('web') @@ -188,9 +191,7 @@ class JobOrderController extends BaseController $datatable = $req->request->get('datatable'); // count total records - $tquery = $qb->select('COUNT(q)') - ->join('q.cus_vehicle', 'cv') - ->join('q.customer', 'c'); + $tquery = $qb->select('COUNT(q)'); $this->setQueryFilters($datatable, $tquery, $qb, $tier_params['jo_status']); @@ -214,22 +215,14 @@ class JobOrderController extends BaseController ]; // build query - $query = $qb->select('q') - ->addSelect('cv.plate_number as plate_number') - ->addSelect('c.first_name as customer_name') - ->addSelect('c.last_name as cust_last_name'); + $query = $qb->select('q'); $this->setQueryFilters($datatable, $query, $qb, $tier_params['jo_status']); // check if sorting is present, otherwise use default if (isset($datatable['sort']['field']) && !empty($datatable['sort']['field'])) { - $prefix = ''; - - if (!in_array($datatable['sort']['field'], ['plate_number', 'customer_name'])) - $prefix = 'q.'; - $order = $datatable['sort']['sort'] ?? 'asc'; - $query->orderBy($prefix . $datatable['sort']['field'], $order); + $query->orderBy('q.' . $datatable['sort']['field'], $order); } else { $query->orderBy('q.date_schedule', 'asc'); } @@ -243,26 +236,16 @@ class JobOrderController extends BaseController // process rows $rows = []; foreach ($obj_rows as $orow) { - // get service type name - $service_type = false; + $statuses = JOStatus::getCollection(); $service_types = ServiceType::getCollection(); - foreach ($service_types as $key => $service) { - if ($key == $orow[0]->getServiceType()) { - $service_type = $service; - break; - } - } // add row data - $row['id'] = $orow[0]->getID(); - $row['date_schedule'] = $orow[0]->getDateSchedule()->format("d M Y"); - $row['date_schedule_time'] = $orow[0]->getDateSchedule()->format("g:i A"); - $row['service_type'] = $service_type; - $row['plate_number'] = $orow['plate_number']; - $row['customer_name'] = $orow['customer_name'] . " " . $orow['cust_last_name']; - $row['mobile_numbers'] = implode("
", $orow[0]->getCustomer()->getMobileNumberList()); - $row['source'] = ucfirst($orow[0]->getSource()); - $row['flag_advance'] = $orow[0]->isAdvanceOrder(); + $row['id'] = $orow->getID(); + $row['delivery_address'] = $orow->getDeliveryAddress(); + $row['date_schedule'] = $orow->isAdvanceOrder() ? $orow->getDateSchedule()->format("d M Y g:i A") : 'Immediate'; + $row['service_type'] = $service_types[$orow->getServiceType()]; + $row['status'] = $statuses[$orow->getStatus()]; + $row['flag_advance'] = $orow->isAdvanceOrder(); // add crud urls $row['meta']['update_url'] = $this->generateUrl($tier_params['edit_route'], ['id' => $row['id']]); @@ -296,6 +279,7 @@ class JobOrderController extends BaseController $params['bmfgs'] = $em->getRepository(BatteryManufacturer::class)->findAll(); $params['customers'] = $em->getRepository(Customer::class)->findAll(); $params['service_types'] = ServiceType::getCollection(); + $params['warranty_classes'] = WarrantyClass::getCollection(); $params['statuses'] = JOStatus::getCollection(); // get closest outlets @@ -378,6 +362,7 @@ class JobOrderController extends BaseController ->setCoordinates($point) ->setAdvanceOrder($req->request->get('flag_advance') ?? false) ->setServiceType($req->request->get('service_type')) + ->setWarrantyClass($req->request->get('warranty_class')) ->setSource('web') ->setStatus($req->request->get('status')) ->setDeliveryInstructions($req->request->get('delivery_instructions')) @@ -431,6 +416,7 @@ class JobOrderController extends BaseController $params['bmfgs'] = $em->getRepository(BatteryManufacturer::class)->findAll(); $params['customers'] = $em->getRepository(Customer::class)->findAll(); $params['service_types'] = ServiceType::getCollection(); + $params['warranty_classes'] = WarrantyClass::getCollection(); $params['statuses'] = JOStatus::getCollection(); // get closest outlets @@ -513,6 +499,7 @@ class JobOrderController extends BaseController ->setCoordinates($point) ->setAdvanceOrder($req->request->get('flag_advance') ?? false) ->setServiceType($req->request->get('service_type')) + ->setWarrantyClass($req->request->get('warranty_class')) ->setSource('web') ->setStatus($req->request->get('status')) ->setDeliveryInstructions($req->request->get('delivery_instructions')) diff --git a/src/Controller/OutletController.php b/src/Controller/OutletController.php index da270a2c..65d2a1b8 100644 --- a/src/Controller/OutletController.php +++ b/src/Controller/OutletController.php @@ -96,6 +96,7 @@ class OutletController extends BaseController // add row data $row['id'] = $orow[0]->getID(); $row['name'] = $orow[0]->getName(); + $row['branch'] = $orow[0]->getBranch(); $row['address'] = $orow[0]->getAddress(); $row['contact_nums'] = $orow[0]->getContactNumbers(); $row['time_open'] = $orow[0]->getTimeOpen()->format('g:i A'); @@ -153,6 +154,7 @@ class OutletController extends BaseController // set and save values $obj->setName($req->request->get('name')) + ->setBranch($req->request->get('branch')) ->setAddress($req->request->get('address')) ->setContactNumbers($req->request->get('contact_nums')) ->setTimeOpen($time_open) @@ -165,6 +167,7 @@ class OutletController extends BaseController if (isset($datatable['query']['data-rows-search']) && !empty($datatable['query']['data-rows-search'])) { $query->where('hub.name LIKE :filter') ->orWhere('q.name LIKE :filter') + ->orWhere('q.branch LIKE :filter') ->orWhere('q.address LIKE :filter') ->setParameter('filter', '%' . $datatable['query']['data-rows-search'] . '%'); } diff --git a/src/Entity/Battery.php b/src/Entity/Battery.php index 8af81bcc..07d9d33c 100644 --- a/src/Entity/Battery.php +++ b/src/Entity/Battery.php @@ -71,7 +71,7 @@ class Battery * @ORM\Column(type="smallint") * @Assert\NotBlank() */ - protected $warr_personal; + protected $warr_private; // warranty commercial /** @@ -118,6 +118,8 @@ class Battery // selling price (vat inclusive) /** * @ORM\Column(type="decimal", precision=7, scale=2, nullable=true) + * @Assert\NotBlank() + * @Assert\Range(min=0, minMessage="This value should be a valid number.") */ protected $sell_price; @@ -193,15 +195,15 @@ class Battery return $this->prod_code; } - public function setWarrantyPersonal($warr_personal) + public function setWarrantyPrivate($warr_private) { - $this->warr_personal = $warr_personal; + $this->warr_private = $warr_private; return $this; } - public function getWarrantyPersonal() + public function getWarrantyPrivate() { - return $this->warr_personal; + return $this->warr_private; } public function setWarrantyCommercial($warr_commercial) diff --git a/src/Entity/Customer.php b/src/Entity/Customer.php index f9939d1f..fb1b083b 100644 --- a/src/Entity/Customer.php +++ b/src/Entity/Customer.php @@ -34,6 +34,13 @@ class Customer */ protected $last_name; + // customer classification + /** + * @ORM\Column(type="string", length=80) + * @Assert\NotBlank() + */ + protected $customer_classification; + /** * @ORM\Column(type="text", length=80) */ @@ -75,12 +82,21 @@ class Customer */ protected $flag_confirmed; + // if registered on mobile app + /** + * @ORM\Column(type="boolean") + */ + protected $flag_mobile_app; + public function __construct() { $this->numbers = new ArrayCollection(); $this->sessions = new ArrayCollection(); $this->vehicles = new ArrayCollection(); $this->job_orders = new ArrayCollection(); + + $this->flag_confirmed = false; + $this->flag_mobile_app = false; } public function getID() @@ -110,6 +126,17 @@ class Customer return $this->last_name; } + public function setCustomerClassification($customer_classification) + { + $this->customer_classification = $customer_classification; + return $this; + } + + public function getCustomerClassification() + { + return $this->customer_classification; + } + public function setCustomerNotes($customer_notes) { $this->customer_notes = $customer_notes; @@ -147,6 +174,15 @@ class Customer return $numbers; } + public function getPlateNumberList() + { + $plate_numbers = []; + foreach ($this->vehicles as $vehicle) + $plate_numbers[] = $vehicle->getPlateNumber(); + + return $plate_numbers; + } + public function addMobileSession(MobileSession $session) { $this->sessions->add($session); @@ -192,6 +228,17 @@ class Customer return $this->flag_confirmed; } + public function setHasMobileApp($flag_mobile_app = true) + { + $this->flag_mobile_app = $flag_mobile_app; + return $this; + } + + public function hasMobileApp() + { + return $this->flag_mobile_app; + } + public function getJobOrders() { return $this->job_orders; diff --git a/src/Entity/Hub.php b/src/Entity/Hub.php index 1251cf03..74eb1b41 100644 --- a/src/Entity/Hub.php +++ b/src/Entity/Hub.php @@ -2,64 +2,20 @@ namespace App\Entity; +use App\Ramcar\Location; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; use Symfony\Component\Validator\Constraints as Assert; -use CrEOF\Spatial\PHP\Types\Geometry\Point; use DateTime; - /** * @ORM\Entity * @ORM\Table(name="hub") */ class Hub { - // unique id - /** - * @ORM\Id - * @ORM\Column(type="integer") - * @ORM\GeneratedValue(strategy="AUTO") - */ - protected $id; - - // name of hub - /** - * @ORM\Column(type="string", length=80) - */ - protected $name; - - // address - /** - * @ORM\Column(type="string", length=80) - */ - protected $address; - - // address coordinates - /** - * @ORM\Column(type="point") - */ - protected $coordinates; - - // contact numbers - // this is displayed in a textarea - /** - * @ORM\Column(type="string", length=200) - */ - protected $contact_nums; - - // opening time - /** - * @ORM\Column(type="time") - */ - protected $time_open; - - // closing time - /** - * @ORM\Column(type="time") - */ - protected $time_close; + use Location; // riders assigned to this hub /** @@ -75,81 +31,10 @@ class Hub public function __construct() { - $this->riders = new ArrayCollection(); $this->time_open = new DateTime(); $this->time_close = new DateTime(); - - } - - public function getID() - { - return $this->id; - } - - public function setName($name) - { - $this->name = $name; - return $this; - } - - public function getName() - { - return $this->name; - } - - public function setAddress($address) - { - $this->address = $address; - return $this; - } - - public function getAddress() - { - return $this->address; - } - - public function setCoordinates(Point $point) - { - $this->coordinates = $point; - return $this; - } - - public function getCoordinates() - { - return $this->coordinates; - } - - public function setContactNumbers($nums) - { - $this->contact_nums = $nums; - return $this; - } - - public function getContactNumbers() - { - return $this->contact_nums; - } - - public function setTimeOpen(DateTime $time_open) - { - $this->time_open = $time_open; - return $this; - } - - public function getTimeOpen() - { - return $this->time_open; - } - - public function setTimeClose(DateTime $time_close) - { - $this->time_close = $time_close; - return $this; - } - - public function getTimeClose() - { - return $this->time_close; + $this->riders = new ArrayCollection(); + $this->outlets = new ArrayCollection(); } public function getRiders() diff --git a/src/Entity/JobOrder.php b/src/Entity/JobOrder.php index 201052b4..c834bca4 100644 --- a/src/Entity/JobOrder.php +++ b/src/Entity/JobOrder.php @@ -86,6 +86,12 @@ class JobOrder */ protected $service_type; + // warranty class + /** + * @ORM\Column(type="string", length=25) + */ + protected $warranty_class; + // customer that requested job order /** * @ORM\ManyToOne(targetEntity="Customer", inversedBy="job_orders") @@ -142,7 +148,8 @@ class JobOrder // delivery address /** - * @ORM\Column(type="text", nullable=true) + * @ORM\Column(type="text") + * @Assert\NotBlank() */ protected $delivery_address; @@ -259,6 +266,17 @@ class JobOrder return $this->service_type; } + public function setWarrantyClass($warranty_class) + { + $this->warranty_class = $warranty_class; + return $this; + } + + public function getWarrantyClass() + { + return $this->warranty_class; + } + public function setCustomer(Customer $customer) { $this->customer = $customer; diff --git a/src/Entity/Outlet.php b/src/Entity/Outlet.php index abd7aa22..c52dcd36 100644 --- a/src/Entity/Outlet.php +++ b/src/Entity/Outlet.php @@ -2,11 +2,11 @@ namespace App\Entity; +use App\Ramcar\Location; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; use Symfony\Component\Validator\Constraints as Assert; -use CrEOF\Spatial\PHP\Types\Geometry\Point; use DateTime; /** @@ -15,55 +15,7 @@ use DateTime; */ class Outlet { - // unique id - /** - * @ORM\Id - * @ORM\Column(type="integer") - * @ORM\GeneratedValue(strategy="AUTO") - */ - protected $id; - - // name of enrollee - /** - * @ORM\Column(type="string", length=80) - * @Assert\NotBlank() - */ - protected $name; - - // address - /** - * @ORM\Column(type="string", length=80) - * @Assert\NotBlank() - */ - protected $address; - - // address coordinates - /** - * @ORM\Column(type="point") - */ - protected $coordinates; - - // contact numbers - // this is displayed in a textarea - /** - * @ORM\Column(type="string", length=200) - * @Assert\NotBlank() - */ - protected $contact_nums; - - // opening time - /** - * @ORM\Column(type="time") - * @Assert\NotBlank() - */ - protected $time_open; - - // closing time - /** - * @ORM\Column(type="time") - * @Assert\NotBlank() - */ - protected $time_close; + use Location; // job orders assigned to outlet /** @@ -81,78 +33,12 @@ class Outlet { $this->time_open = new DateTime(); $this->time_close = new DateTime(); + $this->job_orders = new ArrayCollection(); } - - public function getID() + public function getJobOrders() { - return $this->id; - } - - public function setName($name) - { - $this->name = $name; - return $this; - } - - public function getName() - { - return $this->name; - } - - public function setAddress($address) - { - $this->address = $address; - return $this; - } - - public function getAddress() - { - return $this->address; - } - - public function setCoordinates(Point $point) - { - $this->coordinates = $point; - return $this; - } - - public function getCoordinates() - { - return $this->coordinates; - } - - public function setContactNumbers($nums) - { - $this->contact_nums = $nums; - return $this; - } - - public function getContactNumbers() - { - return $this->contact_nums; - } - - public function setTimeOpen(DateTime $time_open) - { - $this->time_open = $time_open; - return $this; - } - - public function getTimeOpen() - { - return $this->time_open; - } - - public function setTimeClose(DateTime $time_close) - { - $this->time_close = $time_close; - return $this; - } - - public function getTimeClose() - { - return $this->time_close; + return $this->job_orders; } public function setHub(Hub $hub) diff --git a/src/Ramcar/CustomerClassification.php b/src/Ramcar/CustomerClassification.php new file mode 100644 index 00000000..f75b50aa --- /dev/null +++ b/src/Ramcar/CustomerClassification.php @@ -0,0 +1,20 @@ + 'Regular', + 'media' => 'Media', + 'vip' => 'VIP', + 'blacklisted' => 'Blacklisted', + 'other' => 'Other', + ]; +} diff --git a/src/Ramcar/Location.php b/src/Ramcar/Location.php new file mode 100644 index 00000000..31a4ef51 --- /dev/null +++ b/src/Ramcar/Location.php @@ -0,0 +1,151 @@ +id; + } + + public function setName($name) + { + $this->name = $name; + return $this; + } + + public function getName() + { + return $this->name; + } + + public function setBranch($branch) + { + $this->branch = $branch; + return $this; + } + + public function getBranch() + { + return $this->branch; + } + + public function setAddress($address) + { + $this->address = $address; + return $this; + } + + public function getAddress() + { + return $this->address; + } + + public function setCoordinates(Point $point) + { + $this->coordinates = $point; + return $this; + } + + public function getCoordinates() + { + return $this->coordinates; + } + + public function setContactNumbers($nums) + { + $this->contact_nums = $nums; + return $this; + } + + public function getContactNumbers() + { + return $this->contact_nums; + } + + public function setTimeOpen(DateTime $time_open) + { + $this->time_open = $time_open; + return $this; + } + + public function getTimeOpen() + { + return $this->time_open; + } + + public function setTimeClose(DateTime $time_close) + { + $this->time_close = $time_close; + return $this; + } + + public function getTimeClose() + { + return $this->time_close; + } +} \ No newline at end of file diff --git a/src/Ramcar/WarrantyClass.php b/src/Ramcar/WarrantyClass.php new file mode 100644 index 00000000..ca850d9b --- /dev/null +++ b/src/Ramcar/WarrantyClass.php @@ -0,0 +1,14 @@ + 'Private', + 'commercial' => 'Commercial', + ]; +} diff --git a/templates/battery/form.html.twig b/templates/battery/form.html.twig index dc7ee01e..51c8cdb8 100644 --- a/templates/battery/form.html.twig +++ b/templates/battery/form.html.twig @@ -114,11 +114,11 @@
-
diff --git a/templates/battery/list.html.twig b/templates/battery/list.html.twig index f0001f4d..28fe3a32 100644 --- a/templates/battery/list.html.twig +++ b/templates/battery/list.html.twig @@ -83,14 +83,16 @@ title: 'ID', width: 30 }, + /* { field: 'mfg_name', title: 'Manufacturer', width: 150 }, + */ { field: 'model_name', - title: 'Model', + title: 'Brand', width: 150 }, { @@ -98,14 +100,16 @@ title: 'Size', width: 100 }, + /* { field: 'prod_code', title: 'Product Code', width: 150 }, + */ { - field: 'warr_personal', - title: 'Personal Wty.', + field: 'warr_private', + title: 'Private Wty.', width: 170 }, { @@ -115,7 +119,7 @@ }, { field: 'sell_price', - title: 'SRP' + title: 'Price' }, { field: 'Actions', diff --git a/templates/customer/form.html.twig b/templates/customer/form.html.twig index 62ebc0a7..84d28664 100644 --- a/templates/customer/form.html.twig +++ b/templates/customer/form.html.twig @@ -53,23 +53,34 @@
-
+
-
+
+
+
+ + +
-
+
diff --git a/templates/customer/list.html.twig b/templates/customer/list.html.twig index 298d3eea..507e3f89 100644 --- a/templates/customer/list.html.twig +++ b/templates/customer/list.html.twig @@ -91,6 +91,20 @@ field: 'last_name', title: 'Last Name' }, + { + field: 'customer_classification', + title: 'Classification' + }, + { + field: 'mobile_numbers', + title: 'Mobile Numbers', + sortable: false + }, + { + field: 'plate_numbers', + title: 'Plate Numbers', + sortable: false + }, { field: 'flag_confirmed', title: 'Status', @@ -106,6 +120,25 @@ return tag; } }, + { + field: 'flag_mobile_app', + title: 'Has Mobile App?', + template: function (row, index, datatable) { + var tag = ''; + + if (row.flag_mobile_app === true) { + tag = 'Yes'; + } else { + tag = 'No'; + } + + return tag; + } + }, + { + field: 'app_mobile_number', + title: 'Registered Number' + }, { field: 'Actions', width: 110, diff --git a/templates/hub/form.html.twig b/templates/hub/form.html.twig index 7b78ce59..8b3c54ee 100644 --- a/templates/hub/form.html.twig +++ b/templates/hub/form.html.twig @@ -58,6 +58,31 @@
+
+ + + +
+
+
+
+ + + +
+
+ + + +
+
+
-
-
- - - -
-
- - - -
-
+
+ + + +
@@ -252,21 +262,29 @@
-
- - +
+ +
-
- - +
+ +
-
- - +
+ +
-
- - +
+ + +
+
+ + +
+
+ +
@@ -276,23 +294,16 @@ Item Quantity - Price Level - Res Price
(w/ Tax) - Total Price Adj. - Final Amount - No Trade-in Item? - Battery Class - Discount Item - Percentage - Converted Rate
(in Decimal) - Discount Amount Warranty Class + Warranty + Date of Purchase + Warranty Until - + No items to display. @@ -339,21 +350,17 @@ - - - - - - - - + + - + + + - @@ -361,15 +368,12 @@ {% for outlet in outlets %} - - - - - - - + + + + {% endfor %} @@ -835,7 +839,8 @@ $(function() { var unitPrice = 1000; $.each(response.data, function(index, battery) { - html += ''; + console.log(battery); + html += ''; }); field.html(html).prop('disabled', false); @@ -863,6 +868,8 @@ $(function() { var qty = $("#invoice-quantity"); var tbody = $("#invoice-table tbody"); var unitPrice = parseFloat(battery.find('option:selected').data('unit-price')); + var warrPrivate = parseInt(battery.find('option:selected').data('warr-private')); + var warrCommercial = parseInt(battery.find('option:selected').data('warr-commercial')); if (!bmfg.val() || !battery.val() || !qty.val()) { swal({ @@ -896,22 +903,24 @@ $(function() { 'subtotal': subtotal }); + var warrantyClasses = { + {% for key, class in warranty_classes %} + "{{ key }}": "{{ class }}", + {% endfor %} + }; + + var warrantyClass = $("#warranty-class").val(); + var warrantyLength = warrantyClass == warrantyClasses["private"] ? warrPrivate : warrCommercial; + // build row html // TODO: Fill with actual data for the rest of the columns var html = '' + '' + '' + - '' + // TODO: static for now - '' + // TODO: not sure if this is correct since it says w/ tax - '' + // TODO: static for now - '' + // TODO: I assumed this is unit price * qty - '' + // TODO: static for now - '' + - '' + - '' + - '' + - '' + - '' + + '' + + '' + + '' + // TODO: Date of Purchase, blank for now + '' + // TODO: Warranty until, blank for now '' + ''; @@ -925,10 +934,10 @@ $(function() { }); function updateInvoiceFigures() { - var amountField = $("#invoice-amount"); - var taxField = $("#invoice-tax"); + var amountField = $("#invoice-price"); + var taxField = $("#invoice-vat"); var discountField = $("#invoice-discount"); - var finalAmountField = $("#invoice-final-amount"); + var finalAmountField = $("#invoice-total-amount"); var finalAmount = invoiceTotal + invoiceTax - invoiceDiscount; amountField.val(parseFloat(Math.round(invoiceTotal * 100) / 100).toFixed(2)); diff --git a/templates/job-order/list.html.twig b/templates/job-order/list.html.twig index bb74ea15..da8afcb5 100644 --- a/templates/job-order/list.html.twig +++ b/templates/job-order/list.html.twig @@ -75,32 +75,27 @@ columns: [ { field: 'id', - title: 'ID' + title: 'JO Number' + }, + { + field: 'delivery_address', + title: 'Customer Area' + }, + { + field: 'service_type', + title: 'Type of Transaction' }, { field: 'date_schedule', title: 'Scheduled Date' }, { - field: 'date_schedule_time', - title: 'Scheduled Time', - sortable: false + field: 'status', + title: 'Status' }, { - field: 'service_type', - title: 'Service Type' - }, - { - field: 'plate_number', - title: 'Plate No.' - }, - { - field: 'customer_name', - title: 'Customer' - }, - { - field: 'mobile_numbers', - title: 'Mobile Numbers' + field: 'owner', + title: 'Owner' }, { field: 'Actions', diff --git a/templates/outlet/form.html.twig b/templates/outlet/form.html.twig index dbfff2d8..b1751217 100644 --- a/templates/outlet/form.html.twig +++ b/templates/outlet/form.html.twig @@ -43,18 +43,32 @@ +
+ + + +
- - - + + +
+
+ + + +
+
+
+
- -
- - - -
-
- - - + + +
@@ -115,8 +123,6 @@
- -
diff --git a/templates/outlet/list.html.twig b/templates/outlet/list.html.twig index b52803b5..40781c9f 100644 --- a/templates/outlet/list.html.twig +++ b/templates/outlet/list.html.twig @@ -82,7 +82,11 @@ }, { field: 'name', - title: 'Name' + title: 'Outlet' + }, + { + field: 'branch', + title: 'Branch' }, { field: 'address',
NameAddressNumbersOpeningClosingSales CountSales AmountService CountOutletBranch Distance Travel Time
Sales (Day)Services (Day)Contact Numbers
+ No items to display.
{{ outlet.outlet.getName }}{{ outlet.outlet.getAddress }}{{ outlet.outlet.getContactNumbers }}{{ outlet.outlet.getTimeOpen|date("g:i A") }}{{ outlet.outlet.getTimeClose|date("g:i A") }}0.000.000{{ outlet.outlet.getBranch }} {{ outlet.distance ? outlet.distance : '-' }} {{ outlet.duration ? outlet.duration : '-' }}00{{ outlet.outlet.getContactNumbers }}
' + battery.find('option:selected').text() + '' + qty.val() + 'Base Price' + (Math.round(unitPrice * 100) / 100).toFixed(2) + '0.00' + (Math.round(subtotal * 100) / 100).toFixed(2) + 'YesRegular' + warrantyClasses[warrantyClass] + '' + warrantyLength + ' month' + (warrantyLength > 1 ? 's' : '') + '