Merge branch 'RMLWorkorder/update-new-stuff' into 'master'

Rml workorder/update new stuff

See merge request fronk/thetool!1624
This commit is contained in:
Luca Haid
2025-08-07 14:12:34 +00:00
9 changed files with 55 additions and 28 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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'],

View File

@@ -8,6 +8,12 @@
background-color: #f8d7da !important; /* Balanced Red */
}
/* 🟠 High Priority: Deadline less than 2 weeks away */
.table-hover .tt-rml-workorder-high:hover,
.tt-rml-workorder-high {
background-color: #ffd5a1 !important; /* Balanced Orange */
}
/* 🟡 Medium: Deadline less than 3 weeks away */
.table-hover .tt-rml-workorder-medium:hover,
.tt-rml-workorder-medium {

View File

@@ -22,7 +22,26 @@ Vue.component('r-m-l-workorder-admin', {
:crud-config="crudConfig"
>
<template v-slot:preorderinfo="{ row }">
<div v-html="row.preorderInfo" class="small"></div>
<div class="small">
<div>
<strong>Kunde:</strong> {{ row.customerCompany || row.customerName }}
</div>
<div>
<strong>Anschluss:</strong>
{{ row.street }} {{ row.hausnummer }}<template v-if="row.stiege">/{{ row.stiege }}</template><template v-if="row.apartment"> / WE: {{ row.apartment }}</template>, {{ row.plz }} {{ row.city }}
</div>
<div>
<strong>OAID:</strong> <span class="text-pink">{{ row.oaid }}</span>
<tt-button
icon="fas fa-external-link-alt"
@click="window.open(window.TT_CONFIG.BASE_PATH + '/Preorder/Index?filter[ucode]=' + row.ucode, '_blank');"
additional-class="btn-link btn-sm p-0 m-0"
title="Zur Bestellung"
/>
</div>
</div>
</template>
<template v-slot:status="{ row }">
@@ -106,6 +125,7 @@ Vue.component('r-m-l-workorder-admin', {
`,
data() {
return {
window,
workordersToAssign: [],
editingWorkorderId: null,
companies: [],
@@ -121,6 +141,10 @@ Vue.component('r-m-l-workorder-admin', {
if (['completed', 'new'].includes(row.status) || !deadlineDate.isValid()) {
return 'tt-rml-workorder-irrelevant';
}
// if status is correction_requested, return tt-rml-workorder-high
if (row.status === 'correction_requested') {
return 'tt-rml-workorder-high';
}
const daysLeft = deadlineDate.diff(moment(), 'days');

View File

@@ -27,4 +27,8 @@
}
.tt-file-gallery-item.border.border-danger {
border: 4px solid #f1556c!important;
}
.RMLWorkorderCompany-table .modal-body {
overflow-y: hidden;
}

View File

@@ -120,8 +120,6 @@ Vue.component('tt-file-gallery', {
this.editingFile = { ...file }; // create a copy for editing
},
cancelEdit(event) {
console.log('Edit cancelled');
event?.stopPropagation();
this.editingFile = null;
},
saveEdit(event) {
@@ -174,14 +172,14 @@ Vue.component('tt-file-gallery', {
<div class="tt-file-gallery-filename" :title="file.fileName">
<span>{{ file.fileName }}</span>
<i v-if="editMode && !editingFile" class="fas fa-edit text-primary ml-1 action-icon" @click="startEdit(file, $event)"></i>
<i v-if="deleteMode && !editingFile" class="fas fa-trash text-danger ml-1 action-icon" @click="deleteFile(file, $event)"></i>
<i v-if="editMode" class="fas fa-edit text-primary ml-1 action-icon" @click="startEdit(file, $event)"></i>
<i v-if="deleteMode" class="fas fa-trash text-danger ml-1 action-icon" @click="deleteFile(file, $event)"></i>
</div>
</div>
</div>
</div>
<tt-modal v-if="editingFile" :show="true" title="Dokument bearbeiten" @close="cancelEdit" @submit="saveEdit" :delete="false">
<tt-modal v-if="editingFile" :show="true" title="Dokument bearbeiten" @update:show="cancelEdit" @submit="saveEdit" :delete="false" :disable-min-height="true">
<slot name="file-edit" :file="editingFile"></slot>
</tt-modal>

View File

@@ -7,6 +7,7 @@ Vue.component('tt-modal', {
save: {type: Boolean, default: true},
saveLoading: {type: Boolean, default: false},
saveText: {type: String, default: 'Speichern'},
disableMinHeight: {type: Boolean, default: false},
}, watch: {
show(newVal) {
if (!newVal) {
@@ -58,7 +59,7 @@ Vue.component('tt-modal', {
@keydown.esc="$emit('update:show', false)"
v-if="show">
<div class="modal-dialog modal-lg modal-dialog-scrollable" role="document" @mousedown.stop>
<div class="modal-content" style="min-height: 45vh;">
<div class="modal-content" :style="{minHeight: disableMinHeight ? 'auto' : '45vh'}">
<div class="modal-header">
<h5 class="modal-title">{{title}}</h5>
<button type="button" class="close" @click="$emit('update:show', false)">

View File

@@ -581,7 +581,6 @@ Vue.component('tt-table', {
filters: {
handler: function () {
if (!this.isInitialised) return;
console.log('Filters changed:', this.filters);
// go through filters and if there is a set value in filters and the filter of the column is select or autocomplete then parse the value to int
for (const key in this.filters) {