< Summary

Class:MUNity.BlazorServer.Components.Conference.CreateCommitteeSeatModal
Assembly:MUNity.BlazorServer
File(s):C:\Users\aeuke\source\repos\PeerConradi\munity\src\MUNity.BlazorServer\Components\Conference\CreateCommitteeSeatModal.razor
Covered lines:0
Uncovered lines:66
Coverable lines:66
Total lines:154
Line coverage:0% (0 of 66)
Covered branches:0
Total branches:20
Branch coverage:0% (0 of 20)
Covered methods:0
Total methods:14
Method coverage:0% (0 of 14)

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
BuildRenderTree(...)0%60%
.ctor()100%10%
get_authStateTask()100%10%
get_CommitteeId()100%10%
get_CommitteeName()100%10%
get_SeatCreated()100%10%
get_Countries()100%10%
get_Delegations()100%10%
get_groupId()100%10%
OnInitialized()100%10%
Show()100%10%
Hide()100%10%
CreateRoleGroup()0%60%
Reset()100%10%

File(s)

C:\Users\aeuke\source\repos\PeerConradi\munity\src\MUNity.BlazorServer\Components\Conference\CreateCommitteeSeatModal.razor

#LineLine coverage
 1<!-- Create Project Modal -->
 2@inject Services.ConferenceService conferenceService;
 3
 04@if (isVisible)
 05{
 6    <div class="modal fade show" style="display: block;" role="dialog">
 7        <div class="modal-dialog">
 8            <div class="modal-content">
 9                <div class="modal-header">
 010                    <h4 class="modal-title">Neuen Sitz in @CommitteeName</h4>
 011                    <button type="button" class="btn-close" @onclick="() => Hide()"></button>
 12                </div>
 013                @if (response == null)
 014                {
 15                    <EditForm Model="request" OnValidSubmit="CreateRoleGroup">
 16                        <DataAnnotationsValidator />
 17                        <ValidationSummary />
 18                        <div class="modal-body">
 19                            <h3>Über Sitze</h3>
 020                            <p>Über diesen Dialog kann @CommitteeName ein Sitz in Form einer Rolle hinzugefügt werden. D
 21
 22                            <div class="row mb-15px">
 23                                <label class="form-label col-form-label col-md-3">Rollenname</label>
 24                                <div class="col-md-9">
 25                                    <InputText type="text" class="form-control mb-5px" placeholder="Generalversammlung" 
 26                                    <small class="fs-12px text-gray-500-darker">z.B. Abgeordneter Deutschland/ Präsident
 27                                </div>
 28                            </div>
 29
 030                            @if (Countries != null)
 031                            {
 32                                <div class="row mb-15px">
 33                                    <label class="form-label col-form-label col-md-3">Repräsentiertes Land</label>
 34                                    <div class="col-md-9">
 35                                        <InputSelect @bind-Value="@request.CountryId" class="form-select">
 36                                            <option value="-1">Keinem Land zugehörig</option>
 037                                            @foreach (var country in Countries)
 038                                                        {
 039                                                <option value="@country.CountryId">@country.Name</option>
 040                                                        }
 41                                        </InputSelect>
 42                                        <small class="fs-12px text-gray-500-darker"></small>
 43                                    </div>
 44                                </div>
 045                            }
 46
 047                            @if (Delegations != null)
 048                            {
 49                                <div class="row mb-15px">
 50                                    <label class="form-label col-form-label col-md-3">DelegationWishes</label>
 51                                    <div class="col-md-9">
 52                                        <InputSelect @bind-Value="@request.DelegationId" class="form-select">
 53                                            <option value="">Keine DelegationWishes</option>
 054                                            @foreach (var delegation in Delegations)
 055                                                        {
 056                                                <option value="@delegation.DelegationId">@delegation.DelegationName</opt
 057                                                        }
 58                                        </InputSelect>
 59                                        <small class="fs-12px text-gray-500-darker"></small>
 60                                    </div>
 61                                </div>
 062                            }
 63
 64
 65                        </div>
 66                        <div class="modal-footer">
 067                            <button class="btn btn-white" @onclick="() => Hide()">Abbrechen</button>
 68                            <button class="btn btn-success" type="submit">Sitz erstellen</button>
 69                        </div>
 70                    </EditForm>
 071                }
 72                else
 073                {
 74                    <div class="modal-body">
 75                        <div class="col-12">
 076                            @if (!response.HasError)
 077                            {
 078                                <div class="alert alert-success">Sitz erfolgreich erstellt <button class="btn btn-sm btn
 079                            }
 80                        </div>
 81
 82                    </div>
 83                    <div class="modal-footer">
 084                        <button class="btn btn-white" @onclick="() => Hide()">Schließen</button>
 85                    </div>
 086                }
 87
 88            </div>
 89        </div>
 90    </div>
 91    <div class="modal-backdrop fade show"></div>
 092}
 93
 94
 95@code {
 096    private bool isVisible = false;
 97
 098    [CascadingParameter] public Task<AuthenticationState> authStateTask { get; set; }
 99
 0100    [Parameter] public string CommitteeId { get; set; }
 101
 0102    [Parameter] public string CommitteeName { get; set; }
 103
 0104    [Parameter] public EventCallback SeatCreated { get; set; }
 105
 0106    [Parameter] public List<MUNity.Schema.Conference.CountryInfo> Countries { get; set; }
 107
 0108    [Parameter] public List<MUNity.Schema.Conference.DelegationInfo> Delegations { get; set; }
 109
 0110    private int groupId { get; set; }
 111
 112    private Schema.Conference.CreateCommitteeSeatRequest request;
 113
 114    private Schema.Conference.CreateSeatResponse response;
 115
 116
 117    protected override void OnInitialized()
 0118    {
 0119        this.request = new Schema.Conference.CreateCommitteeSeatRequest();
 0120        this.request.CommitteeId = CommitteeId;
 0121    }
 122
 123    public void Show()
 0124    {
 0125        isVisible = true;
 0126        StateHasChanged();
 0127    }
 128
 129    public void Hide()
 0130    {
 0131        isVisible = false;
 0132    }
 133
 134    public async Task CreateRoleGroup()
 0135    {
 0136        var claim = (await authStateTask)?.User;
 0137        if (claim != null)
 0138        {
 0139            this.response = await conferenceService.CreateCommitteeSeat(request, claim);
 0140            if (!response.HasError)
 0141                await SeatCreated.InvokeAsync();
 0142        }
 143
 0144    }
 145
 146    private void Reset()
 0147    {
 0148        request.CountryId = -1;
 0149        request.DelegationId = null;
 0150        request.RoleName = null;
 0151        request.Subtype = null;
 0152        response = null;
 0153    }
 154}