| | | 1 | | @inject IAuthorizationService authService; |
| | | 2 | | @inject MUNity.Services.OrganizationService orgaService; |
| | | 3 | | |
| | | 4 | | |
| | 0 | 5 | | @if (this.response == null) |
| | 0 | 6 | | { |
| | | 7 | | <EditForm Model="@createRequest" OnValidSubmit="Submit"> |
| | | 8 | | <DataAnnotationsValidator /> |
| | | 9 | | <ValidationSummary /> |
| | | 10 | | |
| | | 11 | | <div class="row mb-15px"> |
| | | 12 | | <label class="form-label col-form-label col-md-3">Name</label> |
| | | 13 | | <div class="col-md-9"> |
| | | 14 | | <InputText type="text" @bind-Value="@createRequest.Name" class="form-control mb-5px" placeholder="Name" |
| | | 15 | | <small class="fs-12px text-gray-500-darker">Der vollständige Name der anzulegenen Organisation wie: MUN- |
| | | 16 | | </div> |
| | | 17 | | </div> |
| | | 18 | | |
| | | 19 | | <div class="row mb-15px"> |
| | | 20 | | <label class="form-label col-form-label col-md-3">Kürzel</label> |
| | | 21 | | <div class="col-md-9"> |
| | | 22 | | <InputText type="text" @bind-Value="@createRequest.ShortName" class="form-control mb-5px" placeholder="K |
| | | 23 | | <small class="fs-12px text-gray-500-darker">Ein Kürzel für die Oganisation wie hsm. Diese wird ggf. als |
| | | 24 | | </div> |
| | | 25 | | </div> |
| | | 26 | | |
| | | 27 | | <button class="btn btn-primary w-100px me-5ox">Erstellen</button> |
| | | 28 | | </EditForm> |
| | 0 | 29 | | } |
| | | 30 | | else |
| | 0 | 31 | | { |
| | 0 | 32 | | if (response.Status == Schema.Organization.CreateOrganizationResponse.CreateOrgaStatusCodes.Success) |
| | 0 | 33 | | { |
| | | 34 | | <div class="alert alert-success"> |
| | | 35 | | <strong>Erfolgreich</strong> |
| | | 36 | | Juhu! Wir konnten deine Organisation mit bei uns aufnehmen. Diese darf nun auch Projekte und Konferenzen anl |
| | | 37 | | <a>Zur Organisationsseite</a> |
| | | 38 | | </div> |
| | 0 | 39 | | } |
| | 0 | 40 | | else if (response.Status == Schema.Organization.CreateOrganizationResponse.CreateOrgaStatusCodes.NameTaken) |
| | 0 | 41 | | { |
| | | 42 | | <div class="alert alert-danger"> |
| | | 43 | | <strong>Fehler</strong> |
| | | 44 | | Oh nein :( Wir haben bei uns bereits eine Organisation mit diesem Namen gefunden. Um verwirrung zu vermeiden |
| | | 45 | | </div> |
| | 0 | 46 | | } |
| | 0 | 47 | | else if (response.Status == Schema.Organization.CreateOrganizationResponse.CreateOrgaStatusCodes.ShortTaken) |
| | 0 | 48 | | { |
| | | 49 | | <div class="alert alert-danger"> |
| | | 50 | | <strong>Fehler</strong> |
| | | 51 | | Oh nein :( Das Kürzel welches du eingegeben hast wird bereits von einer Organisation verwendet. Damit keine |
| | | 52 | | </div> |
| | 0 | 53 | | } |
| | 0 | 54 | | else if (response.Status == Schema.Organization.CreateOrganizationResponse.CreateOrgaStatusCodes.Error) |
| | 0 | 55 | | { |
| | | 56 | | <div class="alert alert-danger"> |
| | | 57 | | <strong>Fehler</strong> |
| | | 58 | | Oh Schreck! Es ist ein unerwarteter Fehler aufgetreten. Wir können die leider nicht mehr dazu sagen, aber mö |
| | | 59 | | </div> |
| | 0 | 60 | | } |
| | 0 | 61 | | } |
| | | 62 | | |
| | | 63 | | |
| | | 64 | | @code { |
| | | 65 | | [CascadingParameter] |
| | 0 | 66 | | private Task<AuthenticationState> authenticationStateTask { get; set; } |
| | | 67 | | |
| | | 68 | | MUNity.Schema.Organization.CreateOrganizationRequest createRequest; |
| | | 69 | | |
| | | 70 | | MUNity.Schema.Organization.CreateOrganizationResponse response; |
| | | 71 | | |
| | | 72 | | protected override void OnInitialized() |
| | 0 | 73 | | { |
| | 0 | 74 | | createRequest = new Schema.Organization.CreateOrganizationRequest(); |
| | 0 | 75 | | base.OnInitialized(); |
| | 0 | 76 | | } |
| | | 77 | | |
| | | 78 | | private async Task Submit() |
| | 0 | 79 | | { |
| | 0 | 80 | | var user = (await authenticationStateTask).User; |
| | 0 | 81 | | this.response = await orgaService.CreateOrganizationAsync(createRequest, user); |
| | | 82 | | |
| | | 83 | | |
| | 0 | 84 | | } |
| | | 85 | | } |