Date picker ,delivery date set disable dates

HM-111027 - 3.2. USE CUSTOM QUANTITY AND UOM FIELDS ON THE ORDER LINES -

[48670] [Diversey] 3.1. DELIVERY BASED ON ERP FACTORY CALENDARS

Versalert project


1. we keep disabled dates on model

ExtendedAdditionalInfoModel




public class ExtendedAdditionalInfoModel : AdditionalInfoModel
    {
        //RFC01_v1.4:[Ticket 48670] 3.1.DELIVERY BASED ON ERP FACTORY CALENDARS
        [Required]
        [LookupPeriodDateValidation(ErrorMessageResourceName = SanaTextKeys.InvalidField)]
        [DisableDateValidation(ErrorMessageResourceName = SanaTextKeys.InvalidField)]
        public override Date? DeliveryDate { getset; }
        public List<stringDisableDays getset; }
        public string NextPossibleDeliveryDate { getset; }
        public int DeliveryLookupPeriod { getset; }
    }



2. Update the model and pass to view

((ExtendedAdditionalInfoModel)model.AdditionalInfo).DisableDays = combindedDeliveryDatesList;((ExtendedAdditionalInfoModel)model.AdditionalInfo).NextPossibleDeliveryDate = GetNextPossibleDeliveryDate(holidays).ToShortDateString();
ExtendedCheckoutController > 
private void SetDeliveryDatesToModel(OrderOverviewModel model, List<string> deliveryDates, int deliveryCalendarLookupPeriod)
        {
            List<Date> holidays = new List<Date>();
            var combindedDeliveryDatesList = new List<string>();
 
            if (deliveryDates != null)
            {
                foreach (var item in deliveryDates)
                {
                    DateTime oDate = DateTime.Parse(item);
 
                    // Remove dates greater than deliveryCalendarLookupPeriod 
                    if ((oDate - DateTime.Now).TotalDays >= deliveryCalendarLookupPeriod)
                        continue;
 
                    string strDate = oDate.ToShortDateString();
                    combindedDeliveryDatesList.Add(strDate);
 
                    // Check current date is on list
                    holidays.Add(Date.Parse(oDate.ToShortDateString()));
                }
                ((ExtendedAdditionalInfoModel)model.AdditionalInfo).DisableDays = combindedDeliveryDatesList;
            }
            ((ExtendedAdditionalInfoModel)model.AdditionalInfo).NextPossibleDeliveryDate = GetNextPossibleDeliveryDate(holidays).ToShortDateString();
 
            if (((ExtendedOrderManager)CommerceFrameworkBase.Orders).DeliveryCalendarLookupPeriod > 0)
            {
                // Remove one date from Lookup Period to indlude current date.
                ((ExtendedAdditionalInfoModel)model.AdditionalInfo).DeliveryLookupPeriod = ((ExtendedOrderManager)CommerceFrameworkBase.Orders).DeliveryCalendarLookupPeriod - 1;
            }
        }

get Language formate and culture info, to support Langage switch.