Added ability to unlock Corrective Actions when locked for editing.

This commit is contained in:
Daniel Wathen 2023-03-02 11:54:50 -07:00
parent adad38b849
commit a2b2e04f1f
12 changed files with 382 additions and 265 deletions

Binary file not shown.

View File

@ -321,6 +321,25 @@ namespace Fab2ApprovalSystem.Controllers
return View(ca);
}
public void ReleaseLockOnDocumentAdmin(int issueID)
{
try
{
caDMO.ReleaseLockOnDocument(-1, issueID);
}
catch (Exception e)
{
try
{
Functions.WriteEvent(@User.Identity.Name + "\r\n ReleaseLockOnDocument CA\r\n" + issueID.ToString() + "\r\n" + e.Message, System.Diagnostics.EventLogEntryType.Error);
}
catch { }
caDMO.ReleaseLockOnDocument(-1, issueID);
}
}
/// <summary>
///

View File

@ -884,6 +884,7 @@ namespace Fab2ApprovalSystem.DMO
}
}
public IEnumerable<IssuesViewModel> GetECNList()
{
var parameters = new DynamicParameters();

View File

@ -213,6 +213,7 @@ namespace Fab2ApprovalSystem.Models
public DateTime? ApprovedDate { get; set; }
public bool RecordLockIndicator { get; set; }
public int RecordLockedBy { get; set; }
public string RecordLockByName { get; set; }
public bool RecordLocked { get; set; }
public DateTime RecordLockedDate { get; set; }
public DateTime LastUpdateDate { get; set; }

View File

@ -160,6 +160,32 @@
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<div class="control-group">
<div class="controls">
<div class="controls">
<label for="AssignDelegate">Assign Delegate?</label>
<input type="checkbox" name="AssignDelegate" id="AssignDelegate" value="false" onclick="toggleDelegate()" />
<p>*Please assign a delegate if this user will be assigned tasks while Out of Office.</p>
</div>
</div>
</div>
</div>
</div>
<br />
<div class="row hiddenDelegate" id="delegateLabel">
<div class="col-sm-12">
<div class="control-group">
<div class="controls">
<div class="controls">
<label for="CurrentUser">Delegate To:</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@ -465,6 +491,10 @@
<script>
function toggleDelegate() {
document.getElementById("delegateControl").classList.toggle("hiddenDelegate");
document.getElementById("delegateLabel").classList.toggle("hiddenDelegate");
}
function error_handler(e) {
alert("Error during the operation");
@ -577,10 +607,16 @@
$('#SaveOOOInfo').on('click', function () {
var bfound = false;
//var currentDate = new Date();
var delegate = "";
var isChecked = $("#AssignDelegate").is(":checked");
if (isChecked === true)
delegate = $("#DelegateTo").data("kendoDropDownList").value();
if (userid == $("#DelegateTo").data("kendoDropDownList").value())
{
else
delegate = "0";
if (userid == delegate) {
alert('The OOO person cannot be same as the delegate to person');
return false;
}
@ -630,7 +666,7 @@
url: urlString,
data: {
oooUserID: userid,
delegatedTo: $("#DelegateTo").data("kendoDropDownList").value(),
delegatedTo: delegate,
startDate: $("#txtStartDate").val(),
endDate: $("#txtEndDate").val(),
},

View File

@ -44,18 +44,66 @@
<div class="panel panel-default center-block" data-spy="affix">
<input type="button" value="Back to CA List" class="btn btn-primary btn-xs" id="CAList" />
<input type="button" value="Section Approval Log" class="btn btn-primary btn-xs" id="ShowSectionApprovalLog" />
@if (Session[GlobalVars.IS_ADMIN] != null)
{
<input type="button" value="Unlock Document" class="btn btn-primary btn-xs" id="UnlockDocumentBtn" onclick="UnlockDocument()" />
}
</div>
</div>
<div class="panel panel-default center-block" style="font-size: 10px">
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-body bg-warning">
<div class="row">
<div class="col-sm-12 text-center">
<div class="col-sm-4">
<div class="row">
<div class="col-sm-3">
</div>
<div class="col-sm-3">
</div>
<div class="col-sm-6">
</div>
</div>
</div>
<div class="col-sm-4 text-center">
<div class="row">
<div class="col-sm-12">
<font style="color: crimson; font-size:24px;font-weight: bolder">
Corrective Action
</font>
</div>
</div>
</div>
<div class="col-sm-4 text-right">
<div class="row">
<div class="col-sm-12">
<font style="color:crimson">
@if (Model.RecordLockByName == null)
{
<h4>
<font style="color:red">
Mode: [Readonly]
</font>
</h4>
}
else
{
<h4>
<font style="color:red">
Mode: [Readonly] - Locked for Editing by <font style="color: green; font-weight:bold; font-style:italic">@Model.RecordLockByName</font>
</font>
</h4>
}
</font>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-body bg-danger">
@ -1559,7 +1607,6 @@
)
.Resizable(resize => resize.Columns(true))
)
}
@ -1681,7 +1728,25 @@
}
function UnlockDocument() {
$.ajax({
url: "/CorrectiveAction/ReleaseLockOnDocumentAdmin",
type: "GET",
datatype: "json",
data: {
issueID: ("@Model.CANo")
},
success: function () {
alert('Document Unlocked!');
var url = '@Url.Action("ReadOnlyCA", "CorrectiveAction", new { caNo = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', @Model.CANo);
},
error: function (result) {
alert("ReleaseLockOnDocument - Failed " + result);
}
});
}

View File

@ -153,10 +153,10 @@
<div class="col-sm-6">
@Html.TextBoxFor(model => model.Title, new { id = "txtTitle", @class = "k-textbox", style = "width:100%" })
</div>
<div class="col-sm-6 col-sm-offset-4" style="color:red;">
<div class="col-sm-6 col-sm-offset-4" style="color: red;">
*(DO NOT USE Rev I, O, Q, S, X, and Z)
</div>
<div class="col-sm-6 col-sm-offset-4" style="color:red;">
<div class="col-sm-6 col-sm-offset-4" style="color: red;">
Revision Y is followed by AA. YY is followed by AAA
</div>
</div>
@ -170,7 +170,7 @@
.Value(ViewBag.Nothing)
)
</div>
<div class="col-sm-6" style="left:40%;color:red;">
<div class="col-sm-6 col-sm-offset-4" style="color:red;">
Add minimum of Quality, Si Production, and Dept Specfic
</div>
</div>

View File

@ -371,17 +371,12 @@
var delegate = "";
var isChecked = $("#AssignDelegate").is(":checked");
console.log(isChecked);
if (isChecked === true)
delegate = $("#DelegateTo").data("kendoDropDownList").value();
else
delegate = "0";
console.log(delegate);
if (userid == delegate)
{
alert('The OOO person cannot be same as the delegate to person');