Rml workorder/update new stuff

This commit is contained in:
Luca Haid
2025-08-07 14:12:34 +00:00
parent ee9ff0b93d
commit 17e099e487
9 changed files with 55 additions and 28 deletions
@@ -77,6 +77,9 @@ class RMLWorkorderModel extends TTCrudBaseModel {
if (!empty($filters['preorderInfo'])) {
$searchColumns = "p.firstname|p.lastname|p.company|p.oaid|p.street|p.housenumber|p.zip|p.city|str.name|ort.name";
$sql .= Helper::generateFilterCondition($filters['preorderInfo'], $searchColumns);
} if (!empty($filters['rimo_fcp_name'])) {
$searchColumns = "hn.rimo_fcp_name";
$sql .= Helper::generateFilterCondition($filters['rimo_fcp_name'], $searchColumns);
}
return "WHERE " . ltrim(trim($sql), 'AND');
@@ -89,8 +92,8 @@ class RMLWorkorderModel extends TTCrudBaseModel {
$sql = "
SELECT
w.id, w.status, w.deadlineDate, w.companyId, p.preordercampaign_id,
CONCAT_WS(' ', p.firstname, p.lastname) as customerName,
w.id, w.status, w.deadlineDate, w.companyId, p.preordercampaign_id, hn.rimo_fcp_name,
CONCAT_WS(' ', p.firstname, p.lastname) as customerName, p.ucode,
p.company as customerCompany, p.oaid, c.name as companyName,
str.name as street, hn.hausnummer, hn.stiege, we.bezeichner as apartment, plz.plz, ort.name as city
FROM `$fronkDbName`.`RMLWorkorder` w
@@ -167,6 +170,9 @@ class RMLWorkorderModel extends TTCrudBaseModel {
if (!empty($filters['preorderInfo'])) {
$searchColumns = "p.firstname|p.lastname|p.company|p.oaid|p.street|p.housenumber|p.zip|p.city|str.name|ort.name|p.phone|p.email";
$sql .= Helper::generateFilterCondition($filters['preorderInfo'], $searchColumns);
} if (!empty($filters['rimo_fcp_name'])) {
$searchColumns = "hn.rimo_fcp_name";
$sql .= Helper::generateFilterCondition($filters['rimo_fcp_name'], $searchColumns);
}
return "WHERE " . $sql;
@@ -180,7 +186,7 @@ class RMLWorkorderModel extends TTCrudBaseModel {
$sql = "
SELECT
w.id, w.status, w.deadlineDate, w.appointmentDate,
w.id, w.status, w.deadlineDate, w.appointmentDate, hn.rimo_fcp_name,
CONCAT_WS(' ', p.firstname, p.lastname) as customerName,
p.company as customerCompany, p.oaid, p.phone, p.email,
str.name as street, hn.hausnummer, hn.stiege, we.bezeichner as apartment, plz.plz, ort.name as city
@@ -8,10 +8,11 @@ class RMLWorkorderAdminController extends TTCrud
protected array $permissionCheck = ['RMLAdmin'];
protected array $columns = [
['key' => 'id', 'text' => 'Auftrag-Nr.', 'table' => ['sortable' => true]],
['key' => 'preorderInfo', 'text' => 'Kunde / Projekt', 'modal' => false, 'table' => ['sortable' => false, 'filter' => 'search']],
// ['key' => 'id', 'text' => 'Auftrag-Nr.', 'table' => ['sortable' => true]],
['key' => 'preordercampaign_id', 'text' => 'Cluster', 'modal' => false, 'table' => ['filter' => 'select']],
['key' => 'companyName', 'text' => 'Zuständige Firma', 'modal' => false, 'table' => ['filter' => 'search']],
['key' => 'preorderInfo', 'text' => 'Kunde / Projekt', 'modal' => false, 'table' => ['sortable' => false]],
['key' => 'rimo_fcp_name', 'text' => 'FCP', 'modal' => false, 'table' => ['sortable' => false]],
['key' => 'companyName', 'text' => 'Zuständige Firma', 'modal' => false],
['key' => 'status', 'text' => 'Status', 'modal' => false, 'table' => ['filter' => 'iconSelect', 'filterOptions' => [
['value' => 'new', 'text' => 'Neu', 'icon' => 'fas fa-star text-primary'],
['value' => 'assigned', 'text' => 'Zugewiesen', 'icon' => 'fas fa-user-check text-info'],
@@ -63,23 +64,10 @@ class RMLWorkorderAdminController extends TTCrud
$rows = array_map(function($workorder) {
$row = (array)$workorder;
$anschlussadresse = "{$row['street']} {$row['hausnummer']}";
if ($row['stiege']) $anschlussadresse .= "/{$row['stiege']}";
if ($row['apartment']) $anschlussadresse .= " / WE: {$row['apartment']}";
$anschlussadresse .= ", {$row['plz']} {$row['city']}";
$kunde = $row['customerCompany'] ?: $row['customerName'];
$row['preorderInfo'] = "<strong>Kunde:</strong> {$kunde}<br>" .
"<strong>Anschluss:</strong> {$anschlussadresse}<br>" .
"<strong>OAID:</strong> <span class='text-pink'>{$row['oaid']}</span>";
$row['companyName'] ??= 'Nicht zugewiesen';
$row['deadlineDateFormatted'] = $row['deadlineDate'] ? date('d.m.Y', $row['deadlineDate']) : 'Keine Deadline';
$row['daysUntilDeadline'] = $row['deadlineDate'] ? ceil(($row['deadlineDate'] - time()) / (60 * 60 * 24)) : null;
unset($row['customerName'], $row['customerCompany'], $row['street'], $row['hausnummer'], $row['stiege'], $row['oaid'], $row['apartment'], $row['plz'], $row['city']);
return $row;
}, $workorders);
@@ -8,7 +8,8 @@ class RMLWorkorderCompanyController extends TTCrud
protected array $columns = [
['key' => 'id', 'text' => 'Auftrag-Nr.', 'table' => ['sortable' => true]],
['key' => 'preorderInfo', 'text' => 'Kunde / Projekt', 'modal' => false, 'table' => ['sortable' => false, 'filter' => 'search']],
['key' => 'preorderInfo', 'text' => 'Kunde / Projekt', 'modal' => false, 'table' => ['sortable' => false]],
['key' => 'rimo_fcp_name', 'text' => 'FCP', 'modal' => false, 'table' => ['sortable' => false]],
['key' => 'status', 'text' => 'Status', 'modal' => false, 'table' => ['filter' => 'iconSelect', 'filterOptions' => [
['value' => 'new', 'text' => 'Neu', 'icon' => 'fas fa-star text-primary'],
['value' => 'assigned', 'text' => 'Zugewiesen', 'icon' => 'fas fa-user-check text-info'],