Vario
This commit is contained in:
@@ -35,25 +35,28 @@
|
|||||||
@($"{group.Value.Count} sched{(group.Value.Count == 1 ? "a" : "e")}")
|
@($"{group.Value.Count} sched{(group.Value.Count == 1 ? "a" : "e")}")
|
||||||
</MudChip>
|
</MudChip>
|
||||||
</div>
|
</div>
|
||||||
<div class="action-scheda-group">
|
@if (SteupDataService.InspectionPageState.Ispezione.Stato != StatusEnum.Completata)
|
||||||
@if (NetworkService.IsNetworkAvailable())
|
{
|
||||||
{
|
<div class="action-scheda-group">
|
||||||
<MudFab StartIcon="@Icons.Material.Rounded.Add"
|
@if (NetworkService.IsNetworkAvailable())
|
||||||
Color="Color.Warning" Size="Size.Small"
|
{
|
||||||
OnClick="@(() => CreateNewScheda(group.Key))"/>
|
<MudFab StartIcon="@Icons.Material.Rounded.Add"
|
||||||
|
Color="Color.Warning" Size="Size.Small"
|
||||||
|
OnClick="@(() => CreateNewScheda(group.Key))"/>
|
||||||
|
|
||||||
<MudFab StartIcon="@Icons.Material.Rounded.CloudSync" Label="Esporta reparto"
|
<MudFab StartIcon="@Icons.Material.Rounded.CloudSync" Label="Esporta reparto"
|
||||||
Color="Color.Success" Size="Size.Small"
|
Color="Color.Success" Size="Size.Small"
|
||||||
OnClick="@(() => ExportReparto(group.Key))"/>
|
OnClick="@(() => ExportReparto(group.Key))"/>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<MudFab StartIcon="@Icons.Material.Rounded.Add"
|
<MudFab StartIcon="@Icons.Material.Rounded.Add"
|
||||||
Label="@($"Nuova scheda su {group.Key.Descrizione}")"
|
Label="@($"Nuova scheda su {group.Key.Descrizione}")"
|
||||||
Color="Color.Warning" Size="Size.Medium"
|
Color="Color.Warning" Size="Size.Medium"
|
||||||
OnClick="@(() => CreateNewScheda(group.Key))"/>
|
OnClick="@(() => CreateNewScheda(group.Key))"/>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</TitleContent>
|
</TitleContent>
|
||||||
<ChildContent>
|
<ChildContent>
|
||||||
@@ -61,6 +64,7 @@
|
|||||||
{
|
{
|
||||||
<SchedaCard Scheda="scheda" OnSchedaDeleted="OnSchedaDeleted"
|
<SchedaCard Scheda="scheda" OnSchedaDeleted="OnSchedaDeleted"
|
||||||
OnSchedaModified="OnSchedaModified"
|
OnSchedaModified="OnSchedaModified"
|
||||||
|
Stato="@SteupDataService.InspectionPageState.Ispezione.Stato"
|
||||||
CodMdep="@SteupDataService.InspectionPageState.Ispezione.CodMdep"
|
CodMdep="@SteupDataService.InspectionPageState.Ispezione.CodMdep"
|
||||||
Data="@SteupDataService.InspectionPageState.Ispezione.Data"/>
|
Data="@SteupDataService.InspectionPageState.Ispezione.Data"/>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,21 +27,34 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="scheda-card-action">
|
<div class="scheda-card-action">
|
||||||
@if (NetworkService.IsNetworkAvailable())
|
@if (Stato != StatusEnum.Completata)
|
||||||
{
|
{
|
||||||
<MudFab Color="Color.Info" Size="Size.Small" StartIcon="@Icons.Material.Rounded.Edit" OnClick="@UpdateScheda"/>
|
if (NetworkService.IsNetworkAvailable())
|
||||||
<MudFab Color="Color.Error" Size="Size.Small" StartIcon="@Icons.Material.Rounded.Delete" OnClick="@DeleteScheda"/>
|
{
|
||||||
<MudFab Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Rounded.CloudSync" OnClick="@ExportScheda"/>
|
<MudFab Color="Color.Info" Size="Size.Small" StartIcon="@Icons.Material.Rounded.Edit"
|
||||||
|
OnClick="@UpdateScheda"/>
|
||||||
|
<MudFab Color="Color.Error" Size="Size.Small" StartIcon="@Icons.Material.Rounded.Delete"
|
||||||
|
OnClick="@DeleteScheda"/>
|
||||||
|
<MudFab Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Rounded.CloudSync"
|
||||||
|
OnClick="@ExportScheda"/>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Rounded.Edit"
|
||||||
|
Color="Color.Info" Size="Size.Small" OnClick="@UpdateScheda">
|
||||||
|
Modifica
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Rounded.Delete"
|
||||||
|
Color="Color.Error" Size="Size.Small" OnClick="@DeleteScheda">
|
||||||
|
Cancella
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Rounded.Edit"
|
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Rounded.RemoveRedEye"
|
||||||
Color="Color.Info" Size="Size.Small" OnClick="@UpdateScheda">
|
Color="Color.Info" Size="Size.Small" OnClick="@ViewScheda">
|
||||||
Modifica
|
Visualizza
|
||||||
</MudButton>
|
|
||||||
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Rounded.Delete"
|
|
||||||
Color="Color.Error" Size="Size.Small" OnClick="@DeleteScheda">
|
|
||||||
Cancella
|
|
||||||
</MudButton>
|
</MudButton>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -55,6 +68,7 @@
|
|||||||
@code{
|
@code{
|
||||||
[Parameter] public string CodMdep { get; set; } = string.Empty;
|
[Parameter] public string CodMdep { get; set; } = string.Empty;
|
||||||
[Parameter] public DateTime Data { get; set; }
|
[Parameter] public DateTime Data { get; set; }
|
||||||
|
[Parameter] public StatusEnum Stato { get; set; }
|
||||||
[Parameter] public required Scheda Scheda { get; set; }
|
[Parameter] public required Scheda Scheda { get; set; }
|
||||||
[Parameter] public EventCallback<Scheda> OnSchedaModified { get; set; }
|
[Parameter] public EventCallback<Scheda> OnSchedaModified { get; set; }
|
||||||
[Parameter] public EventCallback<Scheda> OnSchedaDeleted { get; set; }
|
[Parameter] public EventCallback<Scheda> OnSchedaDeleted { get; set; }
|
||||||
@@ -72,7 +86,7 @@
|
|||||||
private async Task DeleteScheda()
|
private async Task DeleteScheda()
|
||||||
{
|
{
|
||||||
var result = await _messageBox.ShowAsync();
|
var result = await _messageBox.ShowAsync();
|
||||||
|
|
||||||
if (result is true)
|
if (result is true)
|
||||||
{
|
{
|
||||||
VisibleOverlay = true;
|
VisibleOverlay = true;
|
||||||
@@ -80,15 +94,18 @@
|
|||||||
|
|
||||||
if (Scheda.ActivityId != null)
|
if (Scheda.ActivityId != null)
|
||||||
await IntegrySteupService.DeleteScheda(Scheda.ActivityId);
|
await IntegrySteupService.DeleteScheda(Scheda.ActivityId);
|
||||||
|
|
||||||
var deleteScheda = await IspezioniService.DeleteSchedaAsync(Scheda.Id);
|
var deleteScheda = await IspezioniService.DeleteSchedaAsync(Scheda.Id);
|
||||||
if (deleteScheda) await OnSchedaDeleted.InvokeAsync(Scheda);
|
if (deleteScheda) await OnSchedaDeleted.InvokeAsync(Scheda);
|
||||||
|
|
||||||
VisibleOverlay = false;
|
VisibleOverlay = false;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ViewScheda() =>
|
||||||
|
_ = Dialog.OpenFormScheda(CodMdep, Data, false, Scheda, true);
|
||||||
|
|
||||||
private async Task ExportScheda()
|
private async Task ExportScheda()
|
||||||
{
|
{
|
||||||
VisibleOverlay = true;
|
VisibleOverlay = true;
|
||||||
@@ -109,12 +126,12 @@
|
|||||||
ParentActivityId = Scheda.Ispezione?.ActivityId
|
ParentActivityId = Scheda.Ispezione?.ActivityId
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (apiResponse != null)
|
if (apiResponse != null)
|
||||||
{
|
{
|
||||||
Scheda.ActivityId = apiResponse.ActivityIdScheda;
|
Scheda.ActivityId = apiResponse.ActivityIdScheda;
|
||||||
SteupDataService.InspectionPageState.Ispezione.ActivityId = apiResponse.ActivityIdIspezione;
|
SteupDataService.InspectionPageState.Ispezione.ActivityId = apiResponse.ActivityIdIspezione;
|
||||||
|
|
||||||
await IspezioniService.UpdateActivityIdIspezioneAsync(CodMdep, Data,
|
await IspezioniService.UpdateActivityIdIspezioneAsync(CodMdep, Data,
|
||||||
UserSession.User.Username, apiResponse.ActivityIdIspezione
|
UserSession.User.Username, apiResponse.ActivityIdIspezione
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<MudDialog Class="customDialog-form">
|
<MudDialog Class="customDialog-form">
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<MudForm @ref="_form">
|
<MudForm ReadOnly="ReadOnly" @ref="_form">
|
||||||
<HeaderLayout Cancel="true" OnCancel="@Cancel" LabelSave="@LabelSave"
|
<HeaderLayout Cancel="true" OnCancel="@Cancel" LabelSave="@LabelSave"
|
||||||
OnSave="Save" Title="Scheda"/>
|
OnSave="Save" Title="Scheda"/>
|
||||||
|
|
||||||
@@ -89,21 +89,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</CardFormModal>
|
</CardFormModal>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="container-button ripple-container">
|
@if (!ReadOnly)
|
||||||
<MudButton Class="button-settings green-icon"
|
{
|
||||||
FullWidth="true"
|
<div class="container-button ripple-container">
|
||||||
StartIcon="@Icons.Material.Rounded.AttachFile"
|
<MudButton Class="button-settings green-icon"
|
||||||
Size="Size.Medium"
|
FullWidth="true"
|
||||||
OnClick="@OpenAddAttached"
|
StartIcon="@Icons.Material.Rounded.AttachFile"
|
||||||
Variant="Variant.Outlined">
|
Size="Size.Medium"
|
||||||
Aggiungi foto
|
OnClick="@OpenAddAttached"
|
||||||
</MudButton>
|
Variant="Variant.Outlined">
|
||||||
</div>
|
Aggiungi foto
|
||||||
|
</MudButton>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<CardFormModal Title="Articoli">
|
<CardFormModal Title="Articoli">
|
||||||
<div class="input-manual-barcode">
|
<div class="input-manual-barcode">
|
||||||
<MudTextField FullWidth="true" ReadOnly="IsView" T="string?" Variant="Variant.Text"
|
<MudTextField FullWidth="true" T="string?" Variant="Variant.Text"
|
||||||
@bind-Value="ManualBarcode" Placeholder="Digita manualmente il codice"/>
|
@bind-Value="ManualBarcode" Placeholder="Digita manualmente il codice"/>
|
||||||
<MudIconButton Color="Color.Primary" OnClick="@OnManualBarcodeSet"
|
<MudIconButton Color="Color.Primary" OnClick="@OnManualBarcodeSet"
|
||||||
Size="Size.Small" Icon="@Icons.Material.Rounded.Send"/>
|
Size="Size.Small" Icon="@Icons.Material.Rounded.Send"/>
|
||||||
@@ -129,7 +132,7 @@
|
|||||||
}
|
}
|
||||||
</CardFormModal>
|
</CardFormModal>
|
||||||
|
|
||||||
@if (!IsView)
|
@if (NetworkService.ConnectionAvailable && !ReadOnly)
|
||||||
{
|
{
|
||||||
<div class="container-button ripple-container">
|
<div class="container-button ripple-container">
|
||||||
<MudButton Class="button-settings red-icon"
|
<MudButton Class="button-settings red-icon"
|
||||||
@@ -190,10 +193,9 @@
|
|||||||
[Parameter] public required string CodMdep { get; set; }
|
[Parameter] public required string CodMdep { get; set; }
|
||||||
[Parameter] public required DateTime Data { get; set; }
|
[Parameter] public required DateTime Data { get; set; }
|
||||||
[Parameter] public bool IsNew { get; set; }
|
[Parameter] public bool IsNew { get; set; }
|
||||||
|
[Parameter] public bool ReadOnly { get; set; }
|
||||||
[Parameter] public Scheda Scheda { get; set; } = new();
|
[Parameter] public Scheda Scheda { get; set; } = new();
|
||||||
|
|
||||||
private bool IsView => !NetworkService.ConnectionAvailable;
|
|
||||||
|
|
||||||
private string? ManualBarcode { get; set; }
|
private string? ManualBarcode { get; set; }
|
||||||
|
|
||||||
//Overlay
|
//Overlay
|
||||||
@@ -262,7 +264,7 @@
|
|||||||
SaveSchedaResponseDto? apiResponse = null;
|
SaveSchedaResponseDto? apiResponse = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!IsView)
|
if (NetworkService.ConnectionAvailable)
|
||||||
{
|
{
|
||||||
apiResponse = await IntegrySteupService.SaveScheda(
|
apiResponse = await IntegrySteupService.SaveScheda(
|
||||||
new SaveRequestDto
|
new SaveRequestDto
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public static class ModalHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DialogResult?> OpenFormScheda(string codMdep, DateTime data,
|
public async Task<DialogResult?> OpenFormScheda(string codMdep, DateTime data,
|
||||||
bool isNew = false, Scheda? scheda = null)
|
bool isNew = false, Scheda? scheda = null, bool readOnly = false)
|
||||||
{
|
{
|
||||||
scheda = isNew && scheda == null ? new Scheda() : scheda;
|
scheda = isNew && scheda == null ? new Scheda() : scheda;
|
||||||
|
|
||||||
@@ -39,6 +39,7 @@ public static class ModalHelper
|
|||||||
{ x => x.CodMdep, codMdep },
|
{ x => x.CodMdep, codMdep },
|
||||||
{ x => x.Data, data },
|
{ x => x.Data, data },
|
||||||
{ x => x.IsNew, isNew },
|
{ x => x.IsNew, isNew },
|
||||||
|
{ x => x.ReadOnly, readOnly },
|
||||||
{ x => x.Scheda, scheda }
|
{ x => x.Scheda, scheda }
|
||||||
},
|
},
|
||||||
new DialogOptions
|
new DialogOptions
|
||||||
|
|||||||
Reference in New Issue
Block a user