Feature: Job Queues
Also UI style, theme and element changes
This commit is contained in:
@@ -44,108 +44,6 @@ namespace Disco.BI.Extensions
|
||||
return ja;
|
||||
}
|
||||
|
||||
public static Tuple<string, string> Status(this Job j)
|
||||
{
|
||||
var statusId = j.CalculateStatusId();
|
||||
return new Tuple<string, string>(statusId, JobBI.Utilities.JobStatusDescription(statusId, j));
|
||||
}
|
||||
|
||||
public static JobTableModel.JobTableItemModelIncludeStatus ToJobTableItemModelIncludeStatus(this Job j)
|
||||
{
|
||||
var i = new JobTableModel.JobTableItemModelIncludeStatus()
|
||||
{
|
||||
Id = j.Id,
|
||||
OpenedDate = j.OpenedDate,
|
||||
ClosedDate = j.ClosedDate,
|
||||
TypeId = j.JobTypeId,
|
||||
TypeDescription = j.JobType.Description,
|
||||
Location = j.DeviceHeldLocation,
|
||||
|
||||
WaitingForUserAction = j.WaitingForUserAction,
|
||||
DeviceReadyForReturn = j.DeviceReadyForReturn,
|
||||
DeviceHeld = j.DeviceHeld,
|
||||
DeviceReturnedDate = j.DeviceReturnedDate
|
||||
};
|
||||
|
||||
if (j.Device != null)
|
||||
{
|
||||
i.DeviceSerialNumber = j.DeviceSerialNumber;
|
||||
i.DeviceModelDescription = j.Device.DeviceModel.Description;
|
||||
i.DeviceAddressId = j.Device.DeviceProfile.DefaultOrganisationAddress;
|
||||
|
||||
if (j.JobMetaWarranty != null)
|
||||
{
|
||||
i.JobMetaWarranty_ExternalReference = j.JobMetaWarranty.ExternalReference;
|
||||
i.JobMetaWarranty_ExternalCompletedDate = j.JobMetaWarranty.ExternalCompletedDate;
|
||||
i.JobMetaWarranty_ExternalName = j.JobMetaWarranty.ExternalName;
|
||||
}
|
||||
if (j.JobMetaNonWarranty != null)
|
||||
{
|
||||
i.JobMetaNonWarranty_RepairerLoggedDate = j.JobMetaNonWarranty.RepairerLoggedDate;
|
||||
i.JobMetaNonWarranty_RepairerCompletedDate = j.JobMetaNonWarranty.RepairerCompletedDate;
|
||||
i.JobMetaNonWarranty_AccountingChargeAddedDate = j.JobMetaNonWarranty.AccountingChargeAddedDate;
|
||||
i.JobMetaNonWarranty_AccountingChargePaidDate = j.JobMetaNonWarranty.AccountingChargePaidDate;
|
||||
i.JobMetaNonWarranty_AccountingChargeRequiredDate = j.JobMetaNonWarranty.AccountingChargeRequiredDate;
|
||||
i.JobMetaNonWarranty_IsInsuranceClaim = j.JobMetaNonWarranty.IsInsuranceClaim;
|
||||
i.JobMetaNonWarranty_RepairerName = j.JobMetaNonWarranty.RepairerName;
|
||||
if (j.JobMetaInsurance != null)
|
||||
{
|
||||
i.JobMetaInsurance_ClaimFormSentDate = j.JobMetaInsurance.ClaimFormSentDate;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (j.User != null)
|
||||
{
|
||||
i.UserId = j.UserId;
|
||||
i.UserDisplayName = j.User.DisplayName;
|
||||
}
|
||||
if (j.OpenedTechUser != null)
|
||||
{
|
||||
i.OpenedTechUserId = j.OpenedTechUserId;
|
||||
i.OpenedTechUserDisplayName = j.OpenedTechUser.DisplayName;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public static string CalculateStatusId(this Job j)
|
||||
{
|
||||
return j.ToJobTableItemModelIncludeStatus().CalculateStatusId();
|
||||
}
|
||||
|
||||
public static string CalculateStatusId(this JobTableModel.JobTableItemModelIncludeStatus j)
|
||||
{
|
||||
if (j.ClosedDate.HasValue)
|
||||
return Job.JobStatusIds.Closed;
|
||||
|
||||
if (j.TypeId == JobType.JobTypeIds.HWar)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(j.JobMetaWarranty_ExternalReference) && !j.JobMetaWarranty_ExternalCompletedDate.HasValue)
|
||||
return Job.JobStatusIds.AwaitingWarrantyRepair; // Job Logged - but not marked as completed
|
||||
}
|
||||
|
||||
if (j.TypeId == JobType.JobTypeIds.HNWar)
|
||||
{
|
||||
if (j.JobMetaNonWarranty_RepairerLoggedDate.HasValue && !j.JobMetaNonWarranty_RepairerCompletedDate.HasValue)
|
||||
return Job.JobStatusIds.AwaitingRepairs; // Repairs logged - but not complete
|
||||
if (j.JobMetaNonWarranty_AccountingChargeAddedDate.HasValue && !j.JobMetaNonWarranty_AccountingChargePaidDate.HasValue)
|
||||
return Job.JobStatusIds.AwaitingAccountingPayment; // Accounting Charge Added, but not paid
|
||||
if (j.JobMetaNonWarranty_AccountingChargeRequiredDate.HasValue && (!j.JobMetaNonWarranty_AccountingChargePaidDate.HasValue || !j.JobMetaNonWarranty_AccountingChargeAddedDate.HasValue))
|
||||
return Job.JobStatusIds.AwaitingAccountingCharge; // Accounting Charge Required, but not added or paid
|
||||
if (j.JobMetaNonWarranty_RepairerLoggedDate.HasValue && j.JobMetaNonWarranty_IsInsuranceClaim.Value && !j.JobMetaInsurance_ClaimFormSentDate.HasValue)
|
||||
return Job.JobStatusIds.AwaitingInsuranceProcessing; // Is insurance claim, but no Claim Form Sent
|
||||
}
|
||||
|
||||
if (j.WaitingForUserAction.HasValue)
|
||||
return Job.JobStatusIds.AwaitingUserAction; // Awaiting for User
|
||||
|
||||
if (j.DeviceReadyForReturn.HasValue && !j.DeviceReturnedDate.HasValue)
|
||||
return Job.JobStatusIds.AwaitingDeviceReturn; // Device not returned to User
|
||||
|
||||
return Job.JobStatusIds.Open;
|
||||
}
|
||||
|
||||
public static List<DocumentTemplate> AvailableDocumentTemplates(this Job j, DiscoDataContext Database, User User, DateTime TimeStamp)
|
||||
{
|
||||
var dts = Database.DocumentTemplates.Include("JobSubTypes")
|
||||
|
||||
Reference in New Issue
Block a user