Files
marechai/Marechai/Pages/Admin/Details/Company.razor

162 lines
5.3 KiB
Plaintext

@{
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Filename : Details.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Admin view details
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the 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
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
}
@page "/admin/companies/details/{Id:int}"
@inherits OwningComponentBase<CompaniesService>
@inject IStringLocalizer<CompaniesService> L
@inject Iso31661NumericService CountriesService
@attribute [Authorize(Roles = "UberAdmin, Admin")]
<h3>@L["Company details"]</h3>
<hr />
@if (!_loaded)
{
<p align="center">@L["Loading..."]</p>
return;
}
<div>
<Field>
<FieldLabel>@L["Name"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Name"/>
</Field>
<Field>
<FieldLabel>@L["Status"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@CompanyStatus"/>
</Field>
@if(_editable || _model.Founded.HasValue)
{
<Field>
<FieldLabel>@L["Founded"]</FieldLabel>
<DateEdit ReadOnly="!_editable" TValue="DateTime?" @bind-Date="@_model.Founded"/>
</Field>
}
@if (_editable || _model.Website != null)
{
<Field>
<FieldLabel>@L["Website"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Website" />
</Field>
}
@if (_editable || _model.Twitter != null)
{
<Field>
<FieldLabel>@L["Twitter"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Twitter" />
</Field>
}
@if (_editable || _model.Facebook != null)
{
<Field>
<FieldLabel>@L["Facebook"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Facebook" />
</Field>
}
@if (_editable || _model.Address != null)
{
<Field>
<FieldLabel>@L["Address"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Address" />
</Field>
}
@if (_editable || _model.City != null)
{
<Field>
<FieldLabel>@L["City"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.City" />
</Field>
}
@if (_editable || _model.Province != null)
{
<Field>
<FieldLabel>@L["Province"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Province" />
</Field>
}
@if (_editable || _model.PostalCode != null)
{
<Field>
<FieldLabel>@L["Postal code"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.PostalCode" />
</Field>
}
@if (_editable)
{
<Field>
<FieldLabel>@L["Country"]</FieldLabel>
<Select ReadOnly="!_editable" TValue="short?" @bind-SelectedValue="@_model.CountryId">
@foreach (var country in _countries)
{
<SelectItem Value="@country.Id">@country.Name</SelectItem>
}
</Select>
</Field>
}
else if (_model.CountryId != null)
{
<Field>
<FieldLabel>@L["Country"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Country.Name" />
</Field>
}
@if (_editable || _model.Sold != null)
{
<Field>
<FieldLabel>@L["Sold"]</FieldLabel>
<DateEdit ReadOnly="!_editable" TValue="DateTime?" @bind-Date="@_model.Sold" />
</Field>
}
@if (_editable)
{
<Field>
<FieldLabel>@L["Sold to"]</FieldLabel>
<Select ReadOnly="!_editable" TValue="int?" @bind-SelectedValue="@_model.SoldToId">
@foreach (var company in _companies)
{
<SelectItem Value="@company.Id">@company.Name</SelectItem>
}
</Select>
</Field>
}
else if (_model.SoldToId != null)
{
<Field>
<FieldLabel>@L["Sold to"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.SoldTo.Name" />
</Field>
}
</div>
<div>
<span class="btn btn-primary">@L["Edit"]</span>
<a href="/admin/companies" class="btn btn-secondary">@L["Back to list"]</a>
</div>