Wonky.Client/Wonky.Client/Pages/CompanyCreate.razor
2022-03-14 17:59:22 +01:00

145 lines
6.3 KiB
Text

@*
// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details.
//
// You should have received a copy of the Affero GNU General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
@page "/create-company"
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Adviser")]
<h2>Opret firma</h2>
<div class="row">
<div class="col-sm-12">
@if(_virkRegInfo.VatNumber != string.Empty)
{
foreach (var state in _virkRegInfo.States)
{
<div class="alert @(state.State == "INAKTIV" ? "alert-danger" : "alert-info")" role="alert">
<table class="table table-striped">
<tr>
<th scope="row">Status</th>
<td colspan="2"><strong>@state.State</strong></td>
</tr>
<tr>
<th scope="row">Opdateret</th>
<td colspan="2">@state.LastUpdate</td>
</tr>
<tr>
<th scope="row">Periode</th>
<th scope="row">Start</th>
<td>@state.TimeFrame.StartDate</td>
</tr>
<tr>
<th scope="row">Periode</th>
<th scope="row">Slut</th>
<td>@state.TimeFrame.EndDate</td>
</tr>
</table>
</div>
}
}
</div>
<div class="col-sm-12">
<EditForm EditContext="_cvrContext" OnValidSubmit="GetCvrDataFromVat">
<DataAnnotationsValidator />
<div class="form-group row mb-2">
<label for="cvrLookup" class="col-md-2 col-form-label">Cvr</label>
<div class="col">
<InputText id="cvrLookup" class="form-control" placeholder="CVR nummer" @bind-Value="VatToLookup"/>
</div>
<div class="col">
<button type="submit" class="btn btn-success btn-lg" disabled="@_cvrInvalid">Hent oplysninger</button>
</div>
</div>
</EditForm>
</div>
</div>
@* <EditForm Model="_company" OnValidSubmit="Create" class="card card-body bg-light mt-5"> *@
<EditForm EditContext="_editContext" OnValidSubmit="Create" class="card card-body bg-light mt-5">
<DataAnnotationsValidator />
@* <ValidationSummary /> *@
<InputText type="hidden" id="salesRepId" @bind-Value="_companyDto.SalesRepId"/>
<div class="form-group row mb-2">
<label for="name" class="col-md-2 col-form-label">Firmanavn</label>
<div class="col-md-10">
<InputText id="name" class="form-control" @bind-Value="_companyDto.Name"/>
<ValidationMessage For="@(() => _companyDto.Name)"></ValidationMessage>
</div>
</div>
<div class="form-group row mb-2">
<label for="address1" class="col-md-2 col-form-label">Adresse</label>
<div class="col-md-10">
<InputText id="address1" class="form-control" @bind-Value="_companyDto.Address1"/>
</div>
</div>
<div class="form-group row mb-2">
<label for="address2" class="col-md-2 col-form-label">Adresse</label>
<div class="col-md-10">
<InputText id="address2" class="form-control" @bind-Value="_companyDto.Address2"/>
</div>
</div>
<div class="form-group row mb-2">
<label for="zipCode" class="col-md-2 col-form-label">Postnr</label>
<div class="col-md-10">
<InputText id="zipCode" class="form-control" @bind-Value="_companyDto.ZipCode"/>
<ValidationMessage For="@(() => _companyDto.ZipCode)"></ValidationMessage>
</div>
</div>
<div class="form-group row mb-2">
<label for="city" class="col-md-2 col-form-label">Bynavn</label>
<div class="col-md-10">
<InputText id="city" class="form-control" @bind-Value="_companyDto.City"/>
<ValidationMessage For="@(() => _companyDto.City)"></ValidationMessage>
</div>
</div>
<div class="form-group row mb-2">
<label for="vatNumber" class="col-md-2 col-form-label">CVR/ORG</label>
<div class="col-md-10">
<InputText id="vatNumber" class="form-control" @bind-Value="_companyDto.VatNumber"/>
<ValidationMessage For="@(() => _companyDto.VatNumber)"></ValidationMessage>
</div>
</div>
<div class="form-group row mb-2">
<label for="phone" class="col-md-2 col-form-label">Telefon nummer</label>
<div class="col-md-10">
<InputText id="phone" class="form-control" @bind-Value="_companyDto.Phone"/>
</div>
</div>
<div class="form-group row mb-2">
<label for="mobile" class="col-md-2 col-form-label">Mobil nummer</label>
<div class="col-md-10">
<InputText id="mobile" class="form-control" @bind-Value="_companyDto.Mobile"/>
</div>
</div>
<div class="form-group row mb-2">
<label for="email" class="col-md-2 col-form-label">Email</label>
<div class="col-md-10">
<InputText id="email" class="form-control" @bind-Value="_companyDto.Email"/>
</div>
</div>
<div class="form-group row mb-2">
<label for="attention" class="col-md-2 col-form-label">Attention</label>
<div class="col-md-10">
<InputText id="attention" class="form-control" @bind-Value="_companyDto.Attention"/>
</div>
</div>
<div class="row mb-2">
<div class="col-md-12 text-right">
<button type="submit" class="btn btn-success" disabled="@_formInvalid">Opret</button>
</div>
</div>
</EditForm>