1@inject StateService _stateService
2@inject CurrencyViewModel _currencyViewService
3@inject PriceListViewModel _priceListViewSerivce
6@if (_stateService.EditPriceList.Value != null)
9 <EditForm Model="_stateService.EditPriceList" OnValidSubmit="Submit" OnInvalidSubmit="EventCallback.Empty" >
11 <StandardModal Header="Endre prisliste" SubmitButtonName="Oppdater prisliste" @ref="Modal" ShowModal="true" OnModalClosed="ResetPriceList">
13 <div class="create-modal-container">
14 <ObjectGraphDataAnnotationsValidator />
16 <div class="input-split">
18 <FloatingInput Name="Navn">
19 <InputText @bind-Value="_stateService.EditPriceList.Value.PriceListName" type="text" class="form-control input-text input-split-left" id="floatingInput" placeholder=" " autocomplete="off"/>
22 @* @if (_currencyViewService.Currencies != null && _stateService.EditPriceList.Value.Currency != null) *@
24 @* <FloatingInput Name="Valuta"> *@
25 @* <InputText @bind-Value="_stateService.EditPriceList.Value.Currency.CurrencyName" type="text" class="form-control input-text hide-picker input-split-right" id="floatingInput" placeholder=" " list="valutaList" autocomplete="off"/> *@
26 @* </FloatingInput> *@
27 @* <datalist id="valutaList"> *@
28 @* @foreach (var c in _currencyViewService.Currencies.DistinctBy(c => c.CurrencyName).ToList()) *@
30 @* <option value="@c.CurrencyName">@c.CurrencyName</option> *@
37 <div class="input-split">
38 <div class="input-container form-floating mb-3">
39 <InputDate @bind-Value="_stateService.EditPriceList.Value.DateFrom" class="form-control input-text input-split-left" id="floatingInput" autocomplete="off" max="@_stateService.EditPriceList.Value.DateTo"/>
40 <label for="floatingInput">Startdato</label>
43 <div class="input-container form-floating mb-3">
44 <InputDate @bind-Value="_stateService.EditPriceList.Value.DateTo" class="form-control input-text input-split-right" id="floatingInput" autocomplete="off"/>
45 <label for="floatingInput">Sluttdato</label>
60 private StandardModal Modal { get; set; }
65 var updatedPriceList = _priceListViewSerivce.UpdatePricelist(_stateService.EditPriceList.Value!);
66 if (updatedPriceList != null)
72 private void ResetPriceList()
74 _stateService.UpdateEditPriceList(null);
77 protected override void OnInitialized()
79 _stateService.EditPriceList.ValueChanged += StateHasChanged;
82 void IDisposable.Dispose()
84 _stateService.EditPriceList.ValueChanged -= StateHasChanged;