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..9632c0fc 100644 --- a/src/Controller/SearchController.php +++ b/src/Controller/SearchController.php @@ -3,8 +3,12 @@ namespace App\Controller; 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; @@ -46,4 +50,20 @@ 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['mode'] = "details"; + + // response + return $this->render('search/legacyjo_details.html.twig', $params); + } } diff --git a/src/Entity/LegacyJobOrder.php b/src/Entity/LegacyJobOrder.php index fde4d7ff..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) @@ -642,15 +646,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) @@ -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..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) */ @@ -59,6 +54,12 @@ class LegacyJobOrderRow */ protected $enrollee; + /** + * @ORM\ManyToOne(targetEntity="LegacyJobOrder", inversedBy="rows") + * @ORM\JoinColumn(name="job_order_id", referencedColumnName="id", nullable=true) + */ + protected $job_order; + public function setID($id) { $this->id = $id; @@ -69,4 +70,93 @@ class LegacyJobOrderRow { return $this->id; } + + public function setItem($item) + { + $this->item = $item; + return $this; + } + + public function getItem() + { + return $this->item; + } + + public function setQuantity($qty) + { + $this->qty = $qty; + return $this; + } + + public function getQuantity() + { + 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/form.html.twig b/templates/search/form.html.twig index 9e9d22c7..892ca1ed 100644 --- a/templates/search/form.html.twig +++ b/templates/search/form.html.twig @@ -86,6 +86,7 @@