{"version":3,"sources":["webpack:///../WCC.UI/App/components/cardsScoreAnswers/cardsScoreAnswers.html?63bd","webpack:///../WCC.UI/App/components/cardsScoreAnswers/cardsScoreAnswers.scss?088e","webpack:///../WCC.UI/App/components/cardsScoreAnswers/cardsScoreAnswers.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/cardsScoreAnswers/cardsScoreAnswers.scss","webpack:///../WCC.UI/App/components/cardsScoreAnswers/cardsScoreAnswers.html"],"names":["content","expose","__esModule","default","api","module","i","options","exports","locals","CardsScoreAnswersVM","constructor","model","info","managers","effects","_model$topic","_model$cardsScales","_model$cards","items","ko","observableArray","topicManager","topic","topicId","isLoadingTopic","observable","pluck","scales","cardsScales","t","cards","hideTitle","showValues","answers","unwrap","isReady","pureComputed","length","register","this","buildItems","showComments","showScaleNames","applyBindingsToNode","element","scaleTuples","reduce","result","answer","scale","find","id","cardsScaleId","push","_","sortBy","item","cardScaleOrder","_ref","cardTuples","answerCard","card","cardId","sortedCardTuples","order","title","scaleLeftName","leftName","scaleRightName","rightName","values","map","_item$answerCard$real","position","value","realValueStr","medianPosition","median","medianStr","realAnswers","realCards","rc","_rc$RealValue","_rc$Person","_rc$Person2","_rc$RealValue2","_item$answerCard$real2","realValue","RealValue","toFixed","personId","Person","PersonId","name","Name","comment","Comment","aboveAVGValue","__decorate","injectable","__param","inject","wccModules","componentConfig","componentInfo","managersContext","system","SystemHelpers","html","getTemplatesAndResources","forEach","node","document","head","appendChild","___CSS_LOADER_API_IMPORT___"],"mappings":"uJAAA,UAAO,CACC,uHACA,wDAIC,KAJyC,EAAF,SAAYA,EAASC,GAGzD,OADAA,EADAD,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,GAE1CA,GACV,4B,oFCNT,IAAII,EAAM,EAAQ,gFACFJ,EAAU,EAAQ,kKAIC,iBAFvBA,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,KAG/CA,EAAU,CAAC,CAACK,EAAOC,EAA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IAAAH,IAAI,KAAkC,QAA7BC,EAAE9B,EAAKI,WAAW2B,mBAAW,IAAAD,IAAI,SAG/EvD,UAAWA,EACXW,eAAgBA,IAGbK,GACR,MAzFUtC,EAAmByF,EAAA,CADvCC,cAKQC,EAAA,EAAAC,YAAOC,IAAWC,kBAClBH,EAAA,EAAAC,YAAOC,IAAWE,gBAClBJ,EAAA,EAAAC,YAAOC,IAAWG,kBAClBL,EAAA,EAAAC,YAAOC,IAAWxF,WAPNL,gB,yLCzDrB,WAOC,KAPD,aACI,MAAMiG,EAAS,EAAQ,mCAAkBC,cAEzC,OAAO,SAAUC,GACbF,EAAOG,yBAAyBD,GAC3BE,SAAQ,SAAUC,GAAQC,SAASC,KAAKC,YAAYH,QAEhE,+B,kLCLDxG,EADkC,EAAQ,wDAChC4G,EAA4B,IAE9B9D,KAAK,CAACjD,EAAOC,EAAI,09CAA29C,KAEp/CD,EAAOG,QAAUA,G,kICHjBH,EAAOG,QAFI","file":"275.24cbbcffbdf17cea5fd2.js","sourcesContent":["define([\n \"!!../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./cardsScoreAnswers.html\", \n \"!../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","var api = require(\"!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n var content = require(\"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/sass-loader/dist/cjs.js!./cardsScoreAnswers.scss\");\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};","import { injectable, inject } from \"inversify\";\r\nimport { SubscribableOrValue, PureComputed, Subscribable, ObservableArray, Observable, Computed } from \"knockout\";\r\n\r\nimport { ManagersContext } from \"managers/context\";\r\nimport { Topic } from \"models/topic\";\r\nimport { TopicCardsScale } from \"models/topicCardsScale\";\r\nimport { TopicCard } from \"../../models/topicCard\";\r\nimport { CardsScoreAnswer } from \"models/cardsScoreAnswer\";\r\nimport { CardsScoreAnswerCard } from \"models/cardsScoreAnswerCard\";\r\nimport { wccModules } from \"enums/wccModules\";\r\nimport { EffectsContainer } from \"mixins/withEffects\";\r\n\r\nimport './cardsScoreAnswers.html';\r\nimport './cardsScoreAnswers.scss';\r\n\r\nexport interface CardsScoreAnswersConfig {\r\n topicId?: SubscribableOrValue\r\n topic?: SubscribableOrValue\r\n cards?: ObservableArray\r\n cardsScales?: ObservableArray\r\n answers?: SubscribableOrValue>\r\n hideTitle?: boolean\r\n showValues?: boolean\r\n showScaleNames?: boolean\r\n showComments: Observable\r\n}\r\n\r\nexport interface CardsScoreAnswersScaleItem {\r\n id: Subscribable\r\n title: Subscribable\r\n scaleLeftName: string\r\n scaleRightName: string\r\n values: Array\r\n hideTitle: boolean\r\n showScaleNames: boolean\r\n}\r\n\r\ninterface CardScoreRealAnswer {\r\n realValue: string | undefined\r\n personId: string | undefined\r\n name: string | undefined\r\n comment: string | undefined\r\n aboveAVGValue: boolean\r\n}\r\n\r\nexport interface CardsScoreAnswersCardValue {\r\n title: Subscribable\r\n position: Subscribable\r\n realValueStr: Subscribable\r\n medianPosition: Subscribable\r\n medianStr: Subscribable\r\n showValues: boolean\r\n showComments: Observable\r\n realAnswers: CardScoreRealAnswer[] | undefined\r\n}\r\n\r\n@injectable()\r\nexport default class CardsScoreAnswersVM {\r\n items: ObservableArray = ko.observableArray()\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) model: CardsScoreAnswersConfig,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\r\n @inject(wccModules.managersContext) managers: ManagersContext,\r\n @inject(wccModules.effects) effects: EffectsContainer\r\n ) {\r\n const topicManager = managers.topic(model.topicId);\r\n const isLoadingTopic = model.topic ? ko.observable(false) : topicManager.pluck('loading', true);\r\n const topic = (model.topic ?? topicManager.pluck('topic')) as PureComputed\r\n const scales = model.cardsScales ?? topic.pluck(t => t.cardsScales, []);\r\n const cards = model.cards ?? topic.pluck(t => t.cards, []);\r\n\r\n const hideTitle = model.hideTitle == true;\r\n const showValues = model.showValues == true;\r\n\r\n const answers = ko.observable(model.answers).unwrap().default([] as Array);\r\n\r\n const isReady = ko.pureComputed(() => !isLoadingTopic() && answers().length > 0);\r\n\r\n effects.register((scales, cards, answers, isReady) => {\r\n if (isReady)\r\n this.items(this.buildItems(scales, cards, answers, hideTitle, showValues, model.showComments, model.showScaleNames == true));\r\n else\r\n this.items([]);\r\n }, [scales, cards, answers, isReady]);\r\n\r\n ko.applyBindingsToNode(info.element, {\r\n 'visible': isReady,\r\n\r\n 'css': {\r\n 'cards-score-answers': true\r\n }\r\n }, this);\r\n }\r\n\r\n private buildItems(scales: Array, cards: Array, answers: Array, \r\n hideTitle: boolean, showValues: boolean, showComments: Observable, showScaleNames: boolean): Array {\r\n const scaleTuples = answers.reduce((result, answer) => {\r\n const scale = scales.find(scale => scale.id() === answer.cardsScaleId());\r\n\r\n if(scale)\r\n result.push({ scale, answer });\r\n\r\n return result;\r\n }, [] as Array<{ scale: TopicCardsScale, answer: CardsScoreAnswer }>);\r\n\r\n const sortedScaleTuples = _(scaleTuples).sortBy(item => item.scale.cardScaleOrder());\r\n\r\n return sortedScaleTuples.reduce((result, { scale, answer }) => {\r\n const cardTuples = answer.cards().reduce((result, answerCard) => {\r\n const card = cards.find(card => card.id() === answerCard.cardId());\r\n\r\n if (card)\r\n result.push({ card, answerCard });\r\n\r\n return result;\r\n }, [] as Array<{ card: TopicCard, answerCard: CardsScoreAnswerCard }>);\r\n\r\n const sortedCardTuples = _(cardTuples).sortBy(item => item.card.order());\r\n\r\n result.push({\r\n id: scale.id as Subscribable,\r\n title: scale.title,\r\n scaleLeftName: scale.leftName(),\r\n scaleRightName: scale.rightName(),\r\n values: sortedCardTuples.map(item => ({\r\n title: item.card.title,\r\n position: item.answerCard.value,\r\n realValueStr: item.answerCard.realValueStr,\r\n medianPosition: item.answerCard.median,\r\n medianStr: item.answerCard.medianStr,\r\n showValues: showValues,\r\n showComments: showComments,\r\n realAnswers: item.answerCard.realCards?.map(rc => ({\r\n realValue: '(' + rc.RealValue?.toFixed(1) + ')',\r\n personId: rc.Person?.PersonId,\r\n name: rc.Person?.Name,\r\n comment: rc.Comment,\r\n aboveAVGValue: +(rc.RealValue ?? 0) > +(item.answerCard.realValue() ?? 0)\r\n }))\r\n })),\r\n hideTitle: hideTitle,\r\n showScaleNames: showScaleNames,\r\n });\r\n\r\n return result;\r\n }, [] as Array);\r\n }\r\n}","define(function () {\r\n const system = require('helpers/system').SystemHelpers;\r\n\r\n return function (html) {\r\n system.getTemplatesAndResources(html)\r\n .forEach(function (node) { document.head.appendChild(node) });\r\n }\r\n});","// Imports\nvar ___CSS_LOADER_API_IMPORT___ = require(\"../../../node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \".cards-score-answers{display:block}.cards-score-answers__scale{margin-bottom:20px}.cards-score-answers__scale:last-child{margin-bottom:0}.cards-score-answers__scale__title{margin:0 0 15px}.cards-score-answers__scale__value{margin-bottom:10px}.cards-score-answers__scale__value:last-child{margin-bottom:0}.cards-score-answers__scale__value__title{margin-bottom:7px;margin-top:14px;font-size:13px}.cards-score-answers__scale__value__title .card-srore-card__title{display:inline-block;width:60%}.cards-score-answers__scale__value__title .card-srore-card__value{font-weight:bold;float:right;display:inline-block;max-width:35%;color:#297dc4}.cards-score-answers__scale__value__title .card-srore-card__value_second{color:#ee7c0e}.cards-score-answers__slider{position:relative;height:4px;background-color:#5ca2dd;border-radius:4px}.cards-score-answers__slider__pin{position:absolute;top:50%;width:12px;height:12px;transform:translate(-50%, -50%);background-color:#297dc4;border-radius:100%}.cards-score-answers__slider__pin.cards-score-answers__slider__pin_orange{background-color:#ee7c0e}.cards-score-answers__slider__center{position:absolute;top:50%;width:1px;height:12px;transform:translate(-50%, -50%);background-color:#297dc4;border-radius:100%;left:50%}.cards-score-answers__scale-names{padding-top:15px;font-weight:bold;font-size:14px}.cards-score-answers__scale-name{width:45%}.cards-score-answers__scale-name-left{float:left}.cards-score-answers__scale-name-right{float:right;text-align:right}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;"],"sourceRoot":""}