initial add
This commit is contained in:
		| @ -0,0 +1,272 @@ | ||||
|     <div class="panel panel-default" style="font-size: 10px"> | ||||
|         <div class="panel-info" style="font-size: 11px"> | ||||
|             <div class="panel-heading"> | ||||
|                 <h5 style="font-weight:600">Approvers</h5> | ||||
|                 @if (ViewBag.ShowAddApprovers == true) | ||||
|                 { | ||||
|                     <button class="k-textbox" data-toggle="modal" id="additionalApprovers"> | ||||
|                         Additional Approvers | ||||
|                     </button> | ||||
|                 } | ||||
|             </div> | ||||
|         </div> | ||||
|         <div class="panel-body bg-warning"> | ||||
|             <div class="col-sm-offset-0"> | ||||
|  | ||||
|                 @(Html.Kendo().Grid<Fab2ApprovalSystem.ViewModels.ApproversListViewModel>() | ||||
|                     .Name("ApproversList") | ||||
|                     .Columns(columns => | ||||
|                     { | ||||
|                         columns.Bound(a => a.UserID).Visible(false); | ||||
|                         columns.Bound(a => a.ApprovalID).Visible(false); | ||||
|                         columns.Bound(a => a.FullName); | ||||
|                         columns.Bound(a => a.RoleName); | ||||
|                         columns.Bound(a => a.SubRoleName); | ||||
|                         columns.Bound(a => a.Status); | ||||
|                         columns.Bound(a => a.AssignedDate).Format("{0:MM/dd/yy hh:mm:ss}"); ; | ||||
|                         columns.Bound(a => a.CompletedDate).Format("{0:MM/dd/yy hh:mm:ss}"); ; | ||||
|                         columns.Bound(a => a.Comments); | ||||
|  | ||||
|                         if (ViewBag.ShowReAssignApprovers) | ||||
|                         { | ||||
|                             columns.Command(command => command.Custom("Re-Assign").Click("showReAssignRole")).Width("100px"); | ||||
|                         } | ||||
|  | ||||
|                     }) | ||||
|                     .Sortable() | ||||
|                     .Scrollable() | ||||
|                     .HtmlAttributes(new { style = "height:200px; width:100%; font-size: 10px" }) | ||||
|                     .DataSource(dataSource => dataSource | ||||
|                         .Ajax() | ||||
|                         .ServerOperation(false) | ||||
|                         .Model(model => | ||||
|                         { | ||||
|                             model.Id(p => p.ApprovalID); | ||||
|                         }) | ||||
|                         .PageSize(20) | ||||
|                                 .Read(read => read.Action("GetApproversList", "PartsRequest", new { issueID = Model.PRNumber, step = Model.CurrentStep })) | ||||
|                         .Sort(s => | ||||
|                         { | ||||
|                             s.Add("CompletedDate").Ascending(); | ||||
|                         }) | ||||
|                     ) | ||||
|                     .Resizable(resize => resize.Columns(true)) | ||||
|  | ||||
|                 ) | ||||
|  | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|  | ||||
| <div class="modal fade" id="ReAssignApproval" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static"> | ||||
|     <div class="modal-dialog"> | ||||
|         <div class="modal-content"> | ||||
|             <div class="modal-header"> | ||||
|                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||||
|                 <h4 class="modal-title" id="myModalLabel">Re-Assign for Approval From: <label class="bg-danger" id="ReAssignApproverFromLabel">Me</label></h4> | ||||
|                 <input type="hidden" id="ReAssignApproverFromUserID"/> | ||||
|             </div> | ||||
|             <div class="modal-body"> | ||||
|                 <div class="control-group"> | ||||
|                     <div class="controls"> | ||||
|                         <h4 class="modal-title" id="myModalLabel">Re-Assign for Approval to:</h4> | ||||
|                         <div id='lstReAssignApproval'> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
|             <div class="modal-footer"> | ||||
|                 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | ||||
|                 <button type="button" class="btn btn-primary" id="ConfirmReAssignment">Confirm Re-assignment</button> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| <div class="modal fade" id="AdditionalApproval" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static"> | ||||
|     <div class="modal-dialog"> | ||||
|         <div class="modal-content"> | ||||
|             <div class="modal-header"> | ||||
|                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||||
|                 <h4 class="modal-title" id="myModalLabel">Add New Approvers:</h4> | ||||
|             </div> | ||||
|             <div class="modal-body"> | ||||
|                 <div class="control-group"> | ||||
|                     <div class="controls"> | ||||
|                         <div id='lstAdditionalApproval'> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
|             <div class="modal-footer"> | ||||
|                 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | ||||
|                 <button type="button" class="btn btn-primary" id="confirmAdditionalApproval">Confirm Additional Approver</button> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
|  | ||||
| <script type="text/javascript"> | ||||
|  | ||||
|     function showReAssignRole(e) { | ||||
|  | ||||
|         e.preventDefault(); | ||||
|         var dataItem = this.dataItem($(e.currentTarget).closest("tr")); | ||||
|  | ||||
|         $('#ReAssignApproverFromLabel').text(dataItem.FullName); | ||||
|         $('#ReAssignApproverFromUserID').val(dataItem.UserID); | ||||
|         var issueID = GetPRNumber(); | ||||
|         reAssignFromUserid = dataItem.UserID; | ||||
|  | ||||
|         if (dataItem.Status.indexOf("Pending") < 0) | ||||
|             alert("Cannot ReAssign, because it is not in a Pending state"); | ||||
|         else { | ||||
|  | ||||
|             var searchText = ($("#txtSearch").val()); | ||||
|             var url = "/PartsRequest/GetAllUsersList"; | ||||
|             var source = | ||||
|             { | ||||
|                 datatype: "json", | ||||
|                 datafields: [ | ||||
|                     { name: 'UserID' }, | ||||
|                     { name: 'FullName' } | ||||
|                 ], | ||||
|                 id: 'id', | ||||
|                 url: url, | ||||
|             }; | ||||
|             var dataAdapter = new $.jqx.dataAdapter(source); | ||||
|  | ||||
|             // Create a jqxListBox | ||||
|             $("#lstReAssignApproval").jqxListBox({ | ||||
|                 multipleextended: false, theme: "arctic", source: dataAdapter, displayMember: "FullName", valueMember: "UserID", width: 200, height: 250 | ||||
|             }); | ||||
|  | ||||
|             $("#ReAssignApproval").modal('show'); | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     $('#ConfirmReAssignment').on('click', function () { | ||||
|         // get selected items. | ||||
|         var bfound = false; | ||||
|         var userids; | ||||
|         var itemsToAdd = $('#lstReAssignApproval').jqxListBox('getSelectedItems'); | ||||
|  | ||||
|         if (itemsToAdd.length > 0) { | ||||
|             for (var i = 0; i < itemsToAdd.length; i++) { | ||||
|                 if (itemsToAdd[i].label != undefined) { | ||||
|                     var tempvalue = itemsToAdd[i].value; | ||||
|                     var templabel = itemsToAdd[i].label; | ||||
|                     if (userids == null) | ||||
|                         userids = tempvalue; | ||||
|                     else | ||||
|                         userids += "~" + tempvalue; | ||||
|                 } | ||||
|             }; | ||||
|             if (userids != null) { | ||||
|                 ReAssignApproval(userids); | ||||
|             } | ||||
|             $("#ReAssignApproval").modal('hide'); | ||||
|  | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|     }); | ||||
|  | ||||
|     var ReAssignApproval = function (userids) { | ||||
|  | ||||
|         var urlString = '/PartsRequest/ReAssignApproval'; | ||||
|         $.ajax({ | ||||
|             type: "POST", | ||||
|             url: urlString, | ||||
|             data: { | ||||
|                 userIDs: userids, | ||||
|                 issueID: GetPRNumber(), | ||||
|                 step: $("#currentStep").val(), | ||||
|                 fromUserID: $('#ReAssignApproverFromUserID').val(), | ||||
|             }, | ||||
|             success: function (result) { | ||||
|                 alert('Approval re-assigned'); | ||||
|                 ReloadUI(); | ||||
|             }, | ||||
|             error: function (xhr, ajaxOptions, thrownError) { | ||||
|                 DisplayAPIError("Re-Assign Approval", xhr); | ||||
|             }, | ||||
|         }); | ||||
|     }; | ||||
|  | ||||
|     $('#additionalApprovers').on('click', function () { | ||||
|  | ||||
|         var searchText = ($("#txtSearch").val()); | ||||
|         var url = "/PartsRequest/GetAllUsersList"; | ||||
|         var source = | ||||
|         { | ||||
|             datatype: "json", | ||||
|             datafields: [ | ||||
|                 { name: 'UserID' }, | ||||
|                 { name: 'FullName' } | ||||
|             ], | ||||
|             id: 'id', | ||||
|             url: url, | ||||
|         }; | ||||
|         var dataAdapter = new $.jqx.dataAdapter(source); | ||||
|         // Create a jqxListBox | ||||
|         $("#lstAdditionalApproval").jqxListBox({ | ||||
|             multipleextended: true, theme: "arctic", source: dataAdapter, displayMember: "FullName", valueMember: "UserID", width: 200, height: 250 | ||||
|         }); | ||||
|  | ||||
|         $("#AdditionalApproval").modal('show'); | ||||
|         return false; | ||||
|     }) | ||||
|  | ||||
|     $('#confirmAdditionalApproval').on('click', function () { | ||||
|         // get selected items. | ||||
|         var bfound = false; | ||||
|         var userids; | ||||
|         var itemsToAdd = $('#lstAdditionalApproval').jqxListBox('getSelectedItems'); | ||||
|         if (itemsToAdd.length > 0) { | ||||
|             for (var i = 0; i < itemsToAdd.length; i++) { | ||||
|                 if (itemsToAdd[i].label != undefined) { | ||||
|                     var tempvalue = itemsToAdd[i].value; | ||||
|                     var templabel = itemsToAdd[i].label; | ||||
|                     if (userids == null) | ||||
|                         userids = tempvalue; | ||||
|                     else | ||||
|                         userids += "~" + tempvalue; | ||||
|                 } | ||||
|             }; | ||||
|             if (userids != null) { | ||||
|                 AssignAdditionalApproval(userids); | ||||
|             } | ||||
|             $("#AdditionalApproval").modal('hide'); | ||||
|             return false; | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|     var AssignAdditionalApproval = function (userids) { | ||||
|  | ||||
|         var urlString = '/PartsRequest/AddAdditionalApproval'; | ||||
|         $.ajax({ | ||||
|             type: "POST", | ||||
|             url: urlString, | ||||
|             data: { | ||||
|                 userIDs: userids, | ||||
|                 issueID: GetPRNumber(), | ||||
|                 step: $("#currentStep").val() | ||||
|             }, | ||||
|             success: function (result) { | ||||
|                 var grid = $("#ApproversList").data("kendoGrid"); | ||||
|                 grid.dataSource.read(GetPRNumber(), $("#currentStep").val());             | ||||
|             }, | ||||
|             error: function (result) { | ||||
|                 alert("Failed " + result); | ||||
|             } | ||||
|  | ||||
|         }); | ||||
|  | ||||
|     }; | ||||
|  | ||||
|  | ||||
| </script> | ||||
		Reference in New Issue
	
	Block a user