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 $conduitToHuepLaid;
|
||||||
public ?int $huepMounted;
|
public ?int $huepMounted;
|
||||||
public ?int $dropCableAvailable;
|
public ?int $dropCableAvailable;
|
||||||
|
public ?int $spliceCompleted;
|
||||||
public int $create;
|
public int $create;
|
||||||
public int $createBy;
|
public int $createBy;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class WorkorderMphBaseController extends TTCrud
|
|||||||
$db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
$db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||||
$hausnummerId = $db->escape($workorder->hausnummerId);
|
$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
|
FROM Wohneinheit w
|
||||||
WHERE w.hausnummer_id = $hausnummerId
|
WHERE w.hausnummer_id = $hausnummerId
|
||||||
ORDER BY w.bezeichner";
|
ORDER BY w.bezeichner";
|
||||||
@@ -161,12 +161,15 @@ class WorkorderMphBaseController extends TTCrud
|
|||||||
$response = [];
|
$response = [];
|
||||||
foreach ($wohneinheiten as $we) {
|
foreach ($wohneinheiten as $we) {
|
||||||
$record = $recordsMap[$we['id']] ?? null;
|
$record = $recordsMap[$we['id']] ?? null;
|
||||||
|
// Prefer WorkorderMphWohneinheit note, fallback to addressdb note
|
||||||
|
$note = $record ? $record->note : $we['note'];
|
||||||
$response[] = [
|
$response[] = [
|
||||||
'wohneinheitId' => intval($we['id']),
|
'wohneinheitId' => intval($we['id']),
|
||||||
'bezeichner' => $we['bezeichner'],
|
'bezeichner' => $we['bezeichner'],
|
||||||
'contact' => $we['contact'],
|
'contact' => $we['contact'],
|
||||||
|
'oaid' => $we['oaid'],
|
||||||
'status' => $record ? $record->status : 1,
|
'status' => $record ? $record->status : 1,
|
||||||
'note' => $record ? $record->note : null,
|
'note' => $note,
|
||||||
'recordId' => $record ? $record->id : null,
|
'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
|
// Add journal entry if status or note changed
|
||||||
if ($oldStatus !== $status || $oldNote !== $note) {
|
if ($oldStatus !== $status || $oldNote !== $note) {
|
||||||
$changes = [];
|
$changes = [];
|
||||||
@@ -274,7 +284,7 @@ class WorkorderMphBaseController extends TTCrud
|
|||||||
if (!$workorder) self::sendError("Arbeitsauftrag nicht gefunden.");
|
if (!$workorder) self::sendError("Arbeitsauftrag nicht gefunden.");
|
||||||
|
|
||||||
$changes = [];
|
$changes = [];
|
||||||
$checkboxFields = ['easement', 'btb', 'fttxLocationSupplied', 'conduitToHuepLaid', 'huepMounted', 'dropCableAvailable'];
|
$checkboxFields = ['easement', 'btb', 'fttxLocationSupplied', 'conduitToHuepLaid', 'huepMounted', 'dropCableAvailable', 'spliceCompleted'];
|
||||||
|
|
||||||
foreach ($checkboxFields as $field) {
|
foreach ($checkboxFields as $field) {
|
||||||
if (array_key_exists($field, $post)) {
|
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">
|
<div class="we-cell we-bezeichner">
|
||||||
<strong>{{ we.bezeichner }}</strong>
|
<strong>{{ we.bezeichner }}</strong>
|
||||||
<div class="text-muted small">
|
<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>
|
||||||
<div v-if="we.contact" class="contact-info text-muted">
|
<div v-if="we.contact" class="contact-info text-muted">
|
||||||
<i class="fas fa-user mr-1"></i>{{ we.contact }}
|
<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 => ({
|
this.wohneinheiten = data.wohneinheiten.map(we => ({
|
||||||
...we,
|
...we,
|
||||||
changed: false,
|
changed: false,
|
||||||
saving: false,
|
saving: false
|
||||||
note: we.note || 'Tür 1, Tür 2, Tür 3'
|
|
||||||
}));
|
}));
|
||||||
this.statusOptions = data.statusOptions || [];
|
this.statusOptions = data.statusOptions || [];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -185,6 +184,12 @@ Vue.component('checkbox-documentation', {
|
|||||||
<span class="checkmark"></span>
|
<span class="checkmark"></span>
|
||||||
<span class="checkbox-label">Dropkabel vorhanden</span>
|
<span class="checkbox-label">Dropkabel vorhanden</span>
|
||||||
</label>
|
</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>
|
||||||
<div class="mt-3 text-right" v-if="!isAdmin">
|
<div class="mt-3 text-right" v-if="!isAdmin">
|
||||||
<tt-button @click="saveCheckboxes" text="Speichern"
|
<tt-button @click="saveCheckboxes" text="Speichern"
|
||||||
@@ -203,7 +208,8 @@ Vue.component('checkbox-documentation', {
|
|||||||
fttxLocationSupplied: false,
|
fttxLocationSupplied: false,
|
||||||
conduitToHuepLaid: false,
|
conduitToHuepLaid: false,
|
||||||
huepMounted: false,
|
huepMounted: false,
|
||||||
dropCableAvailable: false
|
dropCableAvailable: false,
|
||||||
|
spliceCompleted: false
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
@@ -219,7 +225,8 @@ Vue.component('checkbox-documentation', {
|
|||||||
fttxLocationSupplied: !!data.fttxLocationSupplied,
|
fttxLocationSupplied: !!data.fttxLocationSupplied,
|
||||||
conduitToHuepLaid: !!data.conduitToHuepLaid,
|
conduitToHuepLaid: !!data.conduitToHuepLaid,
|
||||||
huepMounted: !!data.huepMounted,
|
huepMounted: !!data.huepMounted,
|
||||||
dropCableAvailable: !!data.dropCableAvailable
|
dropCableAvailable: !!data.dropCableAvailable,
|
||||||
|
spliceCompleted: !!data.spliceCompleted
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
window.notify('error', 'Checkboxen konnten nicht geladen werden.');
|
window.notify('error', 'Checkboxen konnten nicht geladen werden.');
|
||||||
|
|||||||
Reference in New Issue
Block a user