mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 17:02:19 +00:00
new Core Component Function
- autocomplete and dropdown field for search oes and search functions with active and non active entries - possibility to dynamic styling of display switch, newButton in Tabulator, different editLabels - possibility to show/hide column company - possibility to show/hide to save function as copy
This commit is contained in:
@@ -217,4 +217,72 @@ class Organisationseinheit_model extends DB_Model
|
||||
oe_kurzbz ILIKE '%". $this->escapeLike($eventQuery). "%'
|
||||
");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get OEs by eventQuery string and companyOrgetKurzbz
|
||||
* Use with autocomplete event queries in Function Component
|
||||
* @param $searchString String
|
||||
* @param $companyOrgetKurzbz String oe_kurzbz of the company (gst vs gmbh)
|
||||
* @return array
|
||||
*/
|
||||
public function getAutocompleteSuggestionsWithCompany($companyOrgetKurzbz, $searchString)
|
||||
{
|
||||
$sql = "
|
||||
WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) AS (
|
||||
SELECT oe_kurzbz, oe_parent_kurzbz
|
||||
FROM public.tbl_organisationseinheit
|
||||
WHERE oe_kurzbz = ?
|
||||
UNION ALL
|
||||
SELECT o.oe_kurzbz, o.oe_parent_kurzbz
|
||||
FROM public.tbl_organisationseinheit o
|
||||
INNER JOIN oes ON o.oe_parent_kurzbz = oes.oe_kurzbz
|
||||
)
|
||||
SELECT
|
||||
oe.oe_kurzbz, oe.aktiv,
|
||||
'[' || COALESCE(oet.bezeichnung, oet.organisationseinheittyp_kurzbz) ||
|
||||
'] ' || COALESCE(oe.bezeichnung, oe.oe_kurzbz) AS label
|
||||
FROM (
|
||||
SELECT oe_kurzbz FROM oes GROUP BY oe_kurzbz
|
||||
) c
|
||||
JOIN public.tbl_organisationseinheit oe ON oe.oe_kurzbz = c.oe_kurzbz
|
||||
JOIN public.tbl_organisationseinheittyp oet ON oe.organisationseinheittyp_kurzbz = oet.organisationseinheittyp_kurzbz
|
||||
";
|
||||
|
||||
$params = [$companyOrgetKurzbz];
|
||||
|
||||
if (!empty($searchString)) {
|
||||
$escaped = $this->escapeLike($searchString);
|
||||
$ilike = '%' . $escaped . '%';
|
||||
|
||||
$sql .= "
|
||||
WHERE
|
||||
oe.oe_kurzbz ILIKE ? OR
|
||||
oe.bezeichnung ILIKE ? OR
|
||||
oe.organisationseinheittyp_kurzbz ILIKE ?
|
||||
";
|
||||
|
||||
$params[] = $ilike;
|
||||
$params[] = $ilike;
|
||||
$params[] = $ilike;
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY oet.bezeichnung ASC, oe.bezeichnung ASC";
|
||||
|
||||
$result = $this->execQuery($sql, $params);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get highest organisation units
|
||||
*/
|
||||
public function getHeads()
|
||||
{
|
||||
$this->addSelect('*');
|
||||
$this->addSelect('oe_kurzbz as head');
|
||||
$result = $this->loadWhere(array('oe_parent_kurzbz' => null, 'aktiv' => true));
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,26 @@ class Funktion_model extends DB_Model
|
||||
$this->dbTable = 'public.tbl_funktion';
|
||||
$this->pk = 'funktion_kurzbz';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Functions by eventQuery string. Use with autocomplete event queries in Function Component
|
||||
* @param $eventQuery String
|
||||
* @return array
|
||||
*/
|
||||
public function getAutocompleteSuggestions($eventQuery)
|
||||
{
|
||||
$this->addSelect('funktion_kurzbz, beschreibung, aktiv');
|
||||
$this->addSelect("beschreibung AS label");
|
||||
$this->addOrder('beschreibung', 'ASC');
|
||||
|
||||
if($eventQuery === null)
|
||||
{
|
||||
return $this->load();
|
||||
}
|
||||
|
||||
return $this->loadWhere("
|
||||
funktion_kurzbz ILIKE '%". $this->escapeLike($eventQuery). "%'
|
||||
OR beschreibung ILIKE '%". $this->escapeLike($eventQuery). "%'
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user