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.
163 lines
5.5 KiB
163 lines
5.5 KiB
@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.DropDowns
|
|
@using BlazorApp.Helper
|
|
@using BWPMModels;
|
|
|
|
|
|
@*<div class="row">
|
|
<SfButton IsPrimary="true" OnClick="@(() => NewClick())">Neuer Schüler</SfButton>
|
|
</div>*@
|
|
|
|
<EditForm Model="_schueler" OnValidSubmit="@Submit" OnInvalidSubmit="@InvalidSubmit" >
|
|
<div class="row">
|
|
<div class="col-md-1">
|
|
|
|
Name
|
|
</div>
|
|
<div class="col-md-3">
|
|
<InputText id="Name" class="form-control" @bind-Value="_schueler.name" placeholder="Nachname" disabled="@FieldDisabled" />
|
|
<ValidationMessage For="@(() => _schueler.name)" />
|
|
</div>
|
|
<div class="col-md-1">
|
|
|
|
Vorname
|
|
</div>
|
|
<div class="col-md-3">
|
|
|
|
<InputText id="Vorname" class="form-control" @bind-Value="_schueler.vorname" placeholder="Vorname" disabled="@FieldDisabled" />
|
|
<ValidationMessage For="@(() => _schueler.name)" />
|
|
</div>
|
|
<div class="col-md-1">
|
|
|
|
Bemerkung
|
|
</div>
|
|
<div class="col-md-3">
|
|
<InputText id="Bemerkung" class="form-control" @bind-Value="_schueler.bemerkung" placeholder="Bemerkung" disabled="@FieldDisabled" />
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-1">
|
|
Klasse
|
|
</div>
|
|
<div class="col-md-3">
|
|
<SfDropDownList @bind-Value="@KlasseID" TValue="string" TItem="Klasse" Placeholder="Klasse" DataSource="@klasse" Enabled="@DropDownEnabled">
|
|
<DropDownListFieldSettings Value="ID" Text="bezeichnung"></DropDownListFieldSettings>
|
|
</SfDropDownList>
|
|
</div>
|
|
<div class="col-md-1">
|
|
Typ
|
|
</div>
|
|
<div class="col-md-3">
|
|
<SfDropDownList @bind-Value="@KlasseTypID" TValue="string" TItem="Klassentyp" Placeholder="Klassentyp" DataSource="@klassentyp" Enabled="@DropDownEnabled">
|
|
<DropDownListFieldSettings Value="ID" Text="bezeichnung"></DropDownListFieldSettings>
|
|
</SfDropDownList>
|
|
</div>
|
|
<div class="col-md-1">
|
|
</div>
|
|
<div class="col-md-3">
|
|
</div>
|
|
|
|
</div>
|
|
</EditForm>
|
|
|
|
<SfDialog Width="350px" IsModal="true" @bind-Visible="@ShowDeleteConfirmation">
|
|
<DialogTemplates>
|
|
<Header>@DialogHeader</Header>
|
|
<Content>@DialogText</Content>
|
|
|
|
</DialogTemplates>
|
|
<DialogButtons>
|
|
@if (DialogShowYesNO == true)
|
|
{
|
|
<DialogButton Content="Ja" IsPrimary="true" OnClick="@DeleteConfirmed" />
|
|
<DialogButton Content="Nein" OnClick="@AbortDelete" />
|
|
}
|
|
else
|
|
{
|
|
<DialogButton Content="OK" IsPrimary="true" OnClick="@DialogConfirmed" />
|
|
}
|
|
</DialogButtons>
|
|
</SfDialog>
|
|
|
|
@code {
|
|
[Parameter]
|
|
public string iSchuelerID { get; set; } = "";
|
|
|
|
[Parameter]
|
|
public EventCallback<string> OnSchuelerChanged { get; set; }
|
|
|
|
|
|
public int hiddenschuelerid = 0;
|
|
public string DialogHeader { get; set; } = "";
|
|
public string DialogText { get; set; } = "";
|
|
public bool DialogShowYesNO { get; set; } = true;
|
|
public bool ShowDeleteConfirmation { get; set; } = false;
|
|
public string userid = "";
|
|
public bool FieldDisabled = true;
|
|
public string SchuelerklasseID = "0";
|
|
public string KlasseTypID = "0";
|
|
public string KlasseID = "0";
|
|
private Schueler _schueler { get; set; } = new BWPMModels.Schueler();
|
|
public List<BWPMModels.Klassentyp> klassentyp { get; set; } = BlazorApp.Controller.KlassentypController.GetAllAktiveData();
|
|
public List<BWPMModels.Klasse> klasse { get; set; } = BlazorApp.Controller.KlasseController.GetAllActiveData();
|
|
|
|
public List<BWPMModels.Schueler> Schueler { get; set; }
|
|
public bool DropDownEnabled = false;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
|
|
}
|
|
|
|
public void Submit()
|
|
{
|
|
BlazorApp.Controller.SchuelerController.PUT(_schueler);
|
|
}
|
|
public void InvalidSubmit()
|
|
{
|
|
}
|
|
private void DeleteClick()
|
|
{
|
|
DialogHeader = "Löschbestätigung";
|
|
DialogText = "Schüler '" + _schueler.name + ' ' + _schueler.vorname + "' wirklich löschen?'";
|
|
DialogShowYesNO = true;
|
|
ShowDeleteConfirmation = true;
|
|
}
|
|
|
|
private void DeleteConfirmed()
|
|
{
|
|
_schueler.aktiv = false;
|
|
_schueler.mutierer = userid;
|
|
_schueler.mutiert_am = DateTime.Now;
|
|
BlazorApp.Controller.SchuelerController.PUT(_schueler);
|
|
BlazorApp.Controller.SchuelerBerufController.DeleteBerufswunsch(_schueler.ID, userid);
|
|
ShowDeleteConfirmation = false;
|
|
|
|
}
|
|
|
|
private void AbortDelete()
|
|
{
|
|
ShowDeleteConfirmation = false;
|
|
}
|
|
private void DialogConfirmed()
|
|
{
|
|
ShowDeleteConfirmation = false;
|
|
}
|
|
|
|
public void ReloadData(string Schuelerid)
|
|
{
|
|
Schueler = BlazorApp.Controller.SchuelerController.GetByID(Convert.ToInt32(Schuelerid));
|
|
_schueler = Schueler.First<BWPMModels.Schueler>();
|
|
KlasseID = _schueler.klasseID.ToString();
|
|
KlasseTypID = _schueler.klassentypID.ToString();
|
|
FieldDisabled = false;
|
|
DropDownEnabled = false;
|
|
|
|
}
|
|
}
|