You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
315 lines
17 KiB
315 lines
17 KiB
@page "/Company/Company"
|
|
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
|
@inherits Admin.ListBase;
|
|
@using System.ComponentModel.DataAnnotations
|
|
@using Syncfusion.Blazor.Grids;
|
|
@using Syncfusion.Blazor.Buttons;
|
|
@using Syncfusion.Blazor.Spinner;
|
|
@using Syncfusion.Blazor.Navigations;
|
|
@using Syncfusion.Blazor.Popups;
|
|
@using Syncfusion.Blazor.Notifications;
|
|
@using BlazorApp.Helper
|
|
@using BWPMModels;
|
|
|
|
@*<div class="container">*@
|
|
|
|
<h3><b>Firmen-Daten</b></h3>
|
|
<p></p>
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
|
|
|
<div class="control-section e-tab-section">
|
|
<EditForm Model="_firma" OnValidSubmit="@Submit" OnInvalidSubmit="@InvalidSubmit">
|
|
<DataAnnotationsValidator />
|
|
<SfTab ID="BlazorTab" >
|
|
<TabItems>
|
|
<TabItem>
|
|
<ChildContent>
|
|
<TabHeader Text="Kontakt-Daten"></TabHeader>
|
|
</ChildContent>
|
|
<ContentTemplate>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
|
<h5 class="card-title">Adress-Daten</h5>
|
|
<form>
|
|
<div class="form-group row">
|
|
<label for="nameZ1" class="col-2 col-form-label">Name</label>
|
|
<div class="col-10">
|
|
<InputText id="namez1" class="form-control" @bind-Value="_firma.nameZ1" placeholder="Firmenname" />
|
|
<ValidationMessage For="@(() => _firma.nameZ1)" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="nameZ2" class="col-2 col-form-label">Zusatz</label>
|
|
<div class="col-10">
|
|
<InputText id="nameZ2" class="form-control" @bind-Value="@_firma.nameZ2" placeholder="Zusatz" />
|
|
<ValidationMessage For="@(() => _firma.nameZ2)" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="strasse" class="col-2 col-form-label">Strasse</label>
|
|
<div class="col-10">
|
|
<InputText id="strasse" class="form-control" @bind-Value="@_firma.strasse" placeholder="Strasse" />
|
|
<ValidationMessage For="@(() => _firma.strasse)" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="plz" class="col-2 col-form-label">PLZ</label>
|
|
<div class="col-10">
|
|
<InputText id="plz" class="form-control" @bind-Value="@_firma.plz" placeholder="Postleitzahl" />
|
|
<ValidationMessage For="@(() => _firma.plz)" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="ort" class="col-2 col-form-label">Ort</label>
|
|
<div class="col-10">
|
|
<InputText id="ort" class="form-control" @bind-Value="@_firma.ort" placeholder="Ort" />
|
|
<ValidationMessage For="@(() => _firma.ort)" />
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="form-group row">
|
|
<label for="telefon" class="col-2 col-form-label">Telefon</label>
|
|
<div class="col-10">
|
|
<InputText id="tel" class="form-control" @bind-Value="@_firma.tel" placeholder="Telefon-Nummer" />
|
|
<ValidationMessage For="@(() => _firma.tel)" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="email" class="col-2 col-form-label">E-Mail</label>
|
|
<div class="col-10">
|
|
<InputText id="mail" class="form-control" @bind-Value="@_firma.mail" placeholder="E-Mail" required="required" typeof="email" />
|
|
<ValidationMessage For="@(() => _firma.mail)" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="web" class="col-2 col-form-label">Internet</label>
|
|
<div class="col-10">
|
|
<InputText id="internet" class="form-control" @bind-Value="@_firma.web" placeholder="Internet" />
|
|
<ValidationMessage For="@(() => _firma.web)" />
|
|
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="Bemerkungen" class="col-2 col-form-label">Bemerkung</label>
|
|
<div class="col-10">
|
|
<InputTextArea id="bemerkung" class="form-control" @bind-Value="@_firma.bemerkung" placeholder="Bemerkung" />
|
|
<ValidationMessage For="@(() => _firma.bemerkung)" />
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Ansprechperson</h5>
|
|
<form>
|
|
<div class="form-group row">
|
|
<label for="Anrede" class="col-2 col-form-label">Anrede</label>
|
|
<div class="col-10">
|
|
<select id="Anrede" name="Anrede" class="form-control" @bind="@_firma.anrede">
|
|
<option value="1">Herr</option>
|
|
<option value="2">Frau</option>
|
|
<option value="3">Damen und Herren</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="ansprechperson_anme" class="col-2 col-form-label">Name</label>
|
|
<div class="col-10">
|
|
<InputText id="ansprechperson_name" class="form-control" @bind-Value="@_firma.ansprechperson_name" placeholder="Name Ansprechperson" />
|
|
<ValidationMessage For="@(() => _firma.ansprechperson_name)" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="ansprechperson_vorname" class="col-2 col-form-label">Vorname</label>
|
|
<div class="col-10">
|
|
<InputText id="ansprechperson_vorname" class="form-control" @bind-Value="@_firma.ansprechperon_vorname" placeholder="Vorname Ansprechperson" />
|
|
<ValidationMessage For="@(() => _firma.ansprechperon_vorname)" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="briefanrede" class="col-2 col-form-label">Briefanrede</label>
|
|
<div class="col-10">
|
|
<InputText id="briefanrede" class="form-control" @bind-Value="@_firma.briefanrede" placeholder="gewünschte Briefanrede" />
|
|
<ValidationMessage For="@(() => _firma.briefanrede)" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="handy" class="col-2 col-form-label">Telefon</label>
|
|
<div class="col-10">
|
|
<InputText id="handy" class="form-control" @bind-Value="@_firma.handy" placeholder="Telefon" />
|
|
<ValidationMessage For="@(() => _firma.handy)" />
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</ContentTemplate>
|
|
|
|
</TabItem>
|
|
<TabItem>
|
|
<ChildContent>
|
|
<TabHeader text="Angaben zur Ausbildung"></TabHeader>
|
|
</ChildContent>
|
|
<ContentTemplate>
|
|
<div class="col-md">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Allgemeine Angaben</h5>
|
|
<form>
|
|
<div class="form-group row">
|
|
<label for="ausbildung_Standort" class="col-2 col-form-label">Ausbildungsstandort</label>
|
|
<div class="col-10">
|
|
<InputTextArea id="ausbildung_Standort" class="form-control" @bind-Value="@_firma.ausbildungsstandort" placeholder="Allgmeine Angaben über Ausbildungsstandort" />
|
|
<ValidationMessage For="@(() => _firma.ausbildungsstandort)" />
|
|
</div>
|
|
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="ausbildung_bemerkung" class="col-2 col-form-label">Bemerkung</label>
|
|
<div class="col-10">
|
|
<InputTextArea id="ausbildung_bemerkung" class="form-control" @bind-Value="@_firma.ausbildungsbemerkung" placeholder="Allgemeine Bemerkungen zu den Ausbildungen" />
|
|
<ValidationMessage For="@(() => _firma.ausbildungsbemerkung)" />
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</ContentTemplate>
|
|
</TabItem>
|
|
</TabItems>
|
|
</SfTab>
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
|
<SfButton IsPrimary="true" OnClick="@(() => SaveClick())">Speichern</SfButton>
|
|
</div>
|
|
</div>
|
|
|
|
</EditForm>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<SfDialog Width="250px" IsModal="true" @bind-Visible="@ShowErrorDialog">
|
|
<DialogTemplates>
|
|
<Header> Formmular unvollständig </Header>
|
|
<Content> Bitte das Formular vollständig ausfüllen. </Content>
|
|
|
|
</DialogTemplates>
|
|
<DialogButtons>
|
|
<DialogButton Content="OK" IsPrimary="true" OnClick="@CloseDialog" />
|
|
</DialogButtons>
|
|
</SfDialog>
|
|
|
|
<div class="col-lg-12 control-section toast-default-section">
|
|
<SfToast ID="toast_default" @ref="ToastObj" Content="@ToastContent" Timeout="5000" Icon="e-meeting">
|
|
<ToastPosition X="Right" Y="Bottom"></ToastPosition>
|
|
<ToastAnimationSettings>
|
|
<ToastShowAnimationSettings Effect="@ShowAnimation"></ToastShowAnimationSettings>
|
|
<ToastHideAnimationSettings Effect="@HideAnimation"></ToastHideAnimationSettings>
|
|
</ToastAnimationSettings>
|
|
</SfToast>
|
|
</div>
|
|
<style>
|
|
|
|
|
|
.bootstrap4 #toast_default .e-meeting::before {
|
|
content: "\e763";
|
|
font-size: 20px;
|
|
}
|
|
|
|
|
|
.e-toast-container .e-toast {
|
|
background-color: lightgreen;
|
|
}
|
|
</style>
|
|
|
|
@code {
|
|
|
|
SfToast ToastObj;
|
|
private string ToastPosition = "Right";
|
|
private string ToastContent = "Daten erfolgreich gespeichert";
|
|
private ToastEffect ShowAnimation = ToastEffect.FadeIn;
|
|
private ToastEffect HideAnimation = ToastEffect.FadeOut;
|
|
|
|
private Firma _firma { get; set; } = new BWPMModels.Firma();
|
|
public List<BWPMModels.Firma> Firmendaten { get; set; }
|
|
string userid = "";
|
|
public static int? pkey { get; set; }
|
|
public bool Initial { get; set; } = true;
|
|
private bool ShowErrorDialog { get; set; } = false;
|
|
|
|
public void Submit()
|
|
{
|
|
BlazorApp.Controller.FirmaController.PUT(_firma);
|
|
ToastObj.ShowAsync();
|
|
}
|
|
public void InvalidSubmit()
|
|
{
|
|
ShowErrorDialog = true;
|
|
}
|
|
private void CloseDialog()
|
|
{
|
|
this.ShowErrorDialog = false;
|
|
}
|
|
|
|
private void SaveClick()
|
|
{
|
|
//BlazorApp.Controller.FirmaController.PUT(_firma);
|
|
|
|
}
|
|
|
|
protected override async void OnInitialized()
|
|
{
|
|
|
|
}
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
@*userid = "4c456017-85b9-4f34-a42c-f3ac534cc34f";*@
|
|
|
|
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
|
if (userid == null)
|
|
{
|
|
var authState = await authenticationStateTask;
|
|
var userId = authState.User.Claims.FirstOrDefault().Value;
|
|
var user = authState.User;
|
|
|
|
if (user.Identity.IsAuthenticated)
|
|
|
|
{
|
|
await sessionStorage.SetItemAsync("UserID", userId);
|
|
userid = userId;
|
|
}
|
|
else
|
|
{
|
|
await sessionStorage.SetItemAsync("UserID", userId);
|
|
userid = userId;
|
|
}
|
|
}
|
|
if (firstRender)
|
|
{
|
|
Firmendaten = BlazorApp.Controller.FirmaController.GetByUserID(userid);
|
|
_firma = Firmendaten.First<BWPMModels.Firma>();
|
|
}
|
|
|
|
}
|
|
|
|
}
|