Add spliceCompleted checkbox and update OAID handling in WorkorderMphBase
This commit is contained in:
@@ -16,6 +16,7 @@ class WorkorderMphModel extends TTCrudBaseModel
|
||||
public ?int $conduitToHuepLaid;
|
||||
public ?int $huepMounted;
|
||||
public ?int $dropCableAvailable;
|
||||
public ?int $spliceCompleted;
|
||||
public int $create;
|
||||
public int $createBy;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ class WorkorderMphBaseController extends TTCrud
|
||||
$db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||
$hausnummerId = $db->escape($workorder->hausnummerId);
|
||||
|
||||
$sql = "SELECT w.id, w.bezeichner, w.contact
|
||||
$sql = "SELECT w.id, w.bezeichner, w.contact, w.oaid, w.note
|
||||
FROM Wohneinheit w
|
||||
WHERE w.hausnummer_id = $hausnummerId
|
||||
ORDER BY w.bezeichner";
|
||||
@@ -161,12 +161,15 @@ class WorkorderMphBaseController extends TTCrud
|
||||
$response = [];
|
||||
foreach ($wohneinheiten as $we) {
|
||||
$record = $recordsMap[$we['id']] ?? null;
|
||||
// Prefer WorkorderMphWohneinheit note, fallback to addressdb note
|
||||
$note = $record ? $record->note : $we['note'];
|
||||
$response[] = [
|
||||
'wohneinheitId' => intval($we['id']),
|
||||
'bezeichner' => $we['bezeichner'],
|
||||
'contact' => $we['contact'],
|
||||
'oaid' => $we['oaid'],
|
||||
'status' => $record ? $record->status : 1,
|
||||
'note' => $record ? $record->note : null,
|
||||
'note' => $note,
|
||||
'recordId' => $record ? $record->id : null,
|
||||
];
|
||||
}
|
||||
@@ -215,6 +218,13 @@ class WorkorderMphBaseController extends TTCrud
|
||||
]);
|
||||
}
|
||||
|
||||
// Also save note to addressdb.Wohneinheit
|
||||
$db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||
$escapedNote = $note !== null ? "'" . $db->escape($note) . "'" : "NULL";
|
||||
$escapedWohneinheitId = $db->escape($wohneinheitId);
|
||||
$updateSql = "UPDATE Wohneinheit SET note = $escapedNote WHERE id = $escapedWohneinheitId";
|
||||
$db->query($updateSql);
|
||||
|
||||
// Add journal entry if status or note changed
|
||||
if ($oldStatus !== $status || $oldNote !== $note) {
|
||||
$changes = [];
|
||||
@@ -274,7 +284,7 @@ class WorkorderMphBaseController extends TTCrud
|
||||
if (!$workorder) self::sendError("Arbeitsauftrag nicht gefunden.");
|
||||
|
||||
$changes = [];
|
||||
$checkboxFields = ['easement', 'btb', 'fttxLocationSupplied', 'conduitToHuepLaid', 'huepMounted', 'dropCableAvailable'];
|
||||
$checkboxFields = ['easement', 'btb', 'fttxLocationSupplied', 'conduitToHuepLaid', 'huepMounted', 'dropCableAvailable', 'spliceCompleted'];
|
||||
|
||||
foreach ($checkboxFields as $field) {
|
||||
if (array_key_exists($field, $post)) {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class AddSpliceCompletedToWorkorderMph extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table('WorkorderMph');
|
||||
$table->addColumn('spliceCompleted', 'boolean', [
|
||||
'null' => true,
|
||||
'default' => null,
|
||||
'comment' => 'Spleiß im HÜP/HAK erledigt',
|
||||
'after' => 'dropCableAvailable'
|
||||
]);
|
||||
$table->update();
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table('WorkorderMph');
|
||||
$table->removeColumn('spliceCompleted');
|
||||
$table->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ Vue.component('wohneinheit-status-manager', {
|
||||
<div class="we-cell we-bezeichner">
|
||||
<strong>{{ we.bezeichner }}</strong>
|
||||
<div class="text-muted small">
|
||||
<i class="fas fa-id-card mr-1"></i>OAID: {{ we.wohneinheitId }}
|
||||
<i class="fas fa-id-card mr-1"></i>OAID: {{ we.oaid }}
|
||||
</div>
|
||||
<div v-if="we.contact" class="contact-info text-muted">
|
||||
<i class="fas fa-user mr-1"></i>{{ we.contact }}
|
||||
@@ -87,8 +87,7 @@ Vue.component('wohneinheit-status-manager', {
|
||||
this.wohneinheiten = data.wohneinheiten.map(we => ({
|
||||
...we,
|
||||
changed: false,
|
||||
saving: false,
|
||||
note: we.note || 'Tür 1, Tür 2, Tür 3'
|
||||
saving: false
|
||||
}));
|
||||
this.statusOptions = data.statusOptions || [];
|
||||
} catch (e) {
|
||||
@@ -185,6 +184,12 @@ Vue.component('checkbox-documentation', {
|
||||
<span class="checkmark"></span>
|
||||
<span class="checkbox-label">Dropkabel vorhanden</span>
|
||||
</label>
|
||||
|
||||
<label class="custom-checkbox-item" :class="{ disabled: isAdmin }">
|
||||
<input type="checkbox" v-model="checkboxes.spliceCompleted" :disabled="isAdmin">
|
||||
<span class="checkmark"></span>
|
||||
<span class="checkbox-label">Spleiß im HÜP/HAK erledigt</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-3 text-right" v-if="!isAdmin">
|
||||
<tt-button @click="saveCheckboxes" text="Speichern"
|
||||
@@ -203,7 +208,8 @@ Vue.component('checkbox-documentation', {
|
||||
fttxLocationSupplied: false,
|
||||
conduitToHuepLaid: false,
|
||||
huepMounted: false,
|
||||
dropCableAvailable: false
|
||||
dropCableAvailable: false,
|
||||
spliceCompleted: false
|
||||
}
|
||||
}),
|
||||
methods: {
|
||||
@@ -219,7 +225,8 @@ Vue.component('checkbox-documentation', {
|
||||
fttxLocationSupplied: !!data.fttxLocationSupplied,
|
||||
conduitToHuepLaid: !!data.conduitToHuepLaid,
|
||||
huepMounted: !!data.huepMounted,
|
||||
dropCableAvailable: !!data.dropCableAvailable
|
||||
dropCableAvailable: !!data.dropCableAvailable,
|
||||
spliceCompleted: !!data.spliceCompleted
|
||||
};
|
||||
} catch (e) {
|
||||
window.notify('error', 'Checkboxen konnten nicht geladen werden.');
|
||||
|
||||
Reference in New Issue
Block a user