Add ability to edit devices
This commit is contained in:
@@ -18,23 +18,25 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="asset_brand">Brand:</label></td>
|
||||
<td><select id="asset_brand" name="asset_brand" onchange="newOption('asset_brand', 'Brand')">
|
||||
<option value="Unknown" selected>Unknown</option>
|
||||
{{range .Brands}}
|
||||
{{if ne . "Unknown"}}
|
||||
<option value="{{.}}">{{.}}</option>
|
||||
<td>
|
||||
<select id="asset_brand" name="asset_brand" onchange="newOption('asset_brand', 'Brand')">
|
||||
<option value="Unknown" {{if eq .AssetBrand "Unknown"}}selected{{end}}>Unknown</option>
|
||||
{{range .Brands}}
|
||||
{{if ne . "Unknown"}}
|
||||
<option value="{{.}}" {{if eq . $.AssetBrand}}selected{{end}}>{{.}}</option>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
<option>New...</option>
|
||||
</select></td>
|
||||
<option>New...</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="asset_name">Name:</label></td>
|
||||
<td><input type="text" id="asset_name" name="asset_name"></td>
|
||||
<td><input type="text" id="asset_name" name="asset_name" value="{{.AssetName}}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="asset_description">Description:</label></td>
|
||||
<td><textarea id="asset_description" name="asset_description"></textarea></td>
|
||||
<td><textarea id="asset_description" name="asset_description">{{.AssetDescription}}</textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -42,32 +44,38 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td><label for="ram_type">Type:</label></td>
|
||||
<td><select id="ram_type" name="ram_type" onchange="newOption('ram_type', 'Memory Type')">
|
||||
<option value="Unknown" selected>Unknown</option>
|
||||
{{range .RamTypes}}
|
||||
{{if ne . "Unknown"}}
|
||||
<option value="{{.}}">{{.}}</option>
|
||||
<td>
|
||||
<select id="ram_type" name="ram_type" onchange="newOption('ram_type', 'Memory Type')">
|
||||
<option value="Unknown" {{if eq .RamType "Unknown"}}selected{{end}}>Unknown</option>
|
||||
{{range .RamTypes}}
|
||||
{{if ne . "Unknown"}}
|
||||
<option value="{{.}}" {{if eq . $.RamType}}selected{{end}}>{{.}}</option>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
<option>New...</option>
|
||||
</select></td>
|
||||
<option>New...</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="ram_capacity">Capacity:</label></td>
|
||||
<td>
|
||||
<input type="number" id="ram_capacity" name="ram_capacity">
|
||||
<input type="number" id="ram_capacity" name="ram_capacity" value="{{if .RamCapacity}}{{.RamCapacity | formatMemoryPlainSize}}{{end}}">
|
||||
<select id="ram_capacity_unit" name="ram_capacity_unit">
|
||||
<option value="B">B</option>
|
||||
<option value="KB">KB</option>
|
||||
<option value="MB" selected>MB</option>
|
||||
<option value="GB">GB</option>
|
||||
<option value="TB">TB</option>
|
||||
<option value="B" {{if isRamType .RamCapacity "B"}}selected{{end}}>B</option>
|
||||
<option value="KB" {{if isRamType .RamCapacity "KB"}}selected{{end}}>KB</option>
|
||||
<option value="MB" {{if isRamType .RamCapacity "MB"}}selected{{end}} selected>MB</option>
|
||||
<option value="GB" {{if isRamType .RamCapacity "GB"}}selected{{end}}>GB</option>
|
||||
<option value="TB" {{if isRamType .RamCapacity "TB"}}selected{{end}}>TB</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<button type="submit">Create</button>
|
||||
{{if .IsEdit}}
|
||||
<button type="submit">Edit</button>
|
||||
{{else}}
|
||||
<button type="submit">Create</button>
|
||||
{{end}}
|
||||
</form>
|
||||
{{template "footer"}}
|
||||
{{end}}
|
||||
|
||||
@@ -29,5 +29,6 @@
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
<a href="/create?id={{.Qr}}&edit=true"><button>Edit</button></a>
|
||||
{{template "footer"}}
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user