diff --git a/CPRNIMS.Infrastructure/Dto/Canvass/CanvassDto.cs b/CPRNIMS.Infrastructure/Dto/Canvass/CanvassDto.cs index 31ae3d5..6fe078e 100644 --- a/CPRNIMS.Infrastructure/Dto/Canvass/CanvassDto.cs +++ b/CPRNIMS.Infrastructure/Dto/Canvass/CanvassDto.cs @@ -57,7 +57,7 @@ namespace CPRNIMS.Infrastructure.Dto.Canvass public long CanvassDetailId { get; set; } public long CanvassId { get; set; } public decimal QtyRequest { get; set; } - //public byte IsApproved { get; set; } + public bool IsInternational { get; set; } public long RRDetailId { get; set; } public long PRDetailId { get; set; } public decimal Quantity { get; set; } @@ -75,6 +75,7 @@ namespace CPRNIMS.Infrastructure.Dto.Canvass public bool IsDenied { get; set; } = false; public string? FullName { get; set; } public string? Specification { get; set; } + public byte CurrencyId { get; set; } = 1; public bool VatInc { get; set; }=false; public string? TinNo { get; set; } diff --git a/CPRNIMS.Infrastructure/Dto/Canvass/CanvassItemDto.cs b/CPRNIMS.Infrastructure/Dto/Canvass/CanvassItemDto.cs new file mode 100644 index 0000000..9842e62 --- /dev/null +++ b/CPRNIMS.Infrastructure/Dto/Canvass/CanvassItemDto.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPRNIMS.Infrastructure.Dto.Canvass +{ + public class CanvassItemDto + { + public long PRDetailsId { get; set; } + public long PRNo { get; set; } + public long ItemNo { get; set; } + public string ItemDescription { get; set; } = string.Empty; + public string ItemName { get; set; } = string.Empty; + } +} diff --git a/CPRNIMS.Infrastructure/Dto/Canvass/ForCanvassDto.cs b/CPRNIMS.Infrastructure/Dto/Canvass/ForCanvassDto.cs new file mode 100644 index 0000000..204760e --- /dev/null +++ b/CPRNIMS.Infrastructure/Dto/Canvass/ForCanvassDto.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPRNIMS.Infrastructure.Dto.Canvass +{ + public class ForCanvassDto + { + public short Status {get;set;} + public string UserId { get; set; } = string.Empty; + public int SupplierId { get; set; } + public long PRNo { get; set; } + public long ItemNo { get; set; } + public int CanvassNo { get; set; } + public long PRDetailsId { get; set; } + public string FullName { get; set; } = string.Empty; + public string? Remarks { get; set; } + } +} diff --git a/CPRNIMS.Infrastructure/Dto/Canvass/Request/ForCanvassRequest.cs b/CPRNIMS.Infrastructure/Dto/Canvass/Request/ForCanvassRequest.cs new file mode 100644 index 0000000..0c3a926 --- /dev/null +++ b/CPRNIMS.Infrastructure/Dto/Canvass/Request/ForCanvassRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPRNIMS.Infrastructure.Dto.Canvass.Request +{ + public class ForCanvassRequest + { + public string UserId { get; set; } = string.Empty; + public int SupplierId { get; set; } + public long PRNo { get; set; } + public long ItemNo { get; set; } + public int CanvassNo { get; set; } + public long PRDetailsId { get; set; } + } +} diff --git a/CPRNIMS.Infrastructure/Dto/Canvass/Request/StartCanvassRequest.cs b/CPRNIMS.Infrastructure/Dto/Canvass/Request/StartCanvassRequest.cs new file mode 100644 index 0000000..4d30065 --- /dev/null +++ b/CPRNIMS.Infrastructure/Dto/Canvass/Request/StartCanvassRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace CPRNIMS.Infrastructure.Dto.Canvass.Request +{ + public class StartCanvassRequest + { + [JsonPropertyName("isInternational")] + public bool IsInternational { get; set; } + + [JsonPropertyName("items")] + public List Items { get; set; } = new(); + } +} diff --git a/CPRNIMS.Infrastructure/Dto/Canvass/Request/SupplierRequest.cs b/CPRNIMS.Infrastructure/Dto/Canvass/Request/SupplierRequest.cs index eb477b4..024be71 100644 --- a/CPRNIMS.Infrastructure/Dto/Canvass/Request/SupplierRequest.cs +++ b/CPRNIMS.Infrastructure/Dto/Canvass/Request/SupplierRequest.cs @@ -21,5 +21,6 @@ namespace CPRNIMS.Infrastructure.Dto.Canvass.Request public string Address { get; set; } = string.Empty; public long ItemNo { get; set; } = 0; public string Website { get; set; } = string.Empty; + public int SupplierId { get; set; } } } diff --git a/CPRNIMS.Infrastructure/Dto/Canvass/Response/StartCanvassResponse.cs b/CPRNIMS.Infrastructure/Dto/Canvass/Response/StartCanvassResponse.cs new file mode 100644 index 0000000..8fd978d --- /dev/null +++ b/CPRNIMS.Infrastructure/Dto/Canvass/Response/StartCanvassResponse.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPRNIMS.Infrastructure.Dto.Canvass.Response +{ + public class StartCanvassResponse + { + public Guid Id { get; set; } + public bool IsInternational { get; set; } + public string UserId { get; set; } = string.Empty; + public List Items { get; set; } = new(); + } +} diff --git a/CPRNIMS.Infrastructure/Dto/Canvass/Response/SupplierResponse.cs b/CPRNIMS.Infrastructure/Dto/Canvass/Response/SupplierResponse.cs index b394a14..288bd3f 100644 --- a/CPRNIMS.Infrastructure/Dto/Canvass/Response/SupplierResponse.cs +++ b/CPRNIMS.Infrastructure/Dto/Canvass/Response/SupplierResponse.cs @@ -10,18 +10,19 @@ namespace CPRNIMS.Infrastructure.Dto.Canvass.Response { public int SupplierId { get; set; } public string SupplierName { get; set; } = string.Empty; - public string EmailAddress { get; set; } = string.Empty; - public bool IsActive { get; set; } = true; - public string ContactNo { get; set; } = string.Empty; - public string ContactPerson { get; set; } = string.Empty; - public string LeadTime { get; set; } = string.Empty; - public bool VatInc { get; set; } = false; - public string Currency { get; set; } = string.Empty; + public string? EmailAddress { get; set; } + public bool IsActive { get; set; } + public string? ContactNo { get; set; } + public string? ContactPerson { get; set; } + public string? LeadTime { get; set; } + public bool? IsVatable { get; set; } + public byte? PaymentTermsId { get; set; } + public byte? CurrencyId { get; set; } + public string? TinNo { get; set; } + public string? Address { get; set; } + public string? Website { get; set; } + public bool VatInc { get; set; } + public string Currency { get; set; }=string.Empty; public string PaymentTerms { get; set; } = string.Empty; - public byte PaymentTermsId { get; set; } = 1; - public byte CurrencyId { get; set; } = 1; - public string TinNo { get; set; } = string.Empty; - public string Address { get; set; } = string.Empty; - public string Website { get; set; } = string.Empty; } } diff --git a/CPRNIMS.Infrastructure/Dto/Canvass/Response/SupplierResponseDto.cs b/CPRNIMS.Infrastructure/Dto/Canvass/Response/SupplierResponseDto.cs index bec53b1..7738b49 100644 --- a/CPRNIMS.Infrastructure/Dto/Canvass/Response/SupplierResponseDto.cs +++ b/CPRNIMS.Infrastructure/Dto/Canvass/Response/SupplierResponseDto.cs @@ -22,5 +22,6 @@ namespace CPRNIMS.Infrastructure.Dto.Canvass.Response public byte PaymentTermsId { get; set; } public byte CurrencyId { get; set; } public string? TinNo { get; set; } + public bool IsActive { get; set; } } } diff --git a/CPRNIMS.Infrastructure/Dto/Canvass/Result/GroqSupplierResult.cs b/CPRNIMS.Infrastructure/Dto/Canvass/Result/GroqSupplierResult.cs index bda468b..6f6fba1 100644 --- a/CPRNIMS.Infrastructure/Dto/Canvass/Result/GroqSupplierResult.cs +++ b/CPRNIMS.Infrastructure/Dto/Canvass/Result/GroqSupplierResult.cs @@ -1,9 +1,11 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; +using System.Text.RegularExpressions; using System.Threading.Tasks; namespace CPRNIMS.Infrastructure.Dto.Canvass.Result @@ -28,12 +30,43 @@ namespace CPRNIMS.Infrastructure.Dto.Canvass.Result [JsonPropertyName("source")] public string? Source { get; set; } - [JsonPropertyName("estimated_price_usd")] + [JsonConverter(typeof(FlexibleDecimalConverter))] public decimal? EstimatedPriceUsd { get; set; } [JsonPropertyName("item_specifications")] public JsonElement? ItemSpecifications { get; set; } } + public class FlexibleDecimalConverter : JsonConverter + { + public override decimal? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case JsonTokenType.Number: + return reader.TryGetDecimal(out var num) ? num : null; + + case JsonTokenType.String: + var str = reader.GetString()?.Trim(); + if (string.IsNullOrWhiteSpace(str)) return null; + + // Strip currency symbols and commas e.g. "$1,200.00" → 1200.00 + str = Regex.Replace(str, @"[^\d.]", ""); + return decimal.TryParse(str, NumberStyles.Any, CultureInfo.InvariantCulture, out var parsed) + ? parsed + : null; // "contact for pricing", "varies", etc. → null + + case JsonTokenType.Null: + default: + return null; + } + } + + public override void Write(Utf8JsonWriter writer, decimal? value, JsonSerializerOptions options) + { + if (value.HasValue) writer.WriteNumberValue(value.Value); + else writer.WriteNullValue(); + } + } public class TavilySearchResult { public List Results { get; set; } = new(); @@ -46,7 +79,11 @@ namespace CPRNIMS.Infrastructure.Dto.Canvass.Result public string Content { get; set; } = string.Empty; public double Score { get; set; } } - + public class GroqMatchResult + { + public bool Matched { get; set; } + public int? SupplierId { get; set; } + } public class GroqResponse { public List Choices { get; set; } = new(); diff --git a/CPRNIMS.WebApps/Views/CanvassMgmt/Canvass - Copy.cshtml b/CPRNIMS.WebApps/Views/CanvassMgmt/Canvass - Copy.cshtml deleted file mode 100644 index 24a83dd..0000000 --- a/CPRNIMS.WebApps/Views/CanvassMgmt/Canvass - Copy.cshtml +++ /dev/null @@ -1,1177 +0,0 @@ - - -
- - @* {{-- HEADER --}} *@ -
-
- -
-

Canvass Management

-

Manage purchase canvass requests by supplier, status, and comparison

-
-
-
- - @* {{-- TABS --}} *@ -
- - - - -
- -
- - @* -- Filter bar -- *@ -
- - - - - - - - @* {{-- Searchable supplier dropdown --}} *@ -
-
- - - All Suppliers - - -
-
- -
-
- All Suppliers -
-
-
-
- -
- Show - - 0 results -
-
- - @* {{-- Card grid --}} *@ -
-
-

Loading suppliers…

-
-
- - @* {{-- Pagination --}} *@ -
- -
-
-
- -@* {{-- ══ TAB 1 — PER SUPPLIER ═══════════════════════════ --}} *@ -
- -@* {{-- Filter bar --}} *@ -
- - - - - - - - @* {{-- Searchable supplier dropdown --}} *@ -
-
- - - All Suppliers - - -
-
- -
-
- All Suppliers -
-
-
-
- -
- Show - - 0 results -
-
- - @* {{-- Card grid --}} *@ -
-
-

Loading suppliers…

-
-
- - @* {{-- Pagination --}} *@ -
- -
-
-
- -@* {{-- ══ TAB 2 — FOR APPROVAL ════════════════════════════ --}} *@ -
-
- -

For Approval — wire up this panel as needed.

-
-
- - @* {{-- ══ TAB 3 — COMPLETED ═══════════════════════════════ --}} *@ -
-
- -

Completed — wire up this panel as needed.

-
-
- -
- - -@await Html.PartialAsync("PagesView/Canvass/_ForCanvass") - - \ No newline at end of file diff --git a/CPRNIMS.WebApps/Views/Components/CanvassMgmt/CanvassingTabPage/ForTagging.cshtml b/CPRNIMS.WebApps/Views/Components/CanvassMgmt/CanvassingTabPage/ForTagging.cshtml index 0d5b7ba..8c6f807 100644 --- a/CPRNIMS.WebApps/Views/Components/CanvassMgmt/CanvassingTabPage/ForTagging.cshtml +++ b/CPRNIMS.WebApps/Views/Components/CanvassMgmt/CanvassingTabPage/ForTagging.cshtml @@ -1056,15 +1056,6 @@ searchable: false }, {data: 'supplierName'}], - rowCallback: function (row, data) { - var statusCell = $('td:eq(9)', row); - var myStatus = statusCell.text().trim(); - if (myStatus === 'Yes' || myStatus === 'true' || myStatus === true) { - statusCell.text('Yes').addClass('status-active'); - } else { - statusCell.text('No').addClass('status-partial'); - } - }, error: errorHandler }); } diff --git a/CPRNIMS.WebApps/Views/Shared/PagesView/Canvass/_CanvassScript.cshtml b/CPRNIMS.WebApps/Views/Shared/PagesView/Canvass/_CanvassScript.cshtml index 197cacd..980048c 100644 --- a/CPRNIMS.WebApps/Views/Shared/PagesView/Canvass/_CanvassScript.cshtml +++ b/CPRNIMS.WebApps/Views/Shared/PagesView/Canvass/_CanvassScript.cshtml @@ -15,9 +15,9 @@ - + - + diff --git a/CPRNIMS.WebApps/Views/Shared/PagesView/Canvass/_Suppliers.cshtml b/CPRNIMS.WebApps/Views/Shared/PagesView/Canvass/_Suppliers.cshtml index e93ecd4..8be427e 100644 --- a/CPRNIMS.WebApps/Views/Shared/PagesView/Canvass/_Suppliers.cshtml +++ b/CPRNIMS.WebApps/Views/Shared/PagesView/Canvass/_Suppliers.cshtml @@ -1,108 +1,447 @@ - -