< Summary

Class:MUNity.BlazorServer.Components.Conference.CreateDelegationModal
Assembly:MUNity.BlazorServer
File(s):C:\Users\aeuke\source\repos\PeerConradi\munity\src\MUNity.BlazorServer\Components\Conference\CreateDelegationModal.razor
Covered lines:0
Uncovered lines:46
Coverable lines:46
Total lines:128
Line coverage:0% (0 of 46)
Covered branches:0
Total branches:12
Branch coverage:0% (0 of 12)
Covered methods:0
Total methods:11
Method coverage:0% (0 of 11)

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
BuildRenderTree(...)0%60%
.ctor()100%10%
get_authStateTask()100%10%
get_DelegationsChanged()100%10%
get_ConferenceId()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\CreateDelegationModal.razor

#LineLine coverage
 1<!-- Create Project Modal -->
 2@inject Services.DelegationService delegationService
 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 DelegationWishes</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 DelegationWishesen</h3>
 20                            <p>DelegationWishesen sind Gruppen, in welcher mehrere DelegationWishessrollen zusammengefas
 21
 22                            <div class="row mb-15px">
 23                                <label class="form-label col-form-label col-md-3">DelegationWishessname</label>
 24                                <div class="col-md-9">
 25                                    <InputText type="text" class="form-control mb-5px" placeholder="Name" @bind-Value="@
 26                                    <small class="fs-12px text-gray-500-darker">Ein Name für die DelegationWishes</small
 27                                </div>
 28                            </div>
 29
 30                            <div class="row mb-15px">
 31                                <label class="form-label col-form-label col-md-3">Vollständiger DelegationWishessname</l
 32                                <div class="col-md-9">
 33                                    <InputText type="text" class="form-control mb-5px" placeholder="Name" @bind-Value="@
 34                                    <small class="fs-12px text-gray-500-darker">Ein Name, welcher die DelegationWishes g
 35                                </div>
 36                            </div>
 37
 38                            <div class="row mb-15px">
 39                                <label class="form-label col-form-label col-md-3">Kürzel</label>
 40                                <div class="col-md-9">
 41                                    <InputText type="text" class="form-control mb-5px" placeholder="KURZ" @bind-Value="@
 42                                    <small class="fs-12px text-gray-500-darker">Ein Kürzel für die DelegationWishes</sma
 43                                </div>
 44                            </div>
 45
 46                        </div>
 47                        <div class="modal-footer">
 048                            <button class="btn btn-white" @onclick="() => Hide()">Abbrechen</button>
 49                            <button class="btn btn-success" type="submit">DelegationWishes erstellen</button>
 50                        </div>
 51                    </EditForm>
 052                }
 53                else
 054                {
 55                    <div class="modal-body">
 56                        <div class="col-12">
 057                            @if (!response.HasError)
 058                            {
 059                                <div class="alert alert-success">DelegationWishes erfolgreich erstellt <button class="bt
 060                            }
 61                        </div>
 62
 63                    </div>
 64                    <div class="modal-footer">
 065                        <button class="btn btn-white" @onclick="() => Hide()">Schließen</button>
 66                    </div>
 067                }
 68
 69            </div>
 70        </div>
 71    </div>
 72    <div class="modal-backdrop fade show"></div>
 073}
 74
 75
 76@code {
 077    private bool isVisible = false;
 78
 079    [CascadingParameter] public Task<AuthenticationState> authStateTask { get; set; }
 80
 081    [Parameter] public EventCallback DelegationsChanged { get; set; }
 82
 083    [Parameter] public string ConferenceId { get; set; }
 84
 085    private int groupId { get; set; }
 86
 87    private Schema.Conference.CreateDelegationRequest request;
 88
 89    private Schema.Conference.CreateDelegationResponse response;
 90
 91
 92    protected override void OnInitialized()
 093    {
 094        this.request = new Schema.Conference.CreateDelegationRequest();
 095        this.request.ConferenceId = ConferenceId;
 096    }
 97
 98    public void Show()
 099    {
 0100        isVisible = true;
 0101        StateHasChanged();
 0102    }
 103
 104    public void Hide()
 0105    {
 0106        isVisible = false;
 0107    }
 108
 109    public async Task CreateRoleGroup()
 0110    {
 0111        var claim = (await authStateTask)?.User;
 0112        if (claim != null)
 0113        {
 0114            this.response = await delegationService.CreateDelegationAsync(request, claim);
 0115            if (!response.HasError)
 0116                await DelegationsChanged.InvokeAsync();
 0117        }
 118
 0119    }
 120
 121    private void Reset()
 0122    {
 0123        request.DelegationFullName = null;
 0124        request.DelegationName = null;
 0125        request.DelegationShort = null;
 0126        response = null;
 0127    }
 128}