Add PhLinkToast
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 5m9s
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 5m9s
This commit is contained in:
parent
9db1452387
commit
001ba4146a
@ -6,10 +6,12 @@
|
|||||||
@using phronCare.UIBlazor.Pages.Sales.Modals
|
@using phronCare.UIBlazor.Pages.Sales.Modals
|
||||||
@using phronCare.UIBlazor.Services.Integrations
|
@using phronCare.UIBlazor.Services.Integrations
|
||||||
@using phronCare.UIBlazor.Services.Sales.Quotes
|
@using phronCare.UIBlazor.Services.Sales.Quotes
|
||||||
|
@using Blazored.Toast.Services
|
||||||
|
@using Blazored.Toast.Configuration
|
||||||
@inject ISalesLookupService SalesLookupService
|
@inject ISalesLookupService SalesLookupService
|
||||||
@inject IQuoteService QuoteService
|
@inject IQuoteService QuoteService
|
||||||
@inject IToastService toastService
|
@inject IToastService toastService
|
||||||
|
|
||||||
@inject NavigationManager Navigation
|
@inject NavigationManager Navigation
|
||||||
@inject IModalService Modal
|
@inject IModalService Modal
|
||||||
@inject IExchangeRateService ExchangeRateService
|
@inject IExchangeRateService ExchangeRateService
|
||||||
@ -306,7 +308,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-footer text-end">
|
<div class="card-footer text-end">
|
||||||
<button type="button" class="btn btn-primary" @onclick="HandleValidSubmit">Guardar</button>
|
<button type="button" class="btn btn-primary" @onclick="HandleValidSubmit">Guardar</button>
|
||||||
<button type="button" class="btn btn-secondary ms-2">Cancelar</button>
|
<button type="button" class="btn btn-secondary ms-2" @onclick="Cancel">Cancelar</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -465,6 +467,21 @@
|
|||||||
RecalculateTotals();
|
RecalculateTotals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task Cancel()
|
||||||
|
{
|
||||||
|
|
||||||
|
// 2) Añades los parámetros que luego el componente tomará
|
||||||
|
// settings.Parameters.Add(nameof(CustomActionToast.Url), url);
|
||||||
|
ToastParameters _toastParameters;
|
||||||
|
|
||||||
|
_toastParameters = new ToastParameters();
|
||||||
|
_toastParameters.Add(nameof(PhLinkToast.Comprobante), "FAC A0001-00000009");
|
||||||
|
|
||||||
|
_toastParameters.Add(nameof(PhLinkToast.Style), "purple");
|
||||||
|
toastService.ShowToast<PhLinkToast>(_toastParameters);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private async Task HandleValidSubmit()
|
private async Task HandleValidSubmit()
|
||||||
{
|
{
|
||||||
// Si necesitas validar algo extra antes de llamar al servicio, hazlo aquí
|
// Si necesitas validar algo extra antes de llamar al servicio, hazlo aquí
|
||||||
@ -476,9 +493,12 @@
|
|||||||
toastService.ShowError(result.ErrorMessage);
|
toastService.ShowError(result.ErrorMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ToastParameters _toastParameters;
|
||||||
|
|
||||||
toastService.ShowSuccess($"Presupuesto creado: {result.QuoteNumber}");
|
_toastParameters = new ToastParameters();
|
||||||
//Navigation.NavigateTo($"/sales/quotes/details/{result.QuoteNumber}");
|
_toastParameters.Add(nameof(PhLinkToast.Comprobante), result.QuoteNumber);
|
||||||
|
_toastParameters.Add(nameof(PhLinkToast.Style), "success");
|
||||||
|
toastService.ShowToast<PhLinkToast>(_toastParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
48
phronCare.UIBlazor/Shared/Components/PhLinkToast.razor
Normal file
48
phronCare.UIBlazor/Shared/Components/PhLinkToast.razor
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
@using Microsoft.AspNetCore.Components
|
||||||
|
@inject NavigationManager Navigation
|
||||||
|
|
||||||
|
<div class="toast-body text-white p-3 rounded shadow-lg"
|
||||||
|
style="background-color:@GetBackgroundColor();">
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<i class="fas fa-link fa-sm me-2"></i>
|
||||||
|
<span class="fw-bold small me-3">Documento</span>
|
||||||
|
<button class="btn btn-outline-light btn-sm" @onclick="LinkClicked">
|
||||||
|
@Comprobante
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@code {
|
||||||
|
[Parameter] public string Url { get; set; } = "/";
|
||||||
|
[Parameter] public string Comprobante { get; set; } = "Ver";
|
||||||
|
[Parameter] public string Style { get; set; } = "success";
|
||||||
|
|
||||||
|
void LinkClicked(MouseEventArgs e)
|
||||||
|
{
|
||||||
|
Navigation.NavigateTo(Url);
|
||||||
|
}
|
||||||
|
|
||||||
|
string GetBackgroundColor() => Style.ToLower() switch
|
||||||
|
{
|
||||||
|
"success" => "#28a745",
|
||||||
|
"danger" => "#dc3545",
|
||||||
|
"primary" => "#007bff",
|
||||||
|
"dark" => "#343a40",
|
||||||
|
"info" => "#17a2b8",
|
||||||
|
"warning" => "#ffc107",
|
||||||
|
"secondary" => "#6c757d",
|
||||||
|
"light" => "#f8f9fa",
|
||||||
|
"muted" => "#6c757d",
|
||||||
|
"orange" => "#fd7e14",
|
||||||
|
"cyan" => "#0dcaf0",
|
||||||
|
"purple" => "#6f42c1",
|
||||||
|
"pink" => "#d63384",
|
||||||
|
"lime" => "#84cc16",
|
||||||
|
"indigo" => "#6610f2",
|
||||||
|
"rose" => "#e11d48",
|
||||||
|
"emerald" => "#10b981",
|
||||||
|
"amber" => "#d97706",
|
||||||
|
"violet" => "#7c3aed",
|
||||||
|
"slate" => "#64748b",
|
||||||
|
_ => "#6c757d" // fallback secondary
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user