128 lines
5.4 KiB
Plaintext
128 lines
5.4 KiB
Plaintext
@using EnVisage.Code
|
|
@model EnVisage.Models.FiscalCalendarModel
|
|
@using EnVisage.Code.HtmlHelpers
|
|
@using Microsoft.AspNet.Identity
|
|
@{
|
|
ViewBag.Title = "Fiscal Calendar";
|
|
}
|
|
@section scripts
|
|
{
|
|
<script type="text/javascript">
|
|
var ctr = 0;
|
|
emulateNavUrl = "/Calendar";
|
|
init.push(function() {
|
|
$('#holidays').dataTable({
|
|
"bProcessing": true,
|
|
"bServerSide": true,
|
|
"bAutoWidth": false,
|
|
"sAjaxSource": document.URL,
|
|
"sServerMethod": "POST",
|
|
"aoColumns": [
|
|
{ "mDataProp": "Name" },
|
|
{ "mDataProp": "Date" },
|
|
{ "mDataProp": "WorkingDay", "mRender": function (data, type, full) { return data == true ? "Yes" : "No" } },
|
|
{ "mDataProp": "NonWorkingWeek", "mRender": function (data, type, full) { return data == true ? "Yes" : "No" } },
|
|
{
|
|
"mData": function (data, type, full) {
|
|
@if (Html.CheckSecurityObjectPermission(Areas.FiscalCalendar, AccessLevel.Write))
|
|
{
|
|
<text>
|
|
ctr++;
|
|
return ('<a id="btnEdit' + ctr + '" onclick="return CheckLock(this.id, \'Holiday\', \'_rplcmnt_\')" data-toggle="popover" data-placement="left" ' + 'class="btn btn-sm btn-primary popover-warning popover-dark" href="@Url.Action("EditHoliday", "Calendar", new {@id = "_rplcmnt_"})"><i class="fa fa-edit"></i> Edit</a> ' +
|
|
'<a id="btnDelete' + ctr + '" onclick="return CheckLock(this.id, \'Holiday\', \'_rplcmnt_\')" data-toggle="popover" data-placement="left" ' + (1 > 0 ? 'class="btn btn-sm btn-danger popover-warning popover-dark disabled" href="javascript:void(0);"' : 'class="btn btn-sm btn-danger popover-warning popover-dark" href=""') + ' ><i class="fa fa-trash-o"></i> Delete</a>')
|
|
.replace(/_rplcmnt_/g, data.Id);
|
|
</text>
|
|
}
|
|
else
|
|
{
|
|
<text>
|
|
return "";
|
|
</text>
|
|
}
|
|
}
|
|
}],
|
|
});
|
|
@if (Html.CheckSecurityObjectPermission(Areas.FiscalCalendar, AccessLevel.Write))
|
|
{
|
|
<text>
|
|
$('#holidays_wrapper .table-caption').html('<a class="btn btn-primary" href="@Url.Action("EditHoliday", "Calendar")"><i class="fa fa-plus"></i> Add Holiday</a>');
|
|
</text>
|
|
}
|
|
$('#holidays_wrapper .dataTables_filter input').attr('placeholder', 'Search...');
|
|
$('#holidays_wrapper .dataTables_processing').addClass("table-caption");
|
|
$('#holidays_wrapper .dataTables_processing').html('<span class="h3"><img class="valign-middle" src="../Content/images/loadFA.gif"/></span>');
|
|
});
|
|
function checkCalendarSettingsLock(buttonId) {
|
|
var typeSettingId = '';
|
|
var startDateSettingId = '';
|
|
var weekEndingSettingId = '';
|
|
var weekEndingTypeSettingId = '';
|
|
|
|
@if (Model != null && Model.TypeSettingId != Guid.Empty)
|
|
{
|
|
<text>
|
|
typeSettingId = '@Model.TypeSettingId';
|
|
startDateSettingId = '@Model.StartDateSettingId';
|
|
weekEndingSettingId = '@Model.WeekEndingSettingId';
|
|
weekEndingTypeSettingId = '@Model.WeekEndingTypeSettingId';
|
|
</text>
|
|
}
|
|
|
|
return CheckLock(buttonId, 'SystemSettings', typeSettingId) &&
|
|
CheckLock(buttonId, 'SystemSettings', startDateSettingId) &&
|
|
CheckLock(buttonId, 'SystemSettings', weekEndingSettingId) &&
|
|
CheckLock(buttonId, 'SystemSettings', weekEndingTypeSettingId);
|
|
|
|
}
|
|
</script>
|
|
}
|
|
<div class="panel form-horizontal">
|
|
<div class="panel-heading">
|
|
<span class="panel-title">Fiscal Calendar Settings</span>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="form-group">
|
|
@Html.LabelFor(t => t.Type, new {@class="col-sm-2 control-label"})
|
|
<div class="col-sm-4 radio">
|
|
<span class="lbl">@Model.Type.ToDisplayValue()</span>
|
|
</div>
|
|
@Html.LabelFor(t => t.CurrentYearStartDate, new {@class="col-sm-2 control-label"})
|
|
<div class="col-sm-4 radio">
|
|
<span class="lbl">@(Model.CurrentYearStartDate.HasValue ? Model.CurrentYearStartDate.Value.ToShortDateString() : "")</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
@Html.LabelFor(t => t.WeekEnding, new {@class="col-sm-2 control-label"})
|
|
<div class="col-sm-4 radio">
|
|
<span class="lbl">@Model.WeekEnding.ToDisplayValue()</span>
|
|
</div>
|
|
@Html.LabelFor(t => t.WeekEndingType, new {@class="col-sm-2 control-label"})
|
|
<div class="col-sm-4 radio">
|
|
<span class="lbl">@Model.WeekEndingType.ToDisplayValue()</span>
|
|
</div>
|
|
</div>
|
|
@if (Html.CheckSecurityObjectPermission(Areas.FiscalCalendar, AccessLevel.Write))
|
|
{
|
|
<div class="form-group" style="margin-bottom: 0;">
|
|
<div class="col-sm-offset-2 col-sm-10">
|
|
<a id="btnEdit" onclick="return checkCalendarSettingsLock(this.id)" data-toggle="popover" data-placement="left" class="btn btn-primary popover-warning popover-dark" href="@Url.Action("Edit", "Calendar")"><i class="fa fa-edit"></i> Edit</a>
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="table-light table-responsive">
|
|
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="holidays">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Date</th>
|
|
<th>Working Day</th>
|
|
<th>Non Working Week</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|