Asset management/add external text field
This commit is contained in:
@@ -92,6 +92,7 @@ class AssetManagementController extends TTCrud
|
|||||||
$row['currentSite'] = $latestJournal->site;
|
$row['currentSite'] = $latestJournal->site;
|
||||||
$row['borrowDate'] = $latestJournal->borrowDate;
|
$row['borrowDate'] = $latestJournal->borrowDate;
|
||||||
$row['expectedReturnDate'] = $latestJournal->expectedReturnDate;
|
$row['expectedReturnDate'] = $latestJournal->expectedReturnDate;
|
||||||
|
$row['externalUser'] = $latestJournal->externalUser;
|
||||||
} else {
|
} else {
|
||||||
// Asset is available
|
// Asset is available
|
||||||
$row['journalId'] = null;
|
$row['journalId'] = null;
|
||||||
@@ -100,6 +101,7 @@ class AssetManagementController extends TTCrud
|
|||||||
$row['currentSite'] = null;
|
$row['currentSite'] = null;
|
||||||
$row['borrowDate'] = null;
|
$row['borrowDate'] = null;
|
||||||
$row['expectedReturnDate'] = null;
|
$row['expectedReturnDate'] = null;
|
||||||
|
$row['externalUser'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$row['reservations'] = $reservationMap[$asset->id] ?? [];
|
$row['reservations'] = $reservationMap[$asset->id] ?? [];
|
||||||
@@ -156,6 +158,7 @@ class AssetManagementController extends TTCrud
|
|||||||
'assetId' => $post['assetId'],
|
'assetId' => $post['assetId'],
|
||||||
'userId' => $post['userId'],
|
'userId' => $post['userId'],
|
||||||
'site' => $post['site'],
|
'site' => $post['site'],
|
||||||
|
'externalUser' => $post['externalUser'] ?? null,
|
||||||
'borrowReason' => $post['reason'] ?? null,
|
'borrowReason' => $post['reason'] ?? null,
|
||||||
'expectedReturnDate' => $post['expectedReturnDate'] ?? null,
|
'expectedReturnDate' => $post['expectedReturnDate'] ?? null,
|
||||||
'borrowDate' => time(),
|
'borrowDate' => time(),
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class AssetManagementJournalModel extends TTCrudBaseModel {
|
|||||||
public int $assetId;
|
public int $assetId;
|
||||||
public int $userId;
|
public int $userId;
|
||||||
public string $site;
|
public string $site;
|
||||||
|
public ?string $externalUser;
|
||||||
public int $borrowDate;
|
public int $borrowDate;
|
||||||
public ?int $expectedReturnDate;
|
public ?int $expectedReturnDate;
|
||||||
public ?int $returnDate;
|
public ?int $returnDate;
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Phinx\Migration\AbstractMigration;
|
||||||
|
|
||||||
|
final class AssetManagementJournalAddExternalUser extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
if ($this->getEnvironment() == "thetool") {
|
||||||
|
$table = $this->table('AssetManagementJournal');
|
||||||
|
$table->addColumn('externalUser', 'string', [
|
||||||
|
'limit' => 255,
|
||||||
|
'null' => true,
|
||||||
|
'default' => null,
|
||||||
|
'after' => 'site',
|
||||||
|
]);
|
||||||
|
$table->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
if ($this->getEnvironment() == "thetool") {
|
||||||
|
$table = $this->table('AssetManagementJournal');
|
||||||
|
$table->removeColumn('externalUser');
|
||||||
|
$table->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -220,6 +220,7 @@ Vue.component('asset-borrow-return-widget', {
|
|||||||
<div>
|
<div>
|
||||||
<div v-if="rowData.currentUserId">
|
<div v-if="rowData.currentUserId">
|
||||||
<div><strong>Ausgeliehen von:</strong> {{ rowData.currentUser }}</div>
|
<div><strong>Ausgeliehen von:</strong> {{ rowData.currentUser }}</div>
|
||||||
|
<div v-if="rowData.externalUser" class="text-info"><strong>Extern an:</strong> {{ rowData.externalUser }}</div>
|
||||||
<div><strong>Baustelle:</strong> {{ rowData.currentSite }}</div>
|
<div><strong>Baustelle:</strong> {{ rowData.currentSite }}</div>
|
||||||
<div><strong>Seit:</strong> {{ formatDate(rowData.borrowDate, 'DD.MM.YYYY HH:mm') }}</div>
|
<div><strong>Seit:</strong> {{ formatDate(rowData.borrowDate, 'DD.MM.YYYY HH:mm') }}</div>
|
||||||
<div v-if="rowData.expectedReturnDate">
|
<div v-if="rowData.expectedReturnDate">
|
||||||
@@ -274,6 +275,7 @@ Vue.component('asset-borrow-return-widget', {
|
|||||||
<p><strong>Gerät:</strong> {{ rowData.name }}</p>
|
<p><strong>Gerät:</strong> {{ rowData.name }}</p>
|
||||||
<p><strong>Mitarbeiter:</strong> {{ selectedUserName }}</p>
|
<p><strong>Mitarbeiter:</strong> {{ selectedUserName }}</p>
|
||||||
<tt-input label="Baustelle / Projekt" v-model="borrowSite" sm row required/>
|
<tt-input label="Baustelle / Projekt" v-model="borrowSite" sm row required/>
|
||||||
|
<tt-input label="Externer Entleiher (optional)" v-model="externalUser" sm row/>
|
||||||
<tt-date-picker label="Vorauss. Rückgabedatum" v-model="expectedReturnDate" :date-range="false" sm row/>
|
<tt-date-picker label="Vorauss. Rückgabedatum" v-model="expectedReturnDate" :date-range="false" sm row/>
|
||||||
<tt-textarea label="Grund (optional)" v-model="borrowReason" sm row/>
|
<tt-textarea label="Grund (optional)" v-model="borrowReason" sm row/>
|
||||||
</tt-modal>
|
</tt-modal>
|
||||||
@@ -296,6 +298,7 @@ Vue.component('asset-borrow-return-widget', {
|
|||||||
borrowSite: '',
|
borrowSite: '',
|
||||||
borrowReason: '',
|
borrowReason: '',
|
||||||
returnReason: '',
|
returnReason: '',
|
||||||
|
externalUser: '',
|
||||||
expectedReturnDate: null,
|
expectedReturnDate: null,
|
||||||
reservationWarning: null,
|
reservationWarning: null,
|
||||||
}
|
}
|
||||||
@@ -338,6 +341,7 @@ Vue.component('asset-borrow-return-widget', {
|
|||||||
userId: this.selectedUserId,
|
userId: this.selectedUserId,
|
||||||
site: this.borrowSite,
|
site: this.borrowSite,
|
||||||
reason: this.borrowReason,
|
reason: this.borrowReason,
|
||||||
|
externalUser: this.externalUser,
|
||||||
expectedReturnDate: this.expectedReturnDate,
|
expectedReturnDate: this.expectedReturnDate,
|
||||||
force: force
|
force: force
|
||||||
};
|
};
|
||||||
@@ -589,6 +593,7 @@ Vue.component('asset-management-journal-modal', {
|
|||||||
<h5 class="mb-1">{{ entry.userName }} @ {{ entry.site }}</h5>
|
<h5 class="mb-1">{{ entry.userName }} @ {{ entry.site }}</h5>
|
||||||
<small>{{ formatDate(entry.borrowDate, 'DD.MM.YY HH:mm') }}</small>
|
<small>{{ formatDate(entry.borrowDate, 'DD.MM.YY HH:mm') }}</small>
|
||||||
</div>
|
</div>
|
||||||
|
<p v-if="entry.externalUser" class="mb-1"><strong>Extern an:</strong> <span class="text-info">{{ entry.externalUser }}</span></p>
|
||||||
<p class="mb-1"><strong>Grund:</strong> {{ entry.borrowReason || '-' }}</p>
|
<p class="mb-1"><strong>Grund:</strong> {{ entry.borrowReason || '-' }}</p>
|
||||||
<div v-if="entry.returnDate">
|
<div v-if="entry.returnDate">
|
||||||
<small class="text-success">
|
<small class="text-success">
|
||||||
|
|||||||
Reference in New Issue
Block a user