139 lines
5.2 KiB
Plaintext
139 lines
5.2 KiB
Plaintext
@using EnVisage.Code.HtmlHelpers
|
|
@using Microsoft.AspNet.Identity
|
|
@using EnVisage.Code
|
|
@model EnVisage.Models.WorkFlowModel
|
|
|
|
@section scripts
|
|
{
|
|
<script type="text/javascript">
|
|
var ctr = 0;
|
|
init.push(function () {
|
|
$('#wfms').dataTable({
|
|
"bProcessing": true,
|
|
"bServerSide": true,
|
|
"bAutoWidth" : false,
|
|
"sAjaxSource": document.URL,
|
|
"sServerMethod": "POST",
|
|
"aoColumns": [
|
|
{
|
|
"mDataProp": "Name"
|
|
},
|
|
{
|
|
"mDataProp": "Area"
|
|
},
|
|
{
|
|
"mDataProp": "isActive",
|
|
"bSortable": false,
|
|
"bSearchable": false
|
|
},
|
|
{
|
|
"mDataProp": "ItemsInWorkFlow",
|
|
"bSortable": false,
|
|
"bSearchable": false
|
|
},
|
|
{
|
|
"mData": function (data, type, full) {
|
|
@if (SecurityManager.CheckSecurityObjectPermission(Areas.WorkFlowDefinitions, AccessLevel.Write))
|
|
{
|
|
<text>
|
|
ctr++;
|
|
return ('<a id="btnEdit_rplcmnt_ onclick="return CheckLock(this.id, \'wfl\', \'_rplcmnt_\')" data-toggle="popover" data-placement="left" ' + 'class="btn btn-sm btn-primary popover-warning popover-dark" onclick="showEditWfWindow(\'_rplcmnt_\');"><i class="fa fa-edit"></i> Edit</a> ' +
|
|
'<a id="btnDelete_rplcmnt_ onclick="return CheckLock(this.id, \'wfl\', \'_rplcmnt_\')" data-toggle="popover" data-placement="left" ' + (data.ItemsInWorkFlow > 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" ) onclick="deleteWf(\'_rplcmnt_\');"')+' ><i class="fa fa-trash-o"></i> Delete</a>')
|
|
.replace(/_rplcmnt_/g, data.Id);
|
|
</text>
|
|
}
|
|
else
|
|
{
|
|
<text>
|
|
|
|
return "";
|
|
|
|
</text>
|
|
|
|
}
|
|
}
|
|
,'bSortable':false}],
|
|
});
|
|
@if ( SecurityManager.CheckSecurityObjectPermission(Areas.WorkFlowDefinitions, AccessLevel.Write))
|
|
|
|
{
|
|
<text>
|
|
$('#wfms_wrapper .table-caption').html('<a class="btn btn-primary" onclick="showEditWfWindow(\'@Guid.Empty\');"><i class="fa fa-plus"></i> Add Workflow Process</a>');
|
|
</text>
|
|
}
|
|
$('#wfms_wrapper .dataTables_filter input').attr('placeholder', 'Search...');
|
|
$('#wfms_wrapper .dataTables_processing').addClass("table-caption");
|
|
$('#wfms_wrapper .dataTables_processing').html('<span class="h3"><img class="valign-middle" src="../Content/images/loadFA.gif"/></span>');
|
|
});
|
|
function showEditWfWindow(wfid) {
|
|
|
|
$.get('@Url.Action("Edit", "WorkFlowDefinition")?id=' + wfid, function (data) {
|
|
$('#divEditWorkFlow').html(data);
|
|
$('#modalEditWorkFlow').modal("show");
|
|
initUdf();
|
|
}).fail(function () {
|
|
showErrorModal('Oops...', 'An error occurred while processing your request. Please, try again later.');
|
|
});
|
|
};
|
|
|
|
function deleteWf(wfid) {
|
|
if (!wfid)
|
|
return;
|
|
|
|
bootbox.confirm({
|
|
message: "Are you sure you want to delete this WorkFlow process?",
|
|
callback: function (result) {
|
|
if (result) {
|
|
var text = "@Url.Action("Delete", "WorkFlowDefinition", new { Id = "JSVar" })".replace("JSVar", wfid);
|
|
$.post(text, function () {
|
|
blockUI();
|
|
refreshwfls();
|
|
}).fail(function () {
|
|
showErrorModal('Oops...', 'An error occurred while processing your request. Please, try again later.');
|
|
}).always(unblockUI);
|
|
}
|
|
},
|
|
className: "bootbox-sm"
|
|
});
|
|
};
|
|
|
|
function closeEditwflWindow(RedirectUrl) {
|
|
$('#modalEditWorkFlow').modal("hide");
|
|
if (RedirectUrl)
|
|
window.location.replace(RedirectUrl);
|
|
|
|
};
|
|
function refreshwfls() {
|
|
blockUI();
|
|
$('#wfms').DataTable().ajax.reload(unblockUI, false);
|
|
};
|
|
</script>
|
|
}
|
|
|
|
<div class="table-light table-responsive">
|
|
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="wfms">
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
WorkFlow Name
|
|
</th>
|
|
<th>
|
|
Area
|
|
</th>
|
|
<th>
|
|
Active
|
|
</th>
|
|
|
|
<th>
|
|
Items using workflow
|
|
</th>
|
|
<th style="width:229px;"></th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
<div id="modalEditWorkFlow" class="modal fade" data-width="600" tabindex="-1" role="dialog" style="display: none;" data-backdrop="static">
|
|
<div class="modal-dialog" id="divEditWorkFlow">
|
|
</div> <!-- / .modal-dialog -->
|
|
</div> <!-- / .modal -->
|
|
|