added technical data to xinon workorder and workordermph now has a unassign button

This commit is contained in:
Luca Haid
2026-01-18 17:42:11 +00:00
parent a35b865fad
commit 6ab41a9169
13 changed files with 508 additions and 24 deletions
@@ -164,6 +164,7 @@ class WorkorderHandler extends MobileAppBaseHandler {
'interventionTypes' => json_decode($tenantConfig->interventionTypes, true) ?? [],
'requireCableLength' => (bool)$tenantConfig->requireCableLength,
'requireCableType' => (bool)$tenantConfig->requireCableType,
'showTechnicalData' => (bool)$tenantConfig->showTechnicalData,
];
}
@@ -241,6 +242,11 @@ class WorkorderHandler extends MobileAppBaseHandler {
];
}
$technicalData = null;
if ($tenantConfigData && !empty($tenantConfigData['showTechnicalData'])) {
$technicalData = $this->getTechnicalData($id);
}
self::returnJson([
'success' => true,
'workorder' => $workorder,
@@ -252,7 +258,8 @@ class WorkorderHandler extends MobileAppBaseHandler {
'completed' => $completedCount,
'total' => count($docTypes),
'allRequired' => $this->allRequiredCompleted($checklist)
]
],
'technicalData' => $technicalData,
]);
}
@@ -893,6 +900,51 @@ class WorkorderHandler extends MobileAppBaseHandler {
return true;
}
/**
* Get technical data (patchposition and AHA Blatt) for a workorder
*/
private function getTechnicalData($workorderId) {
$workorder = WorkorderModel::get($workorderId);
if (!$workorder || !$workorder->preorderId) return null;
$preorder = new Preorder($workorder->preorderId);
if (!$preorder->id || !$preorder->adb_wohneinheit_id) return null;
$wohneinheit = $preorder->adb_wohneinheit;
if (!$wohneinheit) return null;
$defaultCluster = '';
if ($preorder->adb_hausnummer && $preorder->adb_hausnummer->netzgebiet) {
$defaultCluster = $preorder->adb_hausnummer->netzgebiet->extref ?? '';
}
$patchposition = [
'equipmentName' => $wohneinheit->getPatchEqString(),
'equipmentPort' => $wohneinheit->patch_port,
'cluster' => $wohneinheit->patch_cluster ?: $defaultCluster,
'shelf' => $wohneinheit->patch_shelf,
'module' => $wohneinheit->patch_module,
];
$rimoWorkorders = [];
if (is_array($wohneinheit->rimo_workorders) && count($wohneinheit->rimo_workorders)) {
foreach ($wohneinheit->rimo_workorders as $wo) {
$rimoWorkorders[] = [
'id' => $wo->id,
'rimoName' => $wo->rimo_name,
'rimoId' => $wo->rimo_id,
'rimoStatus' => $wo->rimo_status,
'downloadUrl' => "/RimoWorkorder/downloadAha?id=" . $wo->id,
];
}
}
return [
'patchposition' => $patchposition,
'rimoWorkorders' => $rimoWorkorders,
];
}
/**
* Get single workorder with full joined data (same structure as getCompanyWorkorders)
*/