-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christoph Decker
authored and
Christoph Decker
committed
Oct 27, 2024
1 parent
1f57e23
commit 2312d14
Showing
17 changed files
with
590 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@page "/tour" | ||
@using chdTour.App.Components.Base | ||
@using chdTour.App.Components.Pages.Scala | ||
@using chdTour.App.Components.Pages.Tours | ||
@using chdTour.DataAccess.Contracts.Domain | ||
|
||
@inherits BaseSearchForm<ITourRepository, Tour> | ||
|
||
<EntityTable EntityName="Touren" T="Tour" | ||
TRepo="ITourRepository" Item="this._item" Items="this._items" OnEdit="async x => await this.SetEntity(x)"> | ||
<ChildContent> | ||
<TourEdit Token="this._cts.Token" OnBack="this.OnBack" Value="this._item" /> | ||
</ChildContent> | ||
<HeaderContent> | ||
<TableHead>Title</TableHead> | ||
<TableHead>Ort</TableHead> | ||
<TableHead>Datum</TableHead> | ||
<TableHead>Type</TableHead> | ||
<TableHead>Grad</TableHead> | ||
<TableHead>Partner</TableHead> | ||
</HeaderContent> | ||
<RowTemplate Context="entity"> | ||
<TableData>@entity.Title</TableData> | ||
<TableData>@entity.Location</TableData> | ||
<TableData>@entity.TourDate.ToString("dd.MM.yyyy")</TableData> | ||
<TableData>@entity.TourType.Title</TableData> | ||
<TableData>@entity.Grade.Title</TableData> | ||
<TableData>@(string.Join(",",entity.TourPartners.SelectMany(s => s.PersonObj.FullName)))</TableData> | ||
</RowTemplate> | ||
</EntityTable> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using chd.UI.Base.Components.Base; | ||
using chdTour.App.Components.Base; | ||
using chdTour.Contracts.Constants; | ||
using chdTour.DataAccess.Contracts.Domain; | ||
using chdTour.DataAccess.Contracts.Interfaces.Repositories; | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace chdTour.App.Components.Pages | ||
{ | ||
public partial class TourPage : BaseSearchForm<ITourRepository, Tour> | ||
{ | ||
protected override async Task OnInitializedAsync() | ||
{ | ||
this.Title = PageTitleConstants.Tours; | ||
|
||
this._items = await this._repository.Where(x => true).AsSplitQuery().ToListAsync(this._cts.Token); | ||
|
||
await base.OnInitializedAsync(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
@using Microsoft.EntityFrameworkCore | ||
@using chdTour.App.Components.Base | ||
@using chdTour.App.Components.Inputs | ||
@using chdTour.DataAccess.Contracts.Domain | ||
@inject ITourTypeRepository tourTypeRepo | ||
@inject ITourPartnerRepository tourPartnerRepo | ||
@inherits BaseEditForm<ITourRepository,Tour> | ||
|
||
<EditFormLayout TRepo="ITourRepository" T="Tour" @ref="this._layout" Value="this.Value" OnBack="this.OnBack"> | ||
<EditFormText TRepo="ITourRepository" T="Tour" Value="this.Value" Property="x => x.Title" Title="Titel" /> | ||
<EditFormText TRepo="ITourRepository" T="Tour" Value="this.Value" Property="x => x.Location" Title="Ort/Gebiet" /> | ||
<EditFormDateTime TRepo="ITourRepository" TValue="DateTime" T="Tour" Value="this.Value" Property="x => x.TourDate" Title="Datum" /> | ||
<EditFormNumber TValue="int" TRepo="ITourRepository" T="Tour" Value="this.Value" Property="x => x.Pitches" Title="SL" /> | ||
|
||
<EditFormSearch TRepo="ITourRepository" T="Tour" TValue="TourType" TFavoriteObject="Guid" | ||
Name="x => x?.Title" Property="x => x.TourType" Title="Typ" Value="this.Value" Values="this._tourTypeLst" | ||
OnChange="this.Changed" /> | ||
|
||
<EditFormSearch TRepo="ITourRepository" T="Tour" TValue="Grade" TFavoriteObject="Guid" | ||
Name="x => x?.Title" Property="x => x.Grade" Title="Grad" Value="this.Value" Values="_grades" | ||
OnChange="this.Changed" /> | ||
|
||
<EditMultiAssignment Title="Partner" TRepo="ITourPartnerRepository" TParentRepo="ITourRepository" T="TourPartner" Token="this.Token" | ||
TParent="Tour" | ||
TForm="TourPartnerEdit" | ||
OneAssignedProperty="x => x.TourObj" | ||
OnChange="this.Changed" | ||
ParentEntity="this.Value" CollectionProperty="x => x.TourPartners"> | ||
<HeaderContent> | ||
<TableHead>Name</TableHead> | ||
</HeaderContent> | ||
<RowTemplate Context="tourPartner"> | ||
<TableData>@tourPartner.PersonObj.FullName</TableData> | ||
</RowTemplate> | ||
</EditMultiAssignment> | ||
|
||
<EditFormTextArea TRepo="ITourRepository" T="Tour" Value="this.Value" Property="x => x.Comment" Title="Details" /> | ||
<EditFormTextArea TRepo="ITourRepository" T="Tour" Value="this.Value" Property="x => x.Description" Title="weiete Beschreibung" /> | ||
</EditFormLayout> | ||
|
||
|
||
|
||
@code { | ||
List<TourType> _tourTypeLst; | ||
List<Grade> _grades = []; | ||
|
||
protected async override Task OnInitializedAsync() | ||
{ | ||
this._tourTypeLst = (await this.tourTypeRepo.FindAll(this.Token)).ToList(); | ||
if (this.Value.TourType?.GradeScala is not null) | ||
{ | ||
this._grades = this.Value.TourType.GradeScala.Grades.ToList(); | ||
} | ||
await base.OnInitializedAsync(); | ||
} | ||
|
||
private void Changed(TourType type) | ||
{ | ||
this.Value.TourTypeId = type.Id; | ||
if (this.Value.TourType?.GradeScala is not null) | ||
{ | ||
this._grades = this.Value.TourType.GradeScala.Grades.ToList(); | ||
} | ||
} | ||
private void Changed(Grade grade) | ||
{ | ||
this.Value.GradeId = grade.Id; | ||
} | ||
|
||
private async Task Changed(TourPartner tourPartner, EntityState state) | ||
{ | ||
tourPartner.TourId = this.Value.Id; | ||
} | ||
|
||
} |
55 changes: 55 additions & 0 deletions
55
src/chdTour.App/Components/Pages/Tours/TourPartnerEdit.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
@using chdTour.App.Components.Base | ||
@using chdTour.App.Components.Inputs | ||
@using chdTour.DataAccess.Contracts.Domain | ||
@inject IPersonRepository personRepo | ||
@inject ITourRepository tourRepo | ||
@inherits BaseEditForm<ITourPartnerRepository,TourPartner> | ||
|
||
<EditFormLayout TRepo="ITourPartnerRepository" T="TourPartner" @ref="this._layout" Value="this.Value"> | ||
@if (this.Value.TourObj is null) | ||
{ | ||
<EditFormSearch TRepo="ITourPartnerRepository" T="TourPartner" TValue="Tour" TFavoriteObject="Guid" | ||
Name="x =>x.Title" Property="x => x.TourObj" Title="Tour" Value="this.Value" Values="this._tourLst" | ||
OnChange="this.Changed" /> | ||
} | ||
else | ||
{ | ||
<EditFormLabel TRepo="ITourPartnerRepository" T="TourPartner" Title="Tour" Value="this.Value" Property="x => x.TourObj.Title" /> | ||
} | ||
|
||
@if (this.Value.PersonObj is null) | ||
{ | ||
<EditFormSearch TRepo="ITourPartnerRepository" T="TourPartner" TValue="Person" TFavoriteObject="Guid" | ||
Name="x =>x.FullName" Property="x => x.PersonObj" Title="Partner" Value="this.Value" Values="this._personLst" | ||
OnChange="this.Changed" /> | ||
} | ||
else | ||
{ | ||
<EditFormLabel TRepo="ITourPartnerRepository" T="TourPartner" Title="Partner" Value="this.Value" Property=" x => x.PersonObj.FullName" /> | ||
} | ||
|
||
</EditFormLayout> | ||
|
||
|
||
@code { | ||
List<Person> _personLst; | ||
List<Tour> _tourLst; | ||
|
||
protected async override Task OnInitializedAsync() | ||
{ | ||
this._personLst = (await this.personRepo.FindAll(this.Token)).ToList(); | ||
this._tourLst = (await this.tourRepo.FindAll(this.Token)).ToList(); | ||
|
||
await base.OnInitializedAsync(); | ||
} | ||
|
||
private void Changed(Person person) | ||
{ | ||
this.Value.PartnerId = person.Id; | ||
} | ||
|
||
private void Changed(Tour tour) | ||
{ | ||
this.Value.TourId = tour.Id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/chdTour.DataAccess.Contracts/Interfaces/Repositories/ITourPartnerRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
| ||
using chdTour.DataAccess.Contracts.Domain; | ||
using chdTour.DataAccess.Contracts.Interfaces.Repositories.Base; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace chdTour.DataAccess.Contracts.Interfaces.Repositories | ||
{ | ||
public interface ITourPartnerRepository : IBaseRepository<TourPartner> | ||
{ | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/chdTour.DataAccess/Repositories/TourPartnerRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using chdTour.DataAccess.Contracts.Domain; | ||
using chdTour.DataAccess.Contracts.Interfaces.Repositories; | ||
using chdTour.DataAccess.Repositories.Base; | ||
using chdTour.Persistence.EF; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace chdTour.DataAccess.Repositories | ||
{ | ||
public class TourPartnerRepository : BaseRepository<TourPartner>, ITourPartnerRepository | ||
{ | ||
public TourPartnerRepository(chdTourContext chdTourContext) : base(chdTourContext) | ||
{ | ||
} | ||
} | ||
} |
Oops, something went wrong.