Iniziata implementazione form rilevazione
This commit is contained in:
@@ -2,6 +2,7 @@ using CommunityToolkit.Maui;
|
||||
using IntegryApiClient.MAUI;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MudBlazor.Services;
|
||||
using MudExtensions.Services;
|
||||
using SteUp.Maui.Core;
|
||||
using SteUp.Maui.Core.Services;
|
||||
using SteUp.Shared;
|
||||
@@ -26,6 +27,7 @@ namespace SteUp.Maui
|
||||
|
||||
builder.Services.AddMauiBlazorWebView();
|
||||
builder.Services.AddMudServices();
|
||||
builder.Services.AddMudExtensions();
|
||||
|
||||
#if DEBUG
|
||||
builder.Services.AddBlazorWebViewDeveloperTools();
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<link href="_content/SteUp.Shared/css/bootstrap/bootstrap-icons.min.css" rel="stylesheet"/>
|
||||
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet"/>
|
||||
|
||||
<link href="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.css" rel="stylesheet"/>
|
||||
<link rel="stylesheet" href="_content/SteUp.Shared/css/remixicon/remixicon.css"/>
|
||||
<link rel="stylesheet" href="_content/SteUp.Shared/css/app.css"/>
|
||||
<link rel="stylesheet" href="_content/SteUp.Shared/css/form.css"/>
|
||||
@@ -44,6 +45,7 @@
|
||||
<script src="_framework/blazor.webview.js" autostart="false"></script>
|
||||
<script src="_content/SteUp.Shared/js/bootstrap/bootstrap.bundle.min.js"></script>
|
||||
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
|
||||
<script src="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.js"></script>
|
||||
<script src="_content/SteUp.Shared/js/main.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
@code{
|
||||
[Parameter] public string? Title { get; set; }
|
||||
[Parameter] public bool Back { get; set; }
|
||||
[Parameter] public bool BackOnTop { get; set; }
|
||||
[Parameter] public string BackTo { get; set; } = "";
|
||||
|
||||
[Parameter] public EventCallback OnFilterToggle { get; set; }
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
@inject INetworkService NetworkService
|
||||
@inject IDialogService Dialog
|
||||
|
||||
<div class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
||||
<div
|
||||
class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
||||
<nav class="navbar @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
||||
<div class="container-navbar">
|
||||
<ul class="navbar-nav flex-row nav-justified align-items-center w-100 text-center">
|
||||
@@ -29,13 +30,22 @@
|
||||
{
|
||||
<MudMenu PopoverClass="custom_popover" AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomRight">
|
||||
<ActivatorContent>
|
||||
<MudFab Class="custom-plus-button" Color="Color.Surface" Size="Size.Medium" IconSize="Size.Medium"
|
||||
<MudFab Class="custom-plus-button" OnClick="OnOpenMenu" Color="Color.Surface" Size="Size.Medium" IconSize="Size.Medium"
|
||||
IconColor="Color.Primary" StartIcon="@Icons.Material.Filled.Add"/>
|
||||
</ActivatorContent>
|
||||
<ChildContent>
|
||||
<MudMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@NewActivity">
|
||||
Nuova rilevazione
|
||||
</MudMenuItem>
|
||||
@if (SchedaVisible)
|
||||
{
|
||||
<MudMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@NewScheda">
|
||||
Nuova scheda
|
||||
</MudMenuItem>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@NewActivity">
|
||||
Nuova rilevazione
|
||||
</MudMenuItem>
|
||||
}
|
||||
</ChildContent>
|
||||
</MudMenu>
|
||||
}
|
||||
@@ -46,6 +56,7 @@
|
||||
{
|
||||
private bool IsVisible { get; set; } = true;
|
||||
private bool PlusVisible { get; set; } = true;
|
||||
private bool SchedaVisible { get; set; }
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
@@ -53,10 +64,10 @@
|
||||
{
|
||||
var location = args.Location.Remove(0, NavigationManager.BaseUri.Length);
|
||||
|
||||
var newIsVisible = new List<string> { "ispezioni", "user" }
|
||||
var newIsVisible = new List<string> { "ispezioni", "ispezione", "user" }
|
||||
.Contains(location);
|
||||
|
||||
var newPlusVisible = new List<string> { "ispezioni", "user" }
|
||||
var newPlusVisible = new List<string> { "ispezioni", "ispezione", "user" }
|
||||
.Contains(location);
|
||||
|
||||
if (IsVisible == newIsVisible && PlusVisible == newPlusVisible) return;
|
||||
@@ -72,4 +83,17 @@
|
||||
{
|
||||
_ = ModalHelper.OpenSelectShop(Dialog);
|
||||
}
|
||||
|
||||
private void NewScheda()
|
||||
{
|
||||
_ = ModalHelper.OpenFormScheda(Dialog);
|
||||
}
|
||||
|
||||
private void OnOpenMenu()
|
||||
{
|
||||
var location = NavigationManager.Uri.Remove(0, NavigationManager.BaseUri.Length);
|
||||
|
||||
SchedaVisible = new List<string> { "ispezione" }.Contains(location);
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
24
SteUp.Shared/Components/Layout/Overlay/SaveOverlay.razor
Normal file
24
SteUp.Shared/Components/Layout/Overlay/SaveOverlay.razor
Normal file
@@ -0,0 +1,24 @@
|
||||
@using SteUp.Shared.Components.Layout.Spinner
|
||||
|
||||
<MudOverlay Visible="VisibleOverlay" LightBackground="true">
|
||||
@if (SuccessAnimation)
|
||||
{
|
||||
<div class="success-checkmark">
|
||||
<div class="check-icon">
|
||||
<span class="icon-line line-tip"></span>
|
||||
<span class="icon-line line-long"></span>
|
||||
<div class="icon-circle"></div>
|
||||
<div class="icon-fix"></div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<SpinnerLayout/>
|
||||
}
|
||||
</MudOverlay>
|
||||
|
||||
@code {
|
||||
[Parameter] public required bool SuccessAnimation { get; set; }
|
||||
[Parameter] public required bool VisibleOverlay { get; set; }
|
||||
}
|
||||
51
SteUp.Shared/Components/Pages/Ispezione.razor
Normal file
51
SteUp.Shared/Components/Pages/Ispezione.razor
Normal file
@@ -0,0 +1,51 @@
|
||||
@page "/ispezione"
|
||||
@using SteUp.Shared.Components.Layout
|
||||
|
||||
<HeaderLayout Title="Ispezione" BackTo="Indietro" Back="true"/>
|
||||
|
||||
<div class="container content pb-safe-area">
|
||||
|
||||
<div class="container-primary-info">
|
||||
<div class="section-primary-info">
|
||||
<div class="inspection-info">
|
||||
<span class="info-title">
|
||||
@SteupDataService.Inspection.PuntoVendita!.CodMdep - @SteupDataService.Inspection.PuntoVendita.Descrizione
|
||||
</span>
|
||||
<span class="info-subtitle">
|
||||
@SteupDataService.Inspection.PuntoVendita.Indirizzo
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="section-info">
|
||||
<div class="section-inspection-info">
|
||||
<div>
|
||||
<span class="info-inspection-title">Data ispezione</span>
|
||||
<MudChip T="string" Size="Size.Small" Color="Color.Default">
|
||||
@SteupDataService.Inspection.DateInspection.ToString("d")
|
||||
</MudChip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-inspection-info">
|
||||
<div>
|
||||
<span class="info-inspection-title">Stato ispezione</span>
|
||||
<MudChip T="string" Size="Size.Small" Color="Color.Warning">
|
||||
IN CORSO
|
||||
</MudChip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
69
SteUp.Shared/Components/Pages/Ispezione.razor.css
Normal file
69
SteUp.Shared/Components/Pages/Ispezione.razor.css
Normal file
@@ -0,0 +1,69 @@
|
||||
.container-primary-info {
|
||||
background: var(--light-card-background);
|
||||
width: 100%;
|
||||
margin-bottom: 2rem;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.container-primary-info .divider {
|
||||
margin: .25rem 0;
|
||||
}
|
||||
|
||||
.section-primary-info {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 1.5rem;
|
||||
padding: .8rem 1.2rem .4rem;
|
||||
}
|
||||
|
||||
.personal-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.info-title {
|
||||
color: var(--mud-palette-text-primary);
|
||||
font-weight: 800;
|
||||
font-size: x-large;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.info-subtitle {
|
||||
color: var(--mud-palette-gray-default);
|
||||
font-size: medium;
|
||||
font-weight: 600;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.section-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-direction: row;
|
||||
padding: .4rem 1.2rem .8rem;
|
||||
}
|
||||
|
||||
.section-inspection-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.section-inspection-info > div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
line-height: normal;
|
||||
margin: .25rem 0;
|
||||
}
|
||||
|
||||
.info-inspection-title {
|
||||
color: var(--mud-palette-gray-darker);
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.info-inspection-text {
|
||||
color: var(--mud-palette-text-secondary);
|
||||
font-weight: 700;
|
||||
font-size: small;
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
@using SteUp.Shared.Core.Dto
|
||||
@using SteUp.Shared.Core.Dto.PageState
|
||||
|
||||
<div class="shop-card ripple-container">
|
||||
<div class="shop-card ripple-container" @onclick="StartInspection">
|
||||
<div class="shop-body-section">
|
||||
<div class="title-section">
|
||||
<MudText Class="shop-title" Typo="Typo.subtitle1">
|
||||
<b>@PuntoVendita.CodMdep</b> - @PuntoVendita.Descrizione
|
||||
</MudText>
|
||||
</div>
|
||||
|
||||
|
||||
@if (!PuntoVendita.Indirizzo.IsNullOrEmpty())
|
||||
{
|
||||
<div class="subtitle-section">
|
||||
@@ -32,4 +33,16 @@
|
||||
|
||||
@code {
|
||||
[Parameter] public PuntoVenditaDto PuntoVendita { get; set; } = null!;
|
||||
|
||||
private void StartInspection()
|
||||
{
|
||||
SteupDataService.Inspection = new InspectionPageState
|
||||
{
|
||||
DateInspection = DateTime.Today,
|
||||
PuntoVendita = PuntoVendita
|
||||
};
|
||||
|
||||
NavigationManager.NavigateTo("/ispezione");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,9 +2,4 @@
|
||||
padding: .5rem 1rem;
|
||||
background-color: var(--mud-palette-background-gray);
|
||||
border-radius: 1em;
|
||||
}
|
||||
|
||||
.sub-info-section{
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
@using SteUp.Shared.Components.Layout
|
||||
@using SteUp.Shared.Components.Layout.Overlay
|
||||
|
||||
<MudDialog Class="customDialog-form disable-safe-area">
|
||||
<DialogContent>
|
||||
<HeaderLayout SmallHeader="true" Cancel="true" OnCancel="@(() => MudDialog.Cancel())" Title="@TitleModal"/>
|
||||
|
||||
@if (RequireNewName)
|
||||
{
|
||||
<MudTextField @bind-Value="NewName" Class="px-3" Variant="Variant.Outlined"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div style="margin-bottom: 1rem;" class="content attached">
|
||||
<MudFab Size="Size.Small" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Rounded.CameraAlt"
|
||||
Label="Camera" OnClick="@OnCamera"/>
|
||||
|
||||
<MudFab Size="Size.Small" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Rounded.Image"
|
||||
Label="Galleria" OnClick="@OnGallery"/>
|
||||
</div>
|
||||
}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
@if (RequireNewName)
|
||||
{
|
||||
<MudButton Disabled="NewName.IsNullOrEmpty()" Class="my-3" Size="Size.Small" Variant="Variant.Filled"
|
||||
Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Rounded.Check" OnClick="@OnNewName">
|
||||
Salva
|
||||
</MudButton>
|
||||
}
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
|
||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||
|
||||
[Parameter] public bool CanAddPosition { get; set; }
|
||||
|
||||
//Overlay for save
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
// private AttachedDTO? Attached { get; set; }
|
||||
|
||||
private bool _requireNewName;
|
||||
|
||||
private bool RequireNewName
|
||||
{
|
||||
get => _requireNewName;
|
||||
set
|
||||
{
|
||||
_requireNewName = value;
|
||||
TitleModal = _requireNewName ? "Nome allegato" : "Aggiungi allegati";
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private bool SelectTypePicture { get; set; }
|
||||
|
||||
private string TitleModal { get; set; } = "Aggiungi allegati";
|
||||
|
||||
private string? _newName;
|
||||
|
||||
private string? NewName
|
||||
{
|
||||
get => _newName;
|
||||
set
|
||||
{
|
||||
_newName = value;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
SelectTypePicture = true;
|
||||
RequireNewName = false;
|
||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||
}
|
||||
|
||||
private async Task OnCamera()
|
||||
{
|
||||
// Attached = await AttachedService.SelectImageFromCamera();
|
||||
//
|
||||
// if (Attached != null)
|
||||
// {
|
||||
// RequireNewName = true;
|
||||
// StateHasChanged();
|
||||
// }
|
||||
}
|
||||
|
||||
private async Task OnGallery()
|
||||
{
|
||||
// Attached = await AttachedService.SelectImageFromGallery();
|
||||
//
|
||||
// if (Attached != null)
|
||||
// {
|
||||
// RequireNewName = true;
|
||||
// StateHasChanged();
|
||||
// }
|
||||
}
|
||||
|
||||
private void OnNewName()
|
||||
{
|
||||
// if (Attached != null)
|
||||
// {
|
||||
// switch (Attached.Type)
|
||||
// {
|
||||
// case AttachedDTO.TypeAttached.Position:
|
||||
// {
|
||||
// CanAddPosition = false;
|
||||
//
|
||||
// Attached.Description = NewName!;
|
||||
// Attached.Name = NewName!;
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// case AttachedDTO.TypeAttached.Image:
|
||||
// {
|
||||
// var extension = Path.GetExtension(Attached.Name);
|
||||
// Attached.Name = NewName! + extension;
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// case AttachedDTO.TypeAttached.Document:
|
||||
// break;
|
||||
// default:
|
||||
// throw new ArgumentOutOfRangeException();
|
||||
// }
|
||||
// }
|
||||
|
||||
// MudDialog.Close(Attached);
|
||||
MudDialog.Close();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
.content.attached {
|
||||
display: flex;
|
||||
gap: 2rem;
|
||||
padding: 1rem;
|
||||
height: unset;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
@using SteUp.Shared.Components.Layout
|
||||
@using SteUp.Shared.Components.Layout.Overlay
|
||||
@using SteUp.Shared.Core.Dto
|
||||
@using SteUp.Shared.Core.Interface.IntegryApi
|
||||
@using SteUp.Shared.Core.Interface.System.Network
|
||||
@inject INetworkService NetworkService
|
||||
@inject IDialogService Dialog
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
|
||||
<MudDialog Class="customDialog-form">
|
||||
<DialogContent>
|
||||
<HeaderLayout Cancel="true" OnCancel="@(() => MudDialog.Cancel())" LabelSave="@LabelSave"
|
||||
OnSave="Save" Title="Scheda"/>
|
||||
|
||||
<div class="content">
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Reparto</span>
|
||||
|
||||
@if (SteupDataService.Reparti.IsNullOrEmpty())
|
||||
{
|
||||
<MudSkeleton/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudSelectExtended ReadOnly="IsView" FullWidth="true" T="JtbFasiDto?" Variant="Variant.Text"
|
||||
@bind-Value="SchedaDto.Reparto" AdornmentIcon="@Icons.Material.Filled.Code"
|
||||
ToStringFunc="@(x => x?.Descrizione)"
|
||||
@bind-Value:after="OnAfterChangeValue" Class="customIcon-select">
|
||||
@foreach (var fasi in SteupDataService.Reparti)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@fasi">
|
||||
@fasi.Descrizione
|
||||
</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Motivo</span>
|
||||
|
||||
@if (SteupDataService.TipiAttività.IsNullOrEmpty())
|
||||
{
|
||||
<MudSkeleton/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudSelectExtended ReadOnly="IsView" FullWidth="true" T="string?" Variant="Variant.Text"
|
||||
@bind-Value="SchedaDto.ActivityTypeId" Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code"
|
||||
@bind-Value:after="OnAfterChangeValue">
|
||||
@foreach (var type in SteupDataService.TipiAttività)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select"
|
||||
Value="@type.ActivityTypeId">@type.ActivityTypeId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* <div class="container-chip-attached"> *@
|
||||
@* @if (!AttachedList.IsNullOrEmpty()) *@
|
||||
@* { *@
|
||||
@* foreach (var item in AttachedList!.Select((p, index) => new { p, index })) *@
|
||||
@* { *@
|
||||
@* if (item.p.Type == AttachedDTO.TypeAttached.Position) *@
|
||||
@* { *@
|
||||
@* <MudChip T="string" Icon="@Icons.Material.Rounded.LocationOn" Color="Color.Success" *@
|
||||
@* OnClick="@(() => OpenPosition(item.p))" *@
|
||||
@* OnClose="@(() => OnRemoveAttached(item.index))"> *@
|
||||
@* @item.p.Description *@
|
||||
@* </MudChip> *@
|
||||
@* } *@
|
||||
@* else *@
|
||||
@* { *@
|
||||
@* <MudChip T="string" Color="Color.Default" OnClick="@(() => OpenAttached(item.p))" *@
|
||||
@* OnClose="@(() => OnRemoveAttached(item.index))"> *@
|
||||
@* @item.p.Name *@
|
||||
@* </MudChip> *@
|
||||
@* } *@
|
||||
@* } *@
|
||||
@* } *@
|
||||
@* *@
|
||||
@* @if (!IsLoading) *@
|
||||
@* { *@
|
||||
@* if (ActivityFileList != null) *@
|
||||
@* { *@
|
||||
@* foreach (var file in ActivityFileList) *@
|
||||
@* { *@
|
||||
@* <MudChip T="string" OnClick="@(() => OpenAttached(file.FileName))" *@
|
||||
@* OnClose="@(() => DeleteAttach(file))" Color="Color.Default"> *@
|
||||
@* @file.FileName *@
|
||||
@* </MudChip> *@
|
||||
@* } *@
|
||||
@* } *@
|
||||
@* } *@
|
||||
@* else *@
|
||||
@* { *@
|
||||
@* <MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7"/> *@
|
||||
@* } *@
|
||||
@* </div> *@
|
||||
|
||||
@if (!IsView)
|
||||
{
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings green-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Rounded.AttachFile"
|
||||
Size="Size.Medium"
|
||||
OnClick="@OpenAddAttached"
|
||||
Variant="Variant.Outlined">
|
||||
Aggiungi allegati
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="input-card">
|
||||
<MudTextField ReadOnly="IsView" T="string?" Placeholder="Note" Variant="Variant.Text" Lines="3"
|
||||
@bind-Value="SchedaDto.Note" @bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings blue-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Rounded.Description"
|
||||
Size="Size.Medium"
|
||||
OnClick="@SuggestActivityDescription"
|
||||
Variant="Variant.Outlined">
|
||||
Suggerisci note descrittive
|
||||
</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</MudDialog>
|
||||
|
||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = null!;
|
||||
|
||||
private SchedaDto SchedaDto { get; set; } = new();
|
||||
|
||||
private bool IsNew { get; set; }
|
||||
private bool IsLoading { get; set; }
|
||||
private bool IsView => !NetworkService.ConnectionAvailable;
|
||||
|
||||
//Overlay
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
private string? LabelSave { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
}
|
||||
|
||||
private async Task OpenAddAttached()
|
||||
{
|
||||
var result = await ModalHelper.OpenAddAttached(Dialog);
|
||||
|
||||
// if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(AttachedDTO))
|
||||
// {
|
||||
// var attached = (AttachedDTO)result.Data;
|
||||
//
|
||||
// if (attached.Type == AttachedDTO.TypeAttached.Position)
|
||||
// CanAddPosition = false;
|
||||
//
|
||||
// AttachedList ??= [];
|
||||
// AttachedList.Add(attached);
|
||||
// }
|
||||
}
|
||||
|
||||
private void OnAfterChangeValue()
|
||||
{
|
||||
if (!IsNew)
|
||||
LabelSave = "Aggiorna";
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void SuggestActivityDescription()
|
||||
{
|
||||
if (SchedaDto.ActivityTypeId == null)
|
||||
{
|
||||
Snackbar.Add("Indicare prima il motivo", Severity.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
var activityDescriptions = await IntegryApiService.SuggestActivityDescription(SchedaDto.ActivityTypeId);
|
||||
|
||||
var modal = await ModalHelper.OpenSuggestActivityDescription(Dialog, activityDescriptions);
|
||||
|
||||
if (modal is { Canceled: false, Data: not null })
|
||||
SchedaDto.Note = modal.Data!.ToString();
|
||||
|
||||
VisibleOverlay = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
.container-chip-attached {
|
||||
width: 100%;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.container-button {
|
||||
background: var(--mud-palette-background-gray) !important;
|
||||
box-shadow: unset;
|
||||
}
|
||||
|
||||
.input-card {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
@@ -14,5 +14,5 @@
|
||||
.shop-body{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
gap: 1rem;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
@using SteUp.Shared.Core.Dto
|
||||
|
||||
<MudDialog OnBackdropClick="Cancel">
|
||||
<DialogContent>
|
||||
@if (!ActivityTypers.IsNullOrEmpty())
|
||||
{
|
||||
<MudList T="string" SelectedValueChanged="OnClickItem">
|
||||
@foreach (var item in ActivityTypers!)
|
||||
{
|
||||
<MudListItem Text="@item.ActivityTypeDescription" Value="item.ActivityTypeDescription"/>
|
||||
}
|
||||
</MudList>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="spinner-container" style="height: unset !important;">
|
||||
<MudIcon Size="Size.Large" Color="Color.Error" Icon="@Icons.Material.Rounded.Close"/>
|
||||
<MudText>Nessuna descrizione consigliata</MudText>
|
||||
</div>
|
||||
}
|
||||
</DialogContent>
|
||||
</MudDialog>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = null!;
|
||||
[Parameter] public List<StbActivityTyperDto>? ActivityTypers { get; set; }
|
||||
|
||||
private void Cancel() => MudDialog.Cancel();
|
||||
|
||||
private void OnClickItem(string? selectedValue) =>
|
||||
MudDialog.Close(DialogResult.Ok(selectedValue));
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
using SteUp.Shared.Core.Dto;
|
||||
using SteUp.Shared.Core.Dto.PageState;
|
||||
|
||||
namespace SteUp.Shared.Core.Data.Contracts;
|
||||
|
||||
public interface ISteupDataService
|
||||
{
|
||||
Task Init();
|
||||
|
||||
|
||||
List<PuntoVenditaDto> PuntiVenditaList { get; }
|
||||
InspectionPageState Inspection { get; set; }
|
||||
List<JtbFasiDto> Reparti { get; }
|
||||
List<StbActivityTypeDto> TipiAttività { get; }
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
||||
using SteUp.Shared.Core.Data.Contracts;
|
||||
using SteUp.Shared.Core.Dto;
|
||||
using SteUp.Shared.Core.Dto.PageState;
|
||||
using SteUp.Shared.Core.Interface.IntegryApi;
|
||||
|
||||
namespace SteUp.Shared.Core.Data;
|
||||
@@ -23,6 +24,7 @@ public class SteupDataService(
|
||||
TipiAttività = await integrySteupService.RetrieveActivityType();
|
||||
}
|
||||
|
||||
public InspectionPageState Inspection { get; set; } = new();
|
||||
public List<PuntoVenditaDto> PuntiVenditaList { get; private set; } = [];
|
||||
public List<JtbFasiDto> Reparti { get; private set; } = [];
|
||||
public List<StbActivityTypeDto> TipiAttività { get; private set; } = [];
|
||||
|
||||
8
SteUp.Shared/Core/Dto/PageState/InspectionPageState.cs
Normal file
8
SteUp.Shared/Core/Dto/PageState/InspectionPageState.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace SteUp.Shared.Core.Dto.PageState;
|
||||
|
||||
public class InspectionPageState
|
||||
{
|
||||
public DateTime DateInspection {get; set;}
|
||||
|
||||
public PuntoVenditaDto? PuntoVendita {get; set;}
|
||||
}
|
||||
8
SteUp.Shared/Core/Dto/SchedaDto.cs
Normal file
8
SteUp.Shared/Core/Dto/SchedaDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace SteUp.Shared.Core.Dto;
|
||||
|
||||
public class SchedaDto
|
||||
{
|
||||
public JtbFasiDto? Reparto { get; set; }
|
||||
public string? ActivityTypeId { get; set; }
|
||||
public string? Note { get; set; }
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using MudBlazor;
|
||||
using SteUp.Shared.Components.SingleElements.Modal;
|
||||
using SteUp.Shared.Core.Dto;
|
||||
|
||||
namespace SteUp.Shared.Core.Helpers;
|
||||
|
||||
@@ -21,4 +22,57 @@ public class ModalHelper
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
|
||||
public static async Task<DialogResult?> OpenFormScheda(IDialogService dialog)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<ModalFormScheda>(
|
||||
"ModalFormScheda",
|
||||
new DialogParameters(),
|
||||
new DialogOptions
|
||||
{
|
||||
FullScreen = true,
|
||||
CloseButton = false,
|
||||
NoHeader = true
|
||||
}
|
||||
);
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
|
||||
public static async Task<DialogResult?> OpenAddAttached(IDialogService dialog)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<ModalAddAttached>(
|
||||
"Add attached",
|
||||
new DialogParameters(),
|
||||
new DialogOptions
|
||||
{
|
||||
FullScreen = false,
|
||||
CloseButton = false,
|
||||
NoHeader = true,
|
||||
BackdropClick = false
|
||||
}
|
||||
);
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
|
||||
public static async Task<DialogResult?> OpenSuggestActivityDescription(IDialogService dialog, List<StbActivityTyperDto>? activityTypers)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<ModalSuggestDescription>(
|
||||
"Suggest activity description",
|
||||
new DialogParameters<ModalSuggestDescription>
|
||||
{
|
||||
{ x => x.ActivityTypers, activityTypers }
|
||||
},
|
||||
new DialogOptions
|
||||
{
|
||||
FullScreen = false,
|
||||
CloseButton = false,
|
||||
NoHeader = true,
|
||||
BackdropClick = true
|
||||
}
|
||||
);
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,8 @@
|
||||
<PackageReference Include="IntegryApiClient.Core" Version="1.2.3"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.12"/>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
|
||||
<PackageReference Include="MudBlazor" Version="8.15.0" />
|
||||
<PackageReference Include="MudBlazor" Version="8.13.0" />
|
||||
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.4" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.14.0"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.12"/>
|
||||
<PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.120"/>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using MudBlazor
|
||||
@using MudExtensions
|
||||
@using SteUp.Shared.Core.Data.Contracts
|
||||
@using SteUp.Shared.Core.Helpers
|
||||
@using static InteractiveRenderSettings
|
||||
|
||||
@@ -13,6 +13,28 @@ function addTabindexToButtons() {
|
||||
});
|
||||
}
|
||||
|
||||
// Funzione per monitorare bottom-sheet-container e gestire la navbar
|
||||
function monitorBottomSheetClass(mutations) {
|
||||
const bottomSheet = document.querySelector(".bottom-sheet-container");
|
||||
const navbar = document.querySelector(".animated-navbar");
|
||||
|
||||
if (!bottomSheet || !navbar) return;
|
||||
|
||||
mutations.forEach(function (mutation) {
|
||||
if (mutation.type === 'attributes' && mutation.attributeName === 'class' && mutation.target === bottomSheet) {
|
||||
if (bottomSheet.classList.contains("show")) {
|
||||
navbar.classList.remove("show-nav");
|
||||
navbar.classList.add("hide-nav");
|
||||
console.log("Navbar nascosta (hide-nav)");
|
||||
} else {
|
||||
navbar.classList.remove("hide-nav");
|
||||
navbar.classList.add("show-nav");
|
||||
console.log("Navbar mostrata (show-nav)");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Esegui la funzione tabindex inizialmente
|
||||
addTabindexToButtons();
|
||||
|
||||
@@ -20,6 +42,9 @@ addTabindexToButtons();
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
// Aggiungi tabindex ai nuovi bottoni
|
||||
addTabindexToButtons();
|
||||
|
||||
// Monitora bottom-sheet-container
|
||||
monitorBottomSheetClass(mutations);
|
||||
});
|
||||
|
||||
// Osserva sia i cambiamenti nel DOM che gli attributi
|
||||
@@ -46,6 +71,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
(function () {
|
||||
// Ascoltiamo l'evento 'mousedown' su tutto il documento
|
||||
document.addEventListener('mousedown', function (event) {
|
||||
|
||||
Reference in New Issue
Block a user