< Summary

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

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
BuildRenderTree(...)0%60%
.ctor()100%10%
get_authStateTask()100%10%
get_ConferenceId()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\CreateFreeRoleModal.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">
 10                    <h4 class="modal-title">Neue freie Rolle</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 freie Rollen</h3>
 20                            <p>Freie Rollen sind für Teilnehmende gedacht, welche nicht fester Bestandteil eines Gremium
 21                            <p class="text-warning">Teammitglieder gehören nicht zu dieser Art von Rolle. Das Team hat e
 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="Rollenname" @bind-Va
 26                                    <small class="fs-12px text-gray-500-darker">RedakteurIn, Kameramann/frau, Lehrkraft 
 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                            <div class="row mb-15px">
 65                                <label class="form-label col-form-label col-md-3">Subkategorie</label>
 66                                <div class="col-md-9">
 67                                    <InputText type="text" class="form-control mb-5px" placeholder="Presse" @bind-Value=
 68                                    <small class="fs-12px text-gray-500-darker">Hier kann eine Art erweiterte Gruppe ang
 69                                </div>
 70                            </div>
 71                        </div>
 72                        <div class="modal-footer">
 073                            <button class="btn btn-white" @onclick="() => Hide()">Abbrechen</button>
 74                            <button class="btn btn-success" type="submit">Sitz erstellen</button>
 75                        </div>
 76                    </EditForm>
 077                }
 78                else
 079                {
 80                    <div class="modal-body">
 81                        <div class="col-12">
 082                            @if (!response.HasError)
 083                            {
 084                                <div class="alert alert-success">Rolle erfolgreich erstellt <button class="btn btn-sm bt
 085                            }
 86                        </div>
 87
 88                    </div>
 89                    <div class="modal-footer">
 090                        <button class="btn btn-white" @onclick="() => Hide()">Schließen</button>
 91                    </div>
 092                }
 93
 94            </div>
 95        </div>
 96    </div>
 97    <div class="modal-backdrop fade show"></div>
 098}
 99
 100
 101@code {
 0102    private bool isVisible = false;
 103
 0104    [CascadingParameter] public Task<AuthenticationState> authStateTask { get; set; }
 105
 0106    [Parameter] public string ConferenceId { get; set; }
 107
 0108    [Parameter] public EventCallback SeatCreated { get; set; }
 109
 0110    [Parameter] public List<MUNity.Schema.Conference.CountryInfo> Countries { get; set; }
 111
 0112    [Parameter] public List<MUNity.Schema.Conference.DelegationInfo> Delegations { get; set; }
 113
 0114    private int groupId { get; set; }
 115
 116    private Schema.Conference.CreateFreeSeatRequest request;
 117
 118    private Schema.Conference.CreateSeatResponse response;
 119
 120
 121    protected override void OnInitialized()
 0122    {
 0123        this.request = new Schema.Conference.CreateFreeSeatRequest();
 0124        this.request.ConferenceId = ConferenceId;
 0125    }
 126
 127    public void Show()
 0128    {
 0129        isVisible = true;
 0130        StateHasChanged();
 0131    }
 132
 133    public void Hide()
 0134    {
 0135        isVisible = false;
 0136    }
 137
 138    public async Task CreateRoleGroup()
 0139    {
 0140        var claim = (await authStateTask)?.User;
 0141        if (claim != null)
 0142        {
 0143            this.response = await conferenceService.CreateFreeSeat(request, claim);
 0144            if (!response.HasError)
 0145                await SeatCreated.InvokeAsync();
 0146        }
 147
 0148    }
 149
 150    private void Reset()
 0151    {
 0152        request.CountryId = -1;
 0153        request.DelegationId = null;
 0154        request.RoleName = null;
 0155        request.Subtype = null;
 0156        response = null;
 0157    }
 158}