| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- @model GreenTree.Strohrmann.ERP.Web.Models.Business.CraftEmployeeModel
- @{
- var id = Model != null && !String.IsNullOrEmpty(Model.DictIdentifier) ? Model.DictIdentifier : Html.RandomId();
- }
- <script type="text/javascript">
- @{
- <text>
- function recalculateEmployeeValue_@id () {
- $.ajax({
- method: "POST",
- url: "@Url.Action("CalculateEmployeeValue", "Craft")",
- data: {
- EmployeeId: $("select[name='CraftEmployees[@id].EmployeeId']").val(),
- AmountText: $("input[name='CraftEmployees[@id].AmountText']").val()
- },
- success: function (data) {
- $("input[name='CraftEmployees[@id].Value']").val(data);
- calculateEmployeeAggregation();
- },
- error: function (msg) {
- }
- });
- }
- </text>
- }
- </script>
- <div class="row align-items-start">
- <input type="hidden" asp-for="Index" name="CraftEmployees[@id].Index" />
- <input type="hidden" asp-for="DictIdentifier" name="CraftEmployees[@id].DictIdentifier" value="@id" />
- <div class="form-group col-md-4">
- @if (Model == null || (Model != null && (!Model.Index.HasValue || Model.Index == 0)))
- {
- <label asp-for="EmployeeId" class="control-label"></label>
- }
- <select asp-items='(IEnumerable<SelectListItem>)ViewData["AvailableEmployees"]'
- asp-for="EmployeeId" name="CraftEmployees[@id].EmployeeId" class="form-control"
- onchange="calculateEmployeeAggregation(); recalculateEmployeeValue_@id ();">
- </select>
- @Html.ValidationMessage(String.Format("CraftEmployees[{0}].EmployeeId", id), new { @class = "text-danger" })
- </div>
- <div class="form-group col-md-2">
- @if (Model == null || (Model != null && (!Model.Index.HasValue || Model.Index == 0)))
- {
- <label asp-for="Amount" class="control-label"></label>
- }
- <div class="input-group">
- <div class="input-group-prepend">
- <span class="input-group-text">Std.</span>
- </div>
- @*<span class="input-group-prepend">
- <button type="button" class="quantity-left-minus btn btn-danger btn-number" data-field="">
- <span class="fas fa-minus"></span>
- </button>
- </span>*@
- <input name="CraftEmployees[@id].AmountText" type="text" class="form-control"
- id="CraftEmployees[@id].AmountText" data-aggregation="employeeAmount" data-restriction="numberOnly"
- value="@(Model == null ? 0.00f : Model.Amount)"
- onchange="calculateEmployeeAggregation(); recalculateEmployeeValue_@id ();" />
- @*<span class="input-group-append">
- <button type="button" class="quantity-left-minus btn btn-success btn-number" data-field="">
- <span class="fas fa-plus"></span>
- </button>
- </span>*@
- </div>
- @Html.ValidationMessage(String.Format("CraftEmployees[{0}].AmountText", id), new { @class = "text-danger" })
- </div>
- <div class="form-group col-md-2">
- @if (Model == null || (Model != null && (!Model.Index.HasValue || Model.Index == 0)))
- {
- <label asp-for="Value" class="control-label"></label>
- }
- <div class="input-group">
- <div class="input-group-prepend">
- <span class="input-group-text">@CultureInfo.CurrentCulture.NumberFormat.CurrencySymbol</span>
- </div>
- <input asp-for="Value" name="CraftEmployees[@id].Value" type="number" min="0.00" class="form-control"
- data-aggregation="employeeValue"
- onchange="calculateEmployeeAggregation();" />
- </div>
- @Html.ValidationMessage(String.Format("CraftEmployees[{0}].Value", id), new { @class = "text-danger" })
- </div>
- <div class="form-group col-md-3">
- @if (Model == null || (Model != null && (!Model.Index.HasValue || Model.Index == 0)))
- {
- <label asp-for="Comment" class="control-label"></label>
- }
- <input asp-for="Comment" name="CraftEmployees[@id].Comment" class="form-control" />
- @Html.ValidationMessage(String.Format("CraftEmployees[{0}].Comment", id), new { @class = "text-danger" })
- </div>
- <div class="form-group col-md-1 pl-1">
- @if (Model != null && Model.Index > 0)
- {
- <button type="button" class="btn btn-danger" aria-label="Entfernen"
- onclick="$(this).closest('.row').remove(); calculateEmployeeAggregation();">
- <span class="fas fa-trash"></span>
- </button>
- }
- </div>
- </div>
|