| | 1 | | @namespace Syki.Front.Pages.Student |
| | 2 | |
|
| | 3 | | @page "/student/classes/{classId:guid}/activities/{activityId:guid}" |
| | 4 | | @attribute [Authorize(Roles = "Student")] |
| | 5 | |
|
| | 6 | | <SykiPageTitle Title="Atividade" /> |
| | 7 | |
|
| | 8 | | <MudContainer Class="mb-4 px-4"> |
| | 9 | | <MudBreadcrumbs Items="@_breadcrumbs" Class="px-0" /> |
| | 10 | | <SykiPageHeader Icon="@Icons.Material.Filled.EditNote" Title="@_activity.Title" Typo="Typo.h6" ButtonText="Entregar" |
| | 11 | | <MudPaper Class="my-4 pa-5"> |
| | 12 | | <MudContainer Class="px-0"> |
| | 13 | | <MudGrid Spacing="3"> |
| | 14 | | <MudItem xs="3" sm="2" md="2" lg="2"> |
| | 15 | | <SykiLabelText Label="Nota" Text="@_activity.Note.ToString()"/> |
| | 16 | | </MudItem> |
| | 17 | | <MudItem xs="5" sm="2" md="2" lg="2"> |
| | 18 | | <SykiLabelText Label="Tipo" Text="@_activity.Type.GetDescription()"/> |
| | 19 | | </MudItem> |
| | 20 | | <MudItem xs="4" sm="2" md="2" lg="2"> |
| | 21 | | <SykiLabelText Label="Peso (%)" Text="@_activity.Weight.ToString()"/> |
| | 22 | | </MudItem> |
| | 23 | | <MudItem xs="6" sm="3" md="3" lg="3"> |
| | 24 | | <SykiLabelText Label="Criada em" Text="@_activity.CreatedAt.ToLocalTime().Format()"/> |
| | 25 | | </MudItem> |
| | 26 | | <MudItem xs="6" sm="3" md="3" lg="3"> |
| | 27 | | <SykiLabelText Label="Data de entrega" Text="@_activity.GetDueDate()"/> |
| | 28 | | </MudItem> |
| | 29 | | </MudGrid> |
| | 30 | | <MudText Class="mt-4" Style="white-space: pre-line;"> |
| 0 | 31 | | @_activity.Description |
| | 32 | | </MudText> |
| | 33 | | </MudContainer> |
| | 34 | | </MudPaper> |
| | 35 | | </MudContainer> |
| | 36 | |
|
| | 37 | | @inject IDialogService DialogService |
| | 38 | | @inject ILocalStorageService LocalStorage |
| | 39 | | @inject IBrowserViewportService BrowserViewportService |
| | 40 | | @inject GetStudentClassActivityClient GetStudentClassActivityClient |
| | 41 | |
|
| | 42 | | @code |
| | 43 | | { |
| | 44 | | [Parameter] |
| 0 | 45 | | public Guid ClassId { get; set; } |
| | 46 | |
|
| | 47 | | [Parameter] |
| 0 | 48 | | public Guid ActivityId { get; set; } |
| | 49 | |
|
| 0 | 50 | | private List<CascadingClassDto> _classes = []; |
| 0 | 51 | | private List<BreadcrumbItem> _breadcrumbs = []; |
| | 52 | |
|
| 0 | 53 | | private StudentClassActivityOut _activity = new(); |
| | 54 | |
|
| | 55 | | private Breakpoint _breakpoint; |
| | 56 | |
|
| | 57 | | protected override async Task OnInitializedAsync() |
| | 58 | | { |
| 0 | 59 | | _classes = JsonConvert.DeserializeObject<List<CascadingClassDto>>(await LocalStorage.GetItemAsync<string>("Class |
| 0 | 60 | | var @class = _classes.FirstOrDefault(x => x.Id == ClassId); |
| 0 | 61 | | if (@class != null) |
| | 62 | | { |
| 0 | 63 | | _breadcrumbs.Add(new("Turmas", href: "/", icon: Icons.Material.Filled.CenterFocusStrong)); |
| 0 | 64 | | _breadcrumbs.Add(new(@class.Name, href: $"/student/classes/{@class.Id}")); |
| 0 | 65 | | _breadcrumbs.Add(new("Atividade", href: $"/student/classes/{@class.Id}/activities/{ActivityId}")); |
| | 66 | | } |
| | 67 | |
|
| 0 | 68 | | await Load(); |
| 0 | 69 | | } |
| | 70 | |
|
| | 71 | | private bool GetButtonDisabled() |
| | 72 | | { |
| 0 | 73 | | return _activity.Type == ClassActivityType.Exam; |
| | 74 | | } |
| | 75 | |
|
| | 76 | | private async Task Load() |
| | 77 | | { |
| 0 | 78 | | _activity = await GetStudentClassActivityClient.Get(ClassId, ActivityId); |
| 0 | 79 | | } |
| | 80 | |
|
| | 81 | | private async Task OpenDialog() |
| | 82 | | { |
| 0 | 83 | | var parameters = new DialogParameters<CreateClassActivityWorkDialog>(); |
| 0 | 84 | | parameters.Add(x => x.ActivityId, ActivityId); |
| | 85 | |
|
| 0 | 86 | | _breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync(); |
| 0 | 87 | | var options = new DialogOptions { |
| 0 | 88 | | FullWidth = true, |
| 0 | 89 | | MaxWidth = MaxWidth.Small, |
| 0 | 90 | | FullScreen = _breakpoint == Breakpoint.Xs, |
| 0 | 91 | | }; |
| 0 | 92 | | var dialog = await DialogService.ShowAsync<CreateClassActivityWorkDialog>("", parameters, options); |
| | 93 | |
|
| 0 | 94 | | var result = await dialog.Result; |
| | 95 | |
|
| 0 | 96 | | if (result!.Canceled) return; |
| | 97 | |
|
| 0 | 98 | | await Load(); |
| 0 | 99 | | } |
| | 100 | | } |