127 lines
5.1 KiB
Plaintext
127 lines
5.1 KiB
Plaintext
@page
|
|
@model EveryThing.Pages.Invoices.CreateItemModel
|
|
|
|
@section Styles
|
|
{
|
|
<link rel="stylesheet" href="~/vendor/libs/select2/select2.css" asp-append-version="true" />
|
|
<style type="text/css">
|
|
textarea{
|
|
resize:none;
|
|
overflow-y:auto;
|
|
}
|
|
</style>
|
|
}
|
|
|
|
<form method="post">
|
|
<input type="hidden" asp-for="InvoiceItem.IdInvoiceFk" />
|
|
<input type="hidden" asp-for="InvoiceItem.IdInvoiceItem" />
|
|
|
|
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
|
|
<span>
|
|
<span class="text-muted font-weight-light">
|
|
@Model.Invoice.InvoiceTypeHeaderString
|
|
/
|
|
@Model.Invoice.InvoiceNumberFormatted
|
|
/
|
|
</span>
|
|
@if ((bool)ViewData["Edit"])
|
|
{
|
|
<span>Urejanje pozicije</span>
|
|
}
|
|
else
|
|
{
|
|
<span> Nova pozicija</span>
|
|
}
|
|
|
|
</span>
|
|
</h4>
|
|
|
|
<div class="row">
|
|
<div class="col-6">
|
|
<div class="card">
|
|
<h6 class="card-header">
|
|
Podatki pozicije
|
|
</h6>
|
|
<div class="card-body">
|
|
|
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
|
<input type="hidden" asp-for="@ViewData["IdInvoice"]" name="idInvoice"/>
|
|
<div class="form-group">
|
|
<label asp-for="InvoiceItem.IdItemFk" class="control-label"></label>
|
|
<select asp-for="InvoiceItem.IdItemFk" class="form-control select2" asp-items="ViewBag.Items">
|
|
<option value=""></option>
|
|
</select>
|
|
<span asp-validation-for="InvoiceItem.IdItemFk" class="text-danger"></span>
|
|
</div>
|
|
<div class="form-group">
|
|
<label asp-for="InvoiceItem.ItemDescription" class="control-label"></label>
|
|
<textarea asp-for="InvoiceItem.ItemDescription" class="form-control" rows="6"></textarea>
|
|
<span asp-validation-for="InvoiceItem.ItemDescription" class="text-danger"></span>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<div class="row">
|
|
<div class="col-4">
|
|
<label asp-for="InvoiceItem.Quantity" class="control-label"></label>
|
|
<input asp-for="InvoiceItem.Quantity" class="form-control"/>
|
|
<span asp-validation-for="InvoiceItem.Quantity" class="text-danger"></span>
|
|
</div>
|
|
<div class="col-4">
|
|
<label asp-for="InvoiceItem.Price" class="control-label"></label>
|
|
<input asp-for="InvoiceItem.Price" class="form-control"/>
|
|
<span asp-validation-for="InvoiceItem.Price" class="text-danger"></span>
|
|
</div>
|
|
<div class="col-4">
|
|
<label asp-for="InvoiceItem.Discount" class="control-label"></label>
|
|
<input asp-for="InvoiceItem.Discount" class="form-control"/>
|
|
<span asp-validation-for="InvoiceItem.Discount" class="text-danger"></span>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label asp-for="InvoiceItem.Note" class="control-label"></label>
|
|
<textarea asp-for="InvoiceItem.Note" class="form-control" rows="6"></textarea>
|
|
<span asp-validation-for="InvoiceItem.Note" class="text-danger"></span>
|
|
</div>
|
|
</div>
|
|
<div class="card-footer py-3 text-right">
|
|
@if (ViewData["Edit"] != null && (bool)ViewData["Edit"])
|
|
{
|
|
<button type="submit" class="btn btn-primary">Shrani</button>
|
|
}
|
|
else
|
|
{
|
|
<button type="submit" class="btn btn-primary">Dodaj pozicijo</button>
|
|
}
|
|
|
|
<a class="btn btn-default" asp-page="./Edit" asp-route-id="@ViewData["IdInvoice"]">Prekliči</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
<div>
|
|
|
|
</div>
|
|
|
|
@section Scripts {
|
|
<script src="~/vendor/libs/select2/select2.js" asp-append-version="true"></script>
|
|
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$('.select2').select2({
|
|
placeholder: 'Artikel ni izbran',
|
|
allowClear: true
|
|
});
|
|
// Forced check on load: if the value is null/empty, reset the dropdown
|
|
if (!$('#InvoiceItem_IdItemFk').val()) {
|
|
$('#InvoiceItem_IdItemFk').val(null).trigger('change');
|
|
}
|
|
});
|
|
</script>
|
|
}
|