mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 09:33:13 +00:00
- Replace all Contacts.Name with (FirstName + " " + LastName) pattern - Fix ContactService, Index.razor, QuotesPDF, QuotesDetails, CreateQuotes - Fix WorkOrderPDF, Viewworkorder, UserViewWordOrder, Addworkorders - Fix ViewTemplate, AddTemplate, Templates settings pages - Blazor project now builds successfully
241 lines
No EOL
11 KiB
Text
241 lines
No EOL
11 KiB
Text
@page "/quotesdetails/{id:int}"
|
|
<Header pagename="Quotes " icon='<i class="material-icons-round opacity-10">article</i>'></Header>
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card cardbg mt-2">
|
|
<!-- Card header -->
|
|
<div class="card-header pb-0 cardbg">
|
|
<div class="d-lg-flex">
|
|
<div>
|
|
<h5 class="mb-0 ps-3"> <a href="quotes" style="color: #53C2F1 !important;"><i class="material-icons">reply</i> </a> Quote Details</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card-body ">
|
|
<div class="">
|
|
<div class="card-body ">
|
|
<div class="text-end">
|
|
<p style="color:#B7FC95 !important;">Quote ID : QO-@model.QuotId</p>
|
|
</div>
|
|
<div class="row justify-content-center">
|
|
<div class="col-12 text-center">
|
|
<img src="./assets/img/Logo.png" class="navbar-brand-img-1 h-90 img-fluid" alt="main_logo" id="logo">
|
|
<h6 class="text-info mb-0">80 Orville Dr</h6>
|
|
<p class="mb-0"><i class="fa fa-map-marker me-1"></i> Bohemia, NY 11716</p>
|
|
<p class="mb-0"><i class="fa fa-phone me-1"></i> 516-699-2092/631-334-2594</p>
|
|
<p class="mb-0"><i class="fa fa-envelope me-1"></i> Info@seahavenindustries.com</p>
|
|
</div>
|
|
</div>
|
|
<div class="col-12">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<p>
|
|
<i class="fa fa-calendar text-info me-1"></i> Date:
|
|
@if (model.Date != null)
|
|
{
|
|
@model.Date.Value.ToString("MMM dd yyyy")
|
|
|
|
}
|
|
</p>
|
|
</div>
|
|
<div class="col-md-6 col-lg-4">
|
|
<div class="d-flex">
|
|
<p class="w-50 mb-0">Proposal For :</p>
|
|
@if (model.WorkOrder != null)
|
|
{
|
|
<p class="w-40 mb-0">@model.WorkOrder.WorkerOrderTitle</p>
|
|
}
|
|
</div>
|
|
</div>
|
|
<div class="w-100"></div>
|
|
<div class="col-md-6 col-lg-4">
|
|
<div class="d-flex">
|
|
<p class="w-50 mb-0">POC :</p>
|
|
@if (model.Contacts != null)
|
|
{
|
|
<p class="w-40 mb-0">@(model.Contacts.FirstName + " " + model.Contacts.LastName)</p>
|
|
}
|
|
</div>
|
|
</div>
|
|
<div class="w-100"></div>
|
|
<div class="col-md-6 col-lg-4">
|
|
<div class="d-flex">
|
|
<p class="w-50 mb-0">PO # :</p>
|
|
<p class="w-40 mb-0">@model.PO</p>
|
|
</div>
|
|
</div>
|
|
<div class="w-100"></div>
|
|
<div class="col-md-6 col-lg-4">
|
|
<div class="d-flex">
|
|
<p class="w-50 mb-0">TT # :</p>
|
|
<p class="w-40 mb-0">@model.TT</p>
|
|
</div>
|
|
</div>
|
|
<div class="w-100"></div>
|
|
<div class="col-md-6 col-lg-4">
|
|
<div class="d-flex">
|
|
<p class="w-50 mb-0">Project Name :</p>
|
|
<p class="w-40 mb-0">@model.ProjectName</p>
|
|
</div>
|
|
</div>
|
|
<div class="w-100"></div>
|
|
<div class="col-md-6 col-lg-4">
|
|
<div class="d-flex">
|
|
<p class="w-50 mb-0">Site Name:</p>
|
|
<p class="w-40 mb-0">@model.SiteName</p>
|
|
</div>
|
|
</div>
|
|
<div class="w-100"></div>
|
|
<div class="col-md-12 col-lg-12">
|
|
<div class="d-flex">
|
|
<p class="w-15 mb-0">Site ID:</p>
|
|
<p class="w-65 mb-0 ps-2">@model.SiteId</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="w-100 text-center d-flex justify-content-center">
|
|
<hr class="bg-white w-70 my-3" />
|
|
</div>
|
|
<h5 class="">Address</h5>
|
|
<div class="col-12">
|
|
<div class="d-flex">
|
|
<p class="w-15 mb-0">Billing Address :</p>
|
|
<p class="w-70 mb-0 ps-2">@model.BillingAddress</p>
|
|
</div>
|
|
</div>
|
|
<div class="col-12">
|
|
<div class="d-flex">
|
|
<p class="w-15 mb-0">Shipping Address :</p>
|
|
<p class="w-70 mb-0 ps-2">@model.ShippingAddress</p>
|
|
</div>
|
|
</div>
|
|
<div class="w-100 text-center d-flex justify-content-center">
|
|
<hr class="bg-white w-70 my-3" />
|
|
</div>
|
|
<h5>Line Items</h5>
|
|
@* <div class="col-md-6 col-lg-8">
|
|
<div class="d-flex">
|
|
<p class="w-20 mb-0">Line Item 1 :</p>
|
|
<p class="w-80 mb-0">Completed site assessment for concrete crack repairs as needed that are causing trip hazards.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="w-100 text-center d-flex justify-content-center">
|
|
<hr class="bg-white w-70 my-3" />
|
|
</div>
|
|
*@
|
|
<div class="row justify-content-end">
|
|
<div class="col-md-4">
|
|
@if (model.LineItems != null)
|
|
{
|
|
foreach (var itm in model.LineItems)
|
|
{
|
|
<div class="d-flex">
|
|
<p class="w-80 mb-3"> @itm.Descriptions: </p>
|
|
<p class="w-20 mb-3 text-end">$@itm.Lineitem</p>
|
|
</div>
|
|
}
|
|
<hr class="w-100 my-1 float-end" style="background-color: #767C89 !important" />
|
|
<div class="d-flex mt-4">
|
|
<h4 class="mb-3 text-end" style="color:#53C2F1 !important;">Total:</h4>
|
|
<h4 class="w-100 mb-3 text-end" style="color:#53C2F1 !important;">$@model.LineItems.Sum(s => s.Lineitem)</h4>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div @ref="StepService.htmlContentReference" class="d-none">
|
|
<QuotesPDF id="@id"></QuotesPDF>
|
|
</div>
|
|
|
|
@if (isloading)
|
|
{
|
|
<div class="loading">Loading…</div>
|
|
}
|
|
@using SeaHavenIndustries.Data.IRepository
|
|
@using SeaHavenIndustries.Data.Services
|
|
@using global::Data.SeaHavenIndustries
|
|
@inject IQuotesRepository _service;
|
|
@inject PdfService pdfService
|
|
@inject IJSRuntime JSRuntime
|
|
@inject ChangeStepService StepService
|
|
|
|
@code {
|
|
[Parameter]
|
|
public int? id { get; set; }
|
|
public bool isloading = true;
|
|
private int random5DigitNumber = 0;
|
|
private bool ispdf = false;
|
|
|
|
private Quotes model = new();
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
ispdf = true;
|
|
if (id != null && id != 0)
|
|
{
|
|
model = await _service.GetQuotesById(id.Value);
|
|
}
|
|
isloading = false;
|
|
ispdf = false;
|
|
}
|
|
// protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
// {
|
|
// if (firstRender)
|
|
// {
|
|
// await JSRuntime.InvokeVoidAsync("SavelocalStorage");
|
|
// }
|
|
// }
|
|
private async Task GeneratePdf()
|
|
{
|
|
ispdf = true;
|
|
var htmlContent = await JSRuntime.InvokeAsync<string>("getHtmlContent", StepService.htmlContentReference);
|
|
var pdfBytes = await pdfService.GeneratePdf(htmlContent);
|
|
ispdf = false;
|
|
|
|
var pdfBase64 = Convert.ToBase64String(pdfBytes);
|
|
await JSRuntime.InvokeVoidAsync("downloadFile", pdfBase64, "Quote.pdf");
|
|
|
|
}
|
|
private async Task SendPdf()
|
|
{
|
|
ispdf = true;
|
|
var htmlContent = await JSRuntime.InvokeAsync<string>("getHtmlContent", StepService.htmlContentReference);
|
|
var pdfBytes = await pdfService.GeneratePdf(htmlContent);
|
|
var result = await _service.SendEmailQuote(pdfBytes, model.Id);
|
|
if (result == "success")
|
|
{
|
|
await ShowSweetAlert("Email send successfully", "success");
|
|
}
|
|
else
|
|
{
|
|
await ShowSweetAlert(result, "error");
|
|
}
|
|
ispdf = false;
|
|
}
|
|
private async Task ShowSweetAlert(string title, string icon)
|
|
{
|
|
// Display a SweetAlert dialog
|
|
await JSRuntime.InvokeVoidAsync("Swal.fire", new
|
|
{
|
|
toast = true,
|
|
showConfirmButton = false,
|
|
timer = 3000,
|
|
title = title,
|
|
icon = icon,
|
|
position = "top-end"
|
|
});
|
|
await JSRuntime.InvokeVoidAsync("closemodal");
|
|
}
|
|
|
|
} |