using System.ComponentModel.DataAnnotations;
namespace ODCWeb.Models.ViewModels
{
///
/// ViewModel for generated BQ items used in BQ Generation views
///
public class GeneratedBQItemViewModel
{
[Display(Name = "Item Letter")]
public string ItemLetter { get; set; } = string.Empty;
[Display(Name = "Section Title")]
public string SectionTitle { get; set; } = string.Empty;
[Display(Name = "Section Order")]
public int SectionOrder { get; set; }
[Display(Name = "Item Title")]
public string ItemTitle { get; set; } = string.Empty;
[Display(Name = "Item Order")]
public int ItemOrder { get; set; }
[Display(Name = "Unit of Measure")]
public string Unit { get; set; } = string.Empty;
[Display(Name = "Quantity")]
[DisplayFormat(DataFormatString = "{0:#,##0.00}", ApplyFormatInEditMode = true)]
public double Quantity { get; set; }
[Display(Name = "Rate")]
[DisplayFormat(DataFormatString = "{0:C}", ApplyFormatInEditMode = true)]
public double Rate { get; set; }
[Display(Name = "Amount")]
[DisplayFormat(DataFormatString = "{0:C}", ApplyFormatInEditMode = true)]
public double Amount { get; set; }
[Display(Name = "Notes")]
public string Notes { get; set; } = string.Empty;
[Display(Name = "Formula Expression")]
public string FormulaExpression { get; set; } = string.Empty;
[Display(Name = "Project Name")]
public string ProjectName { get; set; } = string.Empty;
[Display(Name = "Project Location")]
public string ProjectLocation { get; set; } = string.Empty;
// NEW PROPERTIES FOR HIERARCHY
[Display(Name = "Floor Name")]
public string FloorName { get; set; } = string.Empty;
[Display(Name = "Minor Section")]
public string MinorSection { get; set; } = string.Empty;
[Display(Name = "Original Section Title")]
public string OriginalSectionTitle { get; set; } = string.Empty;
[Display(Name = "Original Item Title")]
public string OriginalItemTitle { get; set; } = string.Empty;
// Calculated properties for progress tracking
[Display(Name = "Progress")]
[DisplayFormat(DataFormatString = "{0:P2}", ApplyFormatInEditMode = true)]
public double Progress { get; set; } = 0; // Default to 0% progress
[Display(Name = "Completed Amount")]
[DisplayFormat(DataFormatString = "{0:C}", ApplyFormatInEditMode = true)]
public double CompletedAmount => Amount * Progress;
[Display(Name = "Balance Amount")]
[DisplayFormat(DataFormatString = "{0:C}", ApplyFormatInEditMode = true)]
public double BalanceAmount => Amount - CompletedAmount;
// Additional helper properties
[Display(Name = "Is Completed")]
public bool IsCompleted => Progress >= 1.0;
[Display(Name = "Completion Percentage")]
public string CompletionPercentage => $"{Progress * 100:0}%";
[Display(Name = "Status")]
public string Status
{
get
{
if (Progress == 0) return "Not Started";
if (Progress >= 1.0) return "Completed";
return "In Progress";
}
}
[Display(Name = "Status Badge Class")]
public string StatusBadgeClass
{
get
{
if (Progress == 0) return "bg-secondary";
if (Progress >= 1.0) return "bg-success";
if (Progress >= 0.5) return "bg-warning";
return "bg-info";
}
}
// Hierarchy display helpers
[Display(Name = "Full Hierarchy Path")]
public string FullHierarchyPath
{
get
{
var parts = new List();
if (!string.IsNullOrEmpty(FloorName))
parts.Add(FloorName);
if (!string.IsNullOrEmpty(SectionTitle))
parts.Add(SectionTitle);
if (!string.IsNullOrEmpty(MinorSection))
parts.Add(MinorSection);
return string.Join(" → ", parts);
}
}
[Display(Name = "Display Title")]
public string DisplayTitle
{
get
{
// For display purposes, show clean item title without mini section
return ItemTitle;
}
}
[Display(Name = "Has Minor Section")]
public bool HasMinorSection => !string.IsNullOrEmpty(MinorSection);
public double ImperialQuantity { get; set; }
public string ImperialUnit { get; set; }
public double ImperialRate { get; set; }
public double ImperialAmount { get; set; }
}
}