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/./src/app/administration/value-lists/value-lists.ts"],"sourcesContent":["import { ListService } from 'app/services/list-service';\r\nimport { NewValueList } from '../../components/modals/new-value-list/new-value-list';\r\nimport { ModalService } from './../../services/modal-service';\r\nimport { DeviceService } from 'app/services/device-service';\r\nimport { Subscription, EventAggregator } from 'aurelia-event-aggregator';\r\nimport { TaskQueue, autoinject } from \"aurelia-framework\";\r\nimport { ValueListDto, ValueListItemDto } from \"app/models/value-list-dtos\";\r\nimport { ValueListService } from \"app/services/value-list/value-list-service\";\r\nimport { ApiClient } from 'app/services/api-client';\r\nimport { I18N } from 'aurelia-i18n';\r\nimport { AppContextService } from 'app/services/app-context-service';\r\nimport { ValuelistUpload } from 'app/components/file-upload/specific-uploads/valuelist-upload';\r\nimport { ImportValuelistModel } from 'app/models/viewmodels/import-valuelist-model';\r\nimport {DialogCloseResult} from \"aurelia-dialog\";\r\nimport { ContextMenuService } from 'app/services/context-menu-service';\r\nimport { HttpResponseMessage } from 'aurelia-http-client';\r\nimport { OrgTokenService } from 'app/services/org-token-service';\r\n\r\ndeclare let $: any;\r\n\r\n@autoinject\r\nexport class ValueLists {\r\n\tshowValues: boolean = false;\r\n\tpublic selectedValueLists: ValueListDto[] = [];\r\n\tpublic selectedValueList: ValueListDto | null = null;\r\n\tpublic selectedValueListItem: ValueListItemDto | null = null;\r\n\tpublic selectedValueListItemOriginal: ValueListItemDto | null = null;\r\n\tpublic newValueList: ValueListDto | null = null;\r\n\tpublic newValueListItem: ValueListItemDto | null = null;\r\n\tpublic valueLists: ValueListDto[] = [];\r\n\tpublic viewContext: string;\r\n\tpublic searchTerm: string = \"\";\r\n\tpublic searchTermValues: string = \"\";\r\n\tprivate allSelected: boolean = false;\r\n\tpublic column: string = \"name\";\r\n\tpublic displayState: { icon: string, direction: string } | undefined;\r\n\tprivate subscriptions: Subscription[] = [];\r\n\r\n\tpublic keybuttonHandling: ((this: Window, ev: KeyboardEvent) => any) | undefined;\r\n\tpublic newValueListItemName: string = \"\";\r\n\r\n\t\r\n\tconstructor(\r\n\t\tprivate valueListService:ValueListService, \r\n\t\tprivate events: EventAggregator, private modal: ModalService, private appContext: AppContextService, \r\n\t\tprivate apiClient: ApiClient, private i18n: I18N, private element: Element, \r\n\t\tprivate deviceService: DeviceService, private taskQueue: TaskQueue, \r\n\t\tprivate listService: ListService, \r\n\t\tpublic contextMenuService: ContextMenuService,\r\n\t\tprivate orgTokenService: OrgTokenService\r\n\t) {\r\n\t\tthis.viewContext = \"TopBar\";\r\n\t}\r\n\r\n\tasync activate() {\r\n\t\tawait this.getValueLists();\r\n\r\n\t\tthis.setupKeyHandler();\r\n\t\tthis.displayState = { icon: \"fa-sort-up\", direction: \"ascending\" };\r\n\t}\r\n\r\n\tattached() {\t\t\r\n\t\tconst searchHandler = (data: any) => this.handleSearchEvent(data);\r\n\t\tthis.subscriptions = [\r\n\t\t\tthis.events.subscribe(this.viewContext + \":SearchTermChanged\", searchHandler),\r\n\t\t\tthis.events.subscribe(\"global:org-changed\", async () => this.reloadPage())\r\n\t\t];\r\n\t}\r\n\r\n\tasync reloadPage(): Promise {\r\n\t\tthis.selectedValueListItem = null;\r\n\t\tthis.selectedValueLists = [];\r\n\t\tthis.selectedValueListItemOriginal = null;\r\n\t\tthis.closeValuesPanel();\r\n\t\tawait this.getValueLists();\r\n\t}\r\n\t\r\n\tasync setupKeyHandler() {\r\n\t\tthis.keybuttonHandling = async (event) => {\r\n if(event.key == \"Escape\") {\r\n this.closeValuesPanel();\r\n } \r\n\t\t\tif (event.key == \"Enter\") {\r\n\t\t\t\tif ($('.list-item-input').is(\":focus\")) {\r\n\t\t\t\t\tawait this.addNewListItem();\r\n\t\t\t\t}\r\n\t\t\t}\r\n };\r\n\t\twindow.addEventListener('keyup', this.keybuttonHandling, false);\r\n\t}\r\n\r\n\tdetached() {\r\n\t\tif (this.keybuttonHandling) {\r\n\t\t\twindow.removeEventListener('keyup', this.keybuttonHandling, false);\r\n\t\t}\r\n\t\tthis.subscriptions.forEach(subscription => (\r\n\t\t\tsubscription.dispose()\r\n\t\t));\r\n\t}\r\n\r\n\tprivate handleSearchEvent(data: string) {\r\n\t\tthis.searchTerm = data;\r\n\t\tlet includedList: ValueListDto[] = this.valueLists.filter(valueList => {\r\n\t\t\treturn valueList.name.toLocaleLowerCase().includes(this.searchTerm);\r\n\t\t});\r\n\t\tif (this.selectedValueList && !includedList.includes(this.selectedValueList)) {\r\n\t\t\tthis.closeValuesPanel();\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t* ValueLists \r\n\t*/\r\n\tpublic selectList(list: ValueListDto) {\t\t\r\n\t\t// if (Boolean(this.selectedValueList)) {\r\n\t\t// \tif (this.selectedValueList.id === list.id) {\r\n\t\t// \t\tthis.deselectList(list); // in selectList.\r\n\t\t// \t\treturn;\r\n\t\t// \t}\r\n\t\t// \tthis.selectedValueList.selected = false;\r\n\t\t// \tthis.selectedValueList.inEditMode = false;\r\n\t\t// }\r\n\t\t// list.selected = true;\r\n\t\tthis.selectedValueList = list;\r\n\t\tthis.selectedValueListItem = null;\r\n\t\tthis.newValueList = null;\r\n\t\tthis.newValueListItem = null;\r\n\t\t// this.selectedValueLists.push(list);\r\n\t}\r\n\r\n\tpublic deselectList(list: ValueListDto) {\r\n\t\tif (this.selectedValueList?.inEditMode) {\r\n\t\t\tthis.cancelEditListMode();\r\n\t\t}\r\n\t\t\tthis.selectedValueList = null;\r\n\t\t\tthis.selectedValueLists.splice(this.selectedValueLists.indexOf(list), 1);\r\n\t}\r\n\r\n\tshowValuesPanel(list: ValueListDto) {\r\n\t\t// if (Boolean(this.selectedValueList)) {\r\n\t\t// \tthis.deselectList(list); // in showValuesPanel.\r\n\t\t// }\r\n\t\tthis.newValueListItemName = \"\";\r\n\t\tif (Boolean(this.selectedValueList)) {\r\n\t\t\tthis.cancelEditListMode();\r\n\t\t}\r\n\t\tif (Boolean(this.selectedValueList) && this.selectedValueList == list) {\r\n\t\t\tthis.closeValuesPanel();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis.selectList(list);\r\n\t\tthis.getValueListItems();\r\n\t\tthis.showValues = true;\r\n\t\tthis.events.publish(\"aside-toggled\");\r\n\t}\r\n\r\n\tcloseValuesPanel() {\r\n\t\tthis.showValues = false;\r\n\t\tthis.selectedValueList = null;\r\n\t\tthis.searchTermValues = \"\";\r\n\t\tthis.events.publish(\"aside-toggled\");\r\n\t}\r\n\r\n\tpublic editListName() {\r\n\t\tif (this.selectedValueList) {\r\n\t\t\tthis.selectedValueList.inEditMode = true;\r\n\t\t\tthis.selectedValueList.editName = this.selectedValueList.name;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic cancelEditListMode() {\r\n\t\tif (this.selectedValueList) {\r\n\t\t\tthis.selectedValueList.inEditMode = false;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic async newList() {\r\n\t\tconsole.log('System value list: Started new list (1)');\r\n\t\tawait this.modal.OpenModal(NewValueList).whenClosed(async (x:DialogCloseResult) => {\r\n\t\t\tif (!x.wasCancelled) {\r\n\t\t\t\tconsole.log('Before start of add new list (3)');\r\n\t\t\t\tlet output = x.output;\r\n\t\t\t\tif (!output) {\r\n\t\t\t\t\tconsole.log('value-list.newList, no output yet, bailing out.');\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tawait this.addNewList(x.output);\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tprivate async getValueLists() {\r\n\t\tconsole.log(\"valuelistservice \" , this.valueListService);\r\n\t\tthis.valueLists = (await this.valueListService.getValueListsOnSystem()).filter(x => x.id !== \"00000000-0000-0000-0000-000000000000\");\r\n\t\tif(this.selectedValueList != undefined) {\r\n\t\t\tthis.valueLists.forEach(element => {\r\n\t\t\tif(element.id == this.selectedValueList?.id) {\r\n\t\t\t\t\tthis.selectedValueList = element;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tprivate getValueListItems() {\r\n\t\tif (this.selectedValueList != undefined) {\r\n\t\t\tthis.valueListService.getValueListItemsOnSystem(this.selectedValueList.id)\r\n\t\t\t.then(result => {\r\n\t\t\t\tif (this.selectedValueList) {\r\n\t\t\t\t\tthis.selectedValueList.items = result;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic async addNewList(name: string) {\r\n\t\tif (name.trim().length > 0) {\r\n\t\t\tlet createdValueList: ValueListDto = await this.valueListService.addNewListToSystem(name).finally(() => { this.newValueList = null; });\r\n\t\t\tif (createdValueList != undefined) {\r\n\t\t\t\tawait this.getValueLists();\r\n\t\t\t\tthis.getValueListItems();\r\n\t\t\t\tlet finishedSetupValueList: ValueListDto[] = this.valueLists.filter(valueList => {\r\n\t\t\t\t\treturn createdValueList.id == valueList.id;\r\n\t\t\t\t});\r\n\t\t\t\tif (finishedSetupValueList.length > 0 ) {\r\n\t\t\t\t\tthis.showValuesPanel(finishedSetupValueList[0]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tpublic renameList() {\r\n\t\tif (this.selectedValueList) {\r\n\t\t\tthis.selectedValueList.name = this.selectedValueList.editName;\r\n\t\t\tthis.valueListService.renameValueListOnSystem(this.selectedValueList)\r\n\t\t\t.then((response: HttpResponseMessage) => {\t\r\n\t\t\t\tthis.cancelEditListMode();\r\n\t\t\t});\r\n\t\t} \r\n\t}\r\n\r\n\tpublic removeList() {\r\n\t\t$(\".delete-button\").blur()\r\n\t\tthis.modal.OpenConfirm(\"Delete value lists\", `Are you sure you wish to delete the selected value lists?`).whenClosed(y => {\r\n\t\t\tif (!y.wasCancelled) {\r\n\t\t\t\t// let ids: string[] = [];\r\n\t\t\t\t// this.selectedValueLists.forEach(x => ids.push(x.id));\r\n\t\t\t\tif (this.selectedValueList) {\r\n\t\t\t\t\tthis.valueListService.removeListFromSystem([this.selectedValueList.id])\r\n\t\t\t\t\t.finally(() => {\r\n\t\t\t\t\t\tthis.selectedValueList = null;\r\n\t\t\t\t\t\tthis.selectedValueListItem = null;\r\n\t\t\t\t\t\tthis.selectedValueLists = [];\r\n\t\t\t\t\t\tif (this.showValues) {\r\n\t\t\t\t\t\t\tthis.closeValuesPanel();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.getValueLists();\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tpublic async hasOrgSelected():Promise {\r\n\t\tlet ots=this.orgTokenService;\r\n\t\tlet hasOrgSelected:boolean = ots.hasOrgSelected();\r\n\t\tconsole.log('hasOrgSelected A?', hasOrgSelected, ots.orgId());\r\n\t\tif (!hasOrgSelected) {\r\n\t\t\tawait this.modal.OpenMessage('Information','Please select a current organisation');\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\tpublic async exportToExcel() {\t\r\n\t\tconsole.log('exportToExcel C C:/dev/aoc/AO.Client/ClientApp/src/app/administration/value-lists/value-lists.ts');\r\n\t\tif (!await this.hasOrgSelected()) { return; }\r\n\r\n\t\tthis.selectedValueLists.forEach( valueList => {\r\n\t\t\tconsole.log('admcase, vl:', valueList);\r\n\t\t\tthis.apiClient.orgByToken.get(\"Excel/ExportValueList?id=\" + valueList.id) // under administration\r\n\t\t\t.handleError(this.i18n.tr('Error_Title_Generic'), this.i18n.tr('Error_Message_Generic'))\r\n\t\t\t.downloadFile(`${valueList.name}.xlsx`);\r\n\t\t})\r\n\t}\r\n\r\n\topenImportModal() {\r\n\t\tthis.modal.OpenModal(ValuelistUpload, this.valueLists).whenClosed(x => {\r\n\t\t\tif (!x.wasCancelled) {\r\n\t\t\t\tif (Boolean(x.output.isNewValueList)) {\r\n\t\t\t\t\tthis.importNewFromExcel(x.output);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.importExistingFromExcel(x.output);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tpublic importNewFromExcel(model: ImportValuelistModel){\r\n\t\tlet formData = new FormData();\r\n\t\tif (model?.files && model.files[0]) {\r\n\t\t\tformData.append(this.appContext.projectId, model.files[0]);\r\n\t\t}\r\n\t\tthis.apiClient.orgByToken.postForm(`Excel/ImportNewValueList?name=${model.name}&containsHeaders=${model.containsHeaders}`, formData)\r\n\t\t\t.stringResult().then(receipt =>{\r\n\t\t\t\tthis.modal.OpenMessage(\"Import Receipt\", receipt);\r\n\t\t\t}).finally(() => {\r\n\t\t\t\tthis.getValueLists();\r\n\t\t\t\tthis.getValueListItems();\r\n\t\t\t});\r\n\t}\r\n\r\n\tpublic importExistingFromExcel(model: ImportValuelistModel){\r\n\t\tlet formData = new FormData();\r\n\t\tif (model?.files && model.files[0]) {\r\n\t\t\tformData.append(this.appContext.projectId, model.files[0]);\r\n\t\t}\r\n\t\tthis.apiClient.orgByToken.postForm(`Excel/ImportExistingValueList?listId=${model.selectedValueListId}&containsHeaders=${model.containsHeaders}`, formData)\r\n\t\t\t.stringResult().then(receipt =>{\r\n\t\t\t\tthis.modal.OpenMessage(\"Import Receipt\", receipt);\r\n\t\t\t}).finally(() => {\r\n\t\t\t\tthis.getValueLists();\r\n\t\t\t\tthis.getValueListItems();\r\n\t\t\t});\r\n\t}\r\n\r\n\tpublic async assignColors() {\r\n\t\tif (!this.selectedValueList) { console.log('no selected value list.'); return; }\r\n\r\n\t\tlet rsp = await this.valueListService.assignColorsWithOrgToken(this.selectedValueList.id);\r\n\t\tif (rsp) {\r\n\t\t\tawait this.getValueLists();\r\n\t\t\tthis.getValueListItems();//assignColors\r\n\t\t}\r\n\t}\r\n\t\r\n\t/*\r\n\t* ValueListItems \r\n\t*/\r\n\t\r\n\tpublic selectListItem(item: ValueListItemDto) {\r\n\t\tif (this.selectedValueListItem && Boolean(this.selectedValueListItem)) {\r\n\t\t\tthis.selectedValueListItem.selected = false;\r\n\t\t\tthis.selectedValueListItem.editValue = false;\r\n\t\t\tthis.selectedValueListItem.editSortOrder = false;\t\t\t\r\n\t\t}\r\n\r\n\t\titem.selected = true;\r\n\t\tthis.selectedValueListItem = item;\r\n\t\tthis.selectedValueListItemOriginal = Object.assign({}, item);\r\n\t}\r\n\t\r\n\tpublic newListItem() {\r\n\t\tthis.newValueListItem = {\r\n\t\t\tvalue: this.newValueListItemName,\r\n\t\t\tid: '00000000-0000-0000-0000-000000000000',\r\n\t\t\tvalueListId: this.selectedValueList?.id ? this.selectedValueList?.id : '00000000-0000-0000-0000-000000000000',\r\n\t\t\tsortOrder: 0,\r\n\t\t\tisDefault:false,\r\n\t\t\tcolorUI: '#ff8800'\r\n\t\t}\r\n\t}\r\n\r\n\tpublic cancelNewListItem() {\r\n\t\tthis.newValueListItem = null;\r\n\t\tthis.selectedValueListItem = null;\r\n\t}\r\n\r\n\tpublic editListItemValue(item: ValueListItemDto) {\r\n this.selectListItem(item);\r\n\t\tif (this.selectedValueListItem) {\r\n\t\t\tthis.selectedValueListItem.editValue = true;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic editListItemSortOrder(item: ValueListItemDto) {\r\n this.selectListItem(item);\r\n\t\tif (this.selectedValueListItem) {\r\n\t\t\tthis.selectedValueListItem.editSortOrder = true;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic cancelEditListItemValue() {\r\n\t\tif (this.selectedValueListItem) {\r\n\t\t\tthis.selectedValueListItem.editValue = false;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic cancelEditListItemSortOrder() {\r\n\t\tif (this.selectedValueListItem) {\r\n\t\t\tthis.selectedValueListItem.editSortOrder = false;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic async addNewListItem() {\r\n\t\t$('.button-add').blur();\r\n\t\tthis.newListItem();\r\n\t\tif (this.newValueListItem && this.selectedValueList) {\r\n\r\n\t\t\tawait this.valueListService.addNewListItemOnSystem(this.newValueListItem, this.selectedValueList.name)\r\n\t\t\t.then(response => {\r\n\t\t\t\tif (this.selectedValueList?.items) {\r\n\t\t\t\t\tlet newListItem = Object.assign({}, response);\r\n\t\t\t\t\tthis.selectedValueList.items.push(newListItem);\r\n\t\t\t\t\tthis.selectedValueListItem = newListItem;\r\n\t\t\t\t\tthis.newValueListItem = null; \r\n\t\t\t\t}\r\n\t\t\t}).finally(() => {\r\n\t\t\t\tthis.getValueListItems();\r\n\t\t\t});\r\n\t\t\tthis.newValueListItemName = \"\";\r\n\t\t}\r\n\t\t$('.list-item-input').focus();\r\n\t}\r\n\r\n\tpublic renameListItem() {\r\n\t\tif ((this.selectedValueListItem?.value !== this.selectedValueListItemOriginal?.value) && this.selectedValueListItem && this.selectedValueList) {\r\n\t\t\tthis.valueListService.renameListItemOnSystem(this.selectedValueListItem, this.selectedValueList.name)\r\n\t\t\t\t.then(response => {\r\n\t\t\t\t\tif (this.selectedValueListItem) {\r\n\t\t\t\t\t\tthis.selectedValueListItem.editValue = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}).finally(() => {\r\n\t\t\t\t\tthis.getValueListItems();\r\n\t\t\t\t});\r\n\t\t} else {\r\n\t\t\tthis.cancelEditListItemValue();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic async setColor(item : ValueListItemDto) {\r\n\t\tawait this.valueListService.assignColorToListItemByOrg(item);\r\n\t}\r\n\r\n\tpublic setDefaultListItem(item: ValueListItemDto) {\r\n\t\titem.isDefault = !item.isDefault;\r\n\t\tif (this.selectedValueList?.name) {\r\n\t\t\tthis.valueListService.setDefaultListItemOnSystem(item, this.selectedValueList.name)\r\n\t\t\t.finally(() => {\r\n\t\t\t\tthis.getValueListItems();\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tpublic reorderListItem() {\r\n\t\tif ((this.selectedValueListItem?.sortOrder !== this.selectedValueListItemOriginal?.sortOrder) && this.selectedValueListItem && this.selectedValueList) {\r\n\t\t\tthis.valueListService.reorderListItemOnSystem(this.selectedValueListItem, this.selectedValueList.name)\r\n\t\t\t\t.then(response => {\r\n\t\t\t\t\tif (this.selectedValueListItem) {\r\n\t\t\t\t\t\tthis.selectedValueListItem.editSortOrder = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\t.finally(() => {\r\n\t\t\t\t\tthis.getValueListItems();\r\n\t\t\t\t});\r\n\t\t} else {\r\n\t\t\tthis.cancelEditListItemSortOrder();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic removeListItem(item: ValueListItemDto) {\r\n\t\t$('.btn-delete-value-list').blur();\r\n\t\tthis.modal.OpenConfirm(`Delete`, `Please confirm that you want to delete the selected value lists`).whenClosed(result => {\r\n\t\t\tif (result.wasCancelled) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (this.selectedValueList) {\r\n\t\t\t\tthis.valueListService.removeListItemOnSystem(item, this.selectedValueList.name)\r\n\t\t\t\t.then(response => {\r\n\t\t\t\t\tlet itemIndex = this.selectedValueList?.items?.findIndex(x => x === item);\r\n\t\t\t\t\tif (itemIndex) {\r\n\t\t\t\t\t\tthis.selectedValueList?.items?.splice(itemIndex, 1);\r\n\t\t\t\t\t\tthis.selectedValueListItem = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\t\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tpublic async sortBy(columnName: string) {\r\n\t\tawait this.listService.sortBy(columnName).then(result => {\r\n\t\t\tthis.column = result.column;\r\n\t\t\tthis.displayState = result.displayState;\r\n\t\t});\r\n\t}\r\n\r\n\tpublic async toggleList() {\r\n\t\tawait this.listService.toggleElement(this.valueLists).then(result => {\r\n\t\t\tthis.selectedValueLists = result.selected;\r\n\t\t\tthis.allSelected = result.allSelected;\r\n\t\t});\r\n\t}\r\n\r\n\tpublic async toggleAll() {\r\n\t\tawait this.listService.toggleAll(this.valueLists).then(result => {\r\n\t\t\tif (result) {\r\n\t\t\t\tthis.selectedValueLists = result.selected;\r\n\t\t\t\tthis.allSelected = result.allSelected;\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\tasync showMenuItems(event: Event): Promise {\r\n\t\tlet actions = [];\r\n\t\tactions.push({ viewKey: \"button\", setup: { textKey: \"Create Value list\", icon:\"fa-solid fa-list\", actionKey: \"createValueList\", service: {createValueList: () => { this.newList() }}}});\r\n\t\tactions.push({ viewKey: \"line\", setup: {}});\r\n\t\tactions.push({ viewKey: \"button\", setup: { textKey: \"Import from Excel\", icon:\"fa-solid fa-download\", actionKey: \"importFromExcel\", service: {importFromExcel: () => { this.openImportModal() }}}});\r\n\t\tactions.push({ viewKey: \"button\", setup: { textKey: \"Export selected to Excel\", icon:\"fa-solid fa-upload\", isDisabled: !(this.selectedValueLists.length > 0), actionKey: \"exportToExcel\", service: {exportToExcel: () => { this.exportToExcel() }}}});\r\n this.contextMenuService.open(event, actions);\r\n\t}\r\n\r\n\tformatDate(date: string): string {\r\n\t\tlet formattedDate = new Date(date);\r\n\t\tlet minutes = (formattedDate.getMinutes().toString().length > 1) ? formattedDate.getMinutes() : \"0\" + formattedDate.getMinutes();\r\n\t\tlet hours = (formattedDate.getHours().toString().length > 1) ? formattedDate.getHours() : \"0\" + formattedDate.getHours();\r\n\t\treturn formattedDate.toDateString() + \" - \" + hours + \":\" + minutes;\r\n\t}\r\n}\r\n"],"names":["ValueLists","constructor","valueListService","events","modal","appContext","apiClient","i18n","element","deviceService","taskQueue","listService","contextMenuService","orgTokenService","showValues","selectedValueLists","selectedValueList","selectedValueListItem","selectedValueListItemOriginal","newValueList","newValueListItem","valueLists","searchTerm","searchTermValues","allSelected","column","subscriptions","newValueListItemName","this","viewContext","async","getValueLists","setupKeyHandler","displayState","icon","direction","attached","subscribe","data","handleSearchEvent","reloadPage","closeValuesPanel","keybuttonHandling","event","key","$","is","addNewListItem","window","addEventListener","detached","removeEventListener","forEach","subscription","dispose","includedList","filter","valueList","name","toLocaleLowerCase","includes","selectList","list","deselectList","inEditMode","cancelEditListMode","splice","indexOf","showValuesPanel","Boolean","getValueListItems","publish","editListName","editName","console","log","OpenModal","whenClosed","x","wasCancelled","output","addNewList","getValueListsOnSystem","id","undefined","getValueListItemsOnSystem","then","result","items","trim","length","createdValueList","addNewListToSystem","finally","finishedSetupValueList","renameList","renameValueListOnSystem","response","removeList","blur","OpenConfirm","y","removeListFromSystem","ots","hasOrgSelected","orgId","OpenMessage","orgByToken","get","handleError","tr","downloadFile","openImportModal","isNewValueList","importNewFromExcel","importExistingFromExcel","model","formData","FormData","files","append","projectId","postForm","containsHeaders","stringResult","receipt","selectedValueListId","assignColorsWithOrgToken","selectListItem","item","selected","editValue","editSortOrder","Object","assign","newListItem","value","valueListId","sortOrder","isDefault","colorUI","cancelNewListItem","editListItemValue","editListItemSortOrder","cancelEditListItemValue","cancelEditListItemSortOrder","addNewListItemOnSystem","push","focus","renameListItem","renameListItemOnSystem","assignColorToListItemByOrg","setDefaultListItem","setDefaultListItemOnSystem","reorderListItem","reorderListItemOnSystem","removeListItem","removeListItemOnSystem","itemIndex","findIndex","columnName","sortBy","toggleElement","toggleAll","actions","viewKey","setup","textKey","actionKey","service","createValueList","newList","importFromExcel","isDisabled","exportToExcel","open","formatDate","date","formattedDate","Date","minutes","getMinutes","toString","hours","getHours","toDateString","autoinject","I18N","Element","TaskQueue"],"sourceRoot":""}