@using EnVisage.Code @model EnVisage.Models.CostSavingModel @{ // need to init cost saving controller var jsModel = new { startDate = Model.CostSavingStartDate.HasValue ? Model.CostSavingStartDate.Value.ToString("MM/dd/yyyy") : null, endDate = Model.CostSavingEndDate.HasValue ? Model.CostSavingEndDate.Value.ToString("MM/dd/yyyy") : null, costSavings = Model.CostSavings, costSavingDescription = Model.CostSavingDescription, isExpanded = Model.CostSavingsPanelExpanded, costSavingType = Model.CostSavingType, isMonthlyMode = Model.IsMonthlyMode, isEditable = Model.IsEditable, scenarioId = Model.ScenarioId, scenarioStartDate = Model.ScenarioStartDate.HasValue ? Model.ScenarioStartDate.Value.ToString("MM/dd/yyyy") : null, scenarioEndDate = Model.ScenarioEndDate.HasValue ? Model.ScenarioEndDate.Value.ToString("MM/dd/yyyy") : null, items = string.IsNullOrWhiteSpace(Model.CostSavingItems) ? null : Model.CostSavingItems }; var json = Newtonsoft.Json.JsonConvert.SerializeObject(jsModel); }
@Html.HiddenFor(x => x.CostSavingsPanelExpanded, new { ng_value = "ViewModel.IsExpanded" }) @Html.HiddenFor(m => m.CostSavingItems, new { ng_value = "ViewModel.ItemsJson" }) @Html.HiddenFor(x => x.IsEditable, new { ng_value = "ViewModel.IsEditable" }) @Html.HiddenFor(x => x.ScenarioStartDate) @Html.HiddenFor(x => x.ScenarioEndDate)
$ @Html.TextBoxFor(model => model.CostSavings, new { @class = "form-control", data_ng_model = "ViewModel.CostSavings", ng_disabled = "!ViewModel.IsEditable || !ViewModel.IsExpanded", ng_model_options = "{ updateOn: 'change' }" })
@Html.ValidationMessageFor(model => model.CostSavings)
@Html.TextBoxFor(m => m.CostSavingStartDate, "MM/dd/yyyy", new { @class = "form-control", data_ng_model = "ViewModel.StartDate", ng_disabled = "!ViewModel.IsEditable || !ViewModel.IsExpanded", ng_model_options = "{ updateOn: 'change' }" })
to
@Html.TextBoxFor(m => m.CostSavingEndDate, "MM/dd/yyyy", new { @class = "form-control", data_ng_model = "ViewModel.EndDate", ng_disabled = "!ViewModel.IsEditable || !ViewModel.IsExpanded", ng_model_options = "{ updateOn: 'change' }", data_val_dategreaterthanorequal = "Cost Saving End Date should not be less than Cost Saving Start Date", data_val_dategreaterthanorequal_otherpropertyname = Html.IdFor(x => x.CostSavingStartDate) })
@Html.ValidationMessageFor(model => model.CostSavingStartDate) @Html.ValidationMessageFor(model => model.CostSavingEndDate)
@if (Model.ROIDate.HasValue) {
@Html.LabelFor(x => x.ROIDate, new { @class = "control-label" }) @Html.TextBoxFor(x => x.ROIDate, "{0:MM/dd/yyyy}", new { @class = "form-control", disabled = "disabled" })
}
@Html.CheckBoxFor(x => x.IsMonthlyMode, new { @class = "switcher", ng_model = "ViewModel.Show" })
@Html.LabelFor(model => model.CostSavingType, new { @class = "control-label" }) @Html.CheckBoxFor(model => model.CostSavingType, new { @class = "switcher form-control", ng_model = "ViewModel.CostSavingType" }) @(Model.CostSavingType ? "Hard Savings" : "Soft Savings")
@Html.LabelFor(model => model.CostSavingDescription, new { @class = "control-label" }) @Html.TextAreaFor(model => model.CostSavingDescription, 3, 55, new { @class = "form-control", data_ng_model = "ViewModel.Description", ng_disabled = "!ViewModel.IsEditable || !ViewModel.IsExpanded", ng_model_options = "{ updateOn: 'change' }" })