Files

189 lines
5.0 KiB
C#
Raw Permalink Normal View History

2026-02-03 16:55:37 -06:00
namespace ApplianceRepair
{
public class ContentCardModel : ContentCardRecord
{
public ContentCardModel()
{
BelongsToPage = string.Empty;
Group = string.Empty;
Header = string.Empty;
Text = string.Empty;
}
public ContentCardModel(ContentCardRecord record)
{
2026-05-01 19:48:34 -05:00
Id = record.Id;
CreatedAt = record.CreatedAt;
UpdatedAt = record.UpdatedAt;
2026-02-03 16:55:37 -06:00
BelongsToPage = record.BelongsToPage;
Group = record.Group;
Header = record.Header;
Text = record.Text;
}
}
public class HomePageModel : HomePageRecord
{
2026-04-22 20:09:26 -05:00
public static string PageName = "Home";
2026-04-25 13:14:08 -05:00
2026-04-22 20:09:26 -05:00
public enum ContentCardTypes
{
2026-04-25 13:14:08 -05:00
Services,
2026-04-22 20:09:26 -05:00
Trust,
}
2026-02-03 16:55:37 -06:00
public string BusinessName { get; set; }
2026-04-25 13:14:08 -05:00
public string PhoneNumber { get; set; }
public string FormattedPhoneNumber
{
get
{
if (!string.IsNullOrEmpty(PhoneNumber))
{
return $"({PhoneNumber[0..3]})-{PhoneNumber[3..6]}-{PhoneNumber[6..10]}";
}
return "";
}
}
public string PhoneNumberCallLink
{
get
{
if (!string.IsNullOrEmpty(PhoneNumber))
{
return $"tel:{PhoneNumber}";
}
return "";
}
}
public string CopyrightText
{
get
{
if (!string.IsNullOrEmpty(BusinessName))
{
return $"© {DateTime.Now.Year} {BusinessName}. All rights reserved.";
}
return $"© {DateTime.Now.Year} All rights reserved.";
}
}
2026-02-03 16:55:37 -06:00
public List<ContentCardModel> ServicesCards { get; set; }
2026-04-25 13:14:08 -05:00
2026-02-03 16:55:37 -06:00
public List<ContentCardModel> TrustCards { get; set; }
public HomePageModel()
{
HeaderLine1 = string.Empty;
HeaderLine2 = string.Empty;
HeaderText = string.Empty;
2026-04-25 13:14:08 -05:00
CallHeaderText = string.Empty;
BookHeaderText = string.Empty;
2026-02-03 16:55:37 -06:00
SecondaryHeaderText = string.Empty;
2026-04-25 13:14:08 -05:00
BusinessName = string.Empty;
PhoneNumber = string.Empty;
2026-02-03 16:55:37 -06:00
ServicesCards = [];
TrustCards = [];
}
2026-04-25 13:14:08 -05:00
public HomePageModel(
HomePageRecord homePageRecord,
BusinessConfigRecord businessConfigRecord,
List<ContentCardRecord> serviceCards,
List<ContentCardRecord> trustCards)
2026-02-03 16:55:37 -06:00
{
2026-05-01 19:48:34 -05:00
Id = homePageRecord.Id;
CreatedAt = homePageRecord.CreatedAt;
UpdatedAt = homePageRecord.UpdatedAt;
2026-04-25 13:14:08 -05:00
HeaderLine1 = homePageRecord.HeaderLine1;
HeaderLine2 = homePageRecord.HeaderLine2;
HeaderText = homePageRecord.HeaderText;
CallHeaderText = homePageRecord.CallHeaderText;
BookHeaderText = homePageRecord.BookHeaderText;
SecondaryHeaderText = homePageRecord.SecondaryHeaderText;;
BusinessName = businessConfigRecord.Name ?? "";
PhoneNumber = businessConfigRecord.PhoneNumber ?? "";
2026-02-03 16:55:37 -06:00
ServicesCards = [];
TrustCards = [];
2026-04-25 13:14:08 -05:00
foreach (var card in serviceCards)
{
ServicesCards.Add(new ContentCardModel(card));
}
foreach (var card in trustCards)
{
TrustCards.Add(new ContentCardModel(card));
}
2026-02-03 16:55:37 -06:00
}
}
public class RepairRequestModel : RepairRequestRecord
{
public string FormattedPhoneNumber
{
get
{
if (!string.IsNullOrEmpty(Phone))
{
return $"({Phone[0..3]})-{Phone[3..6]}-{Phone[6..10]}";
}
return "";
}
}
public string PhoneNumberCallLink
{
get
{
if (!string.IsNullOrEmpty(Phone))
{
return $"tel:{Phone}";
}
return "";
}
}
public RepairRequestModel() { }
public RepairRequestModel(RepairRequestRecord record)
{
2026-05-01 19:48:34 -05:00
Id = record.Id;
CreatedAt = record.CreatedAt;
UpdatedAt = record.UpdatedAt;
RequestNumber = record.RequestNumber;
Type = record.Type;
Brand = record.Brand;
Notes = record.Notes;
Phone = record.Phone;
Name = record.Name;
}
}
2026-02-03 16:55:37 -06:00
2026-04-25 13:14:08 -05:00
public class BusinessInfoModel : BusinessConfigRecord
{
public BusinessInfoModel(BusinessConfigRecord record)
{
2026-05-01 19:48:34 -05:00
Id = record.Id;
CreatedAt = record.CreatedAt;
UpdatedAt = record.UpdatedAt;
2026-04-25 13:14:08 -05:00
Name = record.Name;
PhoneNumber = record.PhoneNumber;
SupportEmail = record.SupportEmail;
}
2026-02-03 16:55:37 -06:00
}
}