remove companyView

This commit is contained in:
Frede Hundewadt 2022-06-19 08:05:43 +02:00
parent e041738e9c
commit b0651d2ea6
4 changed files with 1 additions and 161 deletions

View file

@ -35,7 +35,7 @@ namespace Wonky.Client.Pages;
public partial class CompanyEdit : IDisposable
{
[Inject] public IToastService ToastService { get; set; }
[Inject] public ILogger<CreateCompany> Logger { get; set; }
[Inject] public ILogger<CompanyEdit> Logger { get; set; }
[Inject] public NavigationManager Navigation { get; set; }
[Inject] public ICompanyHttpRepository CompanyRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }

View file

@ -1,86 +0,0 @@
@*
// 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 GNU Affero 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
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
@page "/company/{companyId}"
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components;
@using Wonky.Client.Helpers
@attribute [Authorize(Roles = "Adviser")]
@if (_companyDto != null)
{
<div class="card">
<div class="card-header">
<div class="h2">
<img src="gravestone.png" class="img-fluid"
style="float:left;width:48px;height:48px;display:@(_companyDto.HasFolded == 1 ? "block" : "none")" alt="tombstone"/>
@_companyDto.Name
</div>
</div>
<div class="card-body">
<table class="table">
<tbody>
<tr>
<th scope="row">Konto</th>
<td>@_companyDto.Account</td>
<th scope="row">Telefon</th>
<td >@_companyDto.Phone</td>
</tr>
<tr>
<th scope="row">Adresse1</th>
<td>@_companyDto.Address1</td>
<th scope="row">Adresse2</th>
<td>@_companyDto.Address2</td>
</tr>
<tr>
<th scope="row">Postnummer</th>
<td >@_companyDto.ZipCode</td>
<th scope="row">Bynavn</th>
<td >@_companyDto.City</td>
</tr>
<tr>
<th scope="row"><DisplayStateComponent StateClass="@_vatState"></DisplayStateComponent>CVR</th>
<td>@_companyDto.VatNumber</td>
<th scope="row">Email</th>
<td >@_companyDto.Email</td>
</tr>
<tr>
<th scope="row"><DisplayStateComponent StateClass="@(_companyDto.HasFolded == 1 ? "the-dead" : Utils.GetVisitState(_companyDto.NextVisit))"> </DisplayStateComponent>Næste besøg</th>
<td>@_companyDto.NextVisit</td>
<th scope="row">Sidste besøg</th>
<td>@_companyDto.LastVisit</td>
</tr>
</tbody>
</table>
</div>
<div class="card-footer">
<div class="d-flex align-items-end">
<a class="btn btn-primary mx-2" href="/companies">Tilbage</a>
<a class="btn btn-primary mx-2" href="/company/@(_companyDto.CompanyId)/update">Rediger</a>
@if (!_vatInvalid && !string.IsNullOrWhiteSpace(_companyDto.Address1))
{
<a type="button" class="btn btn-primary mx-2" href="/company/@_companyDto.CompanyId/activity">Opret aktivitet</a>
}
</div>
</div>
</div>
}
else
{
<AppSpinner/>
}

View file

@ -1,71 +0,0 @@
// 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 GNU Affero 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
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
using System;
using System.Threading.Tasks;
using Blazored.LocalStorage;
using Blazored.Toast.Services;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository;
using Microsoft.AspNetCore.Components;
using Wonky.Client.Helpers;
using Wonky.Client.Services;
using Wonky.Entity.DTO;
using Wonky.Entity.Models;
using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class CompanyView : IDisposable
{
[Inject] public ILogger<CompanyView> Logger { get; set; }
[Inject] public IToastService ToastService { get; set; }
[Inject] public NavigationManager NavManager { get; set; }
[Inject] public ICompanyHttpRepository CompanyRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public VatInfoLookupService VatInfoLookup { get; set; }
[Inject] public ILocalStorageService Storage { get; set; }
[Parameter] public string CompanyId { get; set; } = "";
private CompanyDto _companyDto = new ();
private string _vatState = "the-dead";
private bool _vatInvalid = true;
protected override async Task OnParametersSetAsync()
{
_companyDto = await CompanyRepo.GetCompanyById(CompanyId);
}
protected override async Task OnInitializedAsync()
{
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
var xu = await Storage.GetItemAsync<UserInfoView>("_xu");
_companyDto.CountryCode = xu.CountryCode;
if (_companyDto.HasFolded == 0)
{
_vatInvalid = !VatUtils.ValidateFormat(_companyDto.CountryCode, _companyDto.VatNumber);
_vatState = !_vatInvalid ? "the-draw" : "the-good";
}
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
Interceptor.DisposeEvent();
}
}

View file

@ -1,3 +0,0 @@
th {
width: 200px;
}