CRUD assembly
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
@using ComputerShopContracts.ViewModels;
|
||||
@using ComputerShopDataModels.Models;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "EditAssembly";
|
||||
}
|
||||
|
||||
<form method="post">
|
||||
<div class="u-form-group u-form-name u-label-top">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Сборка: </label>
|
||||
<div class="u-input u-input-rectangle">
|
||||
<select id="assembly" name="assembly" class="form-control" asp-items="@(new SelectList(@ViewBag.Assemblies, "Id", "AssemblyName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-form-group u-form-name u-label-top">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Название сборки</label>
|
||||
<input type="text"
|
||||
id="assemblyName"
|
||||
placeholder="Введите название сборки"
|
||||
name="assemblyName"
|
||||
class="u-input u-input-rectangle" />
|
||||
</div>
|
||||
<div class="u-form-group u-form-name u-label-top">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Цена сборки</label>
|
||||
<input type="text"
|
||||
id="price"
|
||||
placeholder="Введите цену сборки"
|
||||
name="price"
|
||||
class="u-input u-input-rectangle" />
|
||||
</div>
|
||||
<div class="u-table u-table-responsive u-table-1">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Компоненты сборки</label>
|
||||
<table class="u-table-entity">
|
||||
<colgroup>
|
||||
<col width="63%" />
|
||||
<col width="37%" />
|
||||
</colgroup>
|
||||
<thead class="u-custom-color-1 u-table-header u-table-header-1">
|
||||
<tr style="height: 44px">
|
||||
<th class="u-border-1 u-border-black u-table-cell">
|
||||
Компонент
|
||||
</th>
|
||||
<th class="u-border-1 u-border-black u-table-cell">
|
||||
Количество
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="u-table-body" id="table-elements">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="u-align-right u-form-group u-form-submit u-label-top">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts
|
||||
{
|
||||
<script>
|
||||
function check() {
|
||||
var assembly = $('#assembly').val();
|
||||
if (assembly) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetAssembly",
|
||||
data: { assemblyId: assembly },
|
||||
success: function (result) {
|
||||
$('#assemblyName').val(result.item1.assemblyName);
|
||||
$('#price').val(result.item1.Price);
|
||||
$('#table-elements').html(result.item2);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
check();
|
||||
$('#assembly').on('change', function () {
|
||||
check();
|
||||
});
|
||||
</script>
|
||||
}
|
||||
Reference in New Issue
Block a user