| | 1 | | @namespace Syki.Front.Pages.Adm |
| | 2 | |
|
| | 3 | | @page "/adm/institutions" |
| | 4 | | @attribute [Authorize(Roles = "Adm")] |
| | 5 | |
|
| | 6 | | <SykiPageTitle Title="Instituições" /> |
| | 7 | |
|
| | 8 | | <MudContainer Class="my-4 px-4"> |
| | 9 | | <SykiPageHeader Icon="@Icons.Material.Filled.School" Title="Instituições" /> |
| | 10 | | <MudContainer Class="px-0 my-4"> |
| | 11 | | <MudDataGrid Class="pa-4" Items="@_institutions" QuickFilter="@_quickFilter" Hover="true" Loading="@_loading" De |
| | 12 | | <ToolBarContent> |
| | 13 | | <SykiDataGridSearchTextField @bind-Value="@_searchString" Placeholder="Busque por name" /> |
| | 14 | | </ToolBarContent> |
| | 15 | | <Columns> |
| | 16 | | <PropertyColumn Property="x => x.Id" Title="Id" /> |
| | 17 | | <PropertyColumn Property="x => x.Name" Title="Nome" /> |
| | 18 | | <PropertyColumn Property="x => x.CreatedAt.ToLocalTime()" Title="Criada em" /> |
| | 19 | | </Columns> |
| | 20 | | <NoRecordsContent> |
| | 21 | | @(GetNotFoundMessage()) |
| | 22 | | </NoRecordsContent> |
| | 23 | | <PagerContent> |
| | 24 | | <SykiDataGridPager T="InstitutionOut" /> |
| | 25 | | </PagerContent> |
| | 26 | | </MudDataGrid> |
| | 27 | | </MudContainer> |
| | 28 | | </MudContainer> |
| | 29 | |
|
| | 30 | | @inject GetInstitutionsClient GetInstitutionsClient |
| | 31 | |
|
| | 32 | | @code |
| | 33 | | { |
| | 34 | | private bool _loading; |
| | 35 | | private string _searchString; |
| 0 | 36 | | private List<InstitutionOut> _institutions = []; |
| | 37 | |
|
| | 38 | | protected override async Task OnInitializedAsync() |
| | 39 | | { |
| 0 | 40 | | _loading = true; |
| 0 | 41 | | _institutions = await GetInstitutionsClient.Get(); |
| 0 | 42 | | _loading = false; |
| 0 | 43 | | } |
| | 44 | |
|
| 0 | 45 | | private Func<InstitutionOut, bool> _quickFilter => x => _searchString.IsIn(x.Name); |
| | 46 | |
|
| | 47 | | private string GetNotFoundMessage() |
| | 48 | | { |
| 0 | 49 | | return (_searchString.IsEmpty()) ? "Não existem instituições cadastradas ainda." : "Nenhuma instituição encontra |
| | 50 | | } |
| | 51 | | } |