added new features
This commit is contained in:
@@ -26,6 +26,25 @@ class RMLWorkorderCompanyController extends TTCrud
|
||||
|
||||
protected array $additionalJSVariables = ['COMPANY_ID' => '0'];
|
||||
|
||||
private function getStatusText(string $statusKey): string {
|
||||
$statusColumn = null;
|
||||
foreach ($this->columns as $column) {
|
||||
if ($column['key'] === 'status') {
|
||||
$statusColumn = $column;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($statusColumn) {
|
||||
foreach ($statusColumn['table']['filterOptions'] as $option) {
|
||||
if ($option['value'] === $statusKey) {
|
||||
return $option['text'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return ucfirst(str_replace('_', ' ', $statusKey)); // Fallback
|
||||
}
|
||||
|
||||
protected function prepareCrudConfig() {
|
||||
$company = RMLWorkorderCompanyModel::getFirst(['addressId' => $this->user->address_id]);
|
||||
if ($company) {
|
||||
@@ -197,7 +216,7 @@ class RMLWorkorderCompanyController extends TTCrud
|
||||
RMLWorkorderJournalModel::create([
|
||||
'workorderId' => $workorder->id,
|
||||
'text' => "Eingriff benötigt: " . $post['journalText'],
|
||||
'statusChange' => "$oldStatus -> intervention_required",
|
||||
'statusChange' => $this->getStatusText($oldStatus) . " -> " . $this->getStatusText('intervention_required'),
|
||||
'create' => time(),
|
||||
'createBy' => $this->user->id,
|
||||
]);
|
||||
@@ -205,7 +224,6 @@ class RMLWorkorderCompanyController extends TTCrud
|
||||
self::returnJson(['success' => true, 'message' => 'Eingriff wurde angefordert.']);
|
||||
}
|
||||
|
||||
|
||||
protected function uploadDocumentationAction()
|
||||
{
|
||||
if (empty($_FILES['files']) || empty($_POST['workorderId'])) {
|
||||
@@ -271,20 +289,21 @@ class RMLWorkorderCompanyController extends TTCrud
|
||||
$translationMap = [
|
||||
'photo_hup_mounted' => 'Foto_montierter_HÜP',
|
||||
'photo_hup_open' => 'Foto_offener_HÜP',
|
||||
'photo_splice_cassette' => 'Foto_Spleißkassette',
|
||||
'photo_splice_cassette_hup' => 'Foto_Spleißkassette_HÜP',
|
||||
'photo_splice_cassette_fcp' => 'Foto_Spleißkassette_FCP',
|
||||
'photo_hup_closed_stickers' => 'Foto_geschlossener_HÜP_mit_Aufklebern',
|
||||
'photo_fcp_labeled' => 'Foto_FCP_beschriftet',
|
||||
'photo_patch_position_osp' => 'Foto_Patch-Position_OSP-Seite',
|
||||
'photo_patch_position_anb' => 'Foto_Patch-Position_ANB-Seite',
|
||||
'measurement_protocol_otdr' => 'ODTR_Messung',
|
||||
'other' => 'Sonstiges_Dokument'
|
||||
];
|
||||
|
||||
foreach($docs as $doc) {
|
||||
$file = new File($doc->fileId);
|
||||
$documentTypeKey = $doc->documentType;
|
||||
if (!isset($typeCounts[$documentTypeKey])) {
|
||||
$typeCounts[$documentTypeKey] = 1;
|
||||
} else {
|
||||
$typeCounts[$documentTypeKey]++;
|
||||
}
|
||||
|
||||
$typeCounts[$documentTypeKey] = ($typeCounts[$documentTypeKey] ?? 0) + 1;
|
||||
|
||||
$originalFilename = $file->orig_filename ?? $file->filename;
|
||||
$extension = pathinfo($originalFilename, PATHINFO_EXTENSION);
|
||||
@@ -295,6 +314,7 @@ class RMLWorkorderCompanyController extends TTCrud
|
||||
'id' => $doc->id,
|
||||
'fileId' => $doc->fileId,
|
||||
'fileName' => $newFilename,
|
||||
'description' => $doc->description,
|
||||
'documentType' => $documentTypeKey,
|
||||
'mimetype' => $file->mimetype,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user