From 3e79c3960ce4926abe1b24fd2cbae34a21bbf76e Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Fri, 22 Mar 2019 05:16:59 +0000 Subject: [PATCH 01/23] Change the API call to warranties to sort by date_create #195 --- src/Controller/CAPI/WarrantyController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/CAPI/WarrantyController.php b/src/Controller/CAPI/WarrantyController.php index 3f4433a5..5080f541 100644 --- a/src/Controller/CAPI/WarrantyController.php +++ b/src/Controller/CAPI/WarrantyController.php @@ -97,7 +97,7 @@ class WarrantyController extends APIController $query = $qb->select('w') ->from('App\\Entity\\Warranty', 'w') - ->orderBy('w.serial', $order) + ->orderBy('w.date_create', $order) ->setFirstResult($start) ->setMaxResults($max) ->getQuery(); From a22816d18a708cf71a8fa308b18b4cec53b87097 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Fri, 29 Mar 2019 10:06:49 +0000 Subject: [PATCH 02/23] Add battery conflict report to acl.yaml. Add route to controller for battery conflict report #197 --- config/acl.yaml | 2 ++ config/routes/report.yaml | 10 ++++++++++ src/Controller/ReportController.php | 9 +++++++++ 3 files changed, 21 insertions(+) diff --git a/config/acl.yaml b/config/acl.yaml index a1152234..6655e53f 100644 --- a/config/acl.yaml +++ b/config/acl.yaml @@ -248,3 +248,5 @@ access_keys: label: Menu - id: report.reject label: Rejection Report + - id: report.battery.conflict + label: Battery Conflict Report diff --git a/config/routes/report.yaml b/config/routes/report.yaml index 483d7254..c8560798 100644 --- a/config/routes/report.yaml +++ b/config/routes/report.yaml @@ -17,3 +17,13 @@ rep_reject_detail_submit: path: /report/rejection_detail controller: App\Controller\ReportController::rejectDetailSubmit methods: [POST] + +rep_battery_conflict_form: + path: /report/battery_conflict + controller: App\Controller\ReportController::batteryConflictForm + methods: [GET] + +rep_battery_conflict_submit: + path: /report/battery_conflict + controller: App\Controller\ReportController::batteryConflictSubmit + methods: [POST] diff --git a/src/Controller/ReportController.php b/src/Controller/ReportController.php index 7d302694..3ddd65d4 100644 --- a/src/Controller/ReportController.php +++ b/src/Controller/ReportController.php @@ -260,4 +260,13 @@ class ReportController extends BaseController ]); */ } + + public function batteryConflictForm() + { + $this->denyAccessUnlessGranted('report.battery.conflict', null, 'No access.'); + + $params = $this->initParameters(); + + return $this->render('', $params); + } } From c720be1c2d2959d8d4652e6423d03a49799c0c5d Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Mon, 1 Apr 2019 08:57:49 +0000 Subject: [PATCH 03/23] Add twig files for the battery conflict report. Add link to the battery conflict report in base twig. Add controller functions to query for the report. #197 --- src/Controller/ReportController.php | 74 ++++++++++++++++- templates/base.html.twig | 10 +++ .../battery/batt_conflict_form.html.twig | 82 +++++++++++++++++++ 3 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 templates/report/battery/batt_conflict_form.html.twig diff --git a/src/Controller/ReportController.php b/src/Controller/ReportController.php index 3ddd65d4..352dadf0 100644 --- a/src/Controller/ReportController.php +++ b/src/Controller/ReportController.php @@ -5,8 +5,11 @@ namespace App\Controller; use App\Ramcar\BaseController; use App\Ramcar\JORejectionReason; use App\Ramcar\ServiceType; +use App\Ramcar\JOStatus; use App\Entity\JORejection; +use App\Entity\Battery; +use App\Entity\JobOrder; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; @@ -265,8 +268,75 @@ class ReportController extends BaseController { $this->denyAccessUnlessGranted('report.battery.conflict', null, 'No access.'); - $params = $this->initParameters(); + $params = $this->initParameters('outlet_list'); + + return $this->render('report/battery/batt_conflict_form.html.twig', $params); + } + + public function batteryConflictSubmit(Request $req) + { + $this->denyAccessUnlessGranted('report.battery.conflict', null, 'No access.'); + + // get battery query builder + $batt_qb = $this->getDoctrine() + ->getRepository(Battery::class) + ->createQueryBuilder('batt'); + + // get job order query builder + $job_qb = $this->getDoctrine() + ->getRepository(JobOrder::class) + ->createQueryBuilder('jo'); + + // get dates + $raw_date_start = $req->request->get('date_start'); + $raw_date_end = $req->request->get('date_end'); + + $date_start = DateTime::createFromFormat('m/d/Y', $raw_date_start); + $date_end = DateTime::createFromFormat('m/d/Y', $raw_date_end); + + // build query for battery + $batt_query = $batt_qb->getQuery(); + + // build query for job order + $jo_query = $job_qb->where('jo.date_create >= :start') + ->andWhere('jo.date_create <= :end') + ->andWhere('jo.status != :status') + ->setParameter('start', $date_start->format('Y-m-d') . ' 00:00:00') + ->setParameter('end', $date_end->format('Y-m-d') . ' 23:59:59') + ->setParameter('status', JOStatus::CANCELLED) + ->getQuery(); + + // run queries + $batts = $batt_query->getResult(); + $jos = $jo_query->getResult(); + + $battcomp = []; + // get battery results and store in array + foreach ($batts as $batt) + { + $batt_id = $batt->getID(); + + $comp_vehicles = $batt->getVehicles(); + // go through compatible vehicle list and add to array + foreach ($comp_vehicles as $vehicle) + { + $battcomp[$batt_id] = [ + 'manufacturer' => $vehicle->getManufacturer(), + 'make' => $vehicle->getMake(), + ]; + } + } + + // get results + foreach ($jos as $jo) + { + $vehicle = $jo->getCustomerVehicle()->getVehicle(); + $vmanufacturer = $vehicle->getManufacturer(); + $vmake = $vehicle->getMake(); + + $invoice_items = $jo->getInvoice()->getItems(); + + } - return $this->render('', $params); } } diff --git a/templates/base.html.twig b/templates/base.html.twig index b6464785..e61acf78 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -128,6 +128,16 @@ + +
+
+
+

Battery Conflict Report

+
+
+
+ +
+ +
+
+
+
+
+
+ + + +

+ Select a date range +

+
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+{% endblock %} + +{% block scripts %} + +{% endblock %} From b988abd8520f88429a289613dd0848086be43618 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Tue, 2 Apr 2019 12:06:55 +0800 Subject: [PATCH 04/23] Change error message for geofence error in mobile app #199 --- src/Controller/APIController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index a9a23caf..4925cf9b 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -802,8 +802,9 @@ class APIController extends Controller $is_covered = $geo->isCovered($long, $lat); if (!$is_covered) { + // TODO: put geofence error message in config file somewhere $res->setError(true) - ->setErrorMessage('Location is not covered by our service.'); + ->setErrorMessage('Oops! Our service is limited to Metro Manila only. We will update you as soon as we are able to cover your area'); return $res->getReturnResponse(); } From c971499109ef574bd327d015e616d0c130b3f3d2 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Tue, 2 Apr 2019 14:14:48 +0800 Subject: [PATCH 05/23] Add kml file for supported areas #200 --- kml/supported_areas.kml | 73 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 kml/supported_areas.kml diff --git a/kml/supported_areas.kml b/kml/supported_areas.kml new file mode 100644 index 00000000..aa643fb4 --- /dev/null +++ b/kml/supported_areas.kml @@ -0,0 +1,73 @@ + + + + ResQ Supported Area + + + + + + normal + #poly-000000-1200-77-nodesc-normal + + + highlight + #poly-000000-1200-77-nodesc-highlight + + + + ResQ Supported Area + + Supported Area + #poly-000000-1200-77-nodesc + + + + 1 + + 121.0717128,14.7868868,0 + 121.0222743,14.7895424,0 + 120.9302638,14.6793076,0 + 120.9494899,14.4427135,0 + 121.0250209,14.3735484,0 + 121.0744593,14.5171749,0 + 121.1513636,14.5357864,0 + 121.1884425,14.5809791,0 + 121.2021754,14.6248337,0 + 121.1321376,14.6540653,0 + 121.129391,14.7616569,0 + 121.0717128,14.7868868,0 + + + + + + + + From b0386c47580d946038d25d0a0a675b5707da7765 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Tue, 2 Apr 2019 10:22:17 +0000 Subject: [PATCH 06/23] Add checking for battery conflicts in existing job orders. #197 --- src/Controller/ReportController.php | 101 ++++++++++++++++++++-------- 1 file changed, 72 insertions(+), 29 deletions(-) diff --git a/src/Controller/ReportController.php b/src/Controller/ReportController.php index 352dadf0..545bdae6 100644 --- a/src/Controller/ReportController.php +++ b/src/Controller/ReportController.php @@ -277,16 +277,13 @@ class ReportController extends BaseController { $this->denyAccessUnlessGranted('report.battery.conflict', null, 'No access.'); - // get battery query builder - $batt_qb = $this->getDoctrine() - ->getRepository(Battery::class) - ->createQueryBuilder('batt'); - // get job order query builder $job_qb = $this->getDoctrine() ->getRepository(JobOrder::class) ->createQueryBuilder('jo'); + $em = $this->getDoctrine()->getManager(); + // get dates $raw_date_start = $req->request->get('date_start'); $raw_date_end = $req->request->get('date_end'); @@ -294,10 +291,7 @@ class ReportController extends BaseController $date_start = DateTime::createFromFormat('m/d/Y', $raw_date_start); $date_end = DateTime::createFromFormat('m/d/Y', $raw_date_end); - // build query for battery - $batt_query = $batt_qb->getQuery(); - - // build query for job order + // build query for job order $jo_query = $job_qb->where('jo.date_create >= :start') ->andWhere('jo.date_create <= :end') ->andWhere('jo.status != :status') @@ -305,38 +299,87 @@ class ReportController extends BaseController ->setParameter('end', $date_end->format('Y-m-d') . ' 23:59:59') ->setParameter('status', JOStatus::CANCELLED) ->getQuery(); + // run queries - $batts = $batt_query->getResult(); $jos = $jo_query->getResult(); - $battcomp = []; - // get battery results and store in array - foreach ($batts as $batt) - { - $batt_id = $batt->getID(); + $batteries = $em->getRepository(Battery::class)->findAll(); - $comp_vehicles = $batt->getVehicles(); - // go through compatible vehicle list and add to array - foreach ($comp_vehicles as $vehicle) + // create compatibility matrix for battery and vehicle + $comp_matrix = []; + foreach ($batteries as $batt) + { + $vehicles = $batt->getVehicles(); + foreach ($vehicles as $vehicle) { - $battcomp[$batt_id] = [ - 'manufacturer' => $vehicle->getManufacturer(), - 'make' => $vehicle->getMake(), - ]; + $comp_matrix[$batt->getID()][$vehicle->getID()] = true; } } - // get results + // go through the job orders to find the conflicts + $results = []; foreach ($jos as $jo) { - $vehicle = $jo->getCustomerVehicle()->getVehicle(); - $vmanufacturer = $vehicle->getManufacturer(); - $vmake = $vehicle->getMake(); - - $invoice_items = $jo->getInvoice()->getItems(); - + $invoice_items = $jo->getInvoice()->getItems(); + foreach ($invoice_items as $item) + { + if ($item->getBattery() != null) + { + $batt_id = $item->getBattery()->getID(); + $vehicle_id = $jo->getCustomerVehicle()->getVehicle()->getID(); + if (isset($comp_matrix[$batt_id][$vehicle_id])) + // if (!isset($comp_matrix[$batt_id][$vehicle_id]) && !$comp_matrix[$batt_id][$vehicle_id]) + { + $results[] = [ + 'jo_id' => $jo->getID(), + 'jo_date_create' => $jo->getDateCreate(), + 'cus_vehicle_manufacturer' => $jo->getCustomerVehicle()->getVehicle()->getManufacturer()->getName(), + 'cus_vehicle_make' => $jo->getCustomerVehicle()->getVehicle()->getMake(), + 'cus_vehicle_model' => $jo->getCustomerVehicle()->getModelYear(), + 'battery_model_ordered' => $item->getBattery()->getModel()->getName(), + 'battery_size_ordered' => $item->getBattery()->getSize()->getName(), + 'compatible_batt' => $jo->getCustomerVehicle()->getVehicle()->getBatteries(), + ]; + } + } + } } + /* + $resp = new StreamedResponse(); + $resp->setCallback(function() use ($results) { + // csv output + $csv_handle = fopen('php://output', 'w+'); + fputcsv($csv_handle, [ + 'Order #', + 'Order Date and Time' + //'Manufacturer', + //'Make', + //'Year', + //'Battery Model', + //'Battery Size', + //'Compatible Batteries' + ]); + foreach ($results as $row) + { + fputcsv($csv_handle, $row); + } + + fclose($csv_handle); + }); + + $filename = 'battery_conflict_' . $date_start->format('Ymd') . '_' . $date_end->format('Ymd') . '.csv'; + + $resp->setStatusCode(200); + $resp->headers->set('Content-Type', 'text/csv; charset=utf-8'); + $resp->headers->set('Content-Disposition', 'attachment; filename="' . $filename . '"'); + + return $resp; + */ + + return $this->json([ + 'result' => $results, + ]); } } From 3af6d6b7e8f13ccd39bd83d27229daa13ff37e37 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Wed, 3 Apr 2019 02:14:26 +0000 Subject: [PATCH 07/23] Fix checking for battery conflicts. Add list of compatible batteries for vehicle. #197 --- src/Controller/ReportController.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/Controller/ReportController.php b/src/Controller/ReportController.php index 545bdae6..13d63613 100644 --- a/src/Controller/ReportController.php +++ b/src/Controller/ReportController.php @@ -328,18 +328,32 @@ class ReportController extends BaseController { $batt_id = $item->getBattery()->getID(); $vehicle_id = $jo->getCustomerVehicle()->getVehicle()->getID(); - if (isset($comp_matrix[$batt_id][$vehicle_id])) - // if (!isset($comp_matrix[$batt_id][$vehicle_id]) && !$comp_matrix[$batt_id][$vehicle_id]) + if (isset($comp_matrix[$batt_id][$vehicle_id]) && $comp_matrix[$batt_id][$vehicle_id]) { + continue; + } + else + { + // get the compatible batteries for the customer vehicle + $batteries = []; + foreach($jo->getCustomerVehicle()->getVehicle()->getBatteries() as $comp_batt) + { + $batteries[] = [ + 'id' => $comp_batt->getID(), + 'mfg_name' => $comp_batt->getManufacturer()->getName(), + 'model_name' => $comp_batt->getModel()->getName(), + 'size_name' => $comp_batt->getSize()->getName(), + ]; + } $results[] = [ 'jo_id' => $jo->getID(), 'jo_date_create' => $jo->getDateCreate(), 'cus_vehicle_manufacturer' => $jo->getCustomerVehicle()->getVehicle()->getManufacturer()->getName(), 'cus_vehicle_make' => $jo->getCustomerVehicle()->getVehicle()->getMake(), 'cus_vehicle_model' => $jo->getCustomerVehicle()->getModelYear(), - 'battery_model_ordered' => $item->getBattery()->getModel()->getName(), + 'battery_model_ordered' => $item->getBattery()->getModel()->getName(), 'battery_size_ordered' => $item->getBattery()->getSize()->getName(), - 'compatible_batt' => $jo->getCustomerVehicle()->getVehicle()->getBatteries(), + 'compatible_batt' => $batteries, ]; } } From c80013bc023a6a16ebd73c649186b273e4294b61 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Wed, 3 Apr 2019 07:29:14 +0000 Subject: [PATCH 08/23] Fix formatting issue for csv output. #197 --- src/Controller/ReportController.php | 46 +++++++++++++++-------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/Controller/ReportController.php b/src/Controller/ReportController.php index 13d63613..800474d7 100644 --- a/src/Controller/ReportController.php +++ b/src/Controller/ReportController.php @@ -324,6 +324,7 @@ class ReportController extends BaseController $invoice_items = $jo->getInvoice()->getItems(); foreach ($invoice_items as $item) { + // check if the item is a battery if ($item->getBattery() != null) { $batt_id = $item->getBattery()->getID(); @@ -338,42 +339,44 @@ class ReportController extends BaseController $batteries = []; foreach($jo->getCustomerVehicle()->getVehicle()->getBatteries() as $comp_batt) { - $batteries[] = [ - 'id' => $comp_batt->getID(), - 'mfg_name' => $comp_batt->getManufacturer()->getName(), - 'model_name' => $comp_batt->getModel()->getName(), - 'size_name' => $comp_batt->getSize()->getName(), - ]; + //$batteries[] = [ + // 'mfg_name' => $comp_batt->getManufacturer()->getName(), + // 'model_name' => $comp_batt->getModel()->getName(), + // 'size_name' => $comp_batt->getSize()->getName(), + //]; + $batteries[] = $comp_batt->getManufacturer()->getName() . ' ' . + $comp_batt->getModel()->getName() . ' ' . + $comp_batt->getSize()->getName(); } + $results[] = [ 'jo_id' => $jo->getID(), - 'jo_date_create' => $jo->getDateCreate(), + 'jo_date_create' => $jo->getDateCreate()->format('m/d/Y H:i'), 'cus_vehicle_manufacturer' => $jo->getCustomerVehicle()->getVehicle()->getManufacturer()->getName(), 'cus_vehicle_make' => $jo->getCustomerVehicle()->getVehicle()->getMake(), 'cus_vehicle_model' => $jo->getCustomerVehicle()->getModelYear(), 'battery_model_ordered' => $item->getBattery()->getModel()->getName(), 'battery_size_ordered' => $item->getBattery()->getSize()->getName(), - 'compatible_batt' => $batteries, + 'compatible_batt' => implode(', ', $batteries), ]; } } } } - - /* + $resp = new StreamedResponse(); $resp->setCallback(function() use ($results) { // csv output $csv_handle = fopen('php://output', 'w+'); fputcsv($csv_handle, [ 'Order #', - 'Order Date and Time' - //'Manufacturer', - //'Make', - //'Year', - //'Battery Model', - //'Battery Size', - //'Compatible Batteries' + 'Order Date and Time', + 'Manufacturer', + 'Make', + 'Year', + 'Battery Model', + 'Battery Size', + 'Compatible Batteries' ]); foreach ($results as $row) { @@ -390,10 +393,9 @@ class ReportController extends BaseController $resp->headers->set('Content-Disposition', 'attachment; filename="' . $filename . '"'); return $resp; - */ - - return $this->json([ - 'result' => $results, - ]); + + //return $this->json([ + // 'result' => $results, + //]); } } From 620a750465dcc0c655f9d02fe36814a4582d5cc6 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 4 Apr 2019 09:07:41 +0000 Subject: [PATCH 09/23] Add CAPI call to add a new battery. #201 --- catalyst/api-bundle/Command/TestCommand.php | 11 +++ .../routes/{warranty_api.yaml => capi.yaml} | 6 ++ src/Controller/CAPI/BatteryController.php | 68 +++++++++++++++++++ 3 files changed, 85 insertions(+) rename config/routes/{warranty_api.yaml => capi.yaml} (94%) diff --git a/catalyst/api-bundle/Command/TestCommand.php b/catalyst/api-bundle/Command/TestCommand.php index 03d1fe85..66ec639d 100644 --- a/catalyst/api-bundle/Command/TestCommand.php +++ b/catalyst/api-bundle/Command/TestCommand.php @@ -75,6 +75,17 @@ class TestCommand extends Command ]; $api->post('/capi/warranties/' . $id . '/claim', $params); + // add battery + $sku = 'WZMB31QT-CPP00-S'; + $brand = '4'; + $size = '1'; + $params = [ + 'sku' => $sku, + 'brand' => $brand, + 'size' => $size, + ]; + $api->post('/capi/batteries', $params); + /* // plate warranty diff --git a/config/routes/warranty_api.yaml b/config/routes/capi.yaml similarity index 94% rename from config/routes/warranty_api.yaml rename to config/routes/capi.yaml index 85075440..a340041c 100644 --- a/config/routes/warranty_api.yaml +++ b/config/routes/capi.yaml @@ -30,6 +30,12 @@ capi_battery_sizes: controller: App\Controller\CAPI\BatteryController::getSizes methods: [GET] +# add battery +capi_battery_add: + path: /capi/batteries + controller: App\Controller\CAPI\BatteryController::addBattery + methods: [POST] + # vehicle api diff --git a/src/Controller/CAPI/BatteryController.php b/src/Controller/CAPI/BatteryController.php index a8197bab..dc035c58 100644 --- a/src/Controller/CAPI/BatteryController.php +++ b/src/Controller/CAPI/BatteryController.php @@ -75,4 +75,72 @@ class BatteryController extends APIController return new APIResponse(true, 'Battery sizes loaded.', $data); } + + public function addBattery(Request $req, EntityManagerInterface $em) + { + // required parameters + $params = [ + 'sku', + 'brand', + 'size', + ]; + + $msg = $this->checkRequiredParameters($req, $params); + error_log('msg - ' . $msg); + if ($msg) + return new APIResponse(false, $msg); + + $sku = $req->request->get('sku'); + $brand = $req->request->get('brand'); + $size = $req->request->get('size'); + + // check if sku already exists + $batt = $em->getRepository(SAPBattery::class)->find($sku); + if ($batt != null) + return new APIResponse(false, 'Battery SKU already exists.'); + + // check if brand exists + $batt_brand = $em->getRepository(SAPBatteryBrand::class)->find($brand); + if ($batt_brand == null) + return new APIResponse(false, 'Invalid brand.'); + + // check if size exists + $batt_size = $em->getRepository(SAPBatterySize::class)->find($size); + if ($batt_size == null) + return new APIResponse(false, 'Invalid size.'); + + + $new_batt = new SAPBattery(); + $new_batt->setID($sku) + ->setBrand($batt_brand) + ->setSize($batt_size); + + try + { + $em->persist($new_batt); + $em->flush(); + } + catch (UniqueConstraintViolationException $e) + { + return new APIResponse(false, 'Battery SKU already exists.'); + } + + // return the new battery data + $data = [ + 'battery' => $this->generateBatteryData($new_batt), + ]; + + return new APIResponse(true, 'Battery added.', $data); + } + + protected function generateBatteryData(SAPBattery $batt) + { + $data = [ + 'sku' => $batt->getID(), + 'brand' => $batt->getBrand()->getID(), + 'size' => $batt->getSize()->getID(), + ]; + + return $data; + } } From 24a0e5a2d13ceea9dff29f2d615276144f5d7ff2 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 4 Apr 2019 09:22:31 +0000 Subject: [PATCH 10/23] Change brand and size parameters to brand_id and size_id. #201 --- catalyst/api-bundle/Command/TestCommand.php | 8 ++++---- src/Controller/CAPI/BatteryController.php | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/catalyst/api-bundle/Command/TestCommand.php b/catalyst/api-bundle/Command/TestCommand.php index 66ec639d..3d03ae0d 100644 --- a/catalyst/api-bundle/Command/TestCommand.php +++ b/catalyst/api-bundle/Command/TestCommand.php @@ -77,12 +77,12 @@ class TestCommand extends Command // add battery $sku = 'WZMB31QT-CPP00-S'; - $brand = '4'; - $size = '1'; + $brand_id = '4'; + $size_id = '1'; $params = [ 'sku' => $sku, - 'brand' => $brand, - 'size' => $size, + 'brand_id' => $brand_id, + 'size_id' => $size_id, ]; $api->post('/capi/batteries', $params); diff --git a/src/Controller/CAPI/BatteryController.php b/src/Controller/CAPI/BatteryController.php index dc035c58..ec0d65d9 100644 --- a/src/Controller/CAPI/BatteryController.php +++ b/src/Controller/CAPI/BatteryController.php @@ -81,8 +81,8 @@ class BatteryController extends APIController // required parameters $params = [ 'sku', - 'brand', - 'size', + 'brand_id', + 'size_id', ]; $msg = $this->checkRequiredParameters($req, $params); @@ -91,8 +91,8 @@ class BatteryController extends APIController return new APIResponse(false, $msg); $sku = $req->request->get('sku'); - $brand = $req->request->get('brand'); - $size = $req->request->get('size'); + $brand_id = $req->request->get('brand_id'); + $size_id = $req->request->get('size_id'); // check if sku already exists $batt = $em->getRepository(SAPBattery::class)->find($sku); @@ -100,12 +100,12 @@ class BatteryController extends APIController return new APIResponse(false, 'Battery SKU already exists.'); // check if brand exists - $batt_brand = $em->getRepository(SAPBatteryBrand::class)->find($brand); + $batt_brand = $em->getRepository(SAPBatteryBrand::class)->find($brand_id); if ($batt_brand == null) return new APIResponse(false, 'Invalid brand.'); // check if size exists - $batt_size = $em->getRepository(SAPBatterySize::class)->find($size); + $batt_size = $em->getRepository(SAPBatterySize::class)->find($size_id); if ($batt_size == null) return new APIResponse(false, 'Invalid size.'); From e39289bb544412a99bfb2639d24386281d3d3ce6 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Tue, 9 Apr 2019 09:23:38 +0000 Subject: [PATCH 11/23] Add the customer name, mobile, and sap battery fields to the warranty csv file. #202 --- src/Command/ImportLegacyJobOrderCommand.php | 112 +++++++++++++++----- 1 file changed, 83 insertions(+), 29 deletions(-) diff --git a/src/Command/ImportLegacyJobOrderCommand.php b/src/Command/ImportLegacyJobOrderCommand.php index 8161fbae..7546880b 100644 --- a/src/Command/ImportLegacyJobOrderCommand.php +++ b/src/Command/ImportLegacyJobOrderCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Doctrine\Common\Persistence\ObjectManager; use App\Entity\Warranty; +use App\Entity\Battery; use App\Entity\BatterySize; use App\Entity\BatteryModel; use App\Entity\VehicleManufacturer; @@ -31,6 +32,7 @@ use DateTime; class ImportLegacyJobOrderCommand extends Command { protected $em; + protected $batt_hash; protected $bmodel_hash; protected $bsize_hash; protected $vmfg_hash; @@ -50,6 +52,7 @@ class ImportLegacyJobOrderCommand extends Command $this->loadBatterySizes(); $this->loadVehicleManufacturers(); $this->loadVehicles(); + $this->loadBatteries(); $this->jo_hash = []; @@ -312,7 +315,7 @@ class ImportLegacyJobOrderCommand extends Command continue; // check if battery is found - $found_battery = $this->findBattery($fields[92], $batt_model, $batt_size); + $found_battery = $this->findBattery($fields[92], $batt_model, $batt_size, $sap_code); if (!$found_battery) { // $output->writeln('battery not found - ' . $fields[92]); @@ -399,7 +402,33 @@ class ImportLegacyJobOrderCommand extends Command $line .= '\N,'; // date claim - $line .= '\N'; + $line .= '\N,'; + + // claim id + $line .= '\N,'; + + // sap battery id + if (isset($sap_code)) + $line .= $sap_code . ','; + else + $line .= '\N,'; + // first name + if (isset($fields[20]) && strlen(trim($fields[20])) > 0) + $line .= $fields[20] . ','; + else + $line .= '\N,'; + + // last name + if (isset($fields[22]) && strlen(trim($fields[22])) > 0) + $line .= $fields[22] . ','; + else + $line .= '\N,'; + + // mobile number + if (isset($fields[24]) && strlen(trim($fields[24])) > 0) + $line .= $fields[24] . ','; + else + $line .= '\N'; fwrite($warr_outfile, $line . "\n"); } @@ -769,6 +798,25 @@ class ImportLegacyJobOrderCommand extends Command } } + protected function loadBatteries() + { + $this->batt_hash = []; + + $batts = $this->em->getRepository(Battery::class)->findAll(); + foreach ($batts as $batt) + { + if (($batt->getModel() == null) or ($batt->getSize() == null) or ($batt->getSAPCode() == null)) + { + continue; + } + + $model_id = $batt->getModel()->getID(); + $size_id = $batt->getSize()->getID(); + + $this->batt_hash[$model_id][$size_id] = $batt->getSAPCode(); + } + } + protected function loadVehicleManufacturers() { $this->vmfg_hash = []; @@ -817,16 +865,16 @@ class ImportLegacyJobOrderCommand extends Command return $clean_text; } - protected function findBattery($batt_field, &$batt_model, &$batt_size) - { - // split battery into model and size - // echo "trying match - " . $fields[92] . "\n"; - $res = preg_match("/^(.+)(GOLD|EXCEL|ENDURO|\(Trade-In\))/", $batt_field, $matches); - if (!$res) - { - // echo "no match - " . $fields[92] . "\n"; + protected function findBattery($batt_field, &$batt_model, &$batt_size, &$sap_code) + { + // split battery into model and size + // echo "trying match - " . $batt_field . "\n"; + $res = preg_match("/^(.+)(GOLD|EXCEL|ENDURO|\(Trade-In\))/", $batt_field, $matches); + if (!$res) + { + //echo "no match - " . $fields[92] . "\n"; return false; - } + } if ($matches[2] == '(Trade-In)') return false; @@ -836,29 +884,35 @@ class ImportLegacyJobOrderCommand extends Command // TODO: what to do about (Trade-In) - // check if we have the size - $found_size = $this->simplifyName($matches[1]); - if (!isset($this->bsize_hash[$found_size])) - { - // try legacy battery lookup - $legacy_size = LegacyBattery::translate($found_size); - if ($legacy_size == null) - { - // echo "no size - $found_size\n"; - if (isset($no_sizes[$found_size])) - $no_sizes[$found_size]++; - else - $no_sizes[$found_size] = 1; - return false; - } + // check if we have the size + $found_size = $this->simplifyName($matches[1]); + if (!isset($this->bsize_hash[$found_size])) + { + // try legacy battery lookup + $legacy_size = LegacyBattery::translate($found_size); + if ($legacy_size == null) + { + // echo "no size - $found_size\n"; + if (isset($no_sizes[$found_size])) + $no_sizes[$found_size]++; + else + $no_sizes[$found_size] = 1; + return false; + } - $found_size = $legacy_size; - } + $found_size = $legacy_size; + } $batt_size = $this->bsize_hash[$found_size]; // $batt_size = $found_size; + //get battery using ids of batt_model and batt_size + if (!isset($this->batt_hash[$batt_model][$batt_size])) + return false; + + $sap_code = $this->batt_hash[$batt_model][$batt_size]; + return true; - } + } protected function findVehicle($vmfg_field, $vmake_field, $vmodel_field, &$vehicle) { From a08e7b39eb2934a443eec0803ba8f1ecd028a92f Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Tue, 9 Apr 2019 09:41:37 +0000 Subject: [PATCH 12/23] Create a file with sql commands to load the legacy data from csv to the database. #202 --- utils/legacy_load/import_legacy_data.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 utils/legacy_load/import_legacy_data.sql diff --git a/utils/legacy_load/import_legacy_data.sql b/utils/legacy_load/import_legacy_data.sql new file mode 100644 index 00000000..0f12390e --- /dev/null +++ b/utils/legacy_load/import_legacy_data.sql @@ -0,0 +1,4 @@ +load data local infile '/tmp/plate_numbers.csv' into table plate_number fields terminated by ','; +load data infile '/tmp/legacy_jo_row.csv' into table legacy_job_order_row fields terminated by ',' enclosed by '"' lines terminated by '\n' (job_order_id, item, qty, price, price_level, status, account, enrollee) set id = null; +load data local infile '/tmp/warranty.csv' into table warranty fields terminated by ',' (bty_model_id, bty_size_id, serial, warranty_class, plate_number, status, date_create, date_purchase, date_expire, date_claim, claim_id, sap_bty_id, first_name, last_name, mobile_number) set id = null; +load data infile '/tmp/legacy_jo.csv' into table legacy_job_order fields terminated by '|' (id, trans_date, trans_type, origin, car_brand, car_make, car_model, car_color, cust_name, cust_first_name, cust_middle_name, cust_last_name, cust_contact, cust_mobile, cust_landline, delivery_instructions, agent_notes_1, delivery_date, delivery_time, advance_order, stage, cancel_reason, cancel_reason_specify, payment_method, prepared_by, dispatch_time, dispatch_date, dispatched_by, address, landmark, date_purchase, plate_number); From be8ceb7e2931dd1f841227c2996a7c85e2c19f9a Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 11 Apr 2019 07:33:25 +0000 Subject: [PATCH 13/23] Add warr_tnv to the Battery entity. Add the tnv warranty to the add/edit forms. Add means to save/display the tnv warranty data in the forms. #203 --- src/Controller/BatteryController.php | 3 +++ src/Entity/Battery.php | 18 ++++++++++++++++++ templates/battery/form.html.twig | 8 ++++++++ 3 files changed, 29 insertions(+) diff --git a/src/Controller/BatteryController.php b/src/Controller/BatteryController.php index 317f0f43..48e1dde4 100644 --- a/src/Controller/BatteryController.php +++ b/src/Controller/BatteryController.php @@ -119,6 +119,7 @@ class BatteryController extends BaseController $row['sell_price'] = $orow[0]->getSellingPrice(); $row['warr_private'] = $orow[0]->getWarrantyPrivate(); $row['warr_commercial'] = $orow[0]->getWarrantyCommercial(); + $row['warr_tnv'] = $orow[0]->getWarrantyTnv(); $row['res_capacity'] = $orow[0]->getReserveCapacity(); $row['length'] = $orow[0]->getLength(); $row['width'] = $orow[0]->getWidth(); @@ -181,6 +182,7 @@ class BatteryController extends BaseController ->setSAPCode($req->request->get('sap_code')) ->setWarrantyPrivate($req->request->get('warr_private')) ->setWarrantyCommercial($req->request->get('warr_commercial')) + ->setWarrantyTnv($req->request->get('warr_tnv')) ->setReserveCapacity($req->request->get('res_capacity')) ->setLength($req->request->get('length')) ->setWidth($req->request->get('width')) @@ -303,6 +305,7 @@ class BatteryController extends BaseController ->setSAPCode($req->request->get('sap_code')) ->setWarrantyPrivate($req->request->get('warr_private')) ->setWarrantyCommercial($req->request->get('warr_commercial')) + ->setWarrantyTnv($req->request->get('warr_tnv')) ->setReserveCapacity($req->request->get('res_capacity')) ->setLength($req->request->get('length')) ->setWidth($req->request->get('width')) diff --git a/src/Entity/Battery.php b/src/Entity/Battery.php index ed0c99ec..e05bff81 100644 --- a/src/Entity/Battery.php +++ b/src/Entity/Battery.php @@ -85,6 +85,13 @@ class Battery */ protected $warr_commercial; + // warranty tnv + /** + * @ORM\Column(type="smallint") + * @Assert\NotBlank() + */ + protected $warr_tnv; + // reserve capacity /** * @ORM\Column(type="smallint") @@ -248,6 +255,17 @@ class Battery return $this->warr_commercial; } + public function setWarrantyTnv($warr_tnv) + { + $this->warr_tnv = $warr_tnv; + return $this; + } + + public function getWarrantyTnv() + { + return $this->warr_tnv; + } + public function setReserveCapacity($res_capacity) { $this->res_capacity = $res_capacity; diff --git a/templates/battery/form.html.twig b/templates/battery/form.html.twig index b0e46cbb..53adb693 100644 --- a/templates/battery/form.html.twig +++ b/templates/battery/form.html.twig @@ -157,6 +157,14 @@ In months +
+ + + + In months +
From e4e52768f3d3e0d5023e3c7b6f7da59bbe06b3b9 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 11 Apr 2019 09:00:31 +0000 Subject: [PATCH 14/23] Create sql script to set the tnv warranty for all GOLD model batteries. #203 --- utils/battery_warranty/set_tnv_warranty.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 utils/battery_warranty/set_tnv_warranty.sql diff --git a/utils/battery_warranty/set_tnv_warranty.sql b/utils/battery_warranty/set_tnv_warranty.sql new file mode 100644 index 00000000..28f67d82 --- /dev/null +++ b/utils/battery_warranty/set_tnv_warranty.sql @@ -0,0 +1,2 @@ +update battery as batt inner join battery_model as bmodel on batt.model_id = bmodel.id set batt.warr_tnv=12 where bmodel.name='GOLD'; + From d47158ced792661f52bddd26b0281217e6abc1ef Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Tue, 16 Apr 2019 00:53:20 +0000 Subject: [PATCH 15/23] Add the warranty class, expiry date, serial, battery ID to the warranties table for search. #205 --- templates/search/form.html.twig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/search/form.html.twig b/templates/search/form.html.twig index 1b61334d..9e9d22c7 100644 --- a/templates/search/form.html.twig +++ b/templates/search/form.html.twig @@ -191,6 +191,10 @@ Last Name First Name Plate Number + Warranty Class + Expiry Date + Serial + Battery @@ -200,6 +204,10 @@ {{ result.getLastName|default("") }} {{ result.getFirstName|default("") }} {{ result.getPlateNumber|default("") }} + {{ result.getWarrantyClass|default("") }} + {{ result.getDateExpire|default("")|date('d M Y') }} + {{ result.getSerial|default("") }} + {{ result.getSAPBattery.getID|default("") }} {% endfor %} From 115b99eb7377e4a2147b55c876d080f09e936823 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Tue, 30 Apr 2019 10:58:46 +0000 Subject: [PATCH 16/23] Add details form for legacy job order search results. #207 --- config/routes/search.yaml | 4 + src/Controller/SearchController.php | 20 ++ templates/search/form.html.twig | 2 + templates/search/legacyjo_details.html.twig | 229 ++++++++++++++++++++ 4 files changed, 255 insertions(+) create mode 100644 templates/search/legacyjo_details.html.twig diff --git a/config/routes/search.yaml b/config/routes/search.yaml index 54bebd51..b21d8562 100644 --- a/config/routes/search.yaml +++ b/config/routes/search.yaml @@ -6,3 +6,7 @@ search_history: path: /search/history controller: App\Controller\SearchController::search methods: [GET] + +search_legacyjo_details: + path: /search/legacyjo/{id}/details + controller: App\Controller\SearchController::legacyJODetails diff --git a/src/Controller/SearchController.php b/src/Controller/SearchController.php index 1e660e16..9706e914 100644 --- a/src/Controller/SearchController.php +++ b/src/Controller/SearchController.php @@ -3,8 +3,11 @@ namespace App\Controller; use App\Ramcar\BaseController; + use App\Service\GeneralSearch; +use App\Entity\LegacyJobOrder; + use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -46,4 +49,21 @@ class SearchController extends BaseController // response return $this->render('search/form.html.twig', $params); } + + public function legacyJODetails($id) + { + $this->denyAccessUnlessGranted('general.search', null, 'No access.'); + + // get legacy job order + $em = $this->getDoctrine()->getManager(); + $legacy_jo = $em->getRepository(LegacyJobOrder::class)->find($id); + + $params = $this->initParameters('general.search'); + $params['data'] = $legacy_jo; + $params['search_term'] = $search_term; + $params['mode'] = "details"; + + // response + return $this->render('search/legacyjo_details.html.twig', $params); + } } diff --git a/templates/search/form.html.twig b/templates/search/form.html.twig index 9e9d22c7..fc830136 100644 --- a/templates/search/form.html.twig +++ b/templates/search/form.html.twig @@ -86,6 +86,7 @@ Last Name First Name Plate Number + @@ -95,6 +96,7 @@ {{ result.getCustLastName|default('') }} {{ result.getCustFirstName|default('') }} {{ result.getPlateNumber|default('') }} + Details {% endfor %} diff --git a/templates/search/legacyjo_details.html.twig b/templates/search/legacyjo_details.html.twig new file mode 100644 index 00000000..9177e9c9 --- /dev/null +++ b/templates/search/legacyjo_details.html.twig @@ -0,0 +1,229 @@ +{% extends 'base.html.twig' %} + +{% block body %} + +
+
+
+

Job Order

+
+
+
+ +
+ +
+
+
+
+

+ Customer Details +

+
+
+
+ + + +
+
+ + + +
+
+
+
+ +
+ +63 + + +
+
+
+ +
+ +63 + + +
+
+
+
+
+ +
+ +63 + + +
+
+
+
+
+
+

+ Vehicle Details +

+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+
+ + + +
+
+ + + +
+
+
+
+
+

+ Transaction Details +

+ + + +
+
+
+ + + +
+
+ + + +
+
+
+
+ + + +
+
+ +
+ + + + +
+ +
+
+ +
+ + + + +
+ +
+
+
+
+ + + +
+
+
+
+
+ + + +
+
+
+ + +
+
+
+
+ + + +
+
+
+ + + +
+
+
+
+
+ + + +
+
+
+
+ + + +
+
+ + + +
+
+
+
+
+
+

+ Location +

+
+
+
+ + + +
+
+ + + +
+
+
+
+
+
+{% endblock %} From 32fa839e2c478da3ee9f90064f6117491ac4c011 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Tue, 30 Apr 2019 11:53:47 +0000 Subject: [PATCH 17/23] Display the legacy job order details when Details is clicked. #207 --- src/Controller/SearchController.php | 1 - src/Entity/LegacyJobOrder.php | 8 ++++---- templates/search/form.html.twig | 2 +- templates/search/legacyjo_details.html.twig | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Controller/SearchController.php b/src/Controller/SearchController.php index 9706e914..3afbe85c 100644 --- a/src/Controller/SearchController.php +++ b/src/Controller/SearchController.php @@ -60,7 +60,6 @@ class SearchController extends BaseController $params = $this->initParameters('general.search'); $params['data'] = $legacy_jo; - $params['search_term'] = $search_term; $params['mode'] = "details"; // response diff --git a/src/Entity/LegacyJobOrder.php b/src/Entity/LegacyJobOrder.php index fde4d7ff..17485fc7 100644 --- a/src/Entity/LegacyJobOrder.php +++ b/src/Entity/LegacyJobOrder.php @@ -642,15 +642,15 @@ class LegacyJobOrder return $this->dispatch_date; } - public function setDispatchBy($dispatch_by) + public function setDispatchedBy($dispatched_by) { - $this->dispatch_by = $dispatch_by; + $this->dispatched_by = $dispatched_by; return $this; } - public function getDispatchBy() + public function getDispatchedBy() { - return $this->dispatch_by; + return $this->dispatched_by; } public function setAddress($address) diff --git a/templates/search/form.html.twig b/templates/search/form.html.twig index fc830136..892ca1ed 100644 --- a/templates/search/form.html.twig +++ b/templates/search/form.html.twig @@ -96,7 +96,7 @@ {{ result.getCustLastName|default('') }} {{ result.getCustFirstName|default('') }} {{ result.getPlateNumber|default('') }} - Details + Details {% endfor %} diff --git a/templates/search/legacyjo_details.html.twig b/templates/search/legacyjo_details.html.twig index 9177e9c9..23d11f55 100644 --- a/templates/search/legacyjo_details.html.twig +++ b/templates/search/legacyjo_details.html.twig @@ -80,7 +80,7 @@
- +
@@ -178,7 +178,7 @@
- +
From 55bd686b3452881ccddf2e1042e2789d5c3eb8d8 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Tue, 30 Apr 2019 11:58:36 +0000 Subject: [PATCH 18/23] Disable the text areas and advance order slider. #207 --- templates/search/legacyjo_details.html.twig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/templates/search/legacyjo_details.html.twig b/templates/search/legacyjo_details.html.twig index 23d11f55..2c96b5b5 100644 --- a/templates/search/legacyjo_details.html.twig +++ b/templates/search/legacyjo_details.html.twig @@ -104,7 +104,7 @@ @@ -152,7 +152,7 @@
- +
@@ -166,7 +166,7 @@
- +
@@ -193,12 +193,12 @@
- +
- +
@@ -213,12 +213,12 @@
- +
- +
From 2a31a2823dc7214ffdc3723c1938f279915c4442 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Tue, 30 Apr 2019 12:27:41 +0000 Subject: [PATCH 19/23] Fix the look of the details form. #207 --- templates/search/legacyjo_details.html.twig | 404 +++++++++++--------- 1 file changed, 213 insertions(+), 191 deletions(-) diff --git a/templates/search/legacyjo_details.html.twig b/templates/search/legacyjo_details.html.twig index 2c96b5b5..f43e9e49 100644 --- a/templates/search/legacyjo_details.html.twig +++ b/templates/search/legacyjo_details.html.twig @@ -11,217 +11,239 @@
+ +
+
+
+
+
+
+ + + +

+ Legacy Job Order +

+
+
+
+
+
+
+
-
-
-

- Customer Details -

-
-
-
- - - +
+
+
+

+ Customer Details +

-
- - - -
-
-
-
- -
- +63 - - +
+
+ + + +
+
+ + +
-
- -
- +63 - - +
+
+ +
+ +63 + + +
+
+
+ +
+ +63 + + +
+
+
+
+
+ +
+ +63 + + +
-
-
- -
- +63 - - +
+
+

+ Vehicle Details +

+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+
+ + + +
+
+ + +
-
-
-
-

- Vehicle Details -

-
-
-
- - - +
+
+

+ Transaction Details +

+ + +
-
- - - +
+
+ + + +
+
+ + + +
-
- - - -
-
-
-
- - - -
-
- - - -
-
-
-
-
-

- Transaction Details -

- - - -
-
-
- - - -
-
- - - -
-
-
-
- - - -
-
- -
- - - - +
+
+ + + +
+
+ +
+ + + + +
+
- -
-
- -
- - - - -
- -
-
-
-
- - - -
-
-
-
-
- - - -
-
-
- - -
-
-
-
- - - -
-
-
- - - +
+ +
+ + + + +
+
+
+
+ + + +
+
+
+
+
+ + + +
+
+
+ + +
+
+
+
+ + + +
+
+
+ + + +
+
+
+
+
+ + + +
+
+
+
+ + + +
+
+ + + +
+
-
-
- - - +
+
+
+

+ Location +

+
+
+ + + +
+
+ + + +
+
-
-
- - - -
-
- - - -
-
-
-
-
-
-

- Location -

-
-
-
- - - -
-
- - - -
-
From 92054296621b48569fdf7c6074869ace953dec34 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Wed, 1 May 2019 09:34:00 +0000 Subject: [PATCH 20/23] Add the legacy job order row details to the details page. #207 --- src/Controller/SearchController.php | 1 + src/Entity/LegacyJobOrder.php | 9 + src/Entity/LegacyJobOrderRow.php | 106 +++++ templates/search/legacyjo_details.html.twig | 475 +++++++++++--------- 4 files changed, 374 insertions(+), 217 deletions(-) diff --git a/src/Controller/SearchController.php b/src/Controller/SearchController.php index 3afbe85c..9632c0fc 100644 --- a/src/Controller/SearchController.php +++ b/src/Controller/SearchController.php @@ -7,6 +7,7 @@ use App\Ramcar\BaseController; use App\Service\GeneralSearch; use App\Entity\LegacyJobOrder; +use App\Entity\LegacyJobOrderRow; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; diff --git a/src/Entity/LegacyJobOrder.php b/src/Entity/LegacyJobOrder.php index 17485fc7..e9cbd660 100644 --- a/src/Entity/LegacyJobOrder.php +++ b/src/Entity/LegacyJobOrder.php @@ -343,6 +343,10 @@ class LegacyJobOrder */ protected $plate_number; + /** + * @ORM\OneToMany(targetEntity="LegacyJobOrderRow", mappedBy="job_order") + */ + protected $rows; public function setID($id) @@ -696,4 +700,9 @@ class LegacyJobOrder { return $this->plate_number; } + + public function getRows() + { + return $this->rows; + } } diff --git a/src/Entity/LegacyJobOrderRow.php b/src/Entity/LegacyJobOrderRow.php index 6927afb2..dd8ac461 100644 --- a/src/Entity/LegacyJobOrderRow.php +++ b/src/Entity/LegacyJobOrderRow.php @@ -59,6 +59,12 @@ class LegacyJobOrderRow */ protected $enrollee; + /** + * @ORM\ManyToOne(targetEntity="LegacyJobOrder", inversedBy="rows") + * @ORM\JoinColumn(name="legacy_job_order_id", referencedColumnName="id", nullable=true) + */ + protected $job_order; + public function setID($id) { $this->id = $id; @@ -69,4 +75,104 @@ class LegacyJobOrderRow { return $this->id; } + + public function setJobOrderID($job_order_id) + { + $this->job_order_id = $job_order_id; + return $this; + } + + public function getJobOrderID() + { + return $this->job_order_id; + } + + public function setItem($item) + { + $this->item = $item; + return $this; + } + + public function getItem() + { + return $this->item; + } + + public function setQty($qty) + { + $this->qty = $qty; + return $this; + } + + public function getQty() + { + return $this->qty; + } + + public function setPrice($price) + { + $this->price = $price; + return $this; + } + + public function getPrice() + { + return $this->price; + } + + public function setPriceLevel($price_level) + { + $this->price_level = $price_level; + return $this; + } + + public function getPriceLevel() + { + return $this->price_level; + } + + public function setStatus($status) + { + $this->status = $status; + return $this; + } + + public function getStatus() + { + return $this->status; + } + + public function setAccount($account) + { + $this->account = $account; + return $this; + } + + public function getAccount() + { + return $this->account; + } + + public function setEnrollee($enrollee) + { + $this->enrollee = $enrollee; + return $this; + } + + public function getEnrollee() + { + return $this->enrollee; + } + + public function setJobOrder(LegacyJobOrder $job_order) + { + $this->job_order = $job_order; + return $this; + } + + public function getJobOrder() + { + return $this->job_order; + } + } diff --git a/templates/search/legacyjo_details.html.twig b/templates/search/legacyjo_details.html.twig index f43e9e49..7b1bafd4 100644 --- a/templates/search/legacyjo_details.html.twig +++ b/templates/search/legacyjo_details.html.twig @@ -27,225 +27,266 @@
+ +
+
+
+
+
+

+ Customer Details +

+
+
+
+ + + +
+
+ + + +
+
+
+
+ +
+ +63 + + +
+
+
+ +
+ +63 + + +
+
+
+
+
+ +
+ +63 + + +
+
+
+
+
+
+

+ Vehicle Details +

+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+
+ + + +
+
+ + + +
+
+
+
+
+

+ Transaction Details +

+ + + +
+
+
+ + + +
+
+ + + +
+
+
+
+ + + +
+
+ +
+ + + + +
+ +
+
+ +
+ + + + +
+ +
+
+
+
+ + + +
+
+
+
+
+ + + +
+
+
+ + +
+
+
+
+ + + +
+
+
+ + + +
+
+
+
+
+ + + +
+
+
+
+ + + +
+
+ + + +
+
+
+
+ {% if data.getRows is empty %} + + {% else %} + + + + + + + + + + + + + + + {% for row in data.getRows %} + + + + + + + + + + {% endfor %} + +
IDItemQuantityPricePrice LevelStatusAccountEnrollee
{{ row.getID|default("") }}{{ row.getItem|default('') }}{{ row.getQuantity|default('') }}{{ row.getPrice|default('') }}{{ row.getStatus|default('') }}{{ row.getAccount|default('') }}{{ row.getEnrollee|default('') }}
+ {% endif %} +
+
+
+
+
+
+

+ Location +

+
+
+
+ + + +
+
+ + + +
+
+
+
+
- - -
-
-
-
-
-

- Customer Details -

-
-
-
- - - -
-
- - - -
-
-
-
- -
- +63 - - -
-
-
- -
- +63 - - -
-
-
-
-
- -
- +63 - - -
-
-
-
-
-
-

- Vehicle Details -

-
-
-
- - - -
-
- - - -
-
- - - -
-
-
-
- - - -
-
- - - -
-
-
-
-
-

- Transaction Details -

- - - -
-
-
- - - -
-
- - - -
-
-
-
- - - -
-
- -
- - - - -
- -
-
- -
- - - - -
- -
-
-
-
- - - -
-
-
-
-
- - - -
-
-
- - -
-
-
-
- - - -
-
-
- - - -
-
-
-
-
- - - -
-
-
-
- - - -
-
- - - -
-
-
-
-
-
-

- Location -

-
-
-
- - - -
-
- - - -
-
-
-
-
-
{% endblock %} From fbbfaa56373ce91c60ab3c9876df7dad50442114 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Wed, 1 May 2019 09:55:47 +0000 Subject: [PATCH 21/23] Fix wiring and missing fields for legacy_job_order_row. #207 --- src/Entity/LegacyJobOrderRow.php | 22 +++------------------ templates/search/legacyjo_details.html.twig | 1 + 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/Entity/LegacyJobOrderRow.php b/src/Entity/LegacyJobOrderRow.php index dd8ac461..1b52ee6a 100644 --- a/src/Entity/LegacyJobOrderRow.php +++ b/src/Entity/LegacyJobOrderRow.php @@ -19,11 +19,6 @@ class LegacyJobOrderRow */ protected $id; - /** - * @ORM\Column(type="integer") - */ - protected $job_order_id; - /** * @ORM\Column(type="string", length=40) */ @@ -61,7 +56,7 @@ class LegacyJobOrderRow /** * @ORM\ManyToOne(targetEntity="LegacyJobOrder", inversedBy="rows") - * @ORM\JoinColumn(name="legacy_job_order_id", referencedColumnName="id", nullable=true) + * @ORM\JoinColumn(name="job_order_id", referencedColumnName="id", nullable=true) */ protected $job_order; @@ -76,17 +71,6 @@ class LegacyJobOrderRow return $this->id; } - public function setJobOrderID($job_order_id) - { - $this->job_order_id = $job_order_id; - return $this; - } - - public function getJobOrderID() - { - return $this->job_order_id; - } - public function setItem($item) { $this->item = $item; @@ -98,13 +82,13 @@ class LegacyJobOrderRow return $this->item; } - public function setQty($qty) + public function setQuantity($qty) { $this->qty = $qty; return $this; } - public function getQty() + public function getQuantity() { return $this->qty; } diff --git a/templates/search/legacyjo_details.html.twig b/templates/search/legacyjo_details.html.twig index 7b1bafd4..c221f3e0 100644 --- a/templates/search/legacyjo_details.html.twig +++ b/templates/search/legacyjo_details.html.twig @@ -252,6 +252,7 @@ {{ row.getItem|default('') }} {{ row.getQuantity|default('') }} {{ row.getPrice|default('') }} + {{ row.getPriceLevel|default('') }} {{ row.getStatus|default('') }} {{ row.getAccount|default('') }} {{ row.getEnrollee|default('') }} From b1b2a60f8fee8c17500f6a0b6798c2d56c5ea871 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 2 May 2019 00:02:56 +0000 Subject: [PATCH 22/23] Fix display issue for delivery address and preparedby fields. #207 --- templates/search/legacyjo_details.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/search/legacyjo_details.html.twig b/templates/search/legacyjo_details.html.twig index c221f3e0..c5844c75 100644 --- a/templates/search/legacyjo_details.html.twig +++ b/templates/search/legacyjo_details.html.twig @@ -189,7 +189,7 @@
- +

@@ -274,7 +274,7 @@
- +
From 32e30fcfbbc9b148b4d5d5892212981ec0b6b8b5 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 2 May 2019 01:22:35 +0000 Subject: [PATCH 23/23] Add purchase date to the details form. #207 --- templates/search/legacyjo_details.html.twig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/search/legacyjo_details.html.twig b/templates/search/legacyjo_details.html.twig index c5844c75..15b3ea94 100644 --- a/templates/search/legacyjo_details.html.twig +++ b/templates/search/legacyjo_details.html.twig @@ -138,6 +138,11 @@
+
+ + + +