72 lines
3.7 KiB
PHP
72 lines
3.7 KiB
PHP
<?php ob_start(); ?>
|
|
<h2><?= $device->id === null ? 'Добавить устройство' : 'Редактировать: ' . htmlspecialchars($device->name) ?></h2>
|
|
|
|
<form method="POST" action="<?= $device->id === null ? '/devices/create' : '/devices/' . $device->id . '/update' ?>" class="row g-3">
|
|
<div class="col-md-6">
|
|
<label class="form-label">Название *</label>
|
|
<input type="text" name="name" class="form-control" value="<?= htmlspecialchars($device->name) ?>" required>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Тип</label>
|
|
<select name="type" class="form-select">
|
|
<?php foreach ($types as $t): ?>
|
|
<option value="<?= $t ?>" <?= $device->type === $t ? 'selected' : '' ?>><?= $t ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Важность</label>
|
|
<select name="importance" class="form-select">
|
|
<?php foreach ($importances as $imp): ?>
|
|
<option value="<?= $imp ?>" <?= $device->importance === $imp ? 'selected' : '' ?>><?= $imp ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Primary IP</label>
|
|
<input type="text" name="primary_ip" class="form-control" value="<?= htmlspecialchars($device->primaryIp ?? '') ?>">
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">MAC адрес</label>
|
|
<input type="text" name="mac_address" class="form-control" value="<?= htmlspecialchars($device->macAddress ?? '') ?>" placeholder="aa:bb:cc:dd:ee:ff">
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Hostname</label>
|
|
<input type="text" name="hostname" class="form-control" value="<?= htmlspecialchars($device->hostname ?? '') ?>">
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Vendor</label>
|
|
<input type="text" name="vendor" class="form-control" value="<?= htmlspecialchars($device->vendor ?? '') ?>">
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">OS Name</label>
|
|
<input type="text" name="os_name" class="form-control" value="<?= htmlspecialchars($device->osName ?? '') ?>">
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">OS Version</label>
|
|
<input type="text" name="os_version" class="form-control" value="<?= htmlspecialchars($device->osVersion ?? '') ?>">
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Location</label>
|
|
<input type="text" name="location" class="form-control" value="<?= htmlspecialchars($device->location ?? '') ?>">
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Статус</label>
|
|
<select name="status" class="form-select">
|
|
<option value="active" <?= $device->status === 'active' ? 'selected' : '' ?>>active</option>
|
|
<option value="inactive" <?= $device->status === 'inactive' ? 'selected' : '' ?>>inactive</option>
|
|
<option value="maintenance" <?= $device->status === 'maintenance' ? 'selected' : '' ?>>maintenance</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-12">
|
|
<label class="form-label">Описание</label>
|
|
<textarea name="description" class="form-control" rows="2"><?= htmlspecialchars($device->description ?? '') ?></textarea>
|
|
</div>
|
|
<div class="col-12">
|
|
<button type="submit" class="btn btn-primary">Сохранить</button>
|
|
<a href="/devices" class="btn btn-secondary">Отмена</a>
|
|
</div>
|
|
</form>
|
|
<?php $content = ob_get_clean(); ?>
|
|
<?php require dirname(__DIR__) . '/layout.php'; ?>
|