{"version":3,"file":"app-6de9ed0c.9729664bca28a8e6916d.bundle.js","mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAoBA;AAAA;AAlBA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAIA;AACA;AACA;AACA;AAEA;AACA;AAEA;AAGA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AA9EA;;;;;;;;;;;;;;;;;;ACTA;AACA;AACA;AAEA;AASA;AAAA;AAPA;AACA;AAEA;AACA;AAIA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAnFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AA4BA;AAAA;AA1BA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAGA;AAEA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AAGA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AAEA;AACA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAvIA;AAAA;AAAA;AAAA;AAAA;AAKA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;;;AC1BA;AACA;AACA;AACA;AACA;AAEA;AAUA;AAAA;AARA;AACA;AACA;AAEA;AACA;AAIA;AAEA;AACA;AAEA;AAIA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzDA;;;;;;;;;;;;;;;;;;;;ACNA;AACA;AACA;AACA;AACA;AAEA;AAUA;AAAA;AARA;AACA;AACA;AAEA;AACA;AAIA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3EA;;;;;;;;;;;;;;;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAWA;AAAA;AATA;AACA;AACA;AACA;AACA;AAEA;AAIA;AACA;AACA;AACA;AAEA;AACA;AAEA;AAGA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAcA;AAAA;AAAA;AAAA;AAAA;AARA;AACA;AACA;AACA;AAEA;AAIA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAnJA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AA+BA;AAAA;AA7BA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAKA;AAEA;AAAA;AAAA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AAAA;AACA;AAEA;AACA;AACA;AAmCA;AACA;AACA;AAlCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9qBA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACPA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA","sources":["webpack://www.zeusteam.com/./src/resources/elements/pipelines/dialogs/copy-pipeline.js","webpack://www.zeusteam.com/./src/resources/elements/pipelines/dialogs/edit-pipeline-person.js","webpack://www.zeusteam.com/./src/resources/elements/pipelines/dialogs/edit-pipeline.js","webpack://www.zeusteam.com/./src/resources/elements/pipelines/dialogs/edit-stage.js","webpack://www.zeusteam.com/./src/resources/elements/pipelines/dialogs/reorder-pipeline.js","webpack://www.zeusteam.com/./src/resources/elements/pipelines/dialogs/share-pipeline.js","webpack://www.zeusteam.com/./src/resources/elements/pipelines/pipelines.js","webpack://www.zeusteam.com/./src/resources/elements/pipelines/stages.js","webpack://www.zeusteam.com/./src/resources/elements/pipelines/pipelines.scss","webpack://www.zeusteam.com/./src/resources/elements/pipelines/stages.scss","webpack://www.zeusteam.com/./src/resources/elements/pipelines/dialogs/copy-pipeline.html","webpack://www.zeusteam.com/./src/resources/elements/pipelines/dialogs/edit-pipeline-person.html","webpack://www.zeusteam.com/./src/resources/elements/pipelines/dialogs/edit-pipeline.html","webpack://www.zeusteam.com/./src/resources/elements/pipelines/dialogs/edit-stage.html","webpack://www.zeusteam.com/./src/resources/elements/pipelines/dialogs/reorder-pipeline.html","webpack://www.zeusteam.com/./src/resources/elements/pipelines/dialogs/share-pipeline.html","webpack://www.zeusteam.com/./src/resources/elements/pipelines/pipelines.html","webpack://www.zeusteam.com/./src/resources/elements/pipelines/stages.html"],"sourcesContent":["import { DialogController } from 'aurelia-dialog';\r\nimport { NewInstance } from 'aurelia-dependency-injection';\r\nimport { ValidationRules, ValidationController } from 'aurelia-validation';\r\nimport { BootstrapFormValidationRenderer } from 'validation/bootstrap-form-validation-renderer';\r\nimport { Security } from 'common/security';\r\nimport { Pipelines } from 'services/pipelines';\r\nimport { I18n } from 'common/i18n';\r\nimport { PERSON_TYPE } from 'common/constants';\r\n\r\nexport class CopyPipeline {\r\n static inject = [DialogController, Pipelines, Security, I18n, NewInstance.of(ValidationController)];\r\n dialogController;\r\n validationController;\r\n _pipelines;\r\n security;\r\n _i18n;\r\n\r\n name;\r\n personType;\r\n description;\r\n color;\r\n code;\r\n showPersonProperties;\r\n \r\n personPropertyOptions = [];\r\n personPropertyTagOptions = [];\r\n personProperties = [];\r\n personPropertyTags = [];\r\n\r\n constructor(dialogController, pipelines, security, i18n, validationController) {\r\n this.dialogController = dialogController;\r\n this.security = security;\r\n this._pipelines = pipelines;\r\n this._i18n = i18n;\r\n\r\n\t\tthis.validationController = validationController;\r\n\t\tthis.validationController.addRenderer(new BootstrapFormValidationRenderer());\r\n\r\n\t\tValidationRules\r\n .ensure('name').required()\r\n .on(this);\r\n }\r\n\r\n activate(model) {\r\n this.pipeline = model.pipeline;\r\n this.personType = this.pipeline.personType;\r\n this.name = this.pipeline.name + ' - Copy';\r\n this.description = this.pipeline.description;\r\n this.showPersonProperties = this.pipeline.showPersonProperties || [];\r\n this.color = this.pipeline.color;\r\n\r\n const pp = PERSON_TYPE.properties(this.personType);\r\n this.personPropertyOptions = pp?.tagOptions() ?? [];\r\n this.personPropertyTagOptions = [];\r\n this.personPropertyOptions.forEach(o => {\r\n if (!o.translation) o.translation = this._i18n.tr(o.translationKey);\r\n this.personPropertyTagOptions.push(o.translation);\r\n });\r\n\r\n this.showPersonProperties.forEach(ap => {\r\n const option = this.personPropertyOptions.find(x => x.id === ap);\r\n if (!option) return;\r\n this.personPropertyTags.push(option.translation);\r\n });\r\n }\r\n\r\n personPropertiesChanged(tags) {\r\n const properties = [];\r\n tags.forEach(t => {\r\n let option = this.personPropertyOptions.find(x => x.translation.toLowerCase() === t.toLowerCase());\r\n if (!option) return;\r\n properties.push(option.id);\r\n });\r\n this.showPersonProperties = properties;\r\n }\r\n\r\n async save() {\r\n try {\r\n const v = await this.validationController.validate();\r\n if (!v.valid) return;\r\n\r\n const pipeline = await this._pipelines.copyPipeline(this.pipeline.id, this.name, this.description, this.color, this.showPersonProperties);\r\n this.dialogController.ok({ pipeline });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n}\r\n","import { DialogController } from 'aurelia-dialog';\r\nimport { Pipelines } from 'services/pipelines';\r\nimport moment from 'moment';\r\n\r\nexport class EditPipelinePerson {\r\n static inject = [DialogController, Pipelines];\r\n dialogController;\r\n _pipelines;\r\n\r\n name;\r\n color;\r\n deleteText = 'purge';\r\n\r\n constructor(dialogController, pipelines) {\r\n this.dialogController = dialogController;\r\n this._pipelines = pipelines;\r\n }\r\n\r\n activate(model) {\r\n this.pipelineId = model.pipelineId;\r\n this.personType = model.personType;\r\n this.personId = model.pipelinePerson.person.id;\r\n this.name = model.pipelinePerson.person.fullName;\r\n this.isArchived = model.pipelinePerson.isArchived;\r\n this.originalEnteredStageDate = model.pipelinePerson.enteredStageDate ? model.pipelinePerson.enteredStageDate.substring(0, 10) : '';\r\n this.enteredStageDate = model.pipelinePerson.enteredStageDate ? model.pipelinePerson.enteredStageDate.substring(0, 10) : '';\r\n this.metadata = model.pipelinePerson.metadata;\r\n }\r\n\r\n async save() {\r\n try {\r\n const metadata = Object.assign({}, this.metadata, { enteredStageDate: this.enteredStageDate });\r\n const updatedMetadata = await this._pipelines.savePerson(this.pipelineId, this.personType, this.personId, metadata);\r\n const enteredStageDate = this.originalEnteredStageDate === this.enteredStageDate ? null : moment.utc(this.enteredStageDate).toISOString();\r\n this.dialogController.ok({ metadata: updatedMetadata, enteredStageDate });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async archive() {\r\n try {\r\n await this._pipelines.removePerson(this.pipelineId, this.personType, this.personId);\r\n this.dialogController.ok({ archived: true });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async purge() {\r\n if (!this.showDeleteConfirm) {\r\n this.showDeleteConfirm = true;\r\n this.deleteText = 'purge-confirm';\r\n return;\r\n }\r\n\r\n this.showDeleteConfirm = false;\r\n if (this.deleting) return;\r\n try {\r\n this.deleting = true;\r\n await this._pipelines.purge(this.pipelineId, this.personId, this.personType);\r\n this.dialogController.ok({ deleted: true });\r\n } catch(err) {\r\n console.log(err);\r\n this.resetDelete();\r\n } finally {\r\n this.deleting = false;\r\n }\r\n }\r\n\r\n async restore() {\r\n if (this.restoring) return;\r\n try {\r\n this.restoring = true;\r\n await this._pipelines.restorePerson(this.pipelineId, this.personId, this.personType);\r\n this.dialogController.ok({ restored: true });\r\n } catch(err) {\r\n console.log(err);\r\n } finally {\r\n this.restoring = false;\r\n }\r\n }\r\n\r\n resetDelete() {\r\n this.showDeleteConfirm = false;\r\n this.deleteText = 'purge';\r\n }\r\n}\r\n","import { observable, computedFrom } from 'aurelia-framework';\r\nimport { DialogController } from 'aurelia-dialog';\r\nimport { NewInstance } from 'aurelia-dependency-injection';\r\nimport { ValidationRules, ValidationController } from 'aurelia-validation';\r\nimport { BootstrapFormValidationRenderer } from 'validation/bootstrap-form-validation-renderer';\r\nimport { Security } from 'common/security';\r\nimport { Pipelines } from 'services/pipelines';\r\nimport { Carriers } from 'services/carriers';\r\nimport { I18n } from 'common/i18n';\r\nimport { PERSON_TYPE } from 'common/constants';\r\n\r\nexport class EditPipeline {\r\n static inject = [DialogController, Pipelines, Carriers, Security, I18n, NewInstance.of(ValidationController)];\r\n dialogController;\r\n validationController;\r\n _pipelines;\r\n _carriers;\r\n security;\r\n _i18n;\r\n\r\n pipelineTemplates = [];\r\n @observable pipelineTemplate;\r\n\r\n PERSON_TYPE = PERSON_TYPE;\r\n\r\n name;\r\n @observable personType;\r\n description;\r\n color;\r\n code;\r\n carriers;\r\n carrierId;\r\n showPersonProperties = [];\r\n \r\n personPropertyOptions = [];\r\n personPropertyTagOptions = [];\r\n personProperties = [];\r\n personPropertyTags = [];\r\n\r\n constructor(dialogController, pipelines, carriers, security, i18n, validationController) {\r\n this.dialogController = dialogController;\r\n this.security = security;\r\n this._pipelines = pipelines;\r\n this._carriers = carriers;\r\n this._i18n = i18n;\r\n\r\n\t\tthis.validationController = validationController;\r\n\t\tthis.validationController.addRenderer(new BootstrapFormValidationRenderer());\r\n\r\n\t\tValidationRules\r\n .ensure('name').required()\r\n .on(this);\r\n }\r\n\r\n async activate(model) {\r\n this.pipeline = model.pipeline;\r\n this.titleKey = this.pipeline.id ? 'edit-pipeline' : 'add-pipeline';\r\n this.name = '';\r\n this.personType = model.personType;\r\n this.description = '';\r\n this.code = null;\r\n this.carrierId = null;\r\n this.color = '';\r\n this.step = '';\r\n if (this.pipeline.id) {\r\n this.name = this.pipeline.name;\r\n this.description = this.pipeline.description;\r\n this.code = this.pipeline.code;\r\n this.carrierId = this.pipeline.carrierId;\r\n this.showPersonProperties = this.pipeline.showPersonProperties || [];\r\n this.color = this.pipeline.color;\r\n this.setStep('create-edit', false);\r\n } else {\r\n this.pipelineTemplates = await this._pipelines.availableTemplates(this.personType);\r\n this.setStep(this.pipelineTemplates.length > 0 ? 'select' : 'create-edit');\r\n }\r\n\r\n this._configurePersonProperties();\r\n this.carriers = await this._carriers.all();\r\n }\r\n\r\n @computedFrom('security')\r\n get showCode() {\r\n return this.security.isAdmin;\r\n }\r\n\r\n @computedFrom('security', 'personType')\r\n get showCarrier() {\r\n return this.security.isAdmin && this.personType === PERSON_TYPE.Agent;\r\n }\r\n\r\n setStep(step, clearName = true) {\r\n this.step = step;\r\n if (clearName) this.name = '';\r\n if (step === 'create-edit') {\r\n this.focusName = true;\r\n }\r\n }\r\n\r\n personTypeChanged() {\r\n const pp = PERSON_TYPE.properties(this.personType);\r\n this.personPropertyOptions = pp?.tagOptions() ?? [];\r\n this._configurePersonProperties();\r\n }\r\n\r\n _configurePersonProperties() {\r\n this.personPropertyTagOptions = [];\r\n this.personPropertyOptions.forEach(o => {\r\n if (!o.translation) o.translation = this._i18n.tr(o.translationKey);\r\n this.personPropertyTagOptions.push(o.translation);\r\n });\r\n\r\n this.personPropertyTags = [];\r\n this.showPersonProperties.forEach(ap => {\r\n const option = this.personPropertyOptions.find(x => x.id === ap);\r\n if (!option) return;\r\n this.personPropertyTags.push(option.translation);\r\n });\r\n }\r\n\r\n personPropertiesChanged(tags) {\r\n const properties = [];\r\n tags.forEach(t => {\r\n let option = this.personPropertyOptions.find(x => x.translation.toLowerCase() === t.toLowerCase());\r\n if (!option) return;\r\n properties.push(option.id);\r\n });\r\n this.showPersonProperties = properties;\r\n }\r\n\r\n async createFromTemplate(pipelineTemplate) {\r\n this.pipelineTemplate = pipelineTemplate;\r\n this.name = this.pipelineTemplate.name;\r\n await this.save();\r\n }\r\n\r\n async save() {\r\n try {\r\n const v = await this.validationController.validate();\r\n if (!v.valid) return;\r\n\r\n let pipeline;\r\n if (this.pipeline.id) {\r\n pipeline = await this._pipelines.editPipeline(this.pipeline.id, this.name, this.personType, this.description, this.color, this.showPersonProperties, this.code, this.carrierId);\r\n } else {\r\n if (this.pipelineTemplate) {\r\n pipeline = await this._pipelines.createPipelineFromTemplate(this.pipelineTemplate.id);\r\n } else {\r\n pipeline = await this._pipelines.createPipeline(this.name, this.personType, this.description, this.color, this.showPersonProperties, this.code, this.carrierId);\r\n }\r\n }\r\n this.dialogController.ok({ pipeline });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n}\r\n","import { DialogController } from 'aurelia-dialog';\r\nimport { NewInstance } from 'aurelia-dependency-injection';\r\nimport { ValidationRules, ValidationController } from 'aurelia-validation';\r\nimport { BootstrapFormValidationRenderer } from 'validation/bootstrap-form-validation-renderer';\r\nimport { Pipelines } from 'services/pipelines';\r\n\r\nexport class EditStage {\r\n static inject = [DialogController, NewInstance.of(ValidationController), Pipelines];\r\n dialogController;\r\n validationController;\r\n _pipelines;\r\n\r\n name;\r\n expectedDaysInStage;\r\n color;\r\n \r\n constructor(dialogController, validationController, pipelines) {\r\n this.dialogController = dialogController;\r\n\r\n\t\tthis.validationController = validationController;\r\n\t\tthis.validationController.addRenderer(new BootstrapFormValidationRenderer());\r\n\r\n\t\tValidationRules\r\n .ensure('name').required()\r\n .on(this);\r\n\r\n this._pipelines = pipelines;\r\n }\r\n\r\n activate(model) {\r\n this.pipelineId = model.pipelineId;\r\n this.stage = model.stage;\r\n this.titleKey = this.stage.id ? 'edit-stage' : 'add-stage';\r\n this.name = '';\r\n this.expectedDaysInStage;\r\n this.color = '';\r\n if (this.stage.id) {\r\n this.name = this.stage.name;\r\n this.expectedDaysInStage = this.stage.expectedDaysInStage;\r\n this.color = this.stage.color;\r\n }\r\n }\r\n\r\n async save() {\r\n if (this.saving) return;\r\n try {\r\n this.saving = true;\r\n const v = await this.validationController.validate();\r\n if (!v.valid) return;\r\n\r\n let stage;\r\n if (this.stage.id) {\r\n stage = await this._pipelines.editStage(this.pipelineId, this.stage.id, this.name, this.expectedDaysInStage, this.color);\r\n } else {\r\n stage = await this._pipelines.addStage(this.pipelineId, this.name, this.expectedDaysInStage, this.color);\r\n }\r\n this.dialogController.ok({ stage });\r\n } catch (err) {\r\n console.log(err);\r\n } finally {\r\n this.saving = false;\r\n }\r\n }\r\n}\r\n","import { DialogController } from 'aurelia-dialog';\r\nimport { Pipelines } from 'services/pipelines';\r\nimport { AGENT_PROPERTY } from 'common/constants';\r\nimport { LevelNameValueConverter } from 'resources/value-converters/level-name';\r\nimport moment from 'moment';\r\n\r\nexport class ReorderPipeline {\r\n static inject = [DialogController, Pipelines, LevelNameValueConverter];\r\n dialogController;\r\n _pipelines;\r\n _levelNameConverter;\r\n\r\n orderByOptions = [];\r\n orderBy;\r\n sortDirection = 'asc';\r\n\r\n constructor(dialogController, pipelines, levelNameValueConverter) {\r\n this.dialogController = dialogController;\r\n this._pipelines = pipelines;\r\n this._levelNameConverter = levelNameValueConverter;\r\n\r\n this.orderByOptions = AGENT_PROPERTY.tagOptions();\r\n this.orderByOptions.unshift({ id: 'firstName', translationKey: 'profile-first-name', type: 'String' });\r\n this.orderByOptions.unshift({ id: 'lastName', translationKey: 'profile-last-name', type: 'String' });\r\n this.orderByOptions.unshift({ id: 'fullName', translationKey: 'name', type: 'String' });\r\n this.orderByOptions.push({ id: 'enteredStageDate', translationKey: 'entered-stage-date', type: 'Date', obj: 'root' });\r\n this.orderBy = this.orderByOptions[0].id;\r\n }\r\n\r\n activate(model) {\r\n this.pipeline = model.pipeline;\r\n this.stage = model.stage;\r\n }\r\n\r\n async reorder() {\r\n try {\r\n const reorder = [];\r\n this.pipeline.stages.forEach(sl => {\r\n if (this.stage && this.stage.id !== sl.id) return;\r\n const orderedPersonIds = this._sortedPersonIds(sl.persons);\r\n if (orderedPersonIds.length === 0) return;\r\n reorder.push(this._pipelines.orderPersons(this.pipeline.id, sl.id, orderedPersonIds));\r\n });\r\n await Promise.all(reorder);\r\n const option = this.orderByOptions.find(x => x.id === this.orderBy);\r\n const payload = this.stage ? {} : { orderBy: option, sortDirection: this.sortDirection };\r\n this.dialogController.ok(payload);\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n _sortedPersonIds(persons) {\r\n if (!persons || persons.length === 0) return [];\r\n const option = this.orderByOptions.find(x => x.id === this.orderBy);\r\n persons.sort((a, b) => {\r\n let aValue = option.obj === 'root' ? a[option.id] : a.person[option.id];\r\n let bValue = option.obj === 'root' ? b[option.id] : b.person[option.id];\r\n let valueA = this.sortDirection === 'asc' ? aValue : bValue;\r\n let valueB = this.sortDirection === 'asc' ? bValue : aValue;\r\n if (option.type === 'Date') {\r\n let valueAMoment = moment.utc(valueA);\r\n let valueBMoment = moment.utc(valueB);\r\n if (!valueAMoment.isValid()) return -1;\r\n if (!valueBMoment.isValid()) return 1;\r\n return valueAMoment.isBefore(valueBMoment) ? -1 : 1;\r\n } else if (option.type === 'Boolean') {\r\n if (valueA === valueB) return 0;\r\n if (valueA) return 1;\r\n return -1;\r\n } else if (option.type === 'Level') {\r\n let valueANumber = valueA ? valueA.replace(/^\\D+/g, '') : -1;\r\n if (valueANumber === '') valueANumber = -1;\r\n let valueBNumber = valueB ? valueB.replace(/^\\D+/g, '') : -1;\r\n return Number(valueANumber) - Number(valueBNumber);\r\n } else {\r\n return valueA.localeCompare(valueB);\r\n }\r\n });\r\n return persons.map(x => x.person.id);\r\n }\r\n}\r\n","import { DialogController } from 'aurelia-dialog';\r\nimport { NewInstance } from 'aurelia-dependency-injection';\r\nimport { ValidationRules, ValidationController } from 'aurelia-validation';\r\nimport { BootstrapFormValidationRenderer } from 'validation/bootstrap-form-validation-renderer';\r\nimport { Security } from 'common/security';\r\nimport { Pipelines } from 'services/pipelines';\r\nimport { I18n } from 'common/i18n';\r\n\r\nexport class SharePipeline {\r\n static inject = [DialogController, Pipelines, Security, I18n, NewInstance.of(ValidationController)];\r\n dialogController;\r\n validationController;\r\n _pipelines;\r\n security;\r\n _i18n;\r\n\r\n agent;\r\n canEdit = false;\r\n\r\n constructor(dialogController, pipelines, security, i18n, validationController) {\r\n this.dialogController = dialogController;\r\n this.security = security;\r\n this._pipelines = pipelines;\r\n this._i18n = i18n;\r\n\r\n\t\tthis.validationController = validationController;\r\n\t\tthis.validationController.addRenderer(new BootstrapFormValidationRenderer());\r\n\r\n\t\tValidationRules\r\n .ensure('agent').required()\r\n .on(this);\r\n }\r\n\r\n activate(model) {\r\n this.pipeline = model.pipeline;\r\n this._loadCurrentShares();\r\n }\r\n\r\n async _loadCurrentShares() {\r\n try {\r\n this.shares = await this._pipelines.pipelineShares(this.pipeline.id);\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async toggleCanEdit(share) {\r\n try {\r\n await this._pipelines.sharePipeline(this.pipeline.id, share.agent.id, !share.canEdit);\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async removeShare(index, share) {\r\n try {\r\n await this._pipelines.removePipelineShare(this.pipeline.id, share.agent.id);\r\n this.shares.splice(index, 1);\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n setCanEdit(canEdit) {\r\n this.canEdit = canEdit;\r\n }\r\n\r\n async save() {\r\n try {\r\n const v = await this.validationController.validate();\r\n if (!v.valid) return;\r\n\r\n await this._pipelines.sharePipeline(this.pipeline.id, this.agent.id, this.canEdit);\r\n this.agent = undefined;\r\n this.canEdit = false;\r\n window.setTimeout(() => this.validationController.reset(), 0);\r\n this._loadCurrentShares();\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n}\r\n","import { bindable } from 'aurelia-framework';\r\nimport { PLATFORM } from 'aurelia-pal';\r\nimport { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { Security } from 'common/security';\r\nimport { Pipelines as PipelinesSvc } from 'services/pipelines';\r\nimport { DialogService } from 'aurelia-dialog';\r\nimport { ConfirmDialog } from 'common/dialogs/confirm/confirm-dialog';\r\nimport { EditPipeline } from './dialogs/edit-pipeline';\r\nimport { CopyPipeline } from './dialogs/copy-pipeline';\r\nimport { SharePipeline } from './dialogs/share-pipeline';\r\nimport { PERSON_TYPE } from 'common/constants';\r\nPLATFORM.moduleName('common/dialogs/confirm/confirm-dialog');\r\nPLATFORM.moduleName('./dialogs/edit-pipeline');\r\nPLATFORM.moduleName('./dialogs/copy-pipeline');\r\nPLATFORM.moduleName('./dialogs/share-pipeline');\r\n\r\nexport class Pipelines {\r\n\tstatic inject = [EventAggregator, Security, PipelinesSvc, DialogService];\r\n @bindable memberId;\r\n @bindable showAddPipeline = false;\r\n @bindable personType = PERSON_TYPE.Agent;\r\n\r\n _ea;\r\n _security;\r\n _pipelines;\r\n _dialogService;\r\n\r\n pipelines = [];\r\n _handlers = [];\r\n\r\n constructor(ea, security, pipelinesSvc, dialogService) {\r\n this._ea = ea;\r\n this._security = security;\r\n this._pipelines = pipelinesSvc;\r\n this._dialogService = dialogService;\r\n }\r\n\r\n attached() {\r\n this._load();\r\n this._handlers.push(this._ea.subscribe('dnd:didEnd', () => {\r\n window.setTimeout(() => this._savePipelineOrdering(), 0);\r\n }));\r\n }\r\n\r\n detached() {\r\n this._handlers.forEach(h => h.dispose());\r\n this._handlers = [];\r\n }\r\n\r\n pipelineAction(key, pipeline, index) {\r\n switch (key) {\r\n case 'share':\r\n this.sharePipeline(pipeline);\r\n break;\r\n case 'edit':\r\n this.editPipeline(pipeline);\r\n break;\r\n case 'delete':\r\n this.deletePipeline(pipeline, index);\r\n break;\r\n case 'copy':\r\n this.copyPipeline(pipeline);\r\n break;\r\n }\r\n }\r\n\r\n async _savePipelineOrdering() {\r\n try {\r\n const orderedIds = [];\r\n this.pipelines.forEach(p => {\r\n orderedIds.push(p.id);\r\n });\r\n await this._pipelines.setPipelineOrdering(orderedIds);\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async _load() {\r\n try {\r\n this.pipelines = await this._pipelines.pipelines(this.personType, this.memberId);\r\n this.pipelines.forEach(p => this._setPipelineActions(p));\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n _setPipelineActions(pipeline) {\r\n pipeline.actions = [];\r\n if (this._security.isAdmin && pipeline.personType === PERSON_TYPE.Agent) pipeline.actions.push({ key: 'share', name: 'share-pipeline', icon: 'fa-duotone fa-handshake-simple' });\r\n if (pipeline.canEdit) pipeline.actions.push({ key: 'edit', name: 'edit-pipeline', icon: 'fa-duotone fa-pencil' });\r\n if (pipeline.canEdit) pipeline.actions.push({ key: 'copy', name: 'copy-pipeline', icon: 'fa-duotone fa-clone' });\r\n if (pipeline.canDelete) pipeline.actions.push({ key: 'delete', name: 'delete-pipeline', icon: 'fa-duotone fa-trash-alt' });\r\n }\r\n\r\n addPipeline() {\r\n const model = { personType: this.personType, pipeline: {} };\r\n this._dialogService.open({ viewModel: EditPipeline, model, ignoreTransitions: true }).whenClosed(response => {\r\n if (response.wasCancelled) return;\r\n this._setPipelineActions(response.output.pipeline);\r\n this.pipelines.push(response.output.pipeline);\r\n });\r\n }\r\n\r\n async sharePipeline(pipeline) {\r\n try {\r\n const model = { pipeline };\r\n this._dialogService.open({ viewModel: SharePipeline, model, ignoreTransitions: true });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async copyPipeline(pipeline) {\r\n try {\r\n const model = { pipeline };\r\n this._dialogService.open({ viewModel: CopyPipeline, model, ignoreTransitions: true }).whenClosed(response => {\r\n if (response.wasCancelled) return;\r\n this.pipelines.push(response.output.pipeline);\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async editPipeline(pipeline) {\r\n try {\r\n const model = { personType: this.personType, pipeline };\r\n this._dialogService.open({ viewModel: EditPipeline, model, ignoreTransitions: true }).whenClosed(async(response) => {\r\n if (response.wasCancelled) return;\r\n pipeline.name = response.output.pipeline.name;\r\n pipeline.description = response.output.pipeline.description;\r\n pipeline.color = response.output.pipeline.color;\r\n pipeline.showAgentProperties = response.output.pipeline.showAgentProperties;\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n pipelineEdited(pipeline) {\r\n this.viewPipeline = pipeline;\r\n }\r\n\r\n deletePipeline(pipeline, index) {\r\n const model = { key: 'delete-ats-pipeline', okButtonClass: 'btn-danger', messageObject: { name: pipeline.name } };\r\n\t this._dialogService.open({ viewModel: ConfirmDialog, model, ignoreTransitions: true }).whenClosed(async(response) => {\r\n\t if (response.wasCancelled) return;\r\n\t\t\ttry {\r\n\t\t\t\tawait this._pipelines.deletePipeline(pipeline.id);\r\n this.pipelines.splice(index, 1);\r\n\t\t\t} catch (err) {\r\n console.log(err);\r\n\t\t\t}\r\n });\r\n }\r\n\r\n showPipeline(pipeline) {\r\n this.viewPipeline = pipeline;\r\n }\r\n\r\n hidePipeline() {\r\n this.viewPipeline = undefined;\r\n this._load();\r\n }\r\n}","import { bindable, observable } from 'aurelia-framework';\r\nimport { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { Security } from 'common/security';\r\nimport { Pipelines } from 'services/pipelines';\r\nimport { TemplatingEngine } from 'aurelia-templating';\r\nimport { LpfnUtil } from 'common/utils';\r\nimport { DialogService } from 'aurelia-dialog';\r\nimport { Notifier } from 'common/ui';\r\nimport { SharePipeline } from './dialogs/share-pipeline';\r\nimport { EditPipeline } from './dialogs/edit-pipeline';\r\nimport { CopyPipeline } from './dialogs/copy-pipeline';\r\nimport { ReorderPipeline } from './dialogs/reorder-pipeline';\r\nimport { EditStage } from './dialogs/edit-stage';\r\nimport { EditPipelinePerson } from './dialogs/edit-pipeline-person';\r\nimport { ConfirmDialog } from 'common/dialogs/confirm/confirm-dialog';\r\nimport { c } from 'common/common';\r\nimport { PERSON_TYPE } from 'common/constants';\r\nimport moment from 'moment';\r\nPLATFORM.moduleName('./dialogs/share-pipeline');\r\nPLATFORM.moduleName('./dialogs/edit-pipeline');\r\nPLATFORM.moduleName('./dialogs/copy-pipeline');\r\nPLATFORM.moduleName('./dialogs/reorder-pipeline');\r\nPLATFORM.moduleName('./dialogs/edit-stage');\r\nPLATFORM.moduleName('./dialogs/edit-pipeline-person');\r\nPLATFORM.moduleName('common/dialogs/confirm/confirm-dialog');\r\n\r\nexport class Stages {\r\n static inject = [Element, EventAggregator, Security, Pipelines, TemplatingEngine, DialogService, Notifier]\r\n _element;\r\n _ea;\r\n _security;\r\n _templatingEngine;\r\n _pipelines;\r\n _dialogService;\r\n _notifier;\r\n\r\n @bindable pipelineId;\r\n @observable addPerson;\r\n\r\n PERSON_TYPE = PERSON_TYPE;\r\n\r\n pipeline = { stages: [] };\r\n backlog = [];\r\n _itemViews = [];\r\n\r\n archivedPersons = false;\r\n VIEWS = {\r\n standard: 'view-standard',\r\n compact: 'view-compact',\r\n minimized: 'view-minimized',\r\n };\r\n view = this.VIEWS.standard;\r\n\r\n pipelineActions = [];\r\n _handlers = [];\r\n reordering = false;\r\n\r\n constructor(element, ea, security, pipelines, templatingEngine, dialogService, notifier) {\r\n this._element = element;\r\n this._ea = ea;\r\n this._security = security;\r\n this._pipelines = pipelines;\r\n this._templatingEngine = templatingEngine;\r\n this._dialogService = dialogService;\r\n this._notifier = notifier;\r\n this.id = c.Helpers.uniqueId();\r\n }\r\n\r\n async attached() {\r\n this._isAttached = true;\r\n if (this.pipelineId) await this._load();\r\n this._handlers.push(this._ea.subscribe('dnd:didEnd', () => {\r\n window.setTimeout(() => this._onAfterReorder(), 0);\r\n }));\r\n this._handlers.push(this._ea.subscribe('dnd:willStart', () => {\r\n this.reordering = true;\r\n this._onBeforeReorder();\r\n }));\r\n LpfnUtil.addResizeHandler(this._onResize);\r\n }\r\n\r\n detached() {\r\n this._isAttached = false;\r\n this._handlers.forEach(h => h.dispose());\r\n this._handlers = [];\r\n this.dispose(true);\r\n LpfnUtil.removeResizeHandler(this._setBigButtonView);\r\n }\r\n\r\n _onResize = () => {\r\n this.stageMaxHeightCss = undefined;\r\n this._setStageHeight();\r\n }\r\n\r\n _onBeforeReorder() {\r\n try {\r\n this.dispose(false);\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async _onAfterReorder() {\r\n try {\r\n const orderedIds = [];\r\n this.pipeline.stages.forEach(sl => {\r\n orderedIds.push(sl.id);\r\n });\r\n await this._pipelines.setStageOrdering(this.pipeline.id, orderedIds);\r\n this.pipeline.stages.forEach(sl => {\r\n const slEl = document.getElementById(`sl-container-${sl.id}`);\r\n const gridStackEl = document.createElement('div');\r\n gridStackEl.id = sl.id;\r\n gridStackEl.style.backgroundColor = sl.stageBackgroundColor;\r\n gridStackEl.style.borderLeft = `1px solid ${sl.placeholderColor}`;\r\n gridStackEl.style.borderRight = `1px solid ${sl.placeholderColor}`;\r\n gridStackEl.classList.add('grid-stack', `grid-stack-${this.id}`, 'zeus-stage');\r\n slEl.appendChild(gridStackEl);\r\n });\r\n this._initializeGrids();\r\n this.stageMaxHeightCss = undefined;\r\n this._setStageHeight();\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n dispose(clearPipeline = true) {\r\n try {\r\n this.archivedPersons = false;\r\n this.orderByKey = undefined;\r\n this.sortDirection = undefined;\r\n this._itemViews.forEach(iv => {\r\n try {\r\n iv.view.detached();\r\n } catch (vErr) {\r\n console.log(vErr);\r\n }\r\n });\r\n if (this._grids) {\r\n try {\r\n this._grids.forEach(g => {\r\n g.offAll();\r\n g.destroy(!clearPipeline);\r\n });\r\n } catch (err2) { /* Do nothing, bug in gridstack where it tries to set the height after removing the grid */ }\r\n this._grids = undefined;\r\n }\r\n if (clearPipeline) {\r\n this.pipeline = { stages: [] };\r\n }\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n pipelineIdChanged() {\r\n if (this._isAttached) this._load();\r\n }\r\n\r\n async _load() {\r\n if (!this.pipelineId) return;\r\n try {\r\n await this._loadPipeline();\r\n this._initializeGrids();\r\n this._setStageHeight();\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n _setStageHeight() {\r\n try {\r\n if (!this.pipeline.stages.length) return;\r\n if (this.stageMaxHeightCss) return;\r\n const firstEl = document.getElementById(this.pipeline.stages[0].id);\r\n const offset = LpfnUtil.offset(firstEl);\r\n const fullHeight = LpfnUtil.getDocumentHeight();\r\n const footerEl = document.getElementById('kt_app_footer');\r\n const footerHeight = LpfnUtil.actualHeight(footerEl);\r\n const maxHeight = fullHeight - footerHeight - offset.top - 50; // buffer\r\n if (maxHeight < 250) {\r\n this.pipeline.stages.forEach(sl => {\r\n document.getElementById(sl.id).style.maxHeight = '500px';\r\n });\r\n return;\r\n }\r\n this.stageMaxHeightCss = `${maxHeight}px`;\r\n this.pipeline.stages.forEach(sl => {\r\n document.getElementById(sl.id).style.maxHeight = this.stageMaxHeightCss;\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async _loadPipeline() {\r\n if (!this.pipelineId) return;\r\n try {\r\n this.orderByKey = undefined;\r\n this.sortDirection = undefined;\r\n this.pipeline = await this._pipelines.pipeline(this.pipelineId);\r\n\r\n this.pipelineActions = [];\r\n if (this.archivedPersons) this.pipelineActions.push({ key: 'current-persons', name: 'view-current-pipeline', icon: 'fa-duotone fa-wave-pulse' });\r\n if (this.pipeline.canReorderStageCards) this.pipelineActions.push({ key: 'reorder-pipeline', name: 'reorder-pipeline', icon: 'fa-duotone fa-arrow-up-short-wide' });\r\n if (this.pipeline.canEdit) {\r\n if (this._security.isAdmin) this.pipelineActions.push({ key: 'share-pipeline', name: 'share-pipeline', icon: 'fa-duotone fa-handshake-simple' });\r\n this.pipelineActions.push({ key: 'edit-pipeline', name: 'edit-pipeline', icon: 'fa-duotone fa-pencil' });\r\n this.pipelineActions.push({ key: 'copy-pipeline', name: 'copy-pipeline', icon: 'fa-duotone fa-clone' });\r\n this.pipelineActions.push({ key: 'add-stage', name: 'add-stage', icon: 'fa-duotone fa-line-columns' });\r\n }\r\n if (!this.archivedPersons) this.pipelineActions.push({ key: 'archived-persons', name: 'view-archived-pipeline', icon: 'fa-duotone fa-box-archive' });\r\n this.pipelineActions.push({ key: this.VIEWS.standard, name: 'pipeline-view-standard', icon: 'fa-duotone fa-arrows-maximize' });\r\n this.pipelineActions.push({ key: this.VIEWS.compact, name: 'pipeline-view-compact', icon: 'fa-duotone fa-arrows-minimize' });\r\n this.pipelineActions.push({ key: this.VIEWS.minimized, name: 'pipeline-view-minimized', icon: 'fa-duotone fa-arrows-to-dot' });\r\n \r\n const loaders = [\r\n this._pipelines.backlog(this.pipelineId),\r\n ];\r\n this.pipeline.stages.forEach(sl => {\r\n this._addActionsToStage(sl);\r\n loaders.push(this._pipelines.personsInStage(this.pipelineId, sl.id, this.archivedPersons));\r\n });\r\n const data = await Promise.all(loaders);\r\n this.backlog = data[0];\r\n let dataIdx = 1;\r\n this.pipeline.stages.forEach(sl => {\r\n sl.persons = data[dataIdx] || [];\r\n sl.backgroundColor = LpfnUtil.hexToRgbString(sl.color, 0.05);\r\n sl.placeholderColor = LpfnUtil.hexToRgbString(sl.color, 0.5, '#D3D3D3');\r\n sl.stageBackgroundColor = LpfnUtil.hexToRgbString(sl.color, 0.08, '#D3D3D3');\r\n dataIdx++;\r\n });\r\n if (!this.pipeline.stages.length && this.pipeline.canEdit) this._addStage();\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n _addEventsToGrid(grid, i) {\r\n grid\r\n .on('added', async (e, items) => {\r\n try {\r\n if (this._waitForAddedEventForPersonId === items[0].id) {\r\n this._waitForAddedEventForPersonId = undefined;\r\n }\r\n const toStageId = grid.el.id ?? null;\r\n const el = items[0].el; // the initial load may contain multiple - still just need to check the first to know if this is the initial load\r\n const isInitialized = LpfnUtil.hasClass(el, 'zeus-initialized');\r\n const personId = items[0].id || el.id;\r\n const backlogIndex = this.backlog.findIndex(x => x.id === personId);\r\n let currentStageIndex = -1;\r\n let toStageIndex = -1;\r\n let currentStagePersonIndex = -1;\r\n if (backlogIndex < 0) {\r\n toStageIndex = this.pipeline.stages.findIndex(x => x.id === toStageId);\r\n currentStageIndex = 0;\r\n for (let sl of this.pipeline.stages) {\r\n currentStagePersonIndex = sl.persons.findIndex(x => x.person.id === personId);\r\n if (currentStagePersonIndex >= 0) break;\r\n currentStageIndex++;\r\n }\r\n }\r\n let updatedPerson;\r\n if (currentStageIndex !== toStageIndex) {\r\n updatedPerson = await this._pipelines.movePerson(this.pipelineId, this.pipeline.personType, personId, toStageId);\r\n if (currentStageIndex >= 0 && toStageIndex >= 0) {\r\n this.pipeline.stages[toStageIndex].persons.push(updatedPerson);\r\n }\r\n if (backlogIndex >= 0) {\r\n this.backlog.splice(backlogIndex, 1);\r\n } else {\r\n if (currentStagePersonIndex >= 0) {\r\n this.pipeline.stages[currentStageIndex].persons.splice(currentStagePersonIndex, 1);\r\n }\r\n }\r\n }\r\n let currentStage = currentStageIndex >= 0 ? this.pipeline.stages[currentStageIndex] : undefined;\r\n const stageColor = currentStage?.color || '#ccc';\r\n\r\n if (isInitialized) {\r\n await this._reorderPersons(toStageId, e.srcElement);\r\n if (updatedPerson) {\r\n this._setPersonPipelineCard(updatedPerson.person.id, undefined, updatedPerson.metadata?.color, updatedPerson.enteredStageDate, currentStage);\r\n this._updateViewContext(updatedPerson);\r\n }\r\n return;\r\n }\r\n // Need to initialize the widget\r\n for (let item of items) {\r\n let contentEl = item.el.querySelector('.grid-stack-item-content');\r\n contentEl.id = `grid-stack-item-${item.id}`;\r\n contentEl.classList.add('show-on-hover-trigger');\r\n const person = this._personFromPipeline(item.id);\r\n if (person.metadata) this._setPersonPipelineCard(item.id, contentEl, person.metadata.color);\r\n const gradientStops = this._gradientStops(person.percentageOfExpectedTimeInStage);\r\n const enteredStage = person.enteredStageDate ? moment(person.enteredStageDate).format('M/D') : '';\r\n item.el.classList.add('zeus-initialized');\r\n item.el.classList.add('zeus-stage-item');\r\n let innerHTML = '';\r\n if (this.pipeline.canEdit) innerHTML += '';\r\n innerHTML += `
${enteredStage}
`;\r\n contentEl.innerHTML = innerHTML;\r\n const view = this._templatingEngine.enhance({ element: item.el, bindingContext: { person: person.person, personType: this.pipeline.personType, pipelinePerson: person, metadata: person.metadata, showProperties: this.pipeline.showPersonProperties, carrierId: this.pipeline.carrierId, editPipelinePerson: (pipelinePerson) => this._editPipelinePerson(pipelinePerson) } });\r\n this._itemViews.push({ id: person.person.id, view });\r\n }\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n })\r\n .on('change', async (e, items) => {\r\n try {\r\n await this._reorderPersons(grid.el.id, e.srcElement);\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n })\r\n .on('removed', async (e, items) => {\r\n try {\r\n this._waitForAddedEventForPersonId = items[0].id;\r\n await this._reorderPersons(grid.el.id, e.srcElement);\r\n window.setTimeout(() => this._checkIfRemovedFromPipeline(), 500);\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n })\r\n ;\r\n }\r\n\r\n _updateViewContext(pipelinePerson) {\r\n try {\r\n const itemViewIndex = this._itemViews.findIndex(x => x.id === pipelinePerson.person.id);\r\n if (itemViewIndex >= 0) {\r\n this._itemViews[itemViewIndex].view.bindingContext.person = pipelinePerson.person;\r\n this._itemViews[itemViewIndex].view.bindingContext.pipelinePerson = pipelinePerson;\r\n this._itemViews[itemViewIndex].view.bindingContext.metadata = pipelinePerson.metadata;\r\n } else {\r\n console.log(this._itemViews);\r\n }\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n _gradientStops(percentageOfExpectedTimeInStage) {\r\n let stop1 = percentageOfExpectedTimeInStage - 0.05;\r\n let stop2 = percentageOfExpectedTimeInStage + 0.05;\r\n if (stop1 < 0.01) stop1 = 0.01;\r\n if (stop2 > 1) stop2 = 1;\r\n if (percentageOfExpectedTimeInStage === 1) {\r\n stop1 = 1;\r\n stop2 = 1;\r\n }\r\n stop1 *= 100;\r\n stop2 *= 100;\r\n return { first: stop1, second: stop2 };\r\n }\r\n\r\n _setPersonPipelineCard(personId, el, personColor, enteredStageDate, stage) {\r\n try {\r\n if (!el) el = document.getElementById(`grid-stack-item-${personId}`);\r\n let foregroundColor = 'inherit';\r\n let backgroundColor = undefined;\r\n let borderColor = LpfnUtil.getCssVariableValue('--kt-border-color');\r\n if (personColor) {\r\n backgroundColor = LpfnUtil.hexToRgbString(personColor, 0.05);\r\n borderColor = personColor;\r\n }\r\n el.style.backgroundColor = backgroundColor;\r\n el.style.borderColor = borderColor;\r\n el.style.color = foregroundColor;\r\n\r\n if (enteredStageDate) {\r\n const enteredStage = moment.utc(enteredStageDate);\r\n const dateEl = document.getElementById(`pipeline-entered-stage-date-${personId}`);\r\n if (dateEl) dateEl.innerHTML = enteredStage.format('M/D');\r\n\r\n if (stage && stage.expectedDaysInStage) {\r\n const lengthEl = document.getElementById(`pipeline-stage-length-${personId}`);\r\n if (lengthEl) {\r\n const stageHours = stage.expectedDaysInStage * 24;\r\n const hoursInStage = moment.duration(moment().diff(enteredStage)).asHours();\r\n const percentageOfExpectedTimeInStage = hoursInStage > stageHours ? 1 : hoursInStage / stageHours;\r\n lengthEl.title = `${c.Helpers.round(percentageOfExpectedTimeInStage * 100, 0)}%`;\r\n const stageColor = stage?.color || '#ccc';\r\n const gradientStops = this._gradientStops(percentageOfExpectedTimeInStage);\r\n lengthEl.style.background = `linear-gradient(90deg, ${stageColor} 0%, ${stageColor} ${gradientStops.first}%, transparent ${gradientStops.second}%, transparent 100%)`;\r\n }\r\n }\r\n }\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n _editPipelinePerson(pipelinePerson) {\r\n if (!this.pipeline.canEdit) return;\r\n try {\r\n const model = { pipelineId: this.pipeline.id, personType: this.pipeline.personType, pipelinePerson };\r\n this._dialogService.open({ viewModel: EditPipelinePerson, model, ignoreTransitions: true }).whenClosed(async(response) => {\r\n if (response.wasCancelled) return;\r\n if (response.output.deleted || response.output.restored || response.output.archived) {\r\n this._load();\r\n return;\r\n }\r\n const stage = this._personStage(pipelinePerson.person.id);\r\n this._setPersonPipelineCard(pipelinePerson.person.id, undefined, response.output.metadata.color, response.output.enteredStageDate, stage);\r\n if (response.output.enteredStageDate) pipelinePerson.enteredStageDate = response.output.enteredStageDate;\r\n this._updateViewContext(pipelinePerson);\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async _checkIfRemovedFromPipeline() {\r\n if (!this._waitForAddedEventForPersonId) return;\r\n this._removePersonFromPipeline(this._waitForAddedEventForPersonId);\r\n this._waitForAddedEventForPersonId = undefined;\r\n }\r\n\r\n async _removePersonFromPipeline(personId) {\r\n if (!this.pipeline.canEdit) return;\r\n try {\r\n await this._pipelines.removePerson(this.pipelineId, this.pipeline.personType, personId);\r\n for (let sl of this.pipeline.stages) {\r\n const stageIndex = sl.persons.findIndex(x => x.person.id === personId);\r\n if (stageIndex < 0) continue;\r\n sl.persons.splice(stageIndex, 1);\r\n break;\r\n }\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async _reorderPersons(stageId, stageEl) {\r\n if (!this.pipeline.canEdit) return;\r\n try {\r\n const personIds = [];\r\n stageEl.childNodes.forEach(n => {\r\n personIds.push({ personId: n.getAttribute('gs-id'), y: Number(n.getAttribute('gs-y')) });\r\n });\r\n personIds.sort((a, b) => a.y - b.y);\r\n const orderedPersonIds = personIds.map(x => x.personId);\r\n await this._pipelines.orderPersons(this.pipeline.id, stageId, orderedPersonIds);\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async addPersonChanged() {\r\n if (!this.pipeline.canEdit) return;\r\n try {\r\n if (!this.addPerson) return;\r\n if (this._personFromPipeline(this.addPerson.id)) {\r\n this.addPerson = null;\r\n\t\t\t\tthis._notifier.info('person-already-in-pipeline');\r\n return;\r\n }\r\n const firstStage = this.pipeline && this.pipeline.stages ? this.pipeline.stages[0] : undefined;\r\n const person = await this._pipelines.addPerson(this.pipelineId, this.pipeline.personType, this.addPerson.id);\r\n firstStage.persons.push({ person, daysExpectedInStage: firstStage.daysExpectedInStage, enteredStageDate: moment().toISOString(), isOverExpectedTime: false, percentageOfExpectedTimeInStage: 0 });\r\n let grid;\r\n this._grids.forEach(g => {\r\n if (g.el.id !== firstStage.id) return;\r\n grid = g;\r\n });\r\n // Add to the top\r\n grid.addWidget({ id: person.id, x: 0, y: 0, w: 1, h: 1 });\r\n this.addPerson = null;\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n _personFromPipeline(personId) {\r\n const backlogPerson = this.backlog.find(x => x.id === personId);\r\n if (backlogPerson) return backlogPerson;\r\n for (let sl of this.pipeline.stages) {\r\n const stagePerson = sl.persons.find(x => x.person.id === personId);\r\n if (stagePerson) return stagePerson;\r\n }\r\n return null;\r\n }\r\n\r\n _personStage(personId) {\r\n for (let sl of this.pipeline.stages) {\r\n const stagePerson = sl.persons.find(x => x.person.id === personId);\r\n if (stagePerson) return sl;\r\n }\r\n return null;\r\n }\r\n\r\n pipelineAction(key) {\r\n switch (key) {\r\n case 'share-pipeline': this._sharePipeline(); break;\r\n case 'edit-pipeline': this._editPipeline(); break;\r\n case 'copy-pipeline': this._copyPipeline(); break;\r\n case 'add-stage': this._addStage(); break;\r\n case 'archived-persons': this.archivedPersons = true; this._load(); break;\r\n case 'current-persons': this.archivedPersons = false; this._load(); break;\r\n case this.VIEWS.standard:\r\n case this.VIEWS.compact:\r\n case this.VIEWS.minimized: this._changeView(key); break;\r\n case 'reorder-pipeline': this._reorderPipeline(); break;\r\n }\r\n }\r\n\r\n async _addStage() {\r\n if (!this.pipeline.canEdit) return;\r\n try {\r\n const model = { pipelineId: this.pipelineId, stage: {} };\r\n this._dialogService.open({ viewModel: EditStage, model, ignoreTransitions: true }).whenClosed(async(response) => {\r\n if (response.wasCancelled) return;\r\n\r\n const newStage = response.output.stage;\r\n newStage.persons = [];\r\n newStage.backgroundColor = LpfnUtil.hexToRgbString(newStage.color, 0.05);\r\n newStage.placeholderColor = LpfnUtil.hexToRgbString(newStage.color, 0.5, '#D3D3D3');\r\n newStage.stageBackgroundColor = LpfnUtil.hexToRgbString(newStage.color, 0.08, '#D3D3D3');\r\n this._addActionsToStage(newStage);\r\n this.pipeline.stages.push(newStage);\r\n this.stageMaxHeightCss = undefined;\r\n if (this._grids) this.dispose();\r\n this._load();\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n _addActionsToStage(sl) {\r\n sl.actions = [];\r\n if (this.pipeline.canReorderStageCards) sl.actions.push({ key: 'reorder-stage', name: 'reorder-stage' });\r\n if (this.pipeline.canEditStages) sl.actions.push({ key: 'edit-stage', name: 'edit-stage' });\r\n if (this.pipeline.canEditStages) sl.actions.push({ key: 'delete-stage', name: 'delete-stage' });\r\n }\r\n\r\n stageAction(sl, key) {\r\n switch (key) {\r\n case 'reorder-stage':\r\n this._reorderPipeline(sl);\r\n break;\r\n case 'edit-stage':\r\n this._editStage(sl);\r\n break;\r\n case 'delete-stage':\r\n this.deleteStage(sl);\r\n break;\r\n }\r\n }\r\n\r\n async _editStage(sl) {\r\n if (!this.pipeline.canEdit) return;\r\n try {\r\n const model = { pipelineId: this.pipelineId, stage: sl };\r\n this._dialogService.open({ viewModel: EditStage, model, ignoreTransitions: true }).whenClosed(async(response) => {\r\n if (response.wasCancelled) return;\r\n\r\n sl.name = response.output.stage.name;\r\n sl.expectedDaysInStage = response.output.stage.expectedDaysInStage;\r\n sl.color = response.output.stage.color;\r\n sl.backgroundColor = LpfnUtil.hexToRgbString(sl.color, 0.05);\r\n sl.placeholderColor = LpfnUtil.hexToRgbString(sl.color, 0.5, '#D3D3D3');\r\n sl.stageBackgroundColor = LpfnUtil.hexToRgbString(sl.color, 0.08, '#D3D3D3');\r\n\r\n sl.persons.forEach(p => {\r\n this._setPersonPipelineCard(p.person.id, undefined, p.metadata?.color, p.enteredStageDate, sl);\r\n });\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n deleteStage(sl) {\r\n if (!this.pipeline.canEdit) return;\r\n const index = this.pipeline.stages.findIndex(x => x.id === sl.id);\r\n const model = { key: 'delete-stage', okButtonClass: 'btn-danger', messageObject: { name: sl.name } };\r\n\t this._dialogService.open({ viewModel: ConfirmDialog, model, ignoreTransitions: true }).whenClosed(async(response) => {\r\n\t if (response.wasCancelled) return;\r\n\t\t\ttry {\r\n\t\t\t\tawait this._pipelines.deleteStage(this.pipeline.id, sl.id);\r\n this.pipeline.stages.splice(index, 1);\r\n\t\t\t} catch (err) {\r\n this._notifier.errorText(err);\r\n\t\t\t}\r\n });\r\n }\r\n\r\n _initializeGrids() {\r\n if (!this._isAttached || !this.pipeline || !this.pipeline.stages.length) return;\r\n const config = {\r\n column: 1,\r\n minRow: 5,\r\n disableResize: true,\r\n acceptWidgets: true,\r\n cellHeight: this._cellHeight(this.view),\r\n acceptWidgets: (el) => { return true; },\r\n removable: '.zeus-stage-trash',\r\n };\r\n if (!this.pipeline.canManageStageCards) {\r\n config.disableDrag = true;\r\n config.removable = false;\r\n config.acceptWidgets = false;\r\n config.acceptWidgets = (el) => { return false; };\r\n config.staticGrid = true; \r\n config.removeable = undefined;\r\n }\r\n this._grids = GridStack.initAll(config, `.grid-stack.grid-stack-${this.id}`);\r\n GridStack.setupDragIn('.zeus-pipeline-backlog,.zeus-stage-item', { revert: 'invalid', scroll: false, appendTo: 'body', helper: 'clone' });\r\n this._grids.forEach((grid, i) => {\r\n const stage = this.pipeline.stages.find(x => x.id === grid.el.id);\r\n const items = [];\r\n let y = 0;\r\n if (stage.persons) {\r\n stage.persons.forEach(p => {\r\n items.push({ id: p.person.id, x: 0, y: y++, w: 1, h: 1 });\r\n });\r\n }\r\n this._addEventsToGrid(grid, i);\r\n grid.load(items);\r\n });\r\n }\r\n\r\n async _sharePipeline() {\r\n if (!this.pipeline.canEdit) return;\r\n try {\r\n const model = { pipeline: this.pipeline };\r\n this._dialogService.open({ viewModel: SharePipeline, model, ignoreTransitions: true });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async _editPipeline() {\r\n if (!this.pipeline.canEdit) return;\r\n try {\r\n const model = { pipeline: this.pipeline, personType: this.pipeline.personType };\r\n this._dialogService.open({ viewModel: EditPipeline, model, ignoreTransitions: true }).whenClosed(async(response) => {\r\n if (response.wasCancelled) return;\r\n this.stageMaxHeightCss = undefined;\r\n if (this._grids) this.dispose();\r\n await this._load();\r\n this._element.dispatchEvent(new CustomEvent('pipeline-edited', { bubbles: true, detail: this.pipeline }));\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async _copyPipeline() {\r\n if (!this.pipeline.canEdit) return;\r\n try {\r\n const model = { pipeline: this.pipeline };\r\n this._dialogService.open({ viewModel: CopyPipeline, model, ignoreTransitions: true }).whenClosed(async(response) => {\r\n if (response.wasCancelled) return;\r\n\t\t\t\tthis._notifier.success('pipeline-copied');\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n async _reorderPipeline(stage) {\r\n if (!this.pipeline.canEdit) return;\r\n try {\r\n this._dialogService.open({ viewModel: ReorderPipeline, model: { pipeline: this.pipeline, stage: stage }, ignoreTransitions: true }).whenClosed(async(response) => {\r\n if (response.wasCancelled) return;\r\n await this._load();\r\n if (response.output.orderBy) {\r\n this.orderByKey = response.output.orderBy.translationKey;\r\n this.sortDirection = response.output.sortDirection;\r\n } else {\r\n this.orderByKey = undefined;\r\n this.sortDirection = undefined;\r\n }\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n _changeView(view) {\r\n try {\r\n this.view = view;\r\n if (!this._grids || !this.pipeline) return;\r\n this._grids.forEach(g => {\r\n g.cellHeight(this._cellHeight(view), true);\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n _cellHeight(view) {\r\n switch (view) {\r\n case this.VIEWS.compact: return 95;\r\n case this.VIEWS.minimized: return 95;\r\n default: return 170 + (this.pipeline.showPersonProperties.length * 33);\r\n }\r\n }\r\n\r\n async purgeArchives() {\r\n try {\r\n const model = { key: 'purge-pipeline', okButtonClass: 'btn-danger', messageObject: { name: this.pipeline.name } };\r\n this._dialogService.open({ viewModel: ConfirmDialog, model, ignoreTransitions: true }).whenClosed(async(response) => {\r\n if (response.wasCancelled) return;\r\n try {\r\n await this._pipelines.purge(this.pipeline.id);\r\n this.archivedPersons = false;\r\n await this._load();\r\n } catch (err) {\r\n this._notifier.errorText(err);\r\n }\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n}","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".zeus-pipeline-coloring {\\n border-top: 6px solid transparent;\\n}\\n\\n.zeus-pipeline-title {\\n flex-direction: column;\\n justify-content: flex-start;\\n}\\n.zeus-pipeline-title > * {\\n align-self: flex-start;\\n}\", \"\",{\"version\":3,\"sources\":[\"webpack://./src/resources/elements/pipelines/pipelines.scss\"],\"names\":[],\"mappings\":\"AAAA;EACI,iCAAA;AACJ;;AAEA;EACI,sBAAA;EACA,2BAAA;AACJ;AACI;EACI,sBAAA;AACR\",\"sourcesContent\":[\".zeus-pipeline-coloring {\\r\\n border-top: 6px solid transparent;\\r\\n}\\r\\n\\r\\n.zeus-pipeline-title {\\r\\n flex-direction: column;\\r\\n justify-content: flex-start;\\r\\n\\r\\n > * {\\r\\n align-self: flex-start;\\r\\n }\\r\\n}\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".zeus-pipeline-backlog {\\n background-color: var(--kt-gray-200);\\n color: var(--kt-gray-700);\\n padding: 0.4rem 0.4rem;\\n border-radius: 0.475rem;\\n white-space: pre;\\n display: inline-flex;\\n align-items: center;\\n}\\n.zeus-pipeline-backlog:hover {\\n cursor: move;\\n}\\n\\n.zeus-stage-header {\\n border-bottom: none !important;\\n}\\n\\n.zeus-stage-trash {\\n border: 1px dashed red;\\n flex: 0.5;\\n height: 100%;\\n min-height: 40px;\\n border-radius: var(--zeus-margin-xs);\\n background: rgba(255, 0, 0, 0.1);\\n display: flex;\\n justify-content: center;\\n align-items: center;\\n}\\n.zeus-stage-trash > i {\\n color: red;\\n}\\n.zeus-stage-trash:hover {\\n background: rgba(255, 0, 0, 0.5);\\n}\\n\\n.grid-stack-item-removing {\\n opacity: 0.5;\\n}\\n\\n.zeus-stages {\\n display: flex;\\n width: 100%;\\n height: 100%;\\n overflow-x: auto;\\n}\\n.zeus-stages .zeus-stage-heading {\\n border-bottom-left-radius: 0;\\n border-bottom-right-radius: 0;\\n margin-bottom: var(--zeus-margin);\\n}\\n.zeus-stages .zeus-stage-heading .card-title {\\n flex-direction: column;\\n justify-content: flex-start;\\n}\\n.zeus-stages .zeus-stage-heading .card-title > * {\\n align-self: flex-start;\\n}\\n.zeus-stages .zeus-stage-coloring {\\n border-top: 4px solid transparent;\\n border-radius: 4px;\\n}\\n.zeus-stages .grid-stack-item-content {\\n text-align: left;\\n background-color: white;\\n color: inherit;\\n padding: 1em;\\n border-radius: var(--zeus-margin-xs);\\n border: 1px solid var(--kt-border-color);\\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\\n display: flex;\\n flex-direction: column;\\n justify-content: space-between;\\n position: relative;\\n}\\n.zeus-stages .grid-stack-item-content .zeus-pipeline-person-editor {\\n position: absolute;\\n right: 0;\\n top: 0;\\n padding: var(--zeus-margin-sm);\\n z-index: 2;\\n}\\n.zeus-stages .grid-stack-item-content:hover {\\n cursor: move;\\n}\\n\\n.grid-stack-placeholder > .placeholder-content {\\n border-radius: var(--zeus-margin-xs);\\n}\\n\\n.zeus-stage .grid-stack-item .grid-stack-item-content {\\n width: calc(100% - 20px);\\n left: 10px;\\n right: 10px;\\n top: 10px;\\n}\\n\\n.zeus-stage {\\n height: 100%;\\n overflow: auto;\\n}\\n.zeus-stage .zeus-pipeline-stage-duration {\\n font-size: 0.9em;\\n align-items: center;\\n}\\n.zeus-stage .zeus-pipeline-stage-duration > span {\\n margin-right: 4px;\\n}\\n.zeus-stage .zeus-pipeline-stage-duration .zeus-pipeline-stage-duration-percentage {\\n width: 100%;\\n height: 3px;\\n border-radius: 2px;\\n}\\n\\n.zeus-stage-container {\\n min-width: 250px;\\n max-width: 250px;\\n margin: 0 var(--zeus-margin-xs);\\n}\\n.zeus-stage-container .card-toolbar {\\n position: absolute;\\n right: var(--zeus-margin-xs);\\n}\\n.zeus-stage-container .card-header {\\n min-height: 100px !important;\\n max-height: 100px !important;\\n}\\n.zeus-stage-container .card-title {\\n max-width: 160px;\\n}\\n.zeus-stage-container.zeus-stage-container-view-standard .zeus-person-name-properties,\\n.zeus-stage-container.zeus-stage-container-view-standard .zeus-person-name-actions {\\n display: block;\\n}\\n.zeus-stage-container.zeus-stage-container-view-standard .zeus-pipeline-stage-duration {\\n display: flex;\\n margin-top: var(--zeus-space-xs);\\n}\\n.zeus-stage-container.zeus-stage-container-view-standard .zeus-pipeline-stage-duration > span {\\n display: block;\\n}\\n.zeus-stage-container.zeus-stage-container-view-compact .zeus-person-name-properties,\\n.zeus-stage-container.zeus-stage-container-view-compact .zeus-person-name-actions,\\n.zeus-stage-container.zeus-stage-container-view-compact .zeus-pipeline-stage-duration {\\n display: none;\\n}\\n.zeus-stage-container.zeus-stage-container-view-minimized {\\n min-width: 100px;\\n max-width: 100px;\\n}\\n.zeus-stage-container.zeus-stage-container-view-minimized .zeus-person-name-properties,\\n.zeus-stage-container.zeus-stage-container-view-minimized .zeus-person-name-actions,\\n.zeus-stage-container.zeus-stage-container-view-minimized .zeus-pipeline-stage-duration,\\n.zeus-stage-container.zeus-stage-container-view-minimized .zeus-person-name-right {\\n display: none;\\n}\\n.zeus-stage-container.zeus-stage-container-view-minimized .zeus-draggable-handle,\\n.zeus-stage-container.zeus-stage-container-view-minimized .zeus-stage-sub-title,\\n.zeus-stage-container.zeus-stage-container-view-minimized card-toolbar,\\n.zeus-stage-container.zeus-stage-container-view-minimized .zeus-pipeline-person-editor {\\n display: none !important;\\n}\\n.zeus-stage-container.zeus-stage-container-view-minimized .card-header {\\n min-height: 75px;\\n max-height: 75px;\\n overflow: hidden;\\n padding: var(--zeus-margin-xs);\\n}\\n\\n[data-theme=dark] .zeus-stages .grid-stack-item-content {\\n background-color: var(--kt-app-bg-color);\\n}\", \"\",{\"version\":3,\"sources\":[\"webpack://./src/resources/elements/pipelines/stages.scss\"],\"names\":[],\"mappings\":\"AAEA;EACI,oCAAA;EACA,yBAAA;EACA,sBAAA;EACA,uBAAA;EACA,gBAAA;EACA,oBAAA;EACA,mBAAA;AADJ;AAGI;EACI,YAAA;AADR;;AAKA;EACI,8BAAA;AAFJ;;AAKA;EACI,sBAAA;EACA,SAAA;EACA,YAAA;EACA,gBAAA;EACA,oCAAA;EACA,gCAAA;EACA,aAAA;EACA,uBAAA;EACA,mBAAA;AAFJ;AAII;EACI,UAAA;AAFR;AAKI;EACI,gCAAA;AAHR;;AAOA;EACI,YAAA;AAJJ;;AAOA;EACI,aAAA;EACA,WAAA;EACA,YAAA;EACA,gBAAA;AAJJ;AAMI;EACI,4BAAA;EACA,6BAAA;EACA,iCAAA;AAJR;AAMQ;EACI,sBAAA;EACA,2BAAA;AAJZ;AAMY;EACI,sBAAA;AAJhB;AASI;EACI,iCAAA;EACA,kBAAA;AAPR;AAUI;EACI,gBAAA;EACA,uBAAA;EACA,cAAA;EACA,YAAA;EACA,oCAAA;EACA,wCAAA;EACA,0CAAA;EACA,aAAA;EACA,sBAAA;EACA,8BAAA;EACA,kBAAA;AARR;AAUQ;EACI,kBAAA;EACA,QAAA;EACA,MAAA;EACA,8BAAA;EACA,UAAA;AARZ;AAWQ;EACI,YAAA;AATZ;;AAcA;EACI,oCAAA;AAXJ;;AAcA;EACI,wBAAA;EACA,UAAA;EACA,WAAA;EACA,SAAA;AAXJ;;AAcA;EACI,YAAA;EACA,cAAA;AAXJ;AAaI;EACI,gBAAA;EACA,mBAAA;AAXR;AAaQ;EACI,iBAAA;AAXZ;AAcQ;EACI,WAAA;EACA,WAAA;EACA,kBAAA;AAZZ;;AAiBA;EACI,gBAAA;EACA,gBAAA;EACA,+BAAA;AAdJ;AAgBI;EACI,kBAAA;EACA,4BAAA;AAdR;AAiBI;EACI,4BAAA;EACA,4BAAA;AAfR;AAkBI;EACI,gBAAA;AAhBR;AAoBQ;;EAEI,cAAA;AAlBZ;AAqBQ;EACI,aAAA;EACA,gCAAA;AAnBZ;AAoBY;EACI,cAAA;AAlBhB;AAwBQ;;;EAGI,aAAA;AAtBZ;AA0BI;EACI,gBAAA;EACA,gBAAA;AAxBR;AA0BQ;;;;EAII,aAAA;AAxBZ;AA2BQ;;;;EAII,wBAAA;AAzBZ;AA4BQ;EACI,gBAAA;EACA,gBAAA;EACA,gBAAA;EACA,8BAAA;AA1BZ;;AAiCQ;EACI,wCAAA;AA9BZ\",\"sourcesContent\":[\"@import \\\"./../../../styles/components/mixins/_theme-mode.scss\\\";\\r\\n\\r\\n.zeus-pipeline-backlog {\\r\\n background-color: var(--kt-gray-200);\\r\\n color: var(--kt-gray-700);\\r\\n padding: 0.4rem 0.4rem;\\r\\n border-radius: 0.475rem;\\r\\n white-space: pre;\\r\\n display: inline-flex;\\r\\n align-items: center;\\r\\n\\r\\n &:hover {\\r\\n cursor: move;\\r\\n }\\r\\n}\\r\\n\\r\\n.zeus-stage-header {\\r\\n border-bottom: none !important;\\r\\n}\\r\\n\\r\\n.zeus-stage-trash {\\r\\n border: 1px dashed red;\\r\\n flex: .5;\\r\\n height: 100%;\\r\\n min-height: 40px;\\r\\n border-radius: var(--zeus-margin-xs);\\r\\n background: rgba(255, 0, 0, 0.1);\\r\\n display: flex;\\r\\n justify-content: center;\\r\\n align-items: center;\\r\\n\\r\\n > i {\\r\\n color: red;\\r\\n }\\r\\n\\r\\n &:hover {\\r\\n background: rgba(255, 0, 0, 0.5);\\r\\n }\\r\\n}\\r\\n\\r\\n.grid-stack-item-removing {\\r\\n opacity: 0.5;\\r\\n}\\r\\n\\r\\n.zeus-stages {\\r\\n display: flex;\\r\\n width: 100%;\\r\\n height: 100%;\\r\\n overflow-x: auto;\\r\\n\\r\\n .zeus-stage-heading {\\r\\n border-bottom-left-radius: 0;\\r\\n border-bottom-right-radius: 0;\\r\\n margin-bottom: var(--zeus-margin);\\r\\n\\r\\n .card-title {\\r\\n flex-direction: column;\\r\\n justify-content: flex-start;\\r\\n\\r\\n > * {\\r\\n align-self: flex-start;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n .zeus-stage-coloring {\\r\\n border-top: 4px solid transparent;\\r\\n border-radius: 4px;\\r\\n }\\r\\n\\r\\n .grid-stack-item-content {\\r\\n text-align: left;\\r\\n background-color: white;\\r\\n color: inherit;\\r\\n padding: 1em;\\r\\n border-radius: var(--zeus-margin-xs);\\r\\n border: 1px solid var(--kt-border-color);\\r\\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\\r\\n display: flex;\\r\\n flex-direction: column;\\r\\n justify-content: space-between;\\r\\n position: relative;\\r\\n\\r\\n .zeus-pipeline-person-editor {\\r\\n position: absolute;\\r\\n right: 0;\\r\\n top: 0;\\r\\n padding: var(--zeus-margin-sm);\\r\\n z-index: 2;\\r\\n }\\r\\n\\r\\n &:hover {\\r\\n cursor: move;\\r\\n }\\r\\n }\\r\\n}\\r\\n\\r\\n.grid-stack-placeholder > .placeholder-content {\\r\\n border-radius: var(--zeus-margin-xs);\\r\\n}\\r\\n\\r\\n.zeus-stage .grid-stack-item .grid-stack-item-content {\\r\\n width: calc(100% - 20px); // account for the 10px inset\\r\\n left: 10px;\\r\\n right: 10px;\\r\\n top: 10px;\\r\\n}\\r\\n\\r\\n.zeus-stage {\\r\\n height: 100%;\\r\\n overflow: auto;\\r\\n\\r\\n .zeus-pipeline-stage-duration {\\r\\n font-size: 0.9em;\\r\\n align-items: center;\\r\\n\\r\\n > span {\\r\\n margin-right: 4px;\\r\\n }\\r\\n\\r\\n .zeus-pipeline-stage-duration-percentage {\\r\\n width: 100%;\\r\\n height: 3px;\\r\\n border-radius: 2px;\\r\\n }\\r\\n }\\r\\n}\\r\\n\\r\\n.zeus-stage-container {\\r\\n min-width: 250px;\\r\\n max-width: 250px;\\r\\n margin: 0 var(--zeus-margin-xs);\\r\\n\\r\\n .card-toolbar {\\r\\n position: absolute;\\r\\n right: var(--zeus-margin-xs);\\r\\n }\\r\\n\\r\\n .card-header {\\r\\n min-height: 100px !important;\\r\\n max-height: 100px !important;\\r\\n }\\r\\n\\r\\n .card-title {\\r\\n max-width: 160px;\\r\\n }\\r\\n\\r\\n &.zeus-stage-container-view-standard {\\r\\n .zeus-person-name-properties,\\r\\n .zeus-person-name-actions {\\r\\n display: block;\\r\\n }\\r\\n\\r\\n .zeus-pipeline-stage-duration {\\r\\n display: flex;\\r\\n margin-top: var(--zeus-space-xs);\\r\\n > span {\\r\\n display: block;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n &.zeus-stage-container-view-compact {\\r\\n .zeus-person-name-properties,\\r\\n .zeus-person-name-actions,\\r\\n .zeus-pipeline-stage-duration {\\r\\n display: none;\\r\\n }\\r\\n }\\r\\n\\r\\n &.zeus-stage-container-view-minimized {\\r\\n min-width: 100px;\\r\\n max-width: 100px;\\r\\n\\r\\n .zeus-person-name-properties,\\r\\n .zeus-person-name-actions,\\r\\n .zeus-pipeline-stage-duration,\\r\\n .zeus-person-name-right {\\r\\n display: none;\\r\\n }\\r\\n\\r\\n .zeus-draggable-handle,\\r\\n .zeus-stage-sub-title,\\r\\n card-toolbar,\\r\\n .zeus-pipeline-person-editor {\\r\\n display: none !important;\\r\\n }\\r\\n\\r\\n .card-header {\\r\\n min-height: 75px;\\r\\n max-height: 75px;\\r\\n overflow: hidden;\\r\\n padding: var(--zeus-margin-xs);\\r\\n }\\r\\n }\\r\\n}\\r\\n\\r\\n@include theme-dark() {\\r\\n .zeus-stages {\\r\\n .grid-stack-item-content {\\r\\n background-color: var(--kt-app-bg-color);\\r\\n }\\r\\n }\\r\\n}\\r\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\";\n// Exports\nexport default code;","// Module\nvar code = \"\";\n// Exports\nexport default code;"],"names":[],"sourceRoot":""}