Fix search filter, some sort columns, and menu reference

This commit is contained in:
elmo 2024-10-18 16:28:54 +08:00
parent 0adbfbd861
commit ee89893619
7 changed files with 30 additions and 24 deletions

View file

@ -6,6 +6,14 @@ catalyst_menu:
icon: flaticon-line-graph icon: flaticon-line-graph
order: 1 order: 1
- id: competitors
acl: competitor.menu
label: Competitors
icon: fa fa-battery-0 #hehe
order: 1
- id: user - id: user
acl: user.menu acl: user.menu
label: '[menu.user]' label: '[menu.user]'
@ -305,9 +313,3 @@ catalyst_menu:
acl: item_pricing.update acl: item_pricing.update
label: Item Pricing label: Item Pricing
parent: item parent: item
- id: competitor
acl: competitor.menu
label: Competitors
icon: fa fa-battery-0 #hehe
order: 1

View file

@ -2,6 +2,10 @@ home:
path: / path: /
controller: App\Controller\HomeController::index controller: App\Controller\HomeController::index
home2:
path: /home
controller: App\Controller\HomeController::index
rider_locations: rider_locations:
path: /rider_locations path: /rider_locations
controller: App\Controller\HomeController::getRiderLocations controller: App\Controller\HomeController::getRiderLocations

View file

@ -20,7 +20,7 @@ class CompetitorController extends Controller
{ {
/** /**
* @Menu(selected="competitor") * @Menu(selected="competitors")
*/ */
public function index() public function index()
{ {
@ -65,9 +65,8 @@ class CompetitorController extends Controller
'field' => 'id' 'field' => 'id'
]; ];
// dd($meta);
// build query // build query
$query = $qb->select('q'); $query = $qb->select('q');
$this->setQueryFilters($datatable, $query); $this->setQueryFilters($datatable, $query);
@ -126,7 +125,7 @@ class CompetitorController extends Controller
} }
/** /**
* @Menu(selected="competitor") * @Menu(selected="competitors")
*/ */
public function addForm() public function addForm()
{ {
@ -183,7 +182,7 @@ class CompetitorController extends Controller
} }
/** /**
* @Menu(selected="competitor") * @Menu(selected="competitors")
*/ */
public function updateForm($id) public function updateForm($id)
@ -274,8 +273,10 @@ class CompetitorController extends Controller
protected function setQueryFilters($datatable, QueryBuilder $query) protected function setQueryFilters($datatable, QueryBuilder $query)
{ {
if (isset($datatable['query']['data-rows-search']) && !empty($datatable['query']['data-rows-search'])) { if (isset($datatable['query']['data-rows-search']) && !empty($datatable['query']['data-rows-search'])) {
$query->where('q.name LIKE :filter') $query->where('q.branch_name LIKE :filter')
->orWhere('q.address LIKE :filter') ->orWhere('q.address LIKE :filter')
->orWhere('q.brand LIKE :filter')
->orWhere('q.is_near_partner LIKE :filter')
->setParameter('filter', '%' . $datatable['query']['data-rows-search'] . '%'); ->setParameter('filter', '%' . $datatable['query']['data-rows-search'] . '%');
} }
} }
@ -288,7 +289,7 @@ class CompetitorController extends Controller
$obj->setBranchName($req->request->get('branch_name')) $obj->setBranchName($req->request->get('branch_name'))
->setBrand($req->request->get('brand')) ->setBrand($req->request->get('brand'))
->setAddress($req->request->get('address')) ->setAddress($req->request->get('address'))
->setIsNearPartner($req->request->get('isNearPartner') ? 1 : 0); ->setIsNearPartner($req->request->get('is_near_partner') ? 1 : 0);
} }

View file

@ -30,7 +30,7 @@ class Competitor
/** /**
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
*/ */
private $isNearPartner; private $is_near_partner;
/** /**
* @ORM\Column(type="string", length=255) * @ORM\Column(type="string", length=255)
@ -68,12 +68,12 @@ class Competitor
public function getIsNearPartner(): ?bool public function getIsNearPartner(): ?bool
{ {
return $this->isNearPartner; return $this->is_near_partner;
} }
public function setIsNearPartner(bool $isNearPartner): self public function setIsNearPartner(bool $is_near_partner): self
{ {
$this->isNearPartner = $isNearPartner; $this->is_near_partner = $is_near_partner;
return $this; return $this;
} }

View file

@ -80,7 +80,7 @@
<div class="col-lg-12"> <div class="col-lg-12">
<span class="m-switch m-switch--icon block-switch"> <span class="m-switch m-switch--icon block-switch">
<label> <label>
<input type="checkbox" name="isNearPartner" id="flag_near_partner" value="1"{{ obj.isNearPartner() ? ' checked'}}> <input type="checkbox" name="is_near_partner" id="flag_near_partner" value="1"{{ obj.getIsNearPartner() ? ' checked'}}>
<label class="switch-label">Near A Partner</label> <label class="switch-label">Near A Partner</label>
<span></span> <span></span>
</label> </label>

View file

@ -95,7 +95,6 @@
{ {
field: 'is_near_partner', field: 'is_near_partner',
title: 'Near a Partner?', title: 'Near a Partner?',
sortable: false
}, },
{ {
field: 'Actions', field: 'Actions',

View file

@ -14,7 +14,7 @@
<li class="m-menu__item " aria-haspopup="true" > <li class="m-menu__item " aria-haspopup="true" >
{% endif %} {% endif %}
<a href="{{ menu_link(mi) }}" class="m-menu__link{% if mi.hasChildren %} m-menu__toggle{% endif %}"> <a " href="{{ mi.getRoute }}" class="m-menu__link{% if mi.hasChildren %} m-menu__toggle{% endif %}">
<i class="m-menu__link-icon {{ mi.getIcon }}"></i> <i class="m-menu__link-icon {{ mi.getIcon }}"></i>
<span class="m-menu__link-title"> <span class="m-menu__link-title">
<span class="m-menu__link-wrap"> <span class="m-menu__link-wrap">
@ -49,7 +49,7 @@
{% else %} {% else %}
<li class="m-menu__item " aria-haspopup="true" > <li class="m-menu__item " aria-haspopup="true" >
{% endif %} {% endif %}
<a href="{{ menu_link(mi) }}" class="m-menu__link "> <a " href="{{ menu_link(mi) }}" class="m-menu__link ">
<i class="m-menu__link-bullet m-menu__link-bullet--dot"> <i class="m-menu__link-bullet m-menu__link-bullet--dot">
<span></span> <span></span>
</i> </i>