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.
520 lines
20 KiB
520 lines
20 KiB
@page "/Company/Berufsangebot"
|
|
@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.DropDowns
|
|
@using Syncfusion.Blazor.Lists
|
|
@using Syncfusion.Blazor.Inputs;
|
|
@using Syncfusion.Blazor.Notifications;
|
|
@using BlazorApp.Helper
|
|
@using BWPMModels;
|
|
|
|
<style>
|
|
@*.e-listbox-wrapper:not(.e-list-template) .e-list-item, .e-listbox-wrapper .e-list-nrt, .e-listbox-wrapper .e-selectall-parent, .e-listbox-container:not(.e-list-template) .e-list-item, .e-listbox-container .e-list-nrt, .e-listbox-container .e-selectall-parent
|
|
{
|
|
height: 20px;
|
|
line-height: 1.0;
|
|
|
|
position: relative;
|
|
}*@
|
|
</style>
|
|
<h3><b>Berufsangebot</b></h3>
|
|
<p></p>
|
|
<div class="control-section e-tab-section">
|
|
<div class="card">
|
|
<div class="card-body" style="background-color:#cfe4df;">
|
|
<div class="row">
|
|
<div class="col-sm">
|
|
<div class="card">
|
|
<h6 class="card-header">
|
|
Berufe
|
|
</h6>
|
|
<div class="card-body">
|
|
<SfListBox @bind-Value=@BerufID TValue="string[]" DataSource="@berufe" @ref="Berufsliste" TItem="Beruf" Height="140px" >
|
|
<ListBoxSelectionSettings Mode="Syncfusion.Blazor.DropDowns.SelectionMode.Single" ShowCheckbox="false" ></ListBoxSelectionSettings>
|
|
<ListBoxFieldSettings Text="bezeichnung" Value="id" />
|
|
</SfListBox>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm">
|
|
<div class="card">
|
|
<h6 class="card-header">
|
|
Ansprechpartner
|
|
</h6>
|
|
<div class="card-body">
|
|
<SfListBox @bind-Value=@AnsprechpartnerID TValue="string[]" DataSource="@lap" TItem="AP" Height="140px">
|
|
<ListBoxFieldSettings Text="name" Value="ID" />
|
|
</SfListBox>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="col-sm">
|
|
<div class="card">
|
|
<h6 class="card-header">
|
|
Zeiten
|
|
</h6>
|
|
<div class="card-body">
|
|
<SfListBox @bind-Value=@ZeitID TValue="string[]" DataSource="@zeiten" TItem="Zeit" Height="140px">
|
|
<ListBoxSelectionSettings Mode="Syncfusion.Blazor.DropDowns.SelectionMode.Single" ShowCheckbox="false"></ListBoxSelectionSettings>
|
|
<ListBoxFieldSettings Text="bezeichnung" Value="id" />
|
|
</SfListBox>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="col-sm">
|
|
<div class="card">
|
|
<h6 class="card-header">
|
|
Plätze / Anforderung
|
|
</h6>
|
|
<div class="card-body">
|
|
<h5>Anzahl verfügbare Plätze</h5>
|
|
<SfDropDownList @bind-Value=@PlatzID TValue="string" TItem="Plaetze" Placeholder="Max. Anzahl Plätze" DataSource="@plaetze">
|
|
<DropDownListFieldSettings Value="id" Text="text"></DropDownListFieldSettings>
|
|
</SfDropDownList>
|
|
<h5>Mind. Anforderung</h5>
|
|
<SfDropDownList @bind-Value=@KlassenTypID TValue="string" TItem="Klassentyp" Placeholder="Klassentyp" DataSource="@klassentyp">
|
|
<DropDownListFieldSettings Value="ID" Text="bezeichnung"></DropDownListFieldSettings>
|
|
</SfDropDownList>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<p></p>
|
|
|
|
<div class="control-section e-tab-section">
|
|
<div class="card">
|
|
<h6 class="card-header">
|
|
Bemerkungen und Hinweise
|
|
</h6>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
|
|
<div class="col-sm">
|
|
<h5>Bemerkung</h5>
|
|
<SfTextBox Multiline=true Placeholder="Allgemeine Bemerkung" @bind-Value="@bemerkung"> </SfTextBox>
|
|
</div>
|
|
<div class="col-sm">
|
|
<h5>Hinweis für den Schüler</h5>
|
|
<SfTextBox Multiline=true Placeholder="Hinweise für Schüler" @bind-Value="@schuelerbemerkung"> </SfTextBox>
|
|
</div>
|
|
<div class="col-sm">
|
|
<h5>Hinweis zum Standort</h5>
|
|
<SfTextBox Multiline=true Placeholder="Hinweise bezüglich Standort" @bind-Value="@standortbemerkung"> </SfTextBox>
|
|
</div>
|
|
<div class="col-sm text-center">
|
|
<SfButton @onclick="einfuegen" CssClass="e-flat" IsPrimary="true">Berufsangebot einfügen</SfButton>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<p></p>
|
|
<div class="control-section e-tab-section">
|
|
<div class="content-wrapper">
|
|
<div class="row">
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<p></p>
|
|
<div class="card">
|
|
<h6 class="card-header card-" style="background-color:#f7d687;">
|
|
Ihr Angebot
|
|
</h6>
|
|
<div class="card-body" style="background-color:#ffe89b;">
|
|
<div class="col-lg-12 control-section">
|
|
|
|
<div class="content-wrapper">
|
|
<div class="row">
|
|
<SfGrid DataSource="@GridData" @ref="Grid" AllowPaging="true" AllowSorting="true" Toolbar="@(new List<string>() { "Edit", "Delete" })">
|
|
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
|
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
|
|
<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="BWPMModels.Firmaberuf" OnDataBound="RowDataBoundHandler"></GridEvents>
|
|
<GridSelectionSettings Type="Syncfusion.Blazor.Grids.SelectionType.Single"></GridSelectionSettings>
|
|
<GridColumns>
|
|
@*<GridColumn Type="ColumnType.CheckBox" AllowFiltering="false" AllowSorting="false" Width="60"></GridColumn>*@
|
|
|
|
<GridColumn Field=@nameof(Firmaberuf.ID) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Visible="false" Width="60"></GridColumn>
|
|
|
|
<GridColumn Field=@nameof(Firmaberuf.firmaID) HeaderText="Firmaid" Width="100" Visible="false"></GridColumn>
|
|
|
|
@* <GridColumn Field=@nameof(Firmaberuf.berufID) HeaderText="Berufid" Width="100" Visible="true"></GridColumn>*@
|
|
<GridForeignColumn Field=@nameof(Firmaberuf.berufID) HeaderText="Beruf" ForeignKeyField="id" ForeignKeyValue="bezeichnung" ForeignDataSource="@berufe" Width="150"></GridForeignColumn>
|
|
|
|
@* <GridColumn Field=@nameof(Firmaberuf.ansprechpartnerID) HeaderText="Ansprechpartnerid" Width="100" Visible="true"></GridColumn>*@
|
|
<GridForeignColumn Field=@nameof(Firmaberuf.ansprechpartnerID) HeaderText="Ansprechpartner" ForeignKeyField="ID" ForeignKeyValue="name" ForeignDataSource="@lap" Width="150"></GridForeignColumn>
|
|
|
|
@* <GridColumn Field=@nameof(Firmaberuf.zeitID) HeaderText="Zeitid" Width="100" Visible="true"></GridColumn>*@
|
|
<GridForeignColumn Field=@nameof(Firmaberuf.zeitID) HeaderText="Zeit" ForeignKeyField="id" ForeignKeyValue="bezeichnung" ForeignDataSource="@zeiten" Width="150"></GridForeignColumn>
|
|
|
|
@* <GridColumn Field=@nameof(Firmaberuf.klassetypID) HeaderText="Klassetypid" Width="100" Visible="true"></GridColumn>*@
|
|
<GridForeignColumn Field=@nameof(Firmaberuf.klassetypID) HeaderText="Klassentyp" ForeignKeyField="ID" ForeignKeyValue="bezeichnung" ForeignDataSource="@klassentyp" Width="150"></GridForeignColumn>
|
|
|
|
<GridColumn Field=@nameof(Firmaberuf.anzahl) HeaderText="Anzahl" Width="100" Visible="true"></GridColumn>
|
|
|
|
<GridColumn Field=@nameof(Firmaberuf.bemerkung) HeaderText="Bemerkung" Width="100" Visible="true"></GridColumn>
|
|
|
|
<GridColumn Field=@nameof(Firmaberuf.schuelerbemerkung) HeaderText="Schuelerbemerkung" Width="100" Visible="true"></GridColumn>
|
|
|
|
<GridColumn Field=@nameof(Firmaberuf.standortbemerkung) HeaderText="Standortbemerkung" Width="100" Visible="true"></GridColumn>
|
|
|
|
<GridColumn Field=@nameof(Firmaberuf.minzuteilung) HeaderText="Minzuteilung" Width="100" Visible="false"></GridColumn>
|
|
|
|
<GridColumn Field=@nameof(Firmaberuf.aktiv) HeaderText="Aktiv" Width="100" Visible="false" DisplayAsCheckBox="true"></GridColumn>
|
|
|
|
<GridColumn Field=@nameof(Firmaberuf.erstellt_am) HeaderText="Erstellt_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
|
|
|
<GridColumn Field=@nameof(Firmaberuf.mutiert_am) HeaderText="Mutiert_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
|
|
|
<GridColumn Field=@nameof(Firmaberuf.mutierer) HeaderText="Mutierer" Width="100" Visible="false"></GridColumn>
|
|
</GridColumns>
|
|
</SfGrid>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<SfTextBox Value="@fid"></SfTextBox>
|
|
|
|
<SfDialog Width="250px" IsModal="true" @bind-Visible="@ShowDialogCompany">
|
|
<DialogTemplates>
|
|
<Header> Formmular unvollständig </Header>
|
|
<Content> Bitte zuerst die Firmen-Daten vollständig ausfüllen. </Content>
|
|
|
|
</DialogTemplates>
|
|
<DialogButtons>
|
|
<DialogButton Content="OK" IsPrimary="true" OnClick="@CloseDialog" />
|
|
</DialogButtons>
|
|
</SfDialog>
|
|
<SfDialog Width="350px" IsModal="true" @bind-Visible="@ShowDialog">
|
|
<DialogTemplates>
|
|
<Header> Angaben sind unvollständig </Header>
|
|
<Content>@((MarkupString)this.message)</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;
|
|
}
|
|
@code {
|
|
|
|
public string fid { get; set; } = "";
|
|
public string[] BerufID;
|
|
public string[] AnsprechpartnerID;
|
|
public string[] ZeitID;
|
|
public string PlatzID = "1";
|
|
public string KlassenTypID = "1";
|
|
public string bemerkung { get; set; } = "";
|
|
public string schuelerbemerkung { get; set; } = "";
|
|
public string standortbemerkung { get; set; } = "";
|
|
public bool ShowDialog = false;
|
|
public bool ShowDialogCompany = false;
|
|
string message = "";
|
|
SfListBox<string[], Beruf> Berufsliste { get; set; }
|
|
SfGrid<BWPMModels.Firmaberuf> Grid { get; set; }
|
|
string userid = "";
|
|
string firmaid = "";
|
|
|
|
public List<Beruf> berufe = new List<Beruf>();
|
|
public List<BWPMModels.Beruf> _berufe { get; set; } = BlazorApp.Controller.BerufController.GetAllAktiveData();
|
|
public List<Zeit> zeiten = new List<Zeit>();
|
|
|
|
public List<BWPMModels.Zeiten> _zeiten { get; set; } = BlazorApp.Controller.ZeitenController.GetAllAktiveData();
|
|
public List<BWPMModels.Ansprechpartner> ansprechpartner { get; set; }
|
|
public List<BWPMModels.Klassentyp> klassentyp { get; set; } = BlazorApp.Controller.KlassentypController.GetAllAktiveData();
|
|
private Firma _firma { get; set; } = new BWPMModels.Firma();
|
|
public List<BWPMModels.Firma> Firmendaten { get; set; }
|
|
public List<AP> lap = new List<AP>();
|
|
public List<Plaetze> plaetze = new List<Plaetze>();
|
|
public List<BWPMModels.Firmaberuf> GridData { get; set; }
|
|
|
|
public bool ContinuePaging = true;
|
|
public bool InitialRender { get; set; }
|
|
public int Value = 0; // consider that value your querystring contains
|
|
public int foundrow = 0;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
foreach (BWPMModels.Beruf item in _berufe)
|
|
{
|
|
Beruf be = new Beruf();
|
|
be.id = item.ID;
|
|
be.bezeichnung = item.bezeichnung;
|
|
berufe.Add(be);
|
|
}
|
|
foreach (BWPMModels.Zeiten item in _zeiten)
|
|
{
|
|
Zeit ze = new Zeit();
|
|
ze.id = item.ID;
|
|
ze.bezeichnung = item.bezeichnung;
|
|
zeiten.Add(ze);
|
|
}
|
|
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
|
Firmendaten = BlazorApp.Controller.FirmaController.GetByUserID(userid);
|
|
_firma = Firmendaten.First<BWPMModels.Firma>();
|
|
if (_firma.nameZ1 == "")
|
|
{
|
|
ShowDialogCompany = true;
|
|
return;
|
|
}
|
|
firmaid = await sessionStorage.GetItemAsync<string>("FirmaID");
|
|
get_ansprechaprtner(firmaid);
|
|
GridData = BlazorApp.Controller.FirmaberufController.GetAllAktiveByFirmaID(Convert.ToInt32(firmaid));
|
|
}
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
if (firstRender != true) { return; };
|
|
|
|
try
|
|
{
|
|
get_ansprechaprtner(firmaid);
|
|
}
|
|
catch { };
|
|
await Task.Delay(200);
|
|
for (int i = 1; i < 51; i++)
|
|
{
|
|
plaetze.Add(new Plaetze { id = i, text = i.ToString() });
|
|
}
|
|
PlatzID = "1";
|
|
KlassenTypID = "1";
|
|
|
|
}
|
|
|
|
private async Task get_ansprechaprtner(string firmaid)
|
|
{
|
|
if (firmaid == "") { return; };
|
|
lap.Clear();
|
|
ansprechpartner = BlazorApp.Controller.AnsprechpartnerController.GetAllAktivDataByFirmaID(Convert.ToInt32(firmaid));
|
|
foreach (Ansprechpartner item in ansprechpartner)
|
|
{
|
|
AP a1 = new AP();
|
|
a1.ID = item.ID;
|
|
a1.name = item.name;
|
|
lap.Add(a1);
|
|
}
|
|
|
|
|
|
}
|
|
public class AP
|
|
{
|
|
public int ID { get; set; }
|
|
public string name { get; set; }
|
|
}
|
|
|
|
public class Plaetze
|
|
{
|
|
public int id { get; set; }
|
|
public string text { get; set; }
|
|
}
|
|
|
|
public class Beruf
|
|
{
|
|
public int id { get; set; }
|
|
public string bezeichnung { get; set; }
|
|
}
|
|
|
|
public class Zeit
|
|
{
|
|
public int id { get; set; }
|
|
public string bezeichnung { get; set; }
|
|
}
|
|
|
|
private void CloseDialog()
|
|
{
|
|
this.ShowDialog = false;
|
|
if (this.ShowDialogCompany==true)
|
|
{
|
|
this.ShowDialogCompany = false;
|
|
NavigationManager.NavigateTo("/Company/Company");
|
|
}
|
|
|
|
}
|
|
|
|
public void einfuegen()
|
|
{
|
|
message = "";
|
|
int bid = 0;
|
|
int aid = 0;
|
|
int zid = 0;
|
|
int pid = 0;
|
|
int kid = 0;
|
|
|
|
try { bid = Convert.ToInt32(BerufID[0]); } catch { };
|
|
try { aid = Convert.ToInt32(AnsprechpartnerID[0]); } catch { };
|
|
try { zid = Convert.ToInt32(ZeitID[0]); } catch { };
|
|
try { pid = Convert.ToInt32(PlatzID); } catch { };
|
|
try { kid = Convert.ToInt32(KlassenTypID); } catch { };
|
|
|
|
if (bid == 0) { message += "- Bitte einen Beruf auswählen<br/>"; };
|
|
if (aid == 0) { message += "- Bitte einen Ansprechpartner auswählen<br/>"; };
|
|
if (zid == 0) { message += "- Bitte einen Zeit auswählen<br/>"; };
|
|
if (pid == 0) { message += "- Bitte Anzahl Plätze auswählen<br/>"; };
|
|
if (kid == 0) { message += "- Bitte Klassentyp auswählen<br/>"; };
|
|
if (message != "")
|
|
{
|
|
this.ShowDialog = true;
|
|
return;
|
|
}
|
|
|
|
BWPMModels.Firmaberuf fb = new BWPMModels.Firmaberuf();
|
|
fb.firmaID = Convert.ToInt32(firmaid);
|
|
fb.berufID = bid;
|
|
fb.ansprechpartnerID = aid;
|
|
fb.zeitID = zid;
|
|
fb.anzahl = pid;
|
|
fb.klassetypID = kid;
|
|
fb.erstellt_am = DateTime.Now;
|
|
fb.mutiert_am = DateTime.Now;
|
|
fb.aktiv = true;
|
|
fb.mutierer = userid;
|
|
fb.bemerkung = bemerkung;
|
|
fb.schuelerbemerkung = schuelerbemerkung;
|
|
fb.standortbemerkung = standortbemerkung;
|
|
BlazorApp.Controller.FirmaberufController.POST(fb);
|
|
GridData = BlazorApp.Controller.FirmaberufController.GetAllAktiveByFirmaID(Convert.ToInt32(firmaid));
|
|
Grid.Refresh();
|
|
ToastObj.ShowAsync();
|
|
|
|
}
|
|
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.Firmaberuf> Args)
|
|
|
|
{
|
|
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
|
{
|
|
if (Args.Action == "Add")
|
|
{
|
|
Args.Data.erstellt_am = DateTime.Now;
|
|
Args.Data.mutierer = userid;
|
|
Args.Data.mutiert_am = DateTime.Now;
|
|
Args.Data.aktiv = true;
|
|
Args.Data.ID = BlazorApp.Controller.FirmaberufController.POST(Args.Data);
|
|
Value = Args.Data.ID;
|
|
|
|
ToastObj.ShowAsync();
|
|
|
|
}
|
|
else
|
|
{
|
|
Args.Data.mutierer = userid.ToString();
|
|
Args.Data.mutiert_am = DateTime.Now;
|
|
BlazorApp.Controller.FirmaberufController.PUT(Args.Data);
|
|
|
|
ToastObj.ShowAsync();
|
|
|
|
}
|
|
}
|
|
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Delete)
|
|
{
|
|
Args.Data.aktiv = false;
|
|
Args.Data.mutierer = userid;
|
|
Args.Data.mutiert_am = DateTime.Now;
|
|
BlazorApp.Controller.FirmaberufController.PUT(Args.Data);
|
|
ToastObj.ShowAsync();
|
|
}
|
|
}
|
|
|
|
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.Firmaberuf> Args)
|
|
|
|
{
|
|
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
|
{
|
|
await Grid.SetRowData(Args.Data.ID, Args.Data);
|
|
double xx = 0;
|
|
Value = Args.Data.ID;
|
|
xx = await DataHandler();
|
|
await Grid.SelectRow(xx);
|
|
|
|
}
|
|
}
|
|
public async void RowDataBoundHandler(BeforeDataBoundArgs<BWPMModels.Firmaberuf> args)
|
|
{
|
|
|
|
}
|
|
|
|
public async Task<double> DataHandler()
|
|
{
|
|
var PageCount = (GridData.Count / Grid.PageSettings.PageSize) + 1;
|
|
ContinuePaging = true;
|
|
var CurrentPage = 1;
|
|
Grid.Refresh();
|
|
await Grid.GoToPage(1);
|
|
|
|
for (int i = 1; i <= PageCount; i++)
|
|
|
|
{
|
|
List<Firmaberuf> Rows = await Grid.GetCurrentViewRecords(); // returns the current view data
|
|
for (int j = 0; j < Grid.PageSettings.PageSize; j++)
|
|
{
|
|
if (j < Rows.Count && Rows[j].ID == Value)
|
|
{
|
|
foundrow = j;
|
|
|
|
ContinuePaging = false; // prevent the default navigation
|
|
break;
|
|
}
|
|
}
|
|
if (ContinuePaging)
|
|
{
|
|
if (i >= PageCount)
|
|
{
|
|
i = 0;
|
|
}
|
|
await Grid.GoToPage(i + 1);
|
|
|
|
}
|
|
else
|
|
{
|
|
return foundrow;
|
|
}
|
|
}
|
|
return foundrow;
|
|
}
|
|
|
|
}
|