Initial commit: Tasks.Module
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
@using MudBlazor
|
||||
@using Tasks.Module.Models
|
||||
|
||||
<MudDialog>
|
||||
<DialogContent>
|
||||
<MudStack Spacing="3">
|
||||
<MudTextField T="string"
|
||||
@bind-Value:get="_name"
|
||||
@bind-Value:set="(v) => _name = v"
|
||||
Label="View Name"
|
||||
Required="true"
|
||||
Placeholder="e.g., High Priority Tasks" />
|
||||
|
||||
<MudText Typo="Typo.subtitle2" Class="mt-4">Filter Criteria (optional)</MudText>
|
||||
<MudText Typo="Typo.caption" Color="Color.Default">Leave empty to show all tasks</MudText>
|
||||
|
||||
<MudSelect T="int?" Label="Priority" @bind-Value:get="_priority" @bind-Value:set="(v) => _priority = v" Clearable="true">
|
||||
<MudSelectItem T="int?" Value="null">Any Priority</MudSelectItem>
|
||||
<MudSelectItem T="int?" Value="0">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="w-2 h-2 bg-green-500 rounded-full"></span> Low
|
||||
</div>
|
||||
</MudSelectItem>
|
||||
<MudSelectItem T="int?" Value="1">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="w-2 h-2 bg-yellow-500 rounded-full"></span> Medium
|
||||
</div>
|
||||
</MudSelectItem>
|
||||
<MudSelectItem T="int?" Value="2">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="w-2 h-2 bg-red-500 rounded-full"></span> High
|
||||
</div>
|
||||
</MudSelectItem>
|
||||
</MudSelect>
|
||||
|
||||
<MudSelect T="bool?" Label="Status" @bind-Value:get="_isCompleted" @bind-Value:set="(v) => _isCompleted = v" Clearable="true">
|
||||
<MudSelectItem T="bool?" Value="null">Any Status</MudSelectItem>
|
||||
<MudSelectItem T="bool?" Value="false">
|
||||
<div class="flex items-center gap-2">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Pending" Size="Size.Small" Color="Color.Warning" />
|
||||
Pending
|
||||
</div>
|
||||
</MudSelectItem>
|
||||
<MudSelectItem T="bool?" Value="true">
|
||||
<div class="flex items-center gap-2">
|
||||
<MudIcon Icon="@Icons.Material.Filled.CheckCircle" Size="Size.Small" Color="Color.Success" />
|
||||
Completed
|
||||
</div>
|
||||
</MudSelectItem>
|
||||
</MudSelect>
|
||||
|
||||
<MudTextField T="string"
|
||||
@bind-Value:get="_containsText"
|
||||
@bind-Value:set="(v) => _containsText = v"
|
||||
Label="Contains Text"
|
||||
Placeholder="Filter by title or description..." />
|
||||
|
||||
<MudStack Row="true" Spacing="2">
|
||||
<MudDatePicker Label="Due Date From"
|
||||
@bind-Date:get="_dueDateFrom"
|
||||
@bind-Date:set="(v) => _dueDateFrom = v"
|
||||
Clearable="true" />
|
||||
<MudDatePicker Label="Due Date To"
|
||||
@bind-Date:get="_dueDateTo"
|
||||
@bind-Date:set="(v) => _dueDateTo = v"
|
||||
Clearable="true" />
|
||||
</MudStack>
|
||||
</MudStack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton OnClick="Cancel">Cancel</MudButton>
|
||||
<MudButton Color="Color.Primary" OnClick="Submit" Disabled="string.IsNullOrWhiteSpace(_name)">Create View</MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
|
||||
@code {
|
||||
[CascadingParameter]
|
||||
private IMudDialogInstance? MudDialog { get; set; }
|
||||
|
||||
private string _name = string.Empty;
|
||||
private int? _priority;
|
||||
private bool? _isCompleted;
|
||||
private string? _containsText;
|
||||
private DateTime? _dueDateFrom;
|
||||
private DateTime? _dueDateTo;
|
||||
|
||||
private void Submit()
|
||||
{
|
||||
var dto = new CreateTaskViewDto
|
||||
{
|
||||
Name = _name,
|
||||
Priority = _priority,
|
||||
IsCompleted = _isCompleted,
|
||||
ContainsText = string.IsNullOrWhiteSpace(_containsText) ? null : _containsText,
|
||||
DueDateFrom = _dueDateFrom,
|
||||
DueDateTo = _dueDateTo
|
||||
};
|
||||
MudDialog?.Close(DialogResult.Ok(dto));
|
||||
}
|
||||
|
||||
private void Cancel() => MudDialog?.Cancel();
|
||||
}
|
||||
Reference in New Issue
Block a user