EnVisageOnline/Beta/Source/EnVisage/Views/Calendar/Edit.cshtml

95 lines
3.9 KiB
Plaintext

@using EnVisage.Code
@model EnVisage.Models.FiscalCalendarModel
@{
ViewBag.Title = Model != null ? "Edit Fiscal Calendar" : "Add Fiscal Calendar";
}
@section Scripts
{
<script type="text/javascript">
emulateNavUrl = "/Calendar";
</script>
@if (Model != null)
{
<script type="text/javascript">
init.push(function() {
StartEdit('SystemSettings', '@Model.StartDateSettingId', null, '#btnsave', 'erorMsgPlaceholder');
StartEdit('SystemSettings', '@Model.TypeSettingId', null, '#btnsave', 'erorMsgPlaceholder');
StartEdit('SystemSettings', '@Model.WeekEndingSettingId', null, '#btnsave', 'erorMsgPlaceholder');
StartEdit('SystemSettings', '@Model.WeekEndingTypeSettingId', null, '#btnsave', 'erorMsgPlaceholder');
$(".datepicker").datepicker({ autoclose: true });
$('#btnsave').click(function () {
if ($(this).parents('form').valid())
blockUI();
});
});
</script>
}
}
<div id="erorMsgPlaceholder"></div>
@if (Model != null)
{
<div class="alert alert-danger" id="danger" hidden="hidden">
<strong>Oh snap!</strong>
<span id="erormsg">Change a few things up and try submitting again.</span>
<span style="float: right"><a href="@Url.Action("Index", "Calendar")">Back to Details</a></span>
</div>
}
@using (Html.BeginForm("Edit", "Calendar", FormMethod.Post, new { @class = "panel form-horizontal" }))
{
@Html.HiddenFor(t=>t.StartDateSettingId)
@Html.HiddenFor(t=>t.TypeSettingId)
@Html.HiddenFor(t=>t.WeekEndingSettingId)
@Html.HiddenFor(t=>t.WeekEndingTypeSettingId)
@Html.AntiForgeryToken()
<div class="panel-body">
<div class="form-group">
@Html.LabelFor(model => model.Type, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.DropDownListFor(model => model.Type, Utils.GetFiscalCalendarTypes(), new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Type)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.CurrentYearStartDate, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.EditorFor(t => t.CurrentYearStartDate)
@Html.ValidationMessageFor(model => model.CurrentYearStartDate)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.WeekEnding, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.DropDownListFor(model => model.WeekEnding, Utils.GetWeekDays(), new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.WeekEnding)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.WeekEndingType, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.DropDownListFor(model => model.WeekEndingType, Utils.GetWeekEndingTypes(), new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.WeekEndingType)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Adjustingperiod, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
<div class="checkbox">
@Html.CheckBoxFor(model => model.Adjustingperiod)
</div>
</div>
</div>
@Html.ValidationSummary(false, "The fiscal calendar could not be saved due to the following errors:")
<div class="form-group" style="margin-bottom: 0;">
<div class="col-sm-offset-2 col-sm-10">
<a class="btn btn-primary" href="@Url.Action("Index", "Calendar")"><i class="fa fa-backward"></i> Back to list</a>
<button type="submit" class="btn btn-success" id="btnsave"><i class="fa fa-save"></i> Save</button>
</div>
</div>
</div>
}