202 lines
8.8 KiB
Plaintext
202 lines
8.8 KiB
Plaintext
@using EnVisage.Code
|
|
@model EnVisage.Models.PeopleResourceModel
|
|
@{
|
|
ViewBag.Title = @Model.Team.Name + " Non-Project Time";
|
|
}
|
|
@section scripts
|
|
{
|
|
<script type="text/javascript">
|
|
|
|
$('#resourceDashboard').nonProjectTimeGrid({
|
|
url: '@Url.Action("LoadNonProjectTimeList", "PeopleResource")' + '?teamId=' + URI().query(true).teamId,
|
|
read: '@(SecurityManager.CheckSecurityObjectPermission(Areas.RD_ResourceNonProjectTime, AccessLevel.Read))',
|
|
write: '@(SecurityManager.CheckSecurityObjectPermission(Areas.RD_ResourceNonProjectTime, AccessLevel.Write))',
|
|
permanent: false,
|
|
ishistory: false
|
|
});
|
|
$('#futureDashboard').nonProjectTimeGrid({
|
|
url: '@Url.Action("LoadNonProjectTimeList", "PeopleResource")' + '?teamId=' + URI().query(true).teamId,
|
|
read: '@(SecurityManager.CheckSecurityObjectPermission(Areas.RD_ResourceNonProjectTime, AccessLevel.Read))',
|
|
write: '@(SecurityManager.CheckSecurityObjectPermission(Areas.RD_ResourceNonProjectTime, AccessLevel.Write))',
|
|
permanent: true,
|
|
ishistory: false
|
|
});
|
|
|
|
var _npTimeId = '';
|
|
|
|
_viewPageState = $('#resourceDashboard').pageState({
|
|
pageKey: document.location.pathname
|
|
});
|
|
|
|
var showHistory = _viewPageState.data('pageState').$dataset['showHistory'];
|
|
if (showHistory) {
|
|
$("#NonProjectTimesHistory")[0].checked = true;
|
|
toggleHistory(true);
|
|
} else {
|
|
$('#divNonProjectTimesHistory').hide();
|
|
}
|
|
|
|
$('#NonProjectTimesHistory').switcher({
|
|
on_state_content: 'Show History',
|
|
off_state_content: 'Hide History'
|
|
}).parent().css("width", "120px");
|
|
|
|
function loadHistory() {
|
|
$('#divNonProjectTimesHistory').nonProjectTimeGrid({
|
|
url: '@Url.Action("LoadNonProjectTimeList", "PeopleResource")' + '?teamId=' + URI().query(true).teamId,
|
|
read: '@(SecurityManager.CheckSecurityObjectPermission(Areas.RD_ResourceNonProjectTime, AccessLevel.Read))',
|
|
write: '@(SecurityManager.CheckSecurityObjectPermission(Areas.RD_ResourceNonProjectTime, AccessLevel.Write))',
|
|
permanent: false,
|
|
ishistory: true
|
|
});
|
|
}
|
|
|
|
function loadNonProjectTime(npTimeId, resourceId) {
|
|
if (npTimeId.length > 0)
|
|
StartEdit('NonProjectTime', npTimeId, null, null, 'erorMsgPlaceholder');
|
|
var url = npTimeId.length > 0 ? "?Id=" + npTimeId + "&resourceId=" + resourceId : "?resourceId=" + resourceId ;
|
|
$('#nonProjectTimeReload').load('@Url.Action("LoadNonProjectTime", "PeopleResource")' + url + '&teamId=' + URI().query(true).teamId, function (response, status, xh) {
|
|
if (status == "error") {
|
|
$('#nonProjectTimeReload').modal('hide');
|
|
showErrorModal('Loading error', 'We are sorry but there was an error, please try again later.');
|
|
} else {
|
|
initNonProjectTimes(!npTimeId, true);
|
|
_npTimeId = npTimeId;
|
|
$('#editScheduleNonProjectTime').modal('show');
|
|
$('.validation-summary-errors').hide();
|
|
}
|
|
});
|
|
}
|
|
|
|
function editNonProjectTime(aId, npTimeId, resourceId) {
|
|
if (!CheckLock(aId, 'NonProjectTime', npTimeId))
|
|
return false;
|
|
loadNonProjectTime(npTimeId, resourceId);
|
|
return true;
|
|
}
|
|
|
|
function deleteNonProjectTime(aId, npTimeId) {
|
|
if (!CheckLock(aId, 'NonProjectTime', npTimeId))
|
|
return false;
|
|
if (npTimeId.length > 0)
|
|
StartEdit('NonProjectTime', npTimeId, null, null, 'erorMsgPlaceholder');
|
|
$("#deleteNPTimeId").val(npTimeId);
|
|
$('#modal-warning').on('hidden.bs.modal', function () {
|
|
if (npTimeId.length > 0) {
|
|
StopEdit();
|
|
RemoveLock('NonProjectTime', npTimeId);
|
|
}
|
|
}).modal('show');
|
|
return true;
|
|
}
|
|
|
|
$('#editScheduleNonProjectTime').on('hidden.bs.modal', function () {
|
|
if (_npTimeId.length > 0) {
|
|
StopEdit();
|
|
RemoveLock('NonProjectTime', _npTimeId);
|
|
}
|
|
});
|
|
function toggleHistory(isInit) {
|
|
if ($("#NonProjectTimesHistory")[0].checked) {
|
|
$("#divNonProjectTimesHistory").show();
|
|
if (!$.fn.DataTable.isDataTable($('#divNonProjectTimesHistory').find('table')))
|
|
loadHistory();
|
|
if (!isInit) {
|
|
$('html, body')
|
|
.stop()
|
|
.animate({
|
|
scrollTop: $("#divNonProjectTimesHistory").offset().top
|
|
}, 200);
|
|
}
|
|
} else {
|
|
$("#divNonProjectTimesHistory").hide();
|
|
}
|
|
|
|
_viewPageState.pageState('setData', ['showHistory', $("#NonProjectTimesHistory")[0].checked]);
|
|
_viewPageState.pageState('saveData');
|
|
}
|
|
function deleteNPTimeBegin() {
|
|
blockUI();
|
|
}
|
|
function deleteNPTimeCompleted() {
|
|
unblockUI();
|
|
$('#modal-warning').modal('hide');
|
|
}
|
|
function deleteNPTimeFailure() {
|
|
showErrorModal('Deleting error', 'We are sorry but there was an error, please try again later.');
|
|
}
|
|
function deleteNPTimeSuccess() {
|
|
reloadPage();
|
|
}
|
|
</script>
|
|
|
|
}
|
|
|
|
<div id="erorMsgPlaceholder"></div>
|
|
@if (SecurityManager.CheckSecurityObjectPermission(Areas.RD_ResourceNonProjectTime, AccessLevel.Write))
|
|
{
|
|
<div class="row" style="margin-left:0px;">
|
|
<div class="form-group" style="float:left;margin-top:2px">
|
|
<a class="btn btn-primary" style="margin-bottom: 10px;" href="javascript:;" onclick="loadNonProjectTime('', '');">Schedule Non-Project Time</a>
|
|
</div>
|
|
|
|
<div class="form-group switcher-block" style="float:left;margin-left:10px;">
|
|
<input type="checkbox" id="NonProjectTimesHistory" class="switcher form-control" onchange="toggleHistory(false)" />
|
|
</div>
|
|
</div>
|
|
}
|
|
<div class="table-light table-responsive" id="resourceDashboard">
|
|
<h4>Upcoming</h4>
|
|
@Html.Partial("../PeopleResource/_NPTimeList")
|
|
</div>
|
|
<div class="table-light table-responsive" id="futureDashboard">
|
|
<h4>Permanent</h4>
|
|
@Html.Partial("../PeopleResource/_NPTimeList")
|
|
</div>
|
|
<div class="table-light table-responsive" id="divNonProjectTimesHistory">
|
|
<h4>History</h4>
|
|
@Html.Partial("../PeopleResource/_NPTimeList")
|
|
</div>
|
|
<a class="btn btn-primary" style="margin-top:5px;" href="@(Url.Action("Board", "Team", new { teamId = Request.QueryString["teamId"].ToString() }))"><i class="fa fa-backward"></i> Back to @Model.Team.Name</a>
|
|
|
|
|
|
<!-- Modal -->
|
|
<div id="editScheduleNonProjectTime" class="modal fade" tabindex="-1" role="dialog" style="display: none;" data-backdrop="static">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content" id="nonProjectTimeReload">
|
|
</div> <!-- / .modal-content -->
|
|
</div> <!-- / .modal-dialog -->
|
|
</div> <!-- /.modal -->
|
|
<!-- / Modal -->
|
|
<!-- Warning modal alert -->
|
|
<div id="modal-warning" class="modal fade" tabindex="-1" role="dialog" style="display: none;">
|
|
<div class="modal-dialog">
|
|
@using (Ajax.BeginForm(new AjaxOptions()
|
|
{
|
|
HttpMethod = "POST",
|
|
OnBegin = "deleteNPTimeBegin();",
|
|
OnComplete = "deleteNPTimeCompleted();",
|
|
OnFailure = "deleteNPTimeFailure();",
|
|
OnSuccess = "deleteNPTimeSuccess();",
|
|
Url = Url.Action("DeleteNonProjectTime", "PeopleResource")
|
|
}))
|
|
{
|
|
@Html.AntiForgeryToken()
|
|
@Html.HiddenFor(model => model.Id)
|
|
<input type="hidden" id="deleteNPTimeId" name="deleteNPTimeId" />
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
|
|
<h4 class="modal-title">Delete Non-Project Time</h4>
|
|
</div>
|
|
<div class="modal-title"></div>
|
|
<div class="modal-body"><strong>Deleting this non-project time will affect all resources involved. Continue?</strong></div>
|
|
<div class="modal-footer">
|
|
<button type="submit" class="btn btn-danger">OK</button>
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
</div>
|
|
</div> <!-- / .modal-content -->
|
|
}
|
|
</div> <!-- / .modal-dialog -->
|
|
</div> <!-- / .modal -->
|