Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Commit

Permalink
Revert to master for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Legind committed Jun 7, 2018
1 parent f07b892 commit 1109c69
Showing 1 changed file with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@
if (!usage.ItSystem.TaskRefs) { usage.ItSystem.TaskRefs = { TaskKey: "", Description: "" }; }
if (!usage.SensitiveDataType) { usage.SensitiveDataType = { Name: "" }; }
if (!usage.MainContract) { usage.MainContract = { ItContract: { Supplier: { Name: "" } } }; }
if (!usage.Reference) { usage.Reference = { Title: "", ExternalReferenceId: "" }; }
if (!usage.MainContract.ItContract.Supplier) { usage.MainContract.ItContract.Supplier = { Name: "" }; }
if (!usage.Reference) { usage.Reference = { Title: "" }; }
if (!usage.MainContract.ItContract.Supplier) { usage.MainContract = { ItContract: { Supplier: { Name: "" } } }; }
});
return response;
}
Expand Down Expand Up @@ -618,9 +618,10 @@
field: "MainContract", title: "Kontrakt", width: 120,
persistId: "contract", // DON'T YOU DARE RENAME!
template: dataItem => {
if (!dataItem.MainContract || !dataItem.MainContract.ItContract || !dataItem.MainContract.ItContract.Name) {
if (!dataItem.MainContract || !dataItem.MainContract.ItContract) {
return "";
}

if (this.isContractActive(dataItem.MainContract.ItContract)) {
return `<a data-ui-sref="it-system.usage.contracts({id: ${dataItem.Id}})"><span class="fa fa-file text-success" aria-hidden="true"></span></a>`;
} else {
Expand Down Expand Up @@ -980,20 +981,23 @@
}

private isContractActive(dataItem) {
if (!dataItem.Active) {
var today = moment();
var startDate = dataItem.Concluded ? moment(dataItem.Concluded, "YYYY-MM-DD").startOf('day') : moment().startOf('day');
var endDate = dataItem.ExpirationDate ? moment(dataItem.ExpirationDate, "YYYY-MM-DD").endOf('day') : this.moment("9999-12-30", "YYYY-MM-DD").endOf('day');
if (dataItem.Terminated) {
var terminationDate = moment(dataItem.Terminated, "YYYY-MM-DD").endOf('day');
if (dataItem.TerminationDeadline) {
terminationDate.add(dataItem.TerminationDeadline.Name, "months");
}
// indgået-dato <= dags dato <= opsagt-dato + opsigelsesfrist
return today.isBetween(startDate, terminationDate, null, '[]');

if (!dataItem.Active) {
var today = this.moment().startOf('day');
var startDate = dataItem.Concluded ? moment(dataItem.Concluded).startOf('day') : today;
var endDate = dataItem.ExpirationDate ? moment(dataItem.ExpirationDate).startOf('day') : this.moment("9999-12-30").startOf('day');

if (dataItem.Terminated) {
var terminationDate = moment(dataItem.Terminated);
if (dataItem.TerminationDeadline) {
terminationDate.add(dataItem.TerminationDeadline.Name, "months");
}
// indgået-dato <= dags dato <= udløbs-dato
return today.isBetween(startDate, endDate, null, '[]');
// indgået-dato <= dags dato <= opsagt-dato + opsigelsesfrist
return today >= startDate && today <= terminationDate;
}

// indgået-dato <= dags dato <= udløbs-dato
return today >= startDate && today <= endDate;
}
return dataItem.Active;
}
Expand Down

0 comments on commit 1109c69

Please sign in to comment.