@page "/" @using System.ComponentModel.DataAnnotations @using kmCommonLibsCore; @if (ShowWizard) { @* *@ @* Step 1 - plastic card vs postcard *@ @* *@

Choose a Card Type

@* Logic behind the buttons *@
Plastic Card Postcard

@* Preview information about the selected card type*@ @if (isPlasticCard) {

Focused on Expanding Your Customer Base ($1.02/card)

} else {

Focused on Thanking and Rewarding Your Best Customers ($0.79/card)

} @if(isPlasticCard) { } else { }
@* Need this here to avoid addition of random submit button *@
@* *@ @* Step 2 - selecting card design *@ @* *@

Choose a Design

@* Button logic *@
@if (isPlasticCard) { Plastic Card 1 Plastic Card 2 Plastic Card 3 } else { Postcard 1 Postcard 2 Postcard 3 }

@* Card preview logic *@ @if (designOne) { @if(isPostcard) { } else { } } else if(designTwo) { @if(isPostcard) { } else { } } else if (designThree) { @if(isPostcard) { } else { } }
@* *@ @* Step 3 - For postcards, choose a verse and a signature *@ @* *@ @if (isPlasticCard) {

No customization needed. Please proceed to logo selection.

} else {

Select a Verse

@if (!isPlasticCard) { Option 1 Option 2 Option 3

@if (verseOne) { Thank you for making our success possible. We appreciate loyal customers like you and look forward to continuing to be your complete auto repair, service and tire center } else if(verseTwo) { We appreciate the trust you have shown in us and look forward to working with you in the future. } else if(verseThree) { We want you to know that we truly appreciate your business and will make every effort possible to continue to provide you with excellent car care. }


Select a Signature

From Your Friends Name, Title, Phone Number Custom

@if (sigOne) { From your friends at {Location Name} {Location Phone Number} } else if (sigTwo) { } else if (sigThree) { } } }
@* *@ @* Step 4 - Logo Selection *@ @* *@


@if(goodyear) { } @if(michelin) { }
@* *@ @* Step 5 - Offer selection for Plastic cards *@ @* *@ @if (isPlasticCard) {

Please select two (2) full size offers:




And four (4) half-sized offers:


} else {

No offers needed. Please proceed to location information.

}
@* *@ @* Step 6 - Location information *@ @* *@ @* *@ @* Step 7 - Payment *@ @* *@ Credit Card On File Call With Payment Info Check (due by 5/31/25)

} @code { async Task OnFinishHandler() { using (var em = new kmCommonLibsCore.Emails()) { // Parsing the submitted form to pull the relevant information string cardType = isPostcard ? "Postcard" : "Plastic Card"; string cardDesign = ""; if (designOne) cardDesign = "A"; else if (designTwo) cardDesign = "B"; else if (designThree) cardDesign = "C"; // Postcard or Plastic specific options string customizationInfo = ""; if (isPostcard) { string verseChoice = ""; string sigChoice = ""; if (verseOne) verseChoice = "1"; else if (verseTwo) verseChoice = "2"; else if (verseThree) verseChoice = "3"; if (sigOne) sigChoice = string.Format("Option D - From Your Friends At:
{0}
{1}", locationInfo.LocationName, locationInfo.PhoneNumber); else if (sigTwo) sigChoice = string.Format("Option E - Name: {0}
Title: {1}
Phone: {2}", customName, customTitle, customPhone); else if (sigThree) sigChoice = string.Format("Option F - {0}", customSignature); // combine these into customizationInfo customizationInfo = string.Format("Verse: {0}
Signature: {1}", verseChoice, sigChoice); } else // isPlasticCard { string smallOfferString = ""; string bigOfferString = ""; int[] smallIndexes = new int[4]; int[] bigIndexes = new int[2]; int smallCount = 0; for (int index = 0; index < smallOffers.Length; index++) { if (smallOffers[index]) { smallIndexes[smallCount] = index; smallCount++; } } int bigCount = 0; for (int index = 0; index < bigOffers.Length; index++) { if (bigOffers[index]) { bigIndexes[bigCount] = index; bigCount++; } } foreach (int index in smallIndexes) { switch (index) { case 0: smallOfferString = smallOfferString + "B1 "; break; case 1: smallOfferString = smallOfferString + "B2 "; break; case 2: smallOfferString = smallOfferString + "B3 "; break; case 3: smallOfferString = smallOfferString + "B4 "; break; case 4: smallOfferString = smallOfferString + "B5 "; break; case 5: smallOfferString = smallOfferString + "B6 "; break; case 6: smallOfferString = smallOfferString + "B7 "; break; case 7: smallOfferString = smallOfferString + "B8 "; break; case 8: smallOfferString = smallOfferString + "B9 "; break; case 9: smallOfferString = smallOfferString + "B10 "; break; case 10: smallOfferString = smallOfferString + "B11 "; break; case 11: smallOfferString = smallOfferString + "B12 "; break; } } foreach (int index in bigIndexes) { switch (index) { case 0: bigOfferString = bigOfferString + "A1 "; break; case 1: bigOfferString = bigOfferString + "A2 "; break; case 2: bigOfferString = bigOfferString + "A3 "; break; case 3: bigOfferString = bigOfferString + "A4 "; break; case 4: bigOfferString = bigOfferString + "A5 "; break; case 5: bigOfferString = bigOfferString + "A6 "; break; } } customizationInfo = string.Format("Offers: {0} - {1}", bigOfferString, smallOfferString); } // Logo info string logos = ""; if (!goodyear && !michelin && !custom) logos = "NA"; else { if (goodyear) { logos += "Goodyear"; if (michelin) logos += ", Michelin"; if (custom) logos += ", Custom"; } else if (michelin) { logos += "Michelin"; if (custom) logos += ", Custom"; } else if (custom) logos += "Custom"; } // Payment info string paymentMethod = ""; if (ccOnFile) paymentMethod = "Credit Card on File"; else if (callWithInfo) paymentMethod = "Call With Payment Info"; else if (check) paymentMethod = "Check"; // Formulating the email to send em.Subject = "SBC Order Form Submission"; em.AddAddress(enuAddressType.From, "support@keymotive.us", "Summer Growth Enrollment"); em.AddAddress(enuAddressType.To, "support@keymotive.us", "KeyMotive Support"); string locInfoString = string.Format("
Location Name: {0}
Manager: {1}
Address: {2}
City: {3}
State: {4}
Zip: {5}

Phone Number: {6}
Contact Name: {7}
Contact Phone: {8}
Contact Email: {9}
", locationInfo.LocationName, locationInfo.Manager, locationInfo.Address, locationInfo.City, locationInfo.State, locationInfo.Zip, locationInfo.PhoneNumber, locationInfo.ContactName, locationInfo.ContactPhone, locationInfo.ContactEmail); string cardInfoString = string.Format("Card type: {0}, Design {1}

Customization Options:
{2}
Logos: {3}
", cardType, cardDesign, customizationInfo, logos); string paymentString = string.Format("Payment Method: {0}

Requested Quantity: {1}
Additional Comments: {2}", paymentMethod, requestedQuantity, additionalComments); em.HtmlBody = "You have a new enrollment:
" +locInfoString + cardInfoString + paymentString + "
"; try { em.Send(); await Console.Out.WriteLineAsync("Done sending"); } catch(Exception e) { await Console.Out.WriteLineAsync("ERROR: " + e.Message); } ShowWizard = false; await Dialog.AlertAsync("The Registration was submitted successfully", "Done"); } } public bool? IsCardChoiceValid { get; set; } public bool? IsDesignChoiceValid { get; set; } [CascadingParameter] public DialogFactory Dialog { get; set; } public bool ShowWizard { get; set; } = true; public int Value { get; set; } public TelerikForm RegisterForm { get; set; } public User UserModel { get; set; } = new User(); // Variables for selecting between plastic and post public TelerikForm cardTypeForm { get; set; } public CardType cardType { get; set; } = new CardType(); public bool isPlasticCard = true; public bool isPostcard = false; // Variables for selecting specific design public TelerikForm customizationForm { get; set; } public CustomizationOptions custOptions { get; set; } = new CustomizationOptions(); public bool designOne = true; public bool designTwo = false; public bool designThree = false; // Variables for selecting messaging (postcards only) public TelerikForm messagingForm { get; set; } public MessagingOptions messagingOptions { get; set; } = new MessagingOptions(); public bool verseOne = true; public bool verseTwo = false; public bool verseThree = false; public bool sigOne = true; public bool sigTwo = false; public bool sigThree = false; public string customName = ""; // For sig two public string customTitle = ""; public string customPhone = ""; public string customSignature = ""; // For sig three public bool isMessagingValid = false; // Variables for logo selection public TelerikForm logoForm { get; set; } public LogoOptions logoOptions { get; set; } = new LogoOptions(); public bool goodyear = false; public bool michelin = false; public bool custom = false; public bool isLogoValid = false; // Variables for offer selection (plastic cards only) public TelerikForm offerForm { get; set; } public OfferOptions offerOptions { get; set; } = new OfferOptions(); public bool[] bigOffers = new bool[6]; public bool[] smallOffers = new bool[12]; public bool isOfferSelectionValid = false; // Location information public TelerikForm locationForm { get; set; } public LocationInfo locationInfo { get; set; } = new LocationInfo(); public string locationName { get; set; } public string manager { get; set; } public string address { get; set; } public string city { get; set; } public string state { get; set; } public string zip { get; set; } public string phoneNumber { get; set; } public string contactName { get; set; } public string contactPhone { get; set; } public string contactEmail { get; set; } public bool isLocationInfoValid = false; // Payment information public TelerikForm paymentForm { get; set; } public PaymentInfo paymentInfo { get; set; } = new PaymentInfo(); public string requestedQuantity = ""; public string additionalComments = ""; public bool ccOnFile = true; public bool callWithInfo = false; public bool check = false; public void ToggleCardType() { isPlasticCard = !isPlasticCard; isPostcard = !isPostcard; } public void OnCardChoiceStepChange(WizardStepChangeEventArgs args) { IsCardChoiceValid = true; // This is forced to be true but required nonetheless } public void OnDesignStepChange(WizardStepChangeEventArgs args) { IsDesignChoiceValid = true; // Same as card choice } public void OnMessagingStepChange(WizardStepChangeEventArgs args) { isMessagingValid = true; } public void OnLogoStepChange(WizardStepChangeEventArgs arg) { isLogoValid = true; } public async void OnOfferStepChange(WizardStepChangeEventArgs args) { if (isPostcard) { isOfferSelectionValid = true; } else { int bigOfferCount = 0; foreach (bool selection in bigOffers) { if (selection) bigOfferCount++; } int smallOfferCount = 0; foreach (bool selection in smallOffers) { if (selection) smallOfferCount++; } if (smallOfferCount == 4 && bigOfferCount == 2) isOfferSelectionValid = true; else isOfferSelectionValid = false; if (!isOfferSelectionValid) { args.IsCancelled = true; await Dialog.AlertAsync("Please select the proper amount of offers.", "You cannot proceed"); } } } public async void OnLocationStepChange(WizardStepChangeEventArgs args) { isLocationInfoValid = locationInfo.ContactEmail != "" && locationInfo.ContactPhone != "" && locationInfo.ContactName != "" && locationInfo.City != "" && locationInfo.State != "" && locationInfo.Zip != "" && locationInfo.PhoneNumber != "" && locationInfo.LocationName != "" && locationInfo.Address != "" && locationInfo.Manager != ""; if(!isLocationInfoValid) { args.IsCancelled = true; await Dialog.AlertAsync("Please fill out all required fields.", "You cannot proceed"); } } public class CardType { [Required] public string cardChoice { get; set; } } public class CustomizationOptions { [Required] public string custOption { get; set; } } public class MessagingOptions { public string verse { get; set; } public string signature { get; set; } } public class LogoOptions { public string option; } public class OfferOptions { public string option; } public class LocationInfo { [Required] public string LocationName { get; set; } = ""; [Required] public string Manager { get; set; } = ""; [Required] public string Address { get; set; } = ""; [Required] public string City { get; set; } = ""; [Required] public string State { get; set; } = ""; [Required] public string Zip { get; set; } = ""; [Required] public string PhoneNumber { get; set; } = ""; [Required] public string ContactName { get; set; } = ""; [Required] public string ContactPhone { get; set; } = ""; [Required] public string ContactEmail { get; set; } = ""; } public class PaymentInfo { public string info; } }