Files
Disco/Disco.Web/Views/Job/JobParts/NonWarrantyFinance.cshtml
T
Gary Sharp 7bdbeb6a82 Feature #35: Livestamp implemented
Humanized dates now update automatically when a page is left open for
some time.
2014-02-11 16:50:03 +11:00

144 lines
8.9 KiB
Plaintext

@model Disco.Web.Models.Job.ShowModel
@{
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
Authorization.Require(Claims.Job.ShowNonWarrantyFinance);
}
<table id="jobNonWarrantyFinance">
<tr>
<th style="width: 200px;">Accounting Charge Required
</th>
<td>
@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()
</td>
</tr>
<tr>
<th style="width: 200px;">Accounting Charge Added
</th>
<td>
@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()
</td>
</tr>
<tr>
<th style="width: 200px;">Accounting Charge Paid
</th>
<td>
@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()
</td>
</tr>
<tr>
<th style="width: 200px;">Purchase Order Raised
</th>
<td>
@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()
</td>
</tr>
<tr>
<th>Purchase Order Reference
</th>
<td>
@if (Authorization.Has(Claims.Job.Properties.NonWarrantyProperties.PurchaseOrderReference))
{
@Html.TextBoxFor(m => m.Job.JobMetaNonWarranty.PurchaseOrderReference)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
var $purchaseOrderReference = $('#Job_JobMetaNonWarranty_PurchaseOrderReference');
var $ajaxSave = $purchaseOrderReference.next('.ajaxSave');
$purchaseOrderReference
.watermark('No Reference')
.focus(function () { $purchaseOrderReference.select() })
.keydown(function (e) {
$ajaxSave.show();
if (e.which == 13) {
$(this).blur();
}
}).blur(function () {
$ajaxSave.hide();
})
.change(function () {
$ajaxSave.hide();
$ajaxLoading = $ajaxSave.next('.ajaxLoading').show();
var data = { PurchaseOrderReference: $purchaseOrderReference.val() };
$.ajax({
url: '@Url.Action(MVC.API.Job.UpdateNonWarrantyPurchaseOrderReference(Model.Job.Id, null))',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to update purchase order reference: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update purchase order reference: ' + textStatus);
$ajaxLoading.hide();
}
});
});
});
</script>
}
else
{
if (string.IsNullOrWhiteSpace(Model.Job.JobMetaNonWarranty.PurchaseOrderReference))
{
<span class="smallMessage">&lt;Unknown/None&gt;</span>
}
else
{
@Model.Job.JobMetaNonWarranty.PurchaseOrderReference
}
}
</td>
</tr>
<tr>
<th style="width: 200px;">Purchase Order Sent
</th>
<td>
@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()
</td>
</tr>
<tr>
<th style="width: 200px;">Invoice Received
</th>
<td>
@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()
</td>
</tr>
</table>
<script>
$(function () {
var updateUrl = '@(Url.Action(MVC.API.Job.Update(Model.Job.Id, null)))';
var jobOpenDate = '@(Model.Job.OpenedDate.ToISO8601())';
@if (Authorization.Has(Claims.Job.Properties.NonWarrantyProperties.AccountingChargeRequired))
{<text>document.DiscoFunctions.DateDialogCreateUpdater(updateUrl, 'Accounting Charge Required', 'Job_JobMetaNonWarranty_AccountingChargeRequiredDate', 'Job_JobMetaNonWarranty_AccountingChargeRequiredUser', 'NonWarrantyAccountingChargeRequired', 'Not Required', jobOpenDate, false);</text>}
@if (Authorization.Has(Claims.Job.Properties.NonWarrantyProperties.AccountingChargeAdded))
{<text>document.DiscoFunctions.DateDialogCreateUpdater(updateUrl, 'Accounting Charge Added', 'Job_JobMetaNonWarranty_AccountingChargeAddedDate', 'Job_JobMetaNonWarranty_AccountingChargeAddedUser', 'NonWarrantyAccountingChargeAdded', 'Not Added', jobOpenDate, false);</text>}
@if (Authorization.Has(Claims.Job.Properties.NonWarrantyProperties.AccountingChargePaid))
{<text>document.DiscoFunctions.DateDialogCreateUpdater(updateUrl, 'Accounting Charge Paid', 'Job_JobMetaNonWarranty_AccountingChargePaidDate', 'Job_JobMetaNonWarranty_AccountingChargePaidUser', 'NonWarrantyAccountingChargePaid', 'Not Paid', jobOpenDate, false);</text>}
@if (Authorization.Has(Claims.Job.Properties.NonWarrantyProperties.PurchaseOrderRaised))
{<text>document.DiscoFunctions.DateDialogCreateUpdater(updateUrl, 'Purchase Order Raised', 'Job_JobMetaNonWarranty_PurchaseOrderRaisedDate', 'Job_JobMetaNonWarranty_PurchaseOrderRaisedUser', 'NonWarrantyPurchaseOrderRaised', 'Not Raised', jobOpenDate, true);</text>}
@if (Authorization.Has(Claims.Job.Properties.NonWarrantyProperties.PurchaseOrderSent))
{<text>document.DiscoFunctions.DateDialogCreateUpdater(updateUrl, 'Purchase Order Sent', 'Job_JobMetaNonWarranty_PurchaseOrderSentDate', 'Job_JobMetaNonWarranty_PurchaseOrderSentUser', 'NonWarrantyPurchaseOrderSent', 'Not Sent', jobOpenDate, true);</text>}
@if (Authorization.Has(Claims.Job.Properties.NonWarrantyProperties.InvoiceReceived))
{<text>document.DiscoFunctions.DateDialogCreateUpdater(updateUrl, 'Invoice Received', 'Job_JobMetaNonWarranty_InvoiceReceivedDate', 'Job_JobMetaNonWarranty_InvoiceReceivedUser', 'NonWarrantyInvoiceReceived', 'Not Received', jobOpenDate, true);</text>}
});
</script>