Prospects Page
This commit is contained in:
93
FoodsharingSiegen.Server/Controls/ProspectContainer.razor
Normal file
93
FoodsharingSiegen.Server/Controls/ProspectContainer.razor
Normal file
@@ -0,0 +1,93 @@
|
||||
@using FoodsharingSiegen.Contracts.Entity
|
||||
|
||||
@{
|
||||
var divClass = "pc-main";
|
||||
if (Prospect.Complete) divClass += " complete";
|
||||
}
|
||||
|
||||
<div class="@divClass">
|
||||
<h5 class="mb-0">
|
||||
@Prospect.Name
|
||||
<small style="font-size: .9rem; opacity: .7;">
|
||||
<a class="invert" href="https://foodsharing.de/profile/@Prospect.FsId" target="_blank">Profil öffnen</a>
|
||||
</small>
|
||||
</h5>
|
||||
<div>@Prospect.Memo</div>
|
||||
<table>
|
||||
|
||||
<InteractionRow
|
||||
Prospect="Prospect"
|
||||
Type="InteractionType.Welcome"
|
||||
AddClick="() => AddInteraction(InteractionType.Welcome)"
|
||||
RemoveClick="@RemoveInteraction"
|
||||
Caption="Begrüßung"
|
||||
ButtonText="Abhaken"
|
||||
IconClass="fa-solid fa-handshake-simple">
|
||||
</InteractionRow>
|
||||
|
||||
<InteractionRow
|
||||
Prospect="Prospect"
|
||||
Type="InteractionType.EinAb"
|
||||
AddClick="() => AddInteraction(InteractionType.EinAb)"
|
||||
RemoveClick="@RemoveInteraction"
|
||||
Caption="Einführungen"
|
||||
Multiple="true"
|
||||
Minimum="3"
|
||||
ButtonText="Hinzufügen"
|
||||
IconClass="fa-solid fa-basket-shopping">
|
||||
</InteractionRow>
|
||||
|
||||
<InteractionRow
|
||||
Prospect="Prospect"
|
||||
Type="InteractionType.IdCheck"
|
||||
AddClick="() => AddInteraction(InteractionType.IdCheck)"
|
||||
RemoveClick="@RemoveInteraction"
|
||||
Caption="Perso prüfen"
|
||||
ButtonText="Abhaken"
|
||||
IconClass="fa-solid fa-magnifying-glass">
|
||||
</InteractionRow>
|
||||
|
||||
<InteractionRow
|
||||
Prospect="Prospect"
|
||||
Type="InteractionType.PdfPass"
|
||||
AddClick="() => AddInteraction(InteractionType.PdfPass)"
|
||||
RemoveClick="@RemoveInteraction"
|
||||
Caption="FS-Ausweis (digital)"
|
||||
ButtonText="Abhaken"
|
||||
IconClass="fa-solid fa-file-pdf">
|
||||
</InteractionRow>
|
||||
|
||||
<InteractionRow
|
||||
Prospect="Prospect"
|
||||
Type="InteractionType.PrintPass"
|
||||
AddClick="() => AddInteraction(InteractionType.PrintPass)"
|
||||
RemoveClick="@RemoveInteraction"
|
||||
Caption="FS-Ausweis (print)"
|
||||
ButtonText="Abhaken"
|
||||
IconClass="fa-solid fa-id-card">
|
||||
</InteractionRow>
|
||||
|
||||
<InteractionRow
|
||||
Prospect="Prospect"
|
||||
Type="InteractionType.Verify"
|
||||
AddClick="() => AddInteraction(InteractionType.Verify)"
|
||||
RemoveClick="@RemoveInteraction"
|
||||
Caption="Verifizieren"
|
||||
ButtonText="Abhaken"
|
||||
IconClass="fa-solid fa-user-check">
|
||||
</InteractionRow>
|
||||
|
||||
<InteractionRow
|
||||
Prospect="Prospect"
|
||||
Type="InteractionType.Complete"
|
||||
AddClick="() => AddInteraction(InteractionType.Complete)"
|
||||
RemoveClick="@RemoveInteraction"
|
||||
Caption="Fertig"
|
||||
ButtonText="Abhaken"
|
||||
IconClass="fa-solid fa-flag-checkered">
|
||||
</InteractionRow>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
26
FoodsharingSiegen.Server/Controls/ProspectContainer.razor.cs
Normal file
26
FoodsharingSiegen.Server/Controls/ProspectContainer.razor.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Server.Dialogs;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Controls
|
||||
{
|
||||
public partial class ProspectContainer
|
||||
{
|
||||
[Parameter] public Prospect? Prospect { get; set; }
|
||||
|
||||
[Parameter] public AddInteractionModal InteractionModal { get; set; } = null!;
|
||||
|
||||
[Parameter] public EventCallback<Guid> RemoveInteraction { get; set; }
|
||||
|
||||
|
||||
private async Task AddInteraction(InteractionType type)
|
||||
{
|
||||
await InteractionModal.Show(type, Prospect?.Id);
|
||||
}
|
||||
|
||||
private List<Interaction> GetTyped(InteractionType type)
|
||||
{
|
||||
return Prospect?.Interactions?.Where(x => x.Type == type).ToList() ?? new List<Interaction>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
::deep a,
|
||||
::deep a.invert:hover{
|
||||
|
||||
color: #64ae24;
|
||||
}
|
||||
|
||||
::deep a.invert,
|
||||
::deep a:hover {
|
||||
color: #533a20;
|
||||
}
|
||||
|
||||
.green {
|
||||
color: #64ae24;
|
||||
}
|
||||
|
||||
.pc-main {
|
||||
flex-basis: 0;
|
||||
flex-grow: 1;
|
||||
max-width: 100%;
|
||||
min-width: 350px;
|
||||
border: 1px solid #533a20;
|
||||
border-radius: 15px;
|
||||
margin: 5px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.complete {
|
||||
background: #76ff003b;
|
||||
}
|
||||
29
FoodsharingSiegen.Server/Pages/Prospects.razor
Normal file
29
FoodsharingSiegen.Server/Pages/Prospects.razor
Normal file
@@ -0,0 +1,29 @@
|
||||
@page "/"
|
||||
@page "/prospect"
|
||||
@page "/prospects"
|
||||
@using FoodsharingSiegen.Server.Dialogs
|
||||
@using FoodsharingSiegen.Server.Controls
|
||||
@using FoodsharingSiegen.Contracts.Entity
|
||||
|
||||
<PageTitle>Einarbeitungen</PageTitle>
|
||||
|
||||
<h4>Aktuelle Einarbeitungen</h4>
|
||||
|
||||
<Button Color="Color.Primary" Clicked="() => ProspectModal.Show()">Hinzufügen</Button>
|
||||
|
||||
<div class="row">
|
||||
<Repeater Items="@ProspectList?.Where(x => x.Interactions.All(i => i.Type != InteractionType.Complete))">
|
||||
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" RemoveInteraction="@RemoveInteraction"></ProspectContainer>
|
||||
</Repeater>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<h4>Abgeschlossen</h4>
|
||||
<div class="row">
|
||||
<Repeater Items="@ProspectList?.Where(x => x.Interactions.Any(i => i.Type == InteractionType.Complete))">
|
||||
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" RemoveInteraction="@RemoveInteraction"></ProspectContainer>
|
||||
</Repeater>
|
||||
</div>
|
||||
|
||||
<AddProspectModal @ref="ProspectModal" OnAdd="OnAddProspect"></AddProspectModal>
|
||||
<AddInteractionModal @ref="InteractionModal" OnAdd="OnAddInteraction" Users="Users"></AddInteractionModal>
|
||||
64
FoodsharingSiegen.Server/Pages/Prospects.razor.cs
Normal file
64
FoodsharingSiegen.Server/Pages/Prospects.razor.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Server.Data.Service;
|
||||
using FoodsharingSiegen.Server.Dialogs;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Pages
|
||||
{
|
||||
public partial class Prospects
|
||||
{
|
||||
[Inject] public ProspectService ProspectService { get; set; } = null!;
|
||||
[Inject] public UserService UserService { get; set; } = null!;
|
||||
|
||||
public List<Prospect>? ProspectList { get; set; }
|
||||
|
||||
public AddProspectModal ProspectModal { get; set; } = null!;
|
||||
public AddInteractionModal InteractionModal { get; set; }
|
||||
public List<User>? Users { get; set; }
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await LoadProspects();
|
||||
}
|
||||
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var getUsersR = await UserService.GetUsersAsync();
|
||||
if (getUsersR.Success)
|
||||
Users = getUsersR.Data;
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
private async Task LoadProspects()
|
||||
{
|
||||
var prospectsR = await ProspectService.GetProspectsAsync();
|
||||
if (prospectsR.Success) ProspectList = prospectsR.Data;
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task OnAddProspect(Prospect arg)
|
||||
{
|
||||
var addProspectR = await ProspectService.AddProspectAsync(arg);
|
||||
if (addProspectR.Success) await LoadProspects();
|
||||
}
|
||||
|
||||
private async Task OnAddInteraction(Interaction arg)
|
||||
{
|
||||
await ProspectService.AddInteraction(arg);
|
||||
await LoadProspects();
|
||||
}
|
||||
|
||||
private async Task RemoveInteraction(Guid arg)
|
||||
{
|
||||
await ProspectService.RemoveInteraction(arg);
|
||||
await LoadProspects();
|
||||
}
|
||||
}
|
||||
}
|
||||
1
FoodsharingSiegen.Server/Pages/Prospects.razor.css
Normal file
1
FoodsharingSiegen.Server/Pages/Prospects.razor.css
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user