Update: Support Ajax and Form Post for Finance

This commit is contained in:
Gary Sharp
2013-03-26 14:42:58 +11:00
parent e422bf163d
commit 9eaae3193f
27 changed files with 495 additions and 368 deletions
@@ -1,96 +1,43 @@
@model Disco.Web.Models.Job.ShowModel
<table id="jobNonWarrantyFinance">
<tr>
<th style="width: 200px;">
Accounting Charge Required
<th style="width: 200px;">Accounting Charge Required
</th>
<td>
@Html.EditorFor(m => m.Job.JobMetaNonWarranty.AccountingChargeRequiredDate)
@CommonHelpers.FriendlyDate(Model.Job.JobMetaNonWarranty.AccountingChargeRequiredDate, "Not Required", "Job_JobMetaNonWarranty_AccountingChargeRequiredDate")
<span id="Job_JobMetaNonWarranty_AccountingChargeRequiredUser">@(string.IsNullOrEmpty(Model.Job.JobMetaNonWarranty.AccountingChargeRequiredUserId) ? string.Empty : string.Format("by {0}", Model.Job.JobMetaNonWarranty.AccountingChargeRequiredUser.ToString()))</span>
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.DateChangeUserHelper(
$('#Job_JobMetaNonWarranty_AccountingChargeRequiredDate'),
$('#Job_JobMetaNonWarranty_AccountingChargeRequiredUser'),
'Not Required',
'@(Url.Action(MVC.API.Job.UpdateNonWarrantyAccountingChargeRequired(Model.Job.Id, null)))',
'AccountingChargeRequiredDate',
@(Model.Job.OpenedDate.ToJavascriptDate())
);
});
</script>
</td>
</tr>
<tr>
<th style="width: 200px;">
Accounting Charge Added
<th style="width: 200px;">Accounting Charge Added
</th>
<td>
@Html.EditorFor(m => m.Job.JobMetaNonWarranty.AccountingChargeAddedDate)
@CommonHelpers.FriendlyDate(Model.Job.JobMetaNonWarranty.AccountingChargeAddedDate, "Not Added", "Job_JobMetaNonWarranty_AccountingChargeAddedDate")
<span id="Job_JobMetaNonWarranty_AccountingChargeAddedUser">@(string.IsNullOrEmpty(Model.Job.JobMetaNonWarranty.AccountingChargeAddedUserId) ? string.Empty : string.Format("by {0}", Model.Job.JobMetaNonWarranty.AccountingChargeAddedUser.ToString()))</span>
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.DateChangeUserHelper(
$('#Job_JobMetaNonWarranty_AccountingChargeAddedDate'),
$('#Job_JobMetaNonWarranty_AccountingChargeAddedUser'),
'Not Added',
'@(Url.Action(MVC.API.Job.UpdateNonWarrantyAccountingChargeAdded(Model.Job.Id, null)))',
'AccountingChargeAddedDate',
@(Model.Job.OpenedDate.ToJavascriptDate())
);
});
</script>
</td>
</tr>
<tr>
<th style="width: 200px;">
Accounting Charge Paid
<th style="width: 200px;">Accounting Charge Paid
</th>
<td>
@Html.EditorFor(m => m.Job.JobMetaNonWarranty.AccountingChargePaidDate)
@CommonHelpers.FriendlyDate(Model.Job.JobMetaNonWarranty.AccountingChargePaidDate, "Not Paid", "Job_JobMetaNonWarranty_AccountingChargePaidDate")
<span id="Job_JobMetaNonWarranty_AccountingChargePaidUser">@(string.IsNullOrEmpty(Model.Job.JobMetaNonWarranty.AccountingChargePaidUserId) ? string.Empty : string.Format("by {0}", Model.Job.JobMetaNonWarranty.AccountingChargePaidUser.ToString()))</span>
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.DateChangeUserHelper(
$('#Job_JobMetaNonWarranty_AccountingChargePaidDate'),
$('#Job_JobMetaNonWarranty_AccountingChargePaidUser'),
'Not Paid',
'@(Url.Action(MVC.API.Job.UpdateNonWarrantyAccountingChargePaid(Model.Job.Id, null)))',
'AccountingChargePaidDate',
@(Model.Job.OpenedDate.ToJavascriptDate())
);
});
</script>
</td>
</tr>
<tr>
<th style="width: 200px;">
Purchase Order Raised
<th style="width: 200px;">Purchase Order Raised
</th>
<td>
@Html.EditorFor(m => m.Job.JobMetaNonWarranty.PurchaseOrderRaisedDate)
@CommonHelpers.FriendlyDate(Model.Job.JobMetaNonWarranty.PurchaseOrderRaisedDate, "Not Raised", "Job_JobMetaNonWarranty_PurchaseOrderRaisedDate")
<span id="Job_JobMetaNonWarranty_PurchaseOrderRaisedUser">@(string.IsNullOrEmpty(Model.Job.JobMetaNonWarranty.PurchaseOrderRaisedUserId) ? string.Empty : string.Format("by {0}", Model.Job.JobMetaNonWarranty.PurchaseOrderRaisedUser.ToString()))</span>
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.DateChangeUserHelper(
$('#Job_JobMetaNonWarranty_PurchaseOrderRaisedDate'),
$('#Job_JobMetaNonWarranty_PurchaseOrderRaisedUser'),
'Not Raised',
'@(Url.Action(MVC.API.Job.UpdateNonWarrantyPurchaseOrderRaised(Model.Job.Id, null)))',
'PurchaseOrderRaisedDate',
@(Model.Job.OpenedDate.ToJavascriptDate())
);
});
</script>
</td>
</tr>
<tr>
<th>
Purchase Order Reference
<th>Purchase Order Reference
</th>
<td>
@Html.TextBoxFor(m => m.Job.JobMetaNonWarranty.PurchaseOrderReference)
@@ -138,47 +85,165 @@
</td>
</tr>
<tr>
<th style="width: 200px;">
Purchase Order Sent
<th style="width: 200px;">Purchase Order Sent
</th>
<td>
@Html.EditorFor(m => m.Job.JobMetaNonWarranty.PurchaseOrderSentDate)
@CommonHelpers.FriendlyDate(Model.Job.JobMetaNonWarranty.PurchaseOrderSentDate, "Not Sent", "Job_JobMetaNonWarranty_PurchaseOrderSentDate")
<span id="Job_JobMetaNonWarranty_PurchaseOrderSentUser">@(string.IsNullOrEmpty(Model.Job.JobMetaNonWarranty.PurchaseOrderSentUserId) ? string.Empty : string.Format("by {0}", Model.Job.JobMetaNonWarranty.PurchaseOrderSentUser.ToString()))</span>
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.DateChangeUserHelper(
$('#Job_JobMetaNonWarranty_PurchaseOrderSentDate'),
$('#Job_JobMetaNonWarranty_PurchaseOrderSentUser'),
'Not Sent',
'@(Url.Action(MVC.API.Job.UpdateNonWarrantyPurchaseOrderSent(Model.Job.Id, null)))',
'PurchaseOrderSentDate',
@(Model.Job.OpenedDate.ToJavascriptDate())
);
});
</script>
</td>
</tr>
<tr>
<th style="width: 200px;">
Invoice Received
<th style="width: 200px;">Invoice Received
</th>
<td>
@Html.EditorFor(m => m.Job.JobMetaNonWarranty.InvoiceReceivedDate)
@CommonHelpers.FriendlyDate(Model.Job.JobMetaNonWarranty.InvoiceReceivedDate, "Not Received", "Job_JobMetaNonWarranty_InvoiceReceivedDate")
<span id="Job_JobMetaNonWarranty_InvoiceReceivedUser">@(string.IsNullOrEmpty(Model.Job.JobMetaNonWarranty.InvoiceReceivedUserId) ? string.Empty : string.Format("by {0}", Model.Job.JobMetaNonWarranty.InvoiceReceivedUser.ToString()))</span>
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.DateChangeUserHelper(
$('#Job_JobMetaNonWarranty_InvoiceReceivedDate'),
$('#Job_JobMetaNonWarranty_InvoiceReceivedUser'),
'Not Received',
'@(Url.Action(MVC.API.Job.UpdateNonWarrantyInvoiceReceived(Model.Job.Id, null)))',
'InvoiceReceivedDate',
@(Model.Job.OpenedDate.ToJavascriptDate())
);
});
</script>
</td>
</tr>
</table>
<script>
(function(){
var baseUpdateUrl = '@(Url.Action(MVC.API.Job.Update(Model.Job.Id, null)))';
var dialog, dialogForm, dialogHeader, dialogDateBox, dialogDatePropertyNameBox;
var friendlyName, dateField, userField, updatePropertyName, notSetDisplay, minDate, useAjax;
function dateDialogGet(){
if (!dialog){
dialog = $('<div>').attr({'class': 'dialog'})
dialogForm = $('<form>').attr({'action': baseUpdateUrl, 'method': 'post'}).appendTo(dialog);
var dialogBody = $('<p>').appendTo(dialogForm);
dialogHeader = $('<h3>').attr('autofocus', 'autofocus').appendTo(dialogBody);
dialogDatePropertyNameBox = $('<input>').attr({'type': 'hidden', 'name': 'key'}).appendTo(dialogBody);
dialogDateBox = $('<input>').attr({'type': 'datetime', 'name': 'value'}).css({'display': 'block', 'margin-top': 15, 'margin-left': 'auto', 'margin-right': 'auto' }).appendTo(dialogBody);
$('<input>').attr({'type': 'hidden', 'name': 'redirect'}).val('true').appendTo(dialogBody);
dialog.dialog({
resizable: false,
modal: true,
autoOpen: false,
buttons: {
"Update": dateDialogUpdate,
Cancel: function () {
$(this).dialog("close");
}
},
open: function(){
dialog.dialog('widget').find('.ui-dialog-buttonpane :tabbable:first').focus();
}
});
dialogDateBox.datetimepicker({
defaultDate: new Date(),
ampm: true,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
});
}
return dialog;
}
function dateDialogUpdate(){
var dateValue = dialogDateBox.val();
if (useAjax){
// Use Ajax
var $dateField, $userField;
$dateField = $('#' + dateField);
if (userField)
$userField = $('#' + userField);
dialog.dialog("close");
var $ajaxLoading = ($userField ? $userField.next('.ajaxLoading') : $dateField.next('.ajaxLoading')).show();
var data = {
key: updatePropertyName,
value: dateValue
};
$.getJSON(baseUpdateUrl, data, function (response, result) {
if (result != 'success' || response.Result != 'OK') {
alert('Unable to change ' + friendlyName + ' Date:\n' + response);
$ajaxLoading.hide();
} else {
if (response.DateTimeFull){
$dateField.attr('data-datetimeformatted', response.DateTimeJavascript)
.attr('data-discodatetime', response.DateTimeSortable)
.attr('title', response.DateTimeFull)
.text(response.DateTimeFriendly);
}else{
$dateField.attr('data-datetimeformatted', '')
.attr('data-discodatetime', '-1')
.attr('title', notSetDisplay)
.text(notSetDisplay);
}
if ($userField)
$userField.text('by ' + response.UserDescription);
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
}else{
// Post Form & Redirect
dialog.dialog("disable");
dialog.dialog("option", "buttons", null);
dialogDatePropertyNameBox.val(updatePropertyName);
dialogForm.submit();
}
}
function dateDialogOpen(FriendlyName, DateField, UserField, UpdatePropertyName, NotSetDisplay, MinDate, UseAjax){
friendlyName = FriendlyName;
dateField = DateField;
userField = UserField;
updatePropertyName = UpdatePropertyName;
notSetDisplay = NotSetDisplay;
minDate = MinDate;
useAjax = UseAjax;
var d = dateDialogGet();
d.dialog('option', 'title', friendlyName);
dialogHeader.text(friendlyName + ' Date');
var dfVal = $('#' + DateField).attr('data-datetimeformatted');
if (dfVal)
dialogDateBox.datetimepicker('setDate', new Date(dfVal));
else
dialogDateBox.datetimepicker('setDate', new Date());
if (MinDate)
dialogDateBox.datetimepicker('option', 'minDate', MinDate);
else
dialogDateBox.datetimepicker('option', 'minDate', null);
d.dialog('open');
}
function dateDialogCreateUpdater(FriendlyName, DateField, UserField, UpdatePropertyName, NotSetDisplay, MinDate, UseAjax){
$('<a>').attr({href: '#', 'class': 'button small', style: 'margin-right: 5px;'}).text('Update').click(function(event){
event.preventDefault();
dateDialogOpen(FriendlyName, DateField, UserField, UpdatePropertyName, NotSetDisplay, MinDate, UseAjax);
}).insertBefore('#' + DateField);
}
if (!document.DiscoFunctions)
document.DiscoFunctions = {};
if (!document.DiscoFunctions.DateDialogCreateUpdater)
document.DiscoFunctions.DateDialogCreateUpdater = dateDialogCreateUpdater;
})();
$(function(){
var jobOpenDate = '@(Model.Job.OpenedDate.ToJavascriptDateTime())';
document.DiscoFunctions.DateDialogCreateUpdater('Accounting Charge Required', 'Job_JobMetaNonWarranty_AccountingChargeRequiredDate', 'Job_JobMetaNonWarranty_AccountingChargeRequiredUser', 'NonWarrantyAccountingChargeRequired', 'Not Required', jobOpenDate, false);
document.DiscoFunctions.DateDialogCreateUpdater('Accounting Charge Added', 'Job_JobMetaNonWarranty_AccountingChargeAddedDate', 'Job_JobMetaNonWarranty_AccountingChargeAddedUser', 'NonWarrantyAccountingChargeAdded', 'Not Added', jobOpenDate, false);
document.DiscoFunctions.DateDialogCreateUpdater('Accounting Charge Paid', 'Job_JobMetaNonWarranty_AccountingChargePaidDate', 'Job_JobMetaNonWarranty_AccountingChargePaidUser', 'NonWarrantyAccountingChargePaid', 'Not Paid', jobOpenDate, false);
document.DiscoFunctions.DateDialogCreateUpdater('Purchase Order Raised', 'Job_JobMetaNonWarranty_PurchaseOrderRaisedDate', 'Job_JobMetaNonWarranty_PurchaseOrderRaisedUser', 'NonWarrantyPurchaseOrderRaised', 'Not Raised', jobOpenDate, true);
document.DiscoFunctions.DateDialogCreateUpdater('Purchase Order Sent', 'Job_JobMetaNonWarranty_PurchaseOrderSentDate', 'Job_JobMetaNonWarranty_PurchaseOrderSentUser', 'NonWarrantyPurchaseOrderSent', 'Not Sent', jobOpenDate, true);
document.DiscoFunctions.DateDialogCreateUpdater('Invoice Received', 'Job_JobMetaNonWarranty_InvoiceReceivedDate', 'Job_JobMetaNonWarranty_InvoiceReceivedUser', 'NonWarrantyInvoiceReceived', 'Not Received', jobOpenDate, true);
});
</script>
@@ -31,9 +31,9 @@ namespace Disco.Web.Views.Job.JobParts
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Job/JobParts/NonWarrantyFinance.cshtml")]
public class NonWarrantyFinance : System.Web.Mvc.WebViewPage<Disco.Web.Models.Job.ShowModel>
public partial class NonWarrantyFinance : System.Web.Mvc.WebViewPage<Disco.Web.Models.Job.ShowModel>
{
public NonWarrantyFinance()
{
@@ -48,13 +48,13 @@ WriteLiteral(">\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px;\"");
WriteLiteral(">\r\n Accounting Charge Required\r\n </th>\r\n <td>\r\n");
WriteLiteral(">Accounting Charge Required\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 8 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Html.EditorFor(m => m.Job.JobMetaNonWarranty.AccountingChargeRequiredDate));
#line 7 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(CommonHelpers.FriendlyDate(Model.Job.JobMetaNonWarranty.AccountingChargeRequiredDate, "Not Required", "Job_JobMetaNonWarranty_AccountingChargeRequiredDate"));
#line default
@@ -66,7 +66,7 @@ WriteLiteral(" id=\"Job_JobMetaNonWarranty_AccountingChargeRequiredUser\"");
WriteLiteral(">");
#line 9 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 8 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(string.IsNullOrEmpty(Model.Job.JobMetaNonWarranty.AccountingChargeRequiredUserId) ? string.Empty : string.Format("by {0}", Model.Job.JobMetaNonWarranty.AccountingChargeRequiredUser.ToString()));
@@ -77,54 +77,23 @@ WriteLiteral("</span>\r\n");
WriteLiteral(" ");
#line 10 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 9 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
document.DiscoFunctions.DateChangeUserHelper(
$('#Job_JobMetaNonWarranty_AccountingChargeRequiredDate'),
$('#Job_JobMetaNonWarranty_AccountingChargeRequiredUser'),
'Not Required',
'");
#line 17 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Url.Action(MVC.API.Job.UpdateNonWarrantyAccountingChargeRequired(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral("\',\r\n \'AccountingChargeRequiredDate\',\r\n");
WriteLiteral(" ");
#line 19 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Model.Job.OpenedDate.ToJavascriptDate());
#line default
#line hidden
WriteLiteral("\r\n );\r\n });\r\n </script>\r\n " +
" </td>\r\n </tr>\r\n <tr>\r\n <th");
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px;\"");
WriteLiteral(">\r\n Accounting Charge Added\r\n </th>\r\n <td>\r\n");
WriteLiteral(">Accounting Charge Added\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 30 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Html.EditorFor(m => m.Job.JobMetaNonWarranty.AccountingChargeAddedDate));
#line 16 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(CommonHelpers.FriendlyDate(Model.Job.JobMetaNonWarranty.AccountingChargeAddedDate, "Not Added", "Job_JobMetaNonWarranty_AccountingChargeAddedDate"));
#line default
@@ -136,7 +105,7 @@ WriteLiteral(" id=\"Job_JobMetaNonWarranty_AccountingChargeAddedUser\"");
WriteLiteral(">");
#line 31 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 17 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(string.IsNullOrEmpty(Model.Job.JobMetaNonWarranty.AccountingChargeAddedUserId) ? string.Empty : string.Format("by {0}", Model.Job.JobMetaNonWarranty.AccountingChargeAddedUser.ToString()));
@@ -147,54 +116,23 @@ WriteLiteral("</span>\r\n");
WriteLiteral(" ");
#line 32 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 18 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
document.DiscoFunctions.DateChangeUserHelper(
$('#Job_JobMetaNonWarranty_AccountingChargeAddedDate'),
$('#Job_JobMetaNonWarranty_AccountingChargeAddedUser'),
'Not Added',
'");
#line 39 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Url.Action(MVC.API.Job.UpdateNonWarrantyAccountingChargeAdded(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral("\',\r\n \'AccountingChargeAddedDate\',\r\n");
WriteLiteral(" ");
#line 41 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Model.Job.OpenedDate.ToJavascriptDate());
#line default
#line hidden
WriteLiteral("\r\n );\r\n });\r\n </script>\r\n " +
" </td>\r\n </tr>\r\n <tr>\r\n <th");
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px;\"");
WriteLiteral(">\r\n Accounting Charge Paid\r\n </th>\r\n <td>\r\n");
WriteLiteral(">Accounting Charge Paid\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 52 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Html.EditorFor(m => m.Job.JobMetaNonWarranty.AccountingChargePaidDate));
#line 25 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(CommonHelpers.FriendlyDate(Model.Job.JobMetaNonWarranty.AccountingChargePaidDate, "Not Paid", "Job_JobMetaNonWarranty_AccountingChargePaidDate"));
#line default
@@ -206,7 +144,7 @@ WriteLiteral(" id=\"Job_JobMetaNonWarranty_AccountingChargePaidUser\"");
WriteLiteral(">");
#line 53 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 26 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(string.IsNullOrEmpty(Model.Job.JobMetaNonWarranty.AccountingChargePaidUserId) ? string.Empty : string.Format("by {0}", Model.Job.JobMetaNonWarranty.AccountingChargePaidUser.ToString()));
@@ -217,54 +155,23 @@ WriteLiteral("</span>\r\n");
WriteLiteral(" ");
#line 54 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 27 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
document.DiscoFunctions.DateChangeUserHelper(
$('#Job_JobMetaNonWarranty_AccountingChargePaidDate'),
$('#Job_JobMetaNonWarranty_AccountingChargePaidUser'),
'Not Paid',
'");
#line 61 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Url.Action(MVC.API.Job.UpdateNonWarrantyAccountingChargePaid(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral("\',\r\n \'AccountingChargePaidDate\',\r\n");
WriteLiteral(" ");
#line 63 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Model.Job.OpenedDate.ToJavascriptDate());
#line default
#line hidden
WriteLiteral("\r\n );\r\n });\r\n </script>\r\n " +
" </td>\r\n </tr>\r\n <tr>\r\n <th");
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px;\"");
WriteLiteral(">\r\n Purchase Order Raised\r\n </th>\r\n <td>\r\n");
WriteLiteral(">Purchase Order Raised\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 74 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Html.EditorFor(m => m.Job.JobMetaNonWarranty.PurchaseOrderRaisedDate));
#line 34 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(CommonHelpers.FriendlyDate(Model.Job.JobMetaNonWarranty.PurchaseOrderRaisedDate, "Not Raised", "Job_JobMetaNonWarranty_PurchaseOrderRaisedDate"));
#line default
@@ -276,7 +183,7 @@ WriteLiteral(" id=\"Job_JobMetaNonWarranty_PurchaseOrderRaisedUser\"");
WriteLiteral(">");
#line 75 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 35 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(string.IsNullOrEmpty(Model.Job.JobMetaNonWarranty.PurchaseOrderRaisedUserId) ? string.Empty : string.Format("by {0}", Model.Job.JobMetaNonWarranty.PurchaseOrderRaisedUser.ToString()));
@@ -287,50 +194,19 @@ WriteLiteral("</span>\r\n");
WriteLiteral(" ");
#line 76 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 36 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
document.DiscoFunctions.DateChangeUserHelper(
$('#Job_JobMetaNonWarranty_PurchaseOrderRaisedDate'),
$('#Job_JobMetaNonWarranty_PurchaseOrderRaisedUser'),
'Not Raised',
'");
#line 83 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Url.Action(MVC.API.Job.UpdateNonWarrantyPurchaseOrderRaised(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral("\',\r\n \'PurchaseOrderRaisedDate\',\r\n");
WriteLiteral(" ");
#line 85 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Model.Job.OpenedDate.ToJavascriptDate());
#line default
#line hidden
WriteLiteral("\r\n );\r\n });\r\n </script>\r\n " +
" </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n Purchase Order Reference\r" +
"\n </th>\r\n <td>\r\n");
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>Purchase Order Reference\r\n " +
" </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 96 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 43 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Html.TextBoxFor(m => m.Job.JobMetaNonWarranty.PurchaseOrderReference));
@@ -341,7 +217,7 @@ WriteLiteral("\r\n");
WriteLiteral(" ");
#line 97 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 44 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(AjaxHelpers.AjaxSave());
@@ -352,7 +228,7 @@ WriteLiteral("\r\n");
WriteLiteral(" ");
#line 98 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 45 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(AjaxHelpers.AjaxLoader());
@@ -385,7 +261,7 @@ WriteLiteral(@">
url: '");
#line 119 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 66 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Url.Action(MVC.API.Job.UpdateNonWarrantyPurchaseOrderReference(Model.Job.Id, null)));
@@ -417,13 +293,13 @@ WriteLiteral(@"',
WriteLiteral(" style=\"width: 200px;\"");
WriteLiteral(">\r\n Purchase Order Sent\r\n </th>\r\n <td>\r\n");
WriteLiteral(">Purchase Order Sent\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 145 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Html.EditorFor(m => m.Job.JobMetaNonWarranty.PurchaseOrderSentDate));
#line 91 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(CommonHelpers.FriendlyDate(Model.Job.JobMetaNonWarranty.PurchaseOrderSentDate, "Not Sent", "Job_JobMetaNonWarranty_PurchaseOrderSentDate"));
#line default
@@ -435,7 +311,7 @@ WriteLiteral(" id=\"Job_JobMetaNonWarranty_PurchaseOrderSentUser\"");
WriteLiteral(">");
#line 146 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 92 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(string.IsNullOrEmpty(Model.Job.JobMetaNonWarranty.PurchaseOrderSentUserId) ? string.Empty : string.Format("by {0}", Model.Job.JobMetaNonWarranty.PurchaseOrderSentUser.ToString()));
@@ -446,54 +322,23 @@ WriteLiteral("</span>\r\n");
WriteLiteral(" ");
#line 147 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 93 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
document.DiscoFunctions.DateChangeUserHelper(
$('#Job_JobMetaNonWarranty_PurchaseOrderSentDate'),
$('#Job_JobMetaNonWarranty_PurchaseOrderSentUser'),
'Not Sent',
'");
#line 154 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Url.Action(MVC.API.Job.UpdateNonWarrantyPurchaseOrderSent(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral("\',\r\n \'PurchaseOrderSentDate\',\r\n");
WriteLiteral(" ");
#line 156 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Model.Job.OpenedDate.ToJavascriptDate());
#line default
#line hidden
WriteLiteral("\r\n );\r\n });\r\n </script>\r\n " +
" </td>\r\n </tr>\r\n <tr>\r\n <th");
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px;\"");
WriteLiteral(">\r\n Invoice Received\r\n </th>\r\n <td>\r\n");
WriteLiteral(">Invoice Received\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 167 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Html.EditorFor(m => m.Job.JobMetaNonWarranty.InvoiceReceivedDate));
#line 100 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(CommonHelpers.FriendlyDate(Model.Job.JobMetaNonWarranty.InvoiceReceivedDate, "Not Received", "Job_JobMetaNonWarranty_InvoiceReceivedDate"));
#line default
@@ -505,7 +350,7 @@ WriteLiteral(" id=\"Job_JobMetaNonWarranty_InvoiceReceivedUser\"");
WriteLiteral(">");
#line 168 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 101 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(string.IsNullOrEmpty(Model.Job.JobMetaNonWarranty.InvoiceReceivedUserId) ? string.Empty : string.Format("by {0}", Model.Job.JobMetaNonWarranty.InvoiceReceivedUser.ToString()));
@@ -516,44 +361,125 @@ WriteLiteral("</span>\r\n");
WriteLiteral(" ");
#line 169 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
#line 102 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
document.DiscoFunctions.DateChangeUserHelper(
$('#Job_JobMetaNonWarranty_InvoiceReceivedDate'),
$('#Job_JobMetaNonWarranty_InvoiceReceivedUser'),
'Not Received',
'");
WriteLiteral("\r\n </td>\r\n </tr>\r\n</table>\r\n<script>\r\n (function(){\r\n var bas" +
"eUpdateUrl = \'");
#line 176 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Url.Action(MVC.API.Job.UpdateNonWarrantyInvoiceReceived(Model.Job.Id, null)));
#line 108 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Url.Action(MVC.API.Job.Update(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral("\',\r\n \'InvoiceReceivedDate\',\r\n");
WriteLiteral(" ");
WriteLiteral("\';\r\n\r\n var dialog, dialogForm, dialogHeader, dialogDateBox, dialogDateProp" +
"ertyNameBox;\r\n var friendlyName, dateField, userField, updatePropertyName" +
", notSetDisplay, minDate, useAjax;\r\n\r\n function dateDialogGet(){\r\n " +
" if (!dialog){\r\n dialog = $(\'<div>\').attr({\'class\': \'dialog\'}" +
")\r\n dialogForm = $(\'<form>\').attr({\'action\': baseUpdateUrl, \'meth" +
"od\': \'post\'}).appendTo(dialog);\r\n var dialogBody = $(\'<p>\').appen" +
"dTo(dialogForm);\r\n dialogHeader = $(\'<h3>\').attr(\'autofocus\', \'au" +
"tofocus\').appendTo(dialogBody);\r\n dialogDatePropertyNameBox = $(\'" +
"<input>\').attr({\'type\': \'hidden\', \'name\': \'key\'}).appendTo(dialogBody);\r\n " +
" dialogDateBox = $(\'<input>\').attr({\'type\': \'datetime\', \'name\': \'value\'}" +
").css({\'display\': \'block\', \'margin-top\': 15, \'margin-left\': \'auto\', \'margin-righ" +
"t\': \'auto\' }).appendTo(dialogBody);\r\n $(\'<input>\').attr({\'type\': " +
"\'hidden\', \'name\': \'redirect\'}).val(\'true\').appendTo(dialogBody);\r\n\r\n " +
" dialog.dialog({\r\n resizable: false,\r\n " +
"modal: true,\r\n autoOpen: false,\r\n buttons:" +
" {\r\n \"Update\": dateDialogUpdate,\r\n " +
" Cancel: function () {\r\n $(this).dialog(\"close\");\r\n " +
" }\r\n },\r\n open: funct" +
"ion(){\r\n dialog.dialog(\'widget\').find(\'.ui-dialog-buttonp" +
"ane :tabbable:first\').focus();\r\n }\r\n });\r\n " +
" dialogDateBox.datetimepicker({\r\n defaultDate: new" +
" Date(),\r\n ampm: true,\r\n changeYear: true," +
"\r\n changeMonth: true,\r\n dateFormat: \'yy/mm" +
"/dd\',\r\n });\r\n }\r\n return dialog;\r\n }" +
"\r\n\r\n function dateDialogUpdate(){\r\n var dateValue = dialogDate" +
"Box.val();\r\n\r\n if (useAjax){\r\n // Use Ajax\r\n " +
" var $dateField, $userField;\r\n $dateField = $(\'#\' + dateFiel" +
"d);\r\n if (userField)\r\n $userField = $(\'#\' + us" +
"erField);\r\n\r\n dialog.dialog(\"close\");\r\n\r\n var $aja" +
"xLoading = ($userField ? $userField.next(\'.ajaxLoading\') : $dateField.next(\'.aja" +
"xLoading\')).show();\r\n\r\n var data = {\r\n key: up" +
"datePropertyName,\r\n value: dateValue\r\n };\r\n " +
" $.getJSON(baseUpdateUrl, data, function (response, result) {\r\n " +
" if (result != \'success\' || response.Result != \'OK\') {\r\n " +
" alert(\'Unable to change \' + friendlyName + \' Date:\\n\' + response);" +
"\r\n $ajaxLoading.hide();\r\n } else {\r\n " +
" if (response.DateTimeFull){\r\n $" +
"dateField.attr(\'data-datetimeformatted\', response.DateTimeJavascript)\r\n " +
" .attr(\'data-discodatetime\', response.DateTimeSortable)\r\n " +
" .attr(\'title\', response.DateTimeFull)\r\n " +
" .text(response.DateTimeFriendly);\r\n " +
" }else{\r\n $dateField.attr(\'data-datetimeformatted\', \'" +
"\')\r\n .attr(\'data-discodatetime\', \'-1\')\r\n " +
" .attr(\'title\', notSetDisplay)\r\n " +
" .text(notSetDisplay);\r\n }\r\n " +
"if ($userField)\r\n $userField.text(\'by \' + response.Us" +
"erDescription);\r\n $ajaxLoading.hide().next(\'.ajaxOk\').sho" +
"w().delay(\'fast\').fadeOut(\'slow\');\r\n }\r\n })\r\n " +
" }else{\r\n // Post Form & Redirect\r\n dial" +
"og.dialog(\"disable\");\r\n dialog.dialog(\"option\", \"buttons\", null);" +
"\r\n\r\n dialogDatePropertyNameBox.val(updatePropertyName);\r\n\r\n " +
" dialogForm.submit();\r\n }\r\n }\r\n\r\n function dat" +
"eDialogOpen(FriendlyName, DateField, UserField, UpdatePropertyName, NotSetDispla" +
"y, MinDate, UseAjax){\r\n friendlyName = FriendlyName;\r\n dat" +
"eField = DateField;\r\n userField = UserField;\r\n updatePrope" +
"rtyName = UpdatePropertyName;\r\n notSetDisplay = NotSetDisplay;\r\n " +
" minDate = MinDate;\r\n useAjax = UseAjax;\r\n\r\n var d =" +
" dateDialogGet();\r\n\r\n d.dialog(\'option\', \'title\', friendlyName);\r\n " +
" dialogHeader.text(friendlyName + \' Date\');\r\n\r\n var dfVal = $" +
"(\'#\' + DateField).attr(\'data-datetimeformatted\');\r\n\r\n if (dfVal)\r\n " +
" dialogDateBox.datetimepicker(\'setDate\', new Date(dfVal));\r\n " +
" else\r\n dialogDateBox.datetimepicker(\'setDate\', new Date());\r\n" +
"\r\n if (MinDate)\r\n dialogDateBox.datetimepicker(\'option" +
"\', \'minDate\', MinDate);\r\n else\r\n dialogDateBox.datetim" +
"epicker(\'option\', \'minDate\', null);\r\n\r\n d.dialog(\'open\');\r\n }\r" +
"\n\r\n function dateDialogCreateUpdater(FriendlyName, DateField, UserField, " +
"UpdatePropertyName, NotSetDisplay, MinDate, UseAjax){\r\n $(\'<a>\').attr" +
"({href: \'#\', \'class\': \'button small\', style: \'margin-right: 5px;\'}).text(\'Update" +
"\').click(function(event){\r\n event.preventDefault();\r\n " +
" dateDialogOpen(FriendlyName, DateField, UserField, UpdatePropertyName, NotSe" +
"tDisplay, MinDate, UseAjax);\r\n }).insertBefore(\'#\' + DateField);\r\n " +
" }\r\n\r\n if (!document.DiscoFunctions)\r\n document.DiscoFunct" +
"ions = {};\r\n if (!document.DiscoFunctions.DateDialogCreateUpdater)\r\n " +
" document.DiscoFunctions.DateDialogCreateUpdater = dateDialogCreateUpdater" +
";\r\n })();\r\n $(function(){\r\n var jobOpenDate = \'");
#line 178 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Model.Job.OpenedDate.ToJavascriptDate());
#line 240 "..\..\Views\Job\JobParts\NonWarrantyFinance.cshtml"
Write(Model.Job.OpenedDate.ToJavascriptDateTime());
#line default
#line hidden
WriteLiteral("\r\n );\r\n });\r\n </script>\r\n " +
" </td>\r\n </tr>\r\n</table>\r\n");
WriteLiteral("\';\r\n\r\n document.DiscoFunctions.DateDialogCreateUpdater(\'Accounting Charge " +
"Required\', \'Job_JobMetaNonWarranty_AccountingChargeRequiredDate\', \'Job_JobMetaNo" +
"nWarranty_AccountingChargeRequiredUser\', \'NonWarrantyAccountingChargeRequired\', " +
"\'Not Required\', jobOpenDate, false);\r\n document.DiscoFunctions.DateDialog" +
"CreateUpdater(\'Accounting Charge Added\', \'Job_JobMetaNonWarranty_AccountingCharg" +
"eAddedDate\', \'Job_JobMetaNonWarranty_AccountingChargeAddedUser\', \'NonWarrantyAcc" +
"ountingChargeAdded\', \'Not Added\', jobOpenDate, false);\r\n document.DiscoFu" +
"nctions.DateDialogCreateUpdater(\'Accounting Charge Paid\', \'Job_JobMetaNonWarrant" +
"y_AccountingChargePaidDate\', \'Job_JobMetaNonWarranty_AccountingChargePaidUser\', " +
"\'NonWarrantyAccountingChargePaid\', \'Not Paid\', jobOpenDate, false);\r\n doc" +
"ument.DiscoFunctions.DateDialogCreateUpdater(\'Purchase Order Raised\', \'Job_JobMe" +
"taNonWarranty_PurchaseOrderRaisedDate\', \'Job_JobMetaNonWarranty_PurchaseOrderRai" +
"sedUser\', \'NonWarrantyPurchaseOrderRaised\', \'Not Raised\', jobOpenDate, true);\r\n " +
" document.DiscoFunctions.DateDialogCreateUpdater(\'Purchase Order Sent\', \'J" +
"ob_JobMetaNonWarranty_PurchaseOrderSentDate\', \'Job_JobMetaNonWarranty_PurchaseOr" +
"derSentUser\', \'NonWarrantyPurchaseOrderSent\', \'Not Sent\', jobOpenDate, true);\r\n " +
" document.DiscoFunctions.DateDialogCreateUpdater(\'Invoice Received\', \'Job_" +
"JobMetaNonWarranty_InvoiceReceivedDate\', \'Job_JobMetaNonWarranty_InvoiceReceived" +
"User\', \'NonWarrantyInvoiceReceived\', \'Not Received\', jobOpenDate, true);\r\n })" +
";\r\n</script>\r\n");
}
}
+1 -1
View File
@@ -521,7 +521,7 @@
}
@if (Model.Job.CanInsuranceClaimFormSent())
{
@Html.ActionLinkSmallButton("Insurance Claim Form Sent", MVC.API.Job.UpdateInsuranceClaimFormSentDate(Model.Job.Id, "Now", true), "Job_Show_Job_Actions_InsuranceClaimFormSent_Button", "alert")
@Html.ActionLinkSmallButton("Insurance Claim Sent", MVC.API.Job.UpdateInsuranceClaimFormSentDate(Model.Job.Id, "Now", true), "Job_Show_Job_Actions_InsuranceClaimSent_Button", "alert")
}
@if (Model.Job.CanLogRepair())
{
@@ -1740,14 +1740,14 @@ WriteLiteral(" ");
#line hidden
#line 524 "..\..\Views\Job\JobParts\_Subject.cshtml"
Write(Html.ActionLinkSmallButton("Insurance Claim Form Sent", MVC.API.Job.UpdateInsuranceClaimFormSentDate(Model.Job.Id, "Now", true), "Job_Show_Job_Actions_InsuranceClaimFormSent_Button", "alert"));
Write(Html.ActionLinkSmallButton("Insurance Claim Sent", MVC.API.Job.UpdateInsuranceClaimFormSentDate(Model.Job.Id, "Now", true), "Job_Show_Job_Actions_InsuranceClaimSent_Button", "alert"));
#line default
#line hidden
#line 524 "..\..\Views\Job\JobParts\_Subject.cshtml"
}