Files
laatzen/LaaProductionWeb/LaaProduction.Web/Views/Approvals/Add.cshtml
T

170 lines
9.0 KiB
Plaintext

@model LaaProduction.Services.Models.ProductionApproval
<form action="~/Approvals/Add" method="post" autocomplete="off">
<div class="container my-3">
<div class="row">
<div class="col">
<h4>Neue Genehmigung erstellen</h4>
<hr />
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-floating dropdown mb-3">
@this.Html.TextBoxFor(x => x.OrderNr, new { @class = "form-control", placeholder = "0" })
@this.Html.LabelFor(x => x.OrderNr, labelText: "FertigungsNr")
<ul class="dropdown-menu w-100 shadow-sm mt-2" id="fertigungNrMenu" style="max-height: 500px; overflow-y: auto;"></ul>
</div>
</div>
<div class="col-md-6">
<div class="form-floating mb-3">
@this.Html.TextBoxFor(x => x.PcbId, new { @class = "form-control", placeholder = "0" })
@this.Html.LabelFor(x => x.PcbId, labelText: "PcbId")
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-floating mb-3">
@this.Html.TextBoxFor(x => x.OverrideFwCheck, new { @class = "form-control", placeholder = "0" })
@this.Html.LabelFor(x => x.OverrideFwCheck, labelText: "OverrideFwCheck")
</div>
</div>
<div class="col-md-6">
<div class="form-floating mb-3">
@this.Html.TextBoxFor(x => x.OverrideLutCheck, new { @class = "form-control", placeholder = "0" })
@this.Html.LabelFor(x => x.OverrideLutCheck, labelText: "OverrideLutCheck")
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-floating mb-3">
@this.Html.TextBoxFor(x => x.RequiredLifeTimeYearsAssembly, new { @class = "form-control", placeholder = "0" })
@this.Html.LabelFor(x => x.RequiredLifeTimeYearsAssembly, labelText: "RequiredLifeTimeYearsAssembly")
</div>
</div>
<div class="col-md-6">
<div class="form-floating mb-3">
@this.Html.TextBoxFor(x => x.RequiredLifeTimeYearsShipping, new { @class = "form-control", placeholder = "0" })
@this.Html.LabelFor(x => x.RequiredLifeTimeYearsShipping, labelText: "RequiredLifeTimeYearsShipping")
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-check form-switch pt-3">
@this.Html.CheckBoxFor(x => x.SkipRadioCheck, new { @class = "form-check-input", type = "checkbox", role = "switch", @checked = (this.Model.SkipRadioCheck ? "checked" : null) })
@this.Html.LabelFor(x => x.SkipRadioCheck, labelText: "Überprüfung der Funkparameter überspringen", htmlAttributes: new { @class = "form-check-label" })
</div>
</div>
<div class="col-md-6">
<div class="form-floating mb-3">
@this.Html.TextBoxFor(x => x.KitronProductionDate, new { @class = "form-control", placeholder = "0", type = "date" })
@this.Html.LabelFor(x => x.KitronProductionDate, labelText: "KitronProductionDate")
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-floating mb-3">
@this.Html.TextBoxFor(x => x.MaxDrainedBatteryLoadPercent, new { @class = "form-control", placeholder = "0" })
@this.Html.LabelFor(x => x.RequiredLifeTimeYearsShipping, labelText: "MaxDrainedBatteryLoadPercent")
</div>
</div>
<div class="col-md-6">
<div class="form-floating mb-3">
@this.Html.TextBoxFor(x => x.MaxStorageMonths, new { @class = "form-control", placeholder = "0" })
@this.Html.LabelFor(x => x.RequiredLifeTimeYearsShipping, labelText: "MaxStorageMonths")
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-floating mb-3">
@this.Html.TextBoxFor(x => x.ApproverName, new { @class = "form-control bg-light border-light", placeholder = "0", @readonly = "readonly" })
@this.Html.LabelFor(x => x.ApproverName, labelText: "Name des Genehmigers")
</div>
</div>
<div class="col-md-6">
<div class="form-floating mb-3">
@this.Html.TextBoxFor(x => x.ApprovalDate, new { @class = "form-control bg-light border-light", placeholder = "0", @readonly = "readonly" })
@this.Html.LabelFor(x => x.ApprovalDate, labelText: "Datum der Genehmigung")
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-floating mb-3">
@this.Html.TextAreaFor(x => x.ApprovalComment, new { @class = "form-control", placeholder = "0", style = "height: 210px" })
@this.Html.LabelFor(x => x.ApprovalComment, labelText: "Genehmigungskommentar")
@this.Html.ValidationMessageFor(x => x.ApprovalComment, string.Empty, new { @class = "small text-danger" })
</div>
</div>
</div>
<div class="row">
<div class="col d-flex">
<input type="submit" class="btn btn-primary py-3 px-5 me-3" value="Neue Genehmigung erstellen" />
@if (this.TempData.TryGetValue("Success", out object message))
{
<div class="toast fade show position-relative align-items-center text-bg-success border-0 ms-auto w-100" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<i class="bi-bold bi-check text-success me-2 fs-4"></i>
<strong class="me-auto text-success">@message</strong>
<small class="text-nowrap">Just now</small>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
}
else if (this.TempData.TryGetValue("Error", out object error))
{
<div class="toast fade show position-relative align-items-center text-bg-danger border-0 ms-auto w-100" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<i class="bi-bold bi-x text-danger me-2 fs-4"></i>
<strong class="me-auto text-danger">@error</strong>
<small class="text-nowrap">Just now</small>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
}
</div>
</div>
</div>
</form>
@section scripts {
<script>
(function () {
let fertigungNrMenu = document.getElementById('fertigungNrMenu');
let orderNrInput = document.getElementById('OrderNr');
if (fertigungNrMenu && orderNrInput) {
function loadDropdownItems(html) {
fertigungNrMenu.innerHTML = html;
let items = fertigungNrMenu.querySelectorAll('.dropdown-item');
if (items && items.length == 1) {
orderNrInput.value = items.item(0).innerHTML;
fertigungNrMenu.classList.remove('show');
}
}
orderNrInput.onfocus = () => fertigungNrMenu.classList.add('show');
orderNrInput.oninput = (e) => {
let value = e.target.value;
if (value && value.length > 2) {
fetch(`@this.Url.Action("Production", "Search")?productionNr=${orderNrInput.value}`)
.then(response => response.text())
.then(html => loadDropdownItems(html))
.catch(error => console.log(error));
fertigungNrMenu.classList.add('show');
} else {
fertigungNrMenu.innerHTML = null;
fertigungNrMenu.classList.remove('show');
}
};
window.addEventListener('hashchange', function () {
orderNrInput.value = location.hash.substring(1);
fertigungNrMenu.classList.remove('show');
});
}
})();
</script>
}