| | 1 | | @namespace Syki.Front.Features.Student.CreateClassActivityWork |
| | 2 | |
|
| | 3 | | <MudDialog Class="pb-2" DefaultFocus="DefaultFocus.None"> |
| | 4 | | <TitleContent> |
| | 5 | | <SykiDialogTitle Icon="@Icons.Material.Filled.BookmarkAdded" Text="Entregar" /> |
| | 6 | | </TitleContent> |
| | 7 | | <DialogContent> |
| | 8 | | <MudGrid Spacing="3"> |
| | 9 | | <MudItem xs="12" sm="12" md="12" lg="12"> |
| | 10 | | <MudText>Adicione o link para o documento que contém a entrega da atividade.</MudText> |
| | 11 | | </MudItem> |
| | 12 | | </MudGrid> |
| 0 | 13 | | <MudForm @ref="@_form" Class="pt-4"> |
| 0 | 14 | | <MudGrid Spacing="2"> |
| 0 | 15 | | <MudItem xs="12" sm="12" md="12" lg="12"> |
| 0 | 16 | | <SykiTextField Label="Link" @bind-Value="@_link" AutoFocus="true" /> |
| 0 | 17 | | </MudItem> |
| 0 | 18 | | </MudGrid> |
| | 19 | | </MudForm> |
| | 20 | | </DialogContent> |
| | 21 | | <DialogActions> |
| | 22 | | <DialogCancelButton OnClick="@Cancel" /> |
| | 23 | | <SykiProgressCircular Loading="@_loading" /> |
| | 24 | | <DialogSaveButton OnClick="@Submit" /> |
| | 25 | | </DialogActions> |
| | 26 | | </MudDialog> |
| | 27 | |
|
| | 28 | | @inject ISnackbar Snackbar |
| | 29 | | @inject CreateClassActivityWorkClient CreateClassActivityWorkClient |
| | 30 | |
|
| | 31 | | @code |
| | 32 | | { |
| | 33 | | [CascadingParameter] |
| 0 | 34 | | IMudDialogInstance MudDialog { get; set; } |
| | 35 | |
|
| | 36 | | [Parameter] |
| 0 | 37 | | public Guid ActivityId { get; set; } |
| | 38 | |
|
| | 39 | | private MudForm _form; |
| | 40 | | private bool _loading; |
| | 41 | | private string _link; |
| | 42 | |
|
| | 43 | | private async Task Submit() |
| | 44 | | { |
| 0 | 45 | | if (_loading) return; |
| | 46 | |
|
| 0 | 47 | | await _form.Validate(); |
| 0 | 48 | | if (!_form.IsValid) return; |
| | 49 | |
|
| 0 | 50 | | _loading = true; |
| 0 | 51 | | var result = await CreateClassActivityWorkClient.Create(ActivityId, _link); |
| 0 | 52 | | if (result.IsSuccess) |
| | 53 | | { |
| 0 | 54 | | MudDialog.Close(DialogResult.Ok(true)); |
| 0 | 55 | | Snackbar.Add("Entrega realizada com sucesso!", Severity.Success); |
| | 56 | | } |
| | 57 | | else |
| | 58 | | { |
| 0 | 59 | | Snackbar.Add(result.Error.Message, Severity.Error); |
| | 60 | | } |
| 0 | 61 | | _loading = false; |
| 0 | 62 | | } |
| | 63 | |
|
| 0 | 64 | | private void Cancel() => MudDialog.Cancel(); |
| | 65 | | } |