{ "version": 3, "sources": ["../types/models/vario-types.ts", "analytics-dashboard.ts", "page-navigation.ts", "devextreme-table-functions.ts", "data-grid-side-panel.ts", "floating-actions.ts", "chat.ts", "editor.ts", "emails.ts", "initiate-workflow.ts", "floating-buttons.ts", "calendar.ts", "site.ts", "notifications.ts", "push-notifications.ts", "recipients.ts", "richedit.ts", "refresh-manager.ts", "signature.ts", "../types/models/Enums/signEnumerations.ts", "vario-object.ts", "item-sources.ts", "vario-object-side-panel.ts", "spreadsheet.ts", "user-panel.ts", "diagrams.ts", "edit-operations.ts", "item-properties.ts", "layouts.ts", "notes.ts", "print.ts", "trigger.ts", "search.ts", "message-hub-proxy-client.ts", "../../../node_modules/@microsoft/signalr/src/Errors.ts", "../../../node_modules/@microsoft/signalr/src/HttpClient.ts", "../../../node_modules/@microsoft/signalr/src/ILogger.ts", "../../../node_modules/@microsoft/signalr/src/Loggers.ts", "../../../node_modules/@microsoft/signalr/src/Utils.ts", "../../../node_modules/@microsoft/signalr/src/FetchHttpClient.ts", "../../../node_modules/@microsoft/signalr/src/XhrHttpClient.ts", "../../../node_modules/@microsoft/signalr/src/DefaultHttpClient.ts", "../../../node_modules/@microsoft/signalr/src/TextMessageFormat.ts", "../../../node_modules/@microsoft/signalr/src/HandshakeProtocol.ts", "../../../node_modules/@microsoft/signalr/src/IHubProtocol.ts", "../../../node_modules/@microsoft/signalr/src/Subject.ts", "../../../node_modules/@microsoft/signalr/src/HubConnection.ts", "../../../node_modules/@microsoft/signalr/src/DefaultReconnectPolicy.ts", "../../../node_modules/@microsoft/signalr/src/HeaderNames.ts", "../../../node_modules/@microsoft/signalr/src/AccessTokenHttpClient.ts", "../../../node_modules/@microsoft/signalr/src/ITransport.ts", "../../../node_modules/@microsoft/signalr/src/AbortController.ts", "../../../node_modules/@microsoft/signalr/src/LongPollingTransport.ts", "../../../node_modules/@microsoft/signalr/src/ServerSentEventsTransport.ts", "../../../node_modules/@microsoft/signalr/src/WebSocketTransport.ts", "../../../node_modules/@microsoft/signalr/src/HttpConnection.ts", "../../../node_modules/@microsoft/signalr/src/JsonHubProtocol.ts", "../../../node_modules/@microsoft/signalr/src/HubConnectionBuilder.ts", "vario-app.ts"], "sourcesContent": ["import type { VarioObjectContentGetResult } from \"../models/Enums/varioObjectContentGetResult\";\r\nimport type { RetrieveShareLink } from \"../models/ShareItems/retrieveShareLink\";\r\nimport type { CustomOperationType } from \"./Enums/customOperationType\";\r\nimport type { FieldControlType } from \"./Enums/fieldControlType\";\r\nimport type { FieldValueType } from \"./Enums/fieldValueType\";\r\nimport type { LayoutControlWeb } from \"./Enums/layoutControlWeb\";\r\nimport type { LayoutModel } from \"./LayoutModels/layoutModel\";\r\nimport type { ShareLinkRecipient } from \"./ShareItems/shareLinkRecipient\";\r\nimport \"../dx.all.d.ts\"\r\nimport \"../dx.richedit.d.ts\"\r\n\r\n\r\nenum MediumType {\r\n\tUnknown = 0,\r\n\tNotification = 1,\r\n\tCorrespondence = 2,\r\n\tTask = 3,\r\n}\r\n\r\nenum StepType {\r\n\tToInformation = 0,\r\n\tToRealization = 1,\r\n\tLastStep = 2,\r\n}\r\n\r\nexport interface VirtualDiagramItem {\r\n\ttext: string;\r\n\ttag: any;\r\n\tproperties: { [key: string]: any };\r\n}\r\n\r\nexport interface VirtualNode extends VirtualDiagramItem {\r\n\tid: number;\r\n\tstate: string;\r\n\tisActualState: boolean;\r\n\tstateOrdOrg: number;\r\n\taction: string;\r\n\tactionTopic: string;\r\n\tconnectingToKnotMultiActions: boolean;\r\n\tcolor: string; // Using string for color to represent RGB or Hex format\r\n\tfillColor: string;\r\n\theight: number;\r\n\twidth: number;\r\n\tshape: string;\r\n\tdrawWidth: number;\r\n\tautoSize: string;\r\n\tnodeTextProperties: NodeTextProperties;\r\n}\r\n\r\nexport interface VirtualLink extends VirtualDiagramItem {\r\n\tidLink: number;\r\n\torg: VirtualNode;\r\n\tdst: VirtualNode;\r\n\torgId: number;\r\n\tdstId: number;\r\n\tdrawColor: string; // Using string for color to represent RGB or Hex format\r\n\ttextColor: string;\r\n}\r\n\r\nexport interface NodeTextProperties {\r\n\toperatorName: string;\r\n\tsubstituteOperator: string;\r\n\tgroup: string;\r\n\tposition: string;\r\n\tdateOfRealization: string;\r\n\treceivedDate: string;\r\n\tactionResult: string;\r\n\tstateName: string;\r\n\tduration: string;\r\n}\r\n\r\nexport interface AbstractDiagramLayout {\r\n\tcanRead: boolean;\r\n\tlinks: VirtualLink[];\r\n\tnodes: VirtualNode[];\r\n}\r\n\r\nexport interface ActionsViewModel {\r\n\titemKey: string;\r\n\tactions: VarioActionViewModel[];\r\n\tclose: boolean;\r\n\tmessage: string;\r\n\ttitle: string;\r\n\tcanShowWorkflowOptions: boolean;\r\n\tworkflowRequiredFields: string[];\r\n\tworkflowSuggestedFields: string[];\r\n}\r\nexport interface Auth2FAModel {\r\n\tenabled: boolean;\r\n\tqrImage: string;\r\n\taccount: string;\r\n\tmanualEntryKey: string;\r\n}\r\nexport type ChangedFields = {\r\n\tFieldKey: string;\r\n\tValue: string;\r\n\tModified: boolean;\r\n\tValueType?: string;\r\n\tdropdownText?: string;\r\n};\r\n\r\nexport interface CheckPermissionsResponse {\r\n\tpermResult: boolean;\r\n\tunconstrainedFields: string[];\r\n}\r\n\r\nexport interface ChildSourcesModel {\r\n\tsourceId: string;\r\n\tname: string;\r\n\textension: string;\r\n\tcreationDate: string;\r\n\toperatorName: string;\r\n}\r\n\r\nexport interface ChildSourcesModelJSON {\r\n\tSourceId: string;\r\n\tName: string;\r\n\tExtension: string;\r\n\tCreationDate: string;\r\n\tOperatorName: string;\r\n\tLastCheckOutDate: string;\r\n}\r\n\r\nexport interface CustomOperation {\r\n\titemKey: string;\r\n\tdefinitionKey: string;\r\n\tname: string;\r\n\ttoolTip: string;\r\n\timage: any;\r\n\toperationType: CustomOperationType;\r\n\trecipients: string[];\r\n}\r\nexport interface DisplayDocumentToSignModel {\r\n\timage: string;\r\n\tpagesCount: number;\r\n\twidth: number;\r\n\theight: number;\r\n\trotation: number;\r\n\tmD5: string;\r\n}\r\ninterface DocumentVersions {\r\n\tid: string;\r\n\thashKey?: string;\r\n\tcaption: string;\r\n\tcreatedBy: string;\r\n\tcreationDate: Date;\r\n\tmodificationDate: Date;\r\n\tcomment: string;\r\n\tversion: number;\r\n\tisActualVersion: boolean;\r\n\tfileExtension: string;\r\n\tcontainerCaption: string;\r\n\tstatus: string;\r\n}\r\n\r\nexport interface DocumentVersionsContainer {\r\n\tdefKey: string;\r\n\tdefCaption: string;\r\n\tdocumentVersions: DocumentVersions[];\r\n}\r\nexport interface FieldFlags {\r\n\tfieldKey: string;\r\n\tisRequired: boolean;\r\n\tlimitToList: boolean;\r\n}\r\nexport interface ItemPropertiesExtra {\r\n\tcaption: string;\r\n\tcanRead: boolean;\r\n\tcanReadFromTrigger: boolean;\r\n\tisFilteringFolder: boolean;\r\n\tlicenseAvailable: boolean;\r\n\tnoEditableSignatures: string[];\r\n}\r\nexport type LogonRequired = {\r\n\tlogonRequired: boolean;\r\n};\r\n\r\nexport interface NavigationPanelElement {\r\n\tname: string;\r\n\tkey?: string;\r\n\thashKey?: string;\r\n\tmainViewKey?: string;\r\n\timage?: any;\r\n\tenabled: boolean;\r\n\tisDefault: boolean;\r\n\tredirectToObject: boolean;\r\n\tisExplorable: boolean;\r\n\tisCreatedUserPanel: boolean;\r\n\tsubelementsOnly: boolean;\r\n\titems: VarioObject[];\r\n\tsubelements?: NavigationPanelElement[];\r\n\tnotifications?: WebNotificationsCollection;\r\n}\r\n\r\nexport interface NoteDto {\r\n\ttopic: string;\r\n\tvalue: string;\r\n\tcreationDate: string;\r\n\tcontainerId: string;\r\n\tid: string;\r\n\tcanDelete: boolean;\r\n}\r\nexport interface OperationOnVarioObject {\r\n\tobjectName: string;\r\n\toperatorName: string;\r\n\toperatorSubstitute: string;\r\n\toperationName: string;\r\n\toperationDate: string;\r\n\texecutedOnDesktop: boolean;\r\n\toperationIcon: string;\r\n}\r\nexport interface OrderByModel {\r\n\tdescending: boolean;\r\n\tindex: number;\r\n\tfieldKey: string;\r\n}\r\nexport interface ReplyEmailModel {\r\n\treplyTo: string;\r\n\tsubject: string;\r\n\tbody: string;\r\n}\r\nexport enum RequestStatus {\r\n\terror = 0,\r\n\tsuccess = 1,\r\n\tinProgress = 2,\r\n}\r\n\r\nexport interface ResponseObject {\r\n\tvarioObject: VarioObject;\r\n\tstatus: RequestStatus;\r\n\tmessage: string;\r\n}\r\n\r\nexport interface ResponseTemplate {\r\n\ttemplates: Template[];\r\n\tstatus: RequestStatus;\r\n\tmessage: string;\r\n}\r\n\r\nexport type SelectOption = {\r\n\tid?: string;\r\n\ttext: string; // The display text of the option\r\n\tvalue: string; // The value of the option\r\n\tselected?: boolean; // Whether the option is selected (optional)\r\n};\r\n\r\nexport interface ServiceResponse {\r\n\tdata: T;\r\n\tsuccess: boolean;\r\n\tcode: number;\r\n\tmessage: string | null;\r\n}\r\n\r\nexport enum ImportedFileStatus {\r\n\tSuccess = 0,\r\n\tDuplicatedFiles = 1,\r\n}\r\n\r\nexport enum DuplicatedFilesMode {\r\n\tNormal = 0,\r\n\tOmmit = 1,\r\n\tReplaceWithExisting = 2,\r\n\tImport = 3,\r\n\tNextTry = 4,\r\n}\r\n\r\nexport interface ImportFileResponse extends ServiceResponse {\r\n\tstatus: ImportedFileStatus;\r\n\treplacedWithExistingFilesCount: number;\r\n\tommitedFilesCount: number;\r\n\timportedFileNames: string[];\r\n\treplacedWithExistingFileNames: string[];\r\n\tommitedFileNames: string[];\r\n\tfileNamesForNextTry: string[];\r\n}\r\n\r\nexport interface SiteInfo {\r\n\tsiteName: string;\r\n}\r\n\r\nexport interface SiteParameter {\r\n\tkey: string;\r\n\tvalue: string;\r\n}\r\n\r\nexport interface SourceHistory {\r\n\tid: number;\r\n\tsourceID: number | null;\r\n\tsnapshot: Uint8Array | null;\r\n\tsnapshotDate: string;\r\n\tsnapshotSize: number | null;\r\n\tsnapshotCaption: string;\r\n\tsnapshotFileExtension: string;\r\n\toperatorID: number | null;\r\n\toperatorName: string;\r\n\tlastSnapshotDate: string;\r\n}\r\n\r\nexport interface Template {\r\n\ttemplateType: string;\r\n\ttemplateID: string;\r\n\ttemplateName: string;\r\n}\r\n\r\nexport interface TryToChangeObjectProperitesResponse {\r\n\tfields: VarioObjectField[];\r\n\tmessage: VarioMessageViewModel;\r\n\titemKey: string;\r\n\tshwoCloseButton: boolean;\r\n}\r\n\r\nexport interface VarioAction {\r\n\tactionKey: string;\r\n\tdisplayName: string;\r\n\ttooltip: string;\r\n\tbuttonType: string;\r\n\tresponseMessageDialog: ResponseMessageDialog;\r\n\tenabled: boolean;\r\n\tcurrentState: string;\r\n\tversion: number;\r\n\tCanShowWorkflowOptions: boolean;\r\n\tIsDummyVarioAction: boolean;\r\n\tIsCustomButton: boolean;\r\n\tRemoveFromList: boolean;\r\n\tWorkflowRequiredFields: string[];\r\n\tWorkflowSuggestedFields: string[];\r\n}\r\n\r\nexport interface ResponseMessageDialog {\r\n\tmessageDescription: string;\r\n\tmessageTitle: string;\r\n\tselRecipientsTitle: string;\r\n\trecipients: Recipient[];\r\n\tselectRecipientsAsComplex: boolean;\r\n\tduration: string;\r\n\tshowEmptyCommentsWarning: boolean;\r\n}\r\n\r\nexport interface Recipient {\r\n\trecipientName: string;\r\n\trecipientKey: string;\r\n\trecipientMembershipGroup?: string;\r\n\trecipientPosition?: string;\r\n\trecipientRoles?: string[];\r\n\trecipientType?: string;\r\n\trecipientIcon: string;\r\n\toutsideRecipient?: boolean;\r\n}\r\n\r\nexport interface VarioActionViewModel {\r\n\titemKey: string;\r\n\tactionKey: string;\r\n\tdisplayName: string;\r\n\ttoolTip?: string;\r\n\tbuttonType: string;\r\n\trecipients: Recipient[];\r\n\tmessageDescription: string;\r\n\tmessageTitle: string;\r\n\tselRecipientsTitle: string;\r\n\tenabled: boolean | null;\r\n\tduration?: string;\r\n\tselectedRecipients?: string[];\r\n\tselectRecipientsAsComplex?: boolean | null;\r\n\tresponseMessage?: string;\r\n\tclose: boolean;\r\n\tignoreEmptyComment?: boolean | null;\r\n\tisCustomButton: boolean;\r\n\tremoveFromList: boolean;\r\n}\r\n\r\nexport interface VarioCategory {\r\n\tcategoryID: string;\r\n\tcategoryCode: string;\r\n\tparentID: string;\r\n\tname: string;\r\n}\r\n\r\nexport interface VarioCategory4Edit {\r\n selectedCategoriesDisplayValue: string;\r\n selectedCategoriesID: string[];\r\n categories: VarioCategory[];\r\n canManageCategories: boolean;\r\n}\r\n\r\nexport interface VarioCategoryParsed extends VarioCategory {\r\n\tchildren?: VarioCategoryParsed[];\r\n\tparentName?: string;\r\n\tparentCode?: string;\r\n}\r\n\r\nexport interface VarioEmployee extends Recipient {\r\n\twebAdmin?: boolean;\r\n\temailAddress?: string;\r\n\tsiteCaption?: string;\r\n}\r\n\r\nexport type GroupedRecipients = Record;\r\n\r\nexport interface VarioEmployeeWithOnlyShare extends VarioEmployee {\r\n\tlink?: string;\r\n\trecipient?: string;\r\n}\r\n\r\nexport interface VarioMessageViewModel {\r\n\tstatus: RequestStatus; // Enum type\r\n\tmessage: string;\r\n\titemKey: string;\r\n\tcontainerKey: string;\r\n\tshowCloseButton: boolean;\r\n\telementId?: string; // Optional property\r\n}\r\n\r\nexport interface VarioObject {\r\n\ttitle: string;\r\n\tprevKey: string;\r\n\tnextKey: string;\r\n\tkey: string;\r\n\thashKey: string;\r\n\tcanRead: boolean;\r\n\tcanWrite: boolean;\r\n\tcanExplore: boolean;\r\n\tcanDelete: boolean;\r\n\thasRequestReadReceipt: boolean;\r\n\tcontentFileExists: boolean;\r\n\tcontentFileType: string;\r\n\tchildSources: ChildSourcesModel[];\r\n\tchildSourceDefault: string;\r\n\tcanUpladFile: boolean;\r\n\tcontainerKey: string;\r\n\tshowSubelementsOnly: boolean;\r\n\thasAttachments: boolean;\r\n\tisNew: boolean;\r\n\tisCreated: IsCreatedFrom;\r\n\tworkflowMediumItemKey: string;\r\n\tvarioObjectType: VarioObjectType;\r\n\tfields: VarioObjectField[];\r\n\tsubElementTypes: VarioObjectType[];\r\n\toperations: CustomOperation[];\r\n\tcancelled: boolean;\r\n\tnewFields: VarioObjectField[];\r\n\trecipients: VarioEmployee[];\r\n\tnotes: NoteDto[];\r\n\ttemplateName: string;\r\n\tprojectFieldKey: string;\r\n\ttaskFieldKey: string;\r\n\thasImage: boolean;\r\n\tdecreeDraft: VarioEmployee[];\r\n\tworkflow: string;\r\n\tisWorkflowMedium: boolean;\r\n\tCanShowWorkflowOptions: boolean;\r\n\tHasChildren: boolean;\r\n\tlayoutControl: LayoutControlWeb;\r\n\tdefinitionKey: string;\r\n\tattachmentId: string;\r\n\tactualVersion: boolean;\r\n\tparentKey: string;\r\n\tstatus: number;\r\n\tMD5: string;\r\n}\r\n\r\nexport interface VarioObjectViewModel\r\n\textends Omit {\r\n\ttitleAsLink: string;\r\n\tdisplayName: string;\r\n\tmessage: VarioMessageViewModel;\r\n\tobjectType: VarioObjectType;\r\n\tlayout: LayoutModel;\r\n\tpageNavTitleModel: PageNavTitleModel;\r\n\tuser: string;\r\n\tunconstrained: boolean;\r\n\tselected: boolean;\r\n\tfromCache: boolean;\r\n\tpreviousUrl: string;\r\n\tshowItemOnly: boolean;\r\n\tsubElementsOnly: boolean;\r\n\thasAttachements: boolean;\r\n\tcancelled: boolean;\r\n\tfields: VarioObjectFieldViewModel[];\r\n\tsubElements: VarioObjectViewModel[];\r\n\tnewFields: VarioObjectNewFieldViewModel[];\r\n}\r\n\r\nexport interface VarioObjectFieldViewModel {\r\n\tfieldKey: string;\r\n\tdisplayName: string;\r\n\tvalue: string;\r\n\tvalueType: FieldValueType;\r\n\tcontrolType: FieldControlType;\r\n\tformatString: string;\r\n\tdropDownList: SelectOption[];\r\n\trowSpan: number;\r\n\tcolSpan: number;\r\n\tmodified: boolean;\r\n\tadvancedDictionary: boolean;\r\n\tdictionaryKey: string;\r\n\tdropDownDictionaries: SelectOption[];\r\n\tdisplayText: string;\r\n\tvarioObjectKey: string;\r\n\thashVarioObjectKey: string;\r\n\titemKey: string;\r\n\trequired: boolean;\r\n\tlimitToList: boolean;\r\n\trecipients: VarioEmployee[];\r\n\tunconstrained: boolean;\r\n}\r\n\r\nexport interface VarioObjectNewFieldViewModel\r\n\textends VarioObjectFieldViewModel {\r\n\tboolValue: boolean;\r\n}\r\n\r\nexport interface VarioObjectContent {\r\n\tcontent: Uint8Array | null;\r\n\tcontentType: string | null;\r\n\tcontentFileName: string | null;\r\n\tsourceId: string | null;\r\n\textension: string | null;\r\n\tcreationDate: string | null;\r\n\tmd5: string | null;\r\n\tresult: VarioObjectContentGetResult;\r\n}\r\n\r\nexport interface VarioObjectDeleteViewModel extends LogonRequired {\r\n\tmessage: string;\r\n\tdeepDeleteModeRequired: boolean;\r\n\tunlinkAvailable: boolean;\r\n\tundeletedItemsIds: string[];\r\n\tstatus: RequestStatus;\r\n}\r\n\r\nexport interface VarioObjectField {\r\n\tfieldKey: string;\r\n\tdisplayName: string;\r\n\tvalue: string;\r\n\tdisplayText: string;\r\n\tvalueType: FieldValueType;\r\n\tcontrolType: FieldControlType;\r\n\tadvancedDictionary: boolean;\r\n\tdictionaryKey: string;\r\n\tvarioObjectKey: string;\r\n\thashVarioObjectKey: string;\r\n\tvalueRequired: boolean;\r\n\tformatString: string;\r\n\tlimitToList: boolean;\r\n\trecipients: VarioEmployee[];\r\n\tsignatureIsConstrained: boolean;\r\n}\r\n\r\nexport interface VarioObjectInitModel {\r\n\tkey: string;\r\n\thashKey: string;\r\n\tinitFields: VarioObjectField[];\r\n}\r\n\r\nexport interface VarioObjectType {\r\n\tkey: string;\r\n\tdisplayName: string;\r\n\ttabText: string | null;\r\n\tcanUploadFile: boolean;\r\n\tlayout: LayoutModel | null;\r\n\tisDefault: boolean;\r\n\tfieldsFlags: FieldFlags[] | null;\r\n\tforComponent: boolean;\r\n\tsortIndex: number;\r\n\tisBasedOnCorrespondence: boolean;\r\n\tmustUseTemplate: boolean;\r\n}\r\nexport interface VarioProperties {\r\n\tfullId: string;\r\n\tcaption: string;\r\n\tlastCheckOutDate: string;\r\n\tlastCheckOutBy: string;\r\n\tvalidFrom: string;\r\n\tvalidTo: string;\r\n\tstatus: string;\r\n\tstatusIcon: string;\r\n\tcheckOutStatus: string;\r\n\tcheckOutStatusIcon: string;\r\n\townerSite: string;\r\n\tcreatedBy: string;\r\n\ttype: string;\r\n\tmoreGeneralType: string;\r\n\tmoreGeneralDefinitionId: string;\r\n\tdefinitionId: string;\r\n\tdefinitions: string[];\r\n\towner: string;\r\n\townerIcon: string;\r\n\tdisablePaging: boolean;\r\n\tlatent: boolean;\r\n\tcategories: string[];\r\n\tcategoryRequired: boolean;\r\n}\r\nexport interface VarioUserInviteModel {\r\n\tusers: VarioEmployee[];\r\n\tinvitedUsers: RetrieveShareLink[];\r\n}\r\nexport interface VarioWorkflowStateDescription {\r\n\ttitle: string;\r\n\tdescription: string;\r\n\twatcherNotificationCaption: string;\r\n\tcreatedBy: string;\r\n\tcreationDate: string;\r\n}\r\nexport interface VerifyResult {\r\n\tisError: boolean;\r\n\terrorMessage: string;\r\n\tsingleResults: SingleVerifyResult[];\r\n}\r\n\r\nexport interface SingleVerifyResult {\r\n\tsignatures: VerifiedSignature[];\r\n}\r\n\r\nexport interface VerifiedSignature {\r\n\tresultCode: number;\r\n\tresultText: string;\r\n\tdescriptionCode: number;\r\n\tdescriptionText: string;\r\n\treason: string;\r\n\tlocation: string;\r\n\tsigningTime: Date; // TypeScript's Date object\r\n\tsigningCertificate: CertificateFromSignature;\r\n}\r\n\r\nexport interface CertificateFromSignature {\r\n\tsubject: string;\r\n\tissuer: string;\r\n\tqualified: boolean;\r\n\texpireDate: Date; // TypeScript's Date object\r\n\tserialNumber: string;\r\n}\r\n\r\nexport interface CertificateFromSignatureFull extends CertificateFromSignature {\r\n\tfullPfx: string;\r\n\tid: number;\r\n\tdisplayName: string;\r\n}\r\n\r\nexport interface WebNotification {\r\n\ttitle: string;\r\n\tshortTitle: string;\r\n\ttitleAuthor: string;\r\n\tmessage: string;\r\n\tnotificationID: number;\r\n\tisDeleted: boolean;\r\n\treferencedItemID: number;\r\n\treferencedItemType: number;\r\n\tcreationDate: string;\r\n\texpireTime: string;\r\n\tisRead: boolean;\r\n\tisNew: boolean;\r\n\tisWorkFlow: boolean;\r\n\tnotifyType: number;\r\n\tfullReferencedItemID: string;\r\n\thashKey: string;\r\n\ttype?: string;\r\n}\r\n\r\nexport interface WebNotificationExtra\r\n\textends Partial,\r\n\tPartial { }\r\n\r\nexport interface WebNotificationsCollection {\r\n\tnoReadCount: number;\r\n\tnewCount: number;\r\n\ttype: string;\r\n\tnotifyDownloadError: boolean;\r\n\tnewNotifications: WebNotification[];\r\n}\r\n\r\nexport interface WorkFlowStep {\r\n\tstateOrd: number;\r\n\tord: number;\r\n\tstateName: string;\r\n\tadditional: boolean;\r\n\tcreationTime: string;\r\n\tfinishedTime: string;\r\n\tduration: string;\r\n\toperator: string;\r\n\tsubstituteOperator: string;\r\n\trecipient: string;\r\n\tactionResult: string;\r\n\tmedium: MediumType;\r\n\taction: string;\r\n\tactionTopic: string;\r\n\tdescription: string;\r\n\tmainMedium: boolean;\r\n\tstepType: StepType;\r\n}\r\n\r\nexport interface workflowDiagramLayout {\r\n\tlinks: any[];\r\n\tnodes: any[];\r\n\ttraveledLinks: any[];\r\n\ttraveledLinksArray: string[];\r\n\tcurrentState: string;\r\n}\r\n\r\nexport interface WorkflowRequiredFieldsModel {\r\n\tworkflowRequiredFields: string[];\r\n\tworkflowSuggestedFields: string[];\r\n}\r\n\r\nexport interface ParsedWorkflowFieldsModel {\r\n\tkey: string;\r\n\ttype: string;\r\n}\r\n\r\nexport interface RetrievedChat {\r\n\tchatID: number;\r\n\titemID: number | null;\r\n\titemType: number | null;\r\n\trelatedObjectDef: number | null;\r\n\tmessageID: number;\r\n\tchatCaption: string;\r\n\tbody: string;\r\n\tlastMessageCreatedBy: number;\r\n\tlastMessageCreationDate: string;\r\n\tlastMessageFULLCreationDate: string;\r\n\tlastMessageIsRead: boolean;\r\n\tgroupChat: boolean;\r\n\tisCurrentUserParticipantToChatPosition: boolean;\r\n}\r\n\r\nexport interface CreateMessageResponse {\r\n\tnewCreatedChatID: number | null;\r\n\tmessageID: number;\r\n\tbody: string;\r\n\trecipientsIDs: number[];\r\n}\r\n\r\nexport type MessageReactions = { [key: number]: number };\r\n\r\nexport interface RetrievedHubMessages {\r\n\tid: number;\r\n\tbody: string;\r\n\tmessageType: number;\r\n\tcreationDate: string;\r\n\tcreationDateAsDateTime: Date;\r\n\tcreationDateParsed: string;\r\n\tcreatedBy: number;\r\n\tisRead: number;\r\n\tsources: VarioObjectContent[];\r\n\tuserReaction: number;\r\n\tReactions: MessageReactions;\r\n\tvarioObjectAttachment: VarioObject[];\r\n}\r\n\r\nexport interface RetrievedChatUsers {\r\n\tid: number;\r\n\tchatID: number;\r\n\tuserID: number;\r\n}\r\n\r\nexport interface CreateMessageAttachments {\r\n\titemIDAttachment: number;\r\n\titemTypeAttachment: number;\r\n}\r\n\r\nexport interface RetrievedHubMessageDetails {\r\n\tid: number;\r\n\tchatID: number;\r\n\tcreatedBy: string;\r\n\treactions: { [key: number]: string[] };\r\n\tattachments: CreateMessageAttachments[];\r\n}\r\n\r\nexport interface EditControlsTypeCollection {\r\n\teditControlsType: EditControlType[];\r\n}\r\n\r\ninterface FieldDecorator {\r\n\trequired: boolean;\r\n\tunconstrained: boolean;\r\n\tworkflowSuggested: boolean;\r\n\tworkflowRequired: boolean;\r\n}\r\n\r\nexport interface EditControlType {\r\n\tfieldKey: string;\r\n\tcontrolType: string;\r\n\tadvancedDictionary: boolean;\r\n\tfieldDecorator: FieldDecorator;\r\n}\r\n\r\nexport interface PreRetrieveStatusModel {\r\n\tresultExists: boolean;\r\n\tisDataUpToDate: boolean;\r\n}\r\n\r\nexport type FilesFromVario = {\r\n\titemId: string;\r\n\tcontainerId?: string;\r\n\tname: string;\r\n\ticon?: string;\r\n\tbaseUrl?: string;\r\n\tisFromVarioChat?: boolean;\r\n\tisVarioObject?: boolean;\r\n\tfromGrid?: boolean;\r\n};\r\n\r\nexport type Reactions = {\r\n\temoji: string;\r\n\tcount: number;\r\n\tusers: string[];\r\n\tenum: number;\r\n};\r\n\r\nexport namespace VarioHubModels {\r\n\tinterface BaseMessage {\r\n\t\tchatID?: number;\r\n\t\tmessageID?: number;\r\n\t\ttopic: string;\r\n\t\tmessage: string;\r\n\t\tmessageLevel: MessageLevel;\r\n\t\tmessageType: MessageType;\r\n\t\ticon: string;\r\n\t\tdelay: number;\r\n\t\trequired: boolean;\r\n\t}\r\n\r\n\texport enum MessageLevel {\r\n\t\tUnknown = 0,\r\n\t\tInfo = 1,\r\n\t\tWarning = 2,\r\n\t\tError = 3,\r\n\t}\r\n\r\n\texport enum MessageType {\r\n\t\tUnknown = 0,\r\n\t\tMessage = 1,\r\n\t\tRemoveMessage = 2,\r\n\t\tReaction = 3,\r\n\t}\r\n\texport interface RequestMessage extends BaseMessage {\r\n\t\trecipients: number[];\r\n\t}\r\n\r\n\texport interface ResponseMessage extends BaseMessage {\r\n\t\trecipients: number[];\r\n\t\tmessageSenderId: number;\r\n\t\tmessageSenderName: string;\r\n\t}\r\n\r\n\texport interface ResponseMessageExtra extends VarioHubModels.ResponseMessage {\r\n\t\tid?: string;\r\n\t\tcreationDate?: string;\r\n\t}\r\n\r\n\texport interface RequeryItemModel {\r\n\t\titems: string[];\r\n\t}\r\n\r\n\texport interface HubClient {\r\n\t\tconnectionId: string;\r\n\t\tuserId: number;\r\n\t\tuserName: string;\r\n\t\tapplicationType: ApplicationType;\r\n\t}\r\n\r\n\tenum ApplicationType {\r\n\t\tUnknown = 0,\r\n\t\tVarioHub = 1,\r\n\t\tVarioDesktop = 2,\r\n\t\tVarioWeb = 3,\r\n\t}\r\n}\r\n\r\nexport type ShareCalendarModel = {\r\n\tLink: string;\r\n\tUser: string;\r\n\texist: boolean;\r\n\tItemID: string;\r\n\tItemType: string;\r\n\tFullId: string;\r\n\tCalendarData: Appointment[];\r\n\tPageNavTitleModel: PageNavTitleModel;\r\n\tallowedDefinitions: VarioObjectType[];\r\n};\r\n\r\nexport interface Appointment {\r\n\tAppointmentId: number;\r\n\tIdentity: string;\r\n\tText: string;\r\n\tDescription: string;\r\n\tStartDate: string;\r\n\tEndDate: string;\r\n\tExportStartDate: number;\r\n\tExportEndDate: number;\r\n\tAllDay: boolean;\r\n\tRecurrenceRule: string;\r\n\tRecurrenceException: string;\r\n\tCalendarContainerName: string;\r\n\tColorUse: string;\r\n\tBackGroundColor: string;\r\n\tCanReject: boolean;\r\n\tRejectWithInfo: boolean;\r\n\tCanAccept: boolean;\r\n\tDefinitionKey: string;\r\n}\r\n\r\nexport interface DisableDatesAppointment {\r\n\tAppointmentId: number;\r\n\tText: string;\r\n\tDescription: string;\r\n\tStartDate: string;\r\n\tEndDate: string;\r\n\tExportStartDate: number;\r\n\tExportEndDate: number;\r\n\tAllDay: boolean;\r\n\tRecurrenceRule: string;\r\n\tRecurrenceException: string;\r\n}\r\n\r\ninterface PageNavTitleModel {\r\n\tTitle: string;\r\n\tPath: string;\r\n\tPathMobile: string;\r\n\tRefreshCurrentPage: string;\r\n\tTitleAsLink: string;\r\n\tPrevPage: string;\r\n}\r\n\r\nexport type SelectedRow = {\r\n\tItemID: string;\r\n\tCaption: string;\r\n\tDefinitionKey: string;\r\n\tRowNum: number;\r\n\r\n\tIsNew?: any;\r\n\tFormattingRowColor?: null;\r\n\tFormattingRowStrikeout?: null;\r\n\tCategories?: any; // or you can use 'string[]' if it can be an array of strings\r\n\tCheckOutStatus?: string;\r\n\tChildSources?: string;\r\n\tCreatedBy?: number; // Assuming this is a number based on the value provided\r\n\tCreatedByName?: string;\r\n\tCreationDate?: string; // You might want to use Date if you plan to parse it\r\n\tDefinitionVerID?: number; // Assuming this is a number based on the value provided\r\n\tEndTime?: string;\r\n\tFileExtension?: string;\r\n\tFlags?: number;\r\n\tHasChildren?: boolean;\r\n\tHashID: string;\r\n\tIsCurrentVersion?: boolean;\r\n\tIsMultisource?: boolean;\r\n\tIsSigned?: boolean;\r\n\tItemType: string;\r\n\tLastCheckOutBy?: number;\r\n\tSmallImage?: string;\r\n\tSourcesSize?: number;\r\n\tStatus?: string;\r\n\tSymbol?: any;\r\n\tTotalItemsCount?: number;\r\n\tVersion?: number;\r\n\tVersionNumber?: number;\r\n\tcontainerId?: string;\r\n\tgridEl?: string;\r\n\t[x: string]: any;\r\n};\r\n\r\nexport type SimpleDxRowDataStructure = {\r\n\trow: { data: SelectedRow };\r\n\tcomponent?: DevExpress.ui.dxDataGrid;\r\n\telement?: JQuery;\r\n\ttargetElement?: HTMLElement;\r\n};\r\n\r\nexport type ActionButtonsData = SimpleDxRowDataStructure & { data: SelectedRow, rowElement: JQuery, key: number}\r\n\r\nexport type CustomMenuItems = {\r\n\ttext?: string;\r\n\ticon?: string;\r\n\titems?: CustomMenuItems[];\r\n\tonItemClick?: () => void;\r\n\ttemplate?: string;\r\n};\r\n\r\nexport interface FormatCondition {\r\n\tconditionNameKey: string;\r\n\tcolIndex: string;\r\n\tcolKey: string;\r\n\tconditionOperator: string;\r\n\tvalue1: string;\r\n\tvalue2: string;\r\n\tforceColor: string;\r\n\tfontBold: boolean;\r\n\tfontItalic: boolean;\r\n\tfontStrikeout: boolean;\r\n\tfontUnderline: boolean;\r\n\tbackColor: string;\r\n\tbackColorGradient: string;\r\n\tbackColorAlphaMode: string;\r\n\tbackgroundGradientMode: string;\r\n}\r\n\r\nexport type ModelSubElements = {\r\n\tcolumnsOptions: ColumnOptions | null;\r\n\tsubelementsItemPropertiesExtra: ItemPropertiesExtra | null;\r\n\tglobalListOfEditables: string[];\r\n\tglobalListOfRequiredFields: string[];\r\n\tglobalItemWorkflowMediumItemKey: string | null;\r\n\tglobalHoveredItem: SelectedRow | null;\r\n\tglobalSelectedDefinitionId: string | null;\r\n\tglobalOperationName: string | null;\r\n\tglobalInitializedItemId: string | null;\r\n\tglobalBuforSelectedDefinitionId: string | null;\r\n\tglobalBuforSelectedDefinitionTitle: string | null;\r\n\tcurrentUrlItemId: string | null;\r\n\tlayoutForWeb: string | boolean | null; // stringifed bool\r\n\tadditionalColumns: string | null; // stringfied LayoutRow[]\r\n\tcurrentFocusedRowIndex: number;\r\n\tallowUnrefreshedData: boolean;\r\n\ttotalItemsCount: number | null;\r\n\tlastPage: number | null;\r\n\tpageSize: number | null;\r\n\tpage: number;\r\n\taddedItemId: string;\r\n\tcanDecreeSubElements: string | null; // stringified bool\r\n\tjsonSorting: string;\r\n\ttotalRowBackgroundColor: string | null;\r\n\tcolumnListAsJson: string | null;\r\n\tformatConditions: FormatCondition[] | null;\r\n\tmultiselectOnFirstGridLoad: boolean | string;\r\n\tforceRowSelect: boolean;\r\n\tisCreated: IsCreatedFrom;\r\n\tlayoutKey: string\r\n\tdisableSidePanelPreviewReload: boolean;\r\n\tdataFromLastYearOnly: boolean;\r\n};\r\n\r\nexport type SelectedRowStorage = {\r\n\tid: string;\r\n\tpage: number;\r\n\tlastPageSize: number | null;\r\n\tcontainerId: string;\r\n\tcurrentFocusedRowIndex: number;\r\n\tworkflowed?: number;\r\n};\r\n\r\nexport enum ObjectCreationMode {\r\n\tSend = 1,\r\n\tReplyToAll = 2,\r\n\tReplyToSender = 4,\r\n\tForward = 8,\r\n\tUndefined = 16,\r\n\tCreatedFromInitWorkflow = 32\r\n}\r\n\r\nexport const inputsWithRecipients = [\r\n\t\"RecipientName\",\r\n\t\"SenderName\",\r\n\t\"CCName\",\r\n\t\"BCCName\",\r\n\t\"Operators\",\r\n\t\"Leader\",\r\n\t\"ParentCompany\",\r\n];\r\n\r\nexport type RecipientsDict = {\r\n\tsharelink?: string;\r\n\temail?: string;\r\n};\r\n\r\nexport type RecipientValue =\r\n\t| (Partial & Partial)\r\n\t| undefined;\r\n\r\nexport type GlobalRecipient = {\r\n\tid: string;\r\n\tname: string;\r\n};\r\n\r\nexport interface VarioFile extends File {\r\n\titemId: string;\r\n\tcontentType: string;\r\n\tfileContents: Blob;\r\n};\r\n\r\nexport interface RichEditFileModel {\r\n\tfile: VarioFile;\r\n\tcomments: RichEditCommentModel[];\r\n\trevisions: RichEditCommentModel[];\r\n}\r\n\r\ninterface RichEditCommentModel {\r\n\ttext: string;\r\n\tauthor: string;\r\n\tdate: Date | null;\r\n\trange: string;\r\n\toriginalRange: string;\r\n\tunparsedRange: Range;\r\n\ttype: string;\r\n}\r\n\r\nexport type FrontViewProperties = {\r\n\tcontentFileExists?: boolean;\r\n\tlinkToView?: string;\r\n\tlinkToDownload?: string;\r\n\tpossibleControlsToUse?: LayoutControlWeb;\r\n\tdecreeIcon?: string;\r\n};\r\n\r\nexport type SubElementsFullModel = SelectedRow & FrontViewProperties;\r\n\r\nexport type VarioObjectFullModel = VarioObjectViewModel & FrontViewProperties;\r\n\r\nexport type VarioStatus = {\r\n\tname: string;\r\n\ttype: \"Canceled\" | \"Edited\" | \"Checked\" | \"Approved\" | \"ApprovedAsTemplate\";\r\n\tchecked?: boolean;\r\n};\r\n\r\nexport type DocParams = {\r\n\tforWhat: AddForWhat;\r\n\tforWorkflow?: boolean;\r\n\tallowedDefinitions?: VarioObjectType[] | null;\r\n\tdefinition?: Partial;\r\n\tfromDrop?: boolean;\r\n\tdontRestoreCardEditor?: boolean;\r\n};\r\n\r\nexport type AddForWhat =\r\n\t| \"forSelectedItem\"\r\n\t| \"forNewVersion\"\r\n\t| \"forGrid\"\r\n\t| \"forWorkflow\"\r\n\t| \"forScheduler\";\r\n\r\nexport type FloatingButtonItem = {\r\n\ttext: string;\r\n\torder: number;\r\n\ticon: string;\r\n\tfunctions?: ((response?: any) => void)[];\r\n\timportant?: boolean;\r\n\tcustomHTML?: string;\r\n\texpanded?: boolean;\r\n\tstyle?: string;\r\n\topenAs?: boolean;\r\n\tisCustomButton?: boolean,\r\n\titems?: FloatingButtonItem[]\r\n};\r\n\r\nexport type FloatingButtonData = {\r\n\tcanAdd?: boolean;\r\n\tvisibleShare?: boolean;\r\n\tlastClickedCell?: any;\r\n\tid?: string;\r\n\tcanAccept?: boolean;\r\n\tcanReject?: boolean;\r\n\trejectWithInfo?: boolean;\r\n\tItemID?: string;\r\n\tHashID?: string;\r\n\tCaption?: string;\r\n\tDefinitionKey?: string;\r\n} & Partial &\r\n\tPartial;\r\n\r\nexport type NewVersionParams = {\r\n\tforWhat: \"forNewVersion\";\r\n\tid: string;\r\n\tfromId: string;\r\n\tdefinition: Partial;\r\n\tcomment?: string;\r\n};\r\n\r\nexport namespace RunningOperations {\r\n\texport enum ProcessingStatus {\r\n\t\tUndefined = 0,\r\n\t\tNewItem = 1,\r\n\t\tProcessing = 2,\r\n\t\tDone = 3,\r\n\t\tDoneWithError = 4,\r\n\t\tCanceled = 5,\r\n\t}\r\n\r\n\texport enum OperationType {\r\n\t\tUndefined = 0,\r\n\t\tWorkflow = 1,\r\n\t\tCustomButton = 2,\r\n\t\tTrigger = 3,\r\n\t\tOther = 4,\r\n\t}\r\n}\r\n\r\nexport interface IRelatedObjectResult {\r\n\tOpeartionID: string;\r\n\tOperationName: string;\r\n\tResult: any;\r\n}\r\n\r\nexport interface InputBoxRepresentationResult extends IRelatedObjectResult {\r\n\tInputResult: string;\r\n}\r\n\r\nexport interface RunningOperationStatusSummary {\r\n\tID: string;\r\n\tBatchID: string;\r\n\tItemCaption: string;\r\n\tItemID: string;\r\n\tProcessingStatus: RunningOperations.ProcessingStatus;\r\n\tMessage: string;\r\n\tOperationType: RunningOperations.OperationType;\r\n\tOperationName: string;\r\n}\r\n\r\nexport interface ProcessingWorkflowSummary {\r\n\tRelatedObject: IRelatedObject;\r\n\tAllUserExecutingOperations: number;\r\n\tRunningOperationsStatus: RunningOperationStatusSummary[];\r\n}\r\n\r\nexport interface IRelatedObject {\r\n\tOpeartionID: string;\r\n\tOpeartionName: string;\r\n\tExecutingObjectCaption: string;\r\n}\r\n\r\nexport interface DialogRepresentation extends IRelatedObject {\r\n\tTitle: string;\r\n\tBody: string;\r\n\tButtons: string;\r\n\tIcon: string;\r\n\r\n\tSenderRunningOperationItemKey: string;\r\n\tSenderRunningOperationItemCaption: string;\r\n\tSenderRunningOperationItemDef: string;\r\n}\r\n\r\nexport interface DisplayItemRepresentation extends IRelatedObject {\r\n\tDisplayItemID: string;\r\n\tOpeartionName: \"DisplayItem\";\r\n}\r\n\r\nexport interface InputBoxRepresentation extends IRelatedObject {\r\n\tTitle: string;\r\n\tBody: string;\r\n\tButtons: string;\r\n\tIcon: string;\r\n\tDialogResult: number;\r\n\tDefaultResult: string;\r\n\tDlgResultToAll: boolean;\r\n\tOpeartionName: \"InputBox\";\r\n\r\n\tSenderRunningOperationItemKey: string;\r\n\tSenderRunningOperationItemCaption: string;\r\n\tSenderRunningOperationItemDef: string;\r\n}\r\n\r\nexport type Content = {\r\n\tfileExtensions: string[];\r\n\tcontentTypes: string[];\r\n\ttype: string;\r\n};\r\n\r\nexport type Item = {\r\n\titems?: Item[];\r\n\tcollapsedItems?: Item[];\r\n};\r\n\r\nexport type RGB = { r: number; g: number; b: number };\r\n\r\nexport type WarningButtons = {\r\n\tid: string;\r\n\tcheckFunc?: () => boolean;\r\n\ttext?: string;\r\n\tbtnFunctions?: {\r\n\t\ttext: string;\r\n\t\tfunc?: () => any;\r\n\t}[];\r\n};\r\n\r\nexport type VarioNotification = {\r\n\ttitle: string;\r\n\toptions: {\r\n\t\tbody: string;\r\n\t\ttag: string;\r\n\t\ticon: string;\r\n\t\tdata: VarioNotificationData;\r\n\t};\r\n};\r\n\r\nexport type VarioNotificationData = {\r\n\tisDebug: boolean;\r\n\twebsitePath: string;\r\n\ttype: \"varioNotification\" | \"hubNotification\";\r\n\titemId: string;\r\n\tresponseMessage?: VarioHubModels.ResponseMessage;\r\n};\r\n\r\nexport interface ColumnOptions {\r\n\tdisplayName: string;\r\n\tfieldKey: string;\r\n\tdataFieldKey: string;\r\n\tformatString: string;\r\n\twidth: number;\r\n\tcontrolType: FieldControlType;\r\n\tvalueType: FieldValueType;\r\n\tgroupBy: OrderByModel;\r\n\tvisible: boolean;\r\n\trowIndex: number;\r\n}\r\n\r\nexport enum AddressingScope {\r\n\tCompanies = 1,\r\n\tPersons = 2,\r\n\tUsers = 4,\r\n\tState = 8,\r\n\tCity = 16,\r\n\tAttribute = 32,\r\n\tGroup = 64,\r\n\tContactEntriesEmails = 128,\r\n\tAddressablesGroups = 256,\r\n\tRoles = 512,\r\n\tStands = 1024,\r\n\tCountry = 2048,\r\n\tCaption = 4096, // &H1000 in decimal\r\n\tAllAddressable = 8191, // &H1FFF in decimal\r\n\tInternalRecipients = 1860, // Users | Group | AddressablesGroups | Roles | Stands\r\n\tInternalRecipientsCompaniesPersons = 1863, // Users | Group | AddressablesGroups | Roles | Stands | Companies | Persons\r\n}\r\n\r\ninterface SearchOptions {\r\n\tsearchText: string;\r\n\tsearchFileType: string;\r\n\tsearchItemType: string;\r\n\tsearchBy: SearchByUserEnum;\r\n\tsearchByName: string;\r\n\tsearchCreationDateFrom: Date;\r\n\tsearchCreationDateTo: Date;\r\n\tmodel: any;\r\n}\r\n\r\nexport enum SearchByUserEnum {\r\n\tNone = 0,\r\n\tCreatedByMe = 1,\r\n\tEditedByMe = 2,\r\n\tOpenByMe = 3,\r\n\tCreatedBy = 4,\r\n\tEditedBy = 5,\r\n\tOpenBy = 6,\r\n}\r\n\r\nexport interface PageUrlHelper {\r\n\tpreviousActionName: string;\r\n\titemId: string;\r\n\tsubelementsOnly: boolean;\r\n\tcurrentPage: number;\r\n\tcontainerKey: string;\r\n\tmodel: any;\r\n\tsubElementModel: any;\r\n\tsearchOptions: SearchOptions;\r\n\ttitle: string;\r\n}\r\n\r\nexport interface RichEditExtended extends DevExpress.RichEdit.RichEdit {\r\n\tcomments?: RichEditCommentModel[];\r\n\trevisions?: RichEditCommentModel[];\r\n}\r\n\r\nexport type SelectedRichEdit = {\r\n\trange: string;\r\n\ttype: string;\r\n};\r\n\r\nexport type ChangeCurrentItemParams = {\r\n\titemId: string,\r\n\tsubelementsOnly?: boolean,\r\n\tremovePreviousPages?: boolean,\r\n\tsubelementPageIndex?: number,\r\n\tcontainerKey?: string,\r\n\tworkflowMediumItemKey?: string,\r\n\tselectedControl?: LayoutControlWeb,\r\n\tinnerCall?: boolean,\r\n\tforceVarioObject?: boolean,\r\n\tdefinitionID?: number,\r\n\tfromHistory?: boolean,\r\n\tisCreated?: IsCreatedFrom,\r\n\tdesigner?: boolean,\r\n contextKey?: string\r\n} \r\n\r\nexport type SearchParams = {\r\n\tsearchText: string,\r\n\tremovePrevPage: boolean,\r\n\titemType: string,\r\n\tfileType: string,\r\n\tsearchBy: SearchByUserEnum,\r\n\tsearchByName: string,\r\n\tcreationDateFrom: Date | null,\r\n\tcreationDateTo: Date | null,\r\n\tpage: number,\r\n\tasPartialView?: boolean\r\n}\r\n\r\nexport interface SetPermissionParams {\r\n\toperatorID: number\r\n\tpermissionID: number\r\n\ttype: string\r\n\titemID: string\r\n}\r\n\r\nexport interface PermissionsForItem {\r\n\tpermissions?: string[]\r\n\toperatorID: string\r\n\toperatorCaption: string\r\n\tpermInstanceID?: string\r\n}\r\n\r\nexport type AdminState = {\r\n\tisAdmin: boolean;\r\n\tisReportDesigner: boolean\r\n}\r\n\r\nexport enum IsCreatedFrom {\r\n\tNotCreated = 0,\r\n\tCreatedFromUnknown = 1,\r\n\tCreatedFromInitWorkflow = 2,\r\n}", "\uFEFFimport \"../types/dx.all.d.ts\";\r\nimport \"../types/dx-dashboard.d.ts\";\r\n\r\nimport type { VarioObject } from \"../types/models/vario-types\";\r\nimport { GetBaseUrl } from \"./page-navigation\";\r\nimport {\r\n\tHideLoadingPanel,\r\n\tShowLoadingPanel,\r\n\tshowDxToast,\r\n\tuuidv4,\r\n} from \"./site\";\r\n\r\ntype UnderlyingData = {\r\n\tItemID: number;\r\n\tItemType: string;\r\n};\r\n\r\ntype DataForAnalytics = {\r\n\tfields: any[];\r\n}[];\r\n\r\nlet allDataForAnalyticsPopup: DataForAnalytics = [];\r\n//funkcja obslugujaca klik w item na analizach\r\nexport function onItemClickDashboard(\r\n\targs: DevExpress.Dashboard.ItemClickEventArgs\r\n) {\r\n\ttry {\r\n\t\t//jesli to grid\r\n\t\tif (args?.dashboardItem?.componentName()?.includes(\"grid\")) {\r\n\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\t\tconst underlyingData: UnderlyingData[] = [];\r\n\t\t\tallDataForAnalyticsPopup = [];\r\n\r\n\t\t\t//pobranie danych grida\r\n\t\t\targs.requestUnderlyingData(\r\n\t\t\t\t(data) => {\r\n\t\t\t\t\tconst hasError = (\r\n\t\t\t\t\t\tdata as DevExpress.Dashboard.Internal.Data.DrillThroughDataWrapper\r\n\t\t\t\t\t)?._errorMessage;\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\thasError?.includes(\"You are not allowed\") ||\r\n\t\t\t\t\t\thasError?.includes(\"Callback request failed\")\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t\t\tshowDxToast(\"B\u0142\u0105d pobierania danych.\", \"error\");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst dataMembers = data.getDataMembers();\r\n\t\t\t\t\tfor (let i = 0; i < data.getRowCount(); i++) {\r\n\t\t\t\t\t\tconst dataTableRow: UnderlyingData = { ItemID: 0, ItemType: \"\" };\r\n\t\t\t\t\t\t$.each(dataMembers, (_, dataMember) => {\r\n\t\t\t\t\t\t\tdataTableRow[dataMember] = data.getRowValue(i, dataMember);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tunderlyingData.push(dataTableRow);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (underlyingData != null) {\r\n\t\t\t\t\t\tif (underlyingData.length === 1) {\r\n\t\t\t\t\t\t\tprepareLinkClickForAnalytics(\r\n\t\t\t\t\t\t\t\tunderlyingData[0].ItemType,\r\n\t\t\t\t\t\t\t\tunderlyingData[0].ItemID\r\n\t\t\t\t\t\t\t).then((res) => {\r\n\t\t\t\t\t\t\t\twindow.open(res, \"_blank\");\r\n\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tconst dataToRequest: string[] = [];\r\n\t\t\t\t\t\t\tfor (let i = 0; i < underlyingData.length; i++) {\r\n\t\t\t\t\t\t\t\tdataToRequest.push(\r\n\t\t\t\t\t\t\t\t\t`Type=${underlyingData[i].ItemType};Id=${underlyingData[i].ItemID}`\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tajaxLoopArray(dataToRequest, () => {});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\t[\"ItemID\", \"ItemType\"]\r\n\t\t\t);\r\n\t\t}\r\n\t} catch (ex) {\r\n\t\tconsole.error(ex);\r\n\t\tHideLoadingPanel();\r\n\t}\r\n}\r\n\r\n//funkcja przygotowujaca dane do analizy\r\nexport function onBeforeRenderDashboard(\r\n\tsender: DevExpress.Dashboard.DashboardControl\r\n) {\r\n\tconst dashboardControl = sender;\r\n\r\n\tconst viewerApiExtension = dashboardControl.findExtension(\"viewerApi\") as any;\r\n\tDevExpress.Dashboard.ViewerApiExtension;\r\n\tif (viewerApiExtension)\r\n\t\tviewerApiExtension.on(\"itemClick\", onItemClickDashboard);\r\n\r\n\t$(\"#Dialog\").dxPopup({\r\n\t\twidth: 800,\r\n\t\theight: 600,\r\n\t\ttitle: \"Underlying data\",\r\n\t\tshowCloseButton: true,\r\n\t});\r\n}\r\n\r\n//funkcja przygotowujaca link do pozycji na klikniecie w analizie\r\nexport function prepareLinkClickForAnalytics(\r\n\titemType: string,\r\n\titemID: number\r\n): Promise {\r\n\treturn new Promise((resolve, reject) => {\r\n\t\ttry {\r\n\t\t\tconst fullID = `Type=${itemType};Id=${itemID}`;\r\n\t\t\t$.ajax({\r\n\t\t\t\turl: `${GetBaseUrl()}/Vario/GetHashKey?itemID=${fullID}`,\r\n\t\t\t\ttype: \"Get\",\r\n\t\t\t\tdataType: \"text\",\r\n\t\t\t\tcache: false,\r\n\t\t\t\tsuccess: (response: string) => {\r\n\t\t\t\t\tif (response != null) {\r\n\t\t\t\t\t\tconst baseUrl = GetBaseUrl();\r\n\t\t\t\t\t\tconst linkParam = `?id=${response}&browserTabGuid=${uuidv4()}`;\r\n\t\t\t\t\t\tconst link = `${baseUrl}/Vario/VarioObject${linkParam}`;\r\n\t\t\t\t\t\tresolve(link);\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\terror: (err) => {\r\n\t\t\t\t\tconsole.log(err);\r\n\t\t\t\t\treject(err);\r\n\t\t\t\t},\r\n\t\t\t});\r\n\t\t} catch (e) {\r\n\t\t\tconsole.error(e);\r\n\t\t}\r\n\t});\r\n}\r\n\r\n//funkcja przechodzaca przez pozycje analizy\r\nexport function ajaxLoopArray(\r\n\tsomeArray: string[],\r\n\tcallbackFunction: (response: any) => void\r\n) {\r\n\tif (someArray.length > 0) {\r\n\t\tconst data = someArray.pop();\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetVarioObjectById?id=${data}`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t})\r\n\t\t\t.done((x: VarioObject) => {\r\n\t\t\t\tif (x) allDataForAnalyticsPopup.push(x);\r\n\t\t\t})\r\n\t\t\t.fail(() => {\r\n\t\t\t\tconsole.log(`error GetVarioObjectById${data}`);\r\n\t\t\t})\r\n\t\t\t.always(() => {\r\n\t\t\t\tajaxLoopArray(someArray, callbackFunction);\r\n\t\t\t});\r\n\t} else {\r\n\t\tHideLoadingPanel();\r\n\t\tconst newList: DataForAnalytics = [];\r\n\r\n\t\tif (allDataForAnalyticsPopup.length === 0) {\r\n\t\t\tshowDxToast(\"Brak danych\", \"warning\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tfor (const x of allDataForAnalyticsPopup) {\r\n\t\t\tconst mappedObject = x.fields.reduce((acc, curr) => {\r\n\t\t\t\tacc[curr.fieldKey] = curr.value;\r\n\t\t\t\treturn acc;\r\n\t\t\t}, {});\r\n\r\n\t\t\tconst { fields, ...newObject } = { ...mappedObject, ...x };\r\n\t\t\tnewList.push(newObject);\r\n\t\t}\r\n\r\n\t\tconst $grid = $('
');\r\n\t\t$grid.dxDataGrid({\r\n\t\t\theight: 700,\r\n\t\t\tcolumns: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdataField: \"Caption\",\r\n\t\t\t\t\tcaption: \"Nazwa\",\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\tdataField: \"CreatedBy\",\r\n\t\t\t\t\tcaption: \"Autor\",\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\tdataField: \"CreationDate\",\r\n\t\t\t\t\tcaption: \"Data utworzenia\",\r\n\t\t\t\t\tdataType: \"date\",\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t\tonRowClick: (e: DevExpress.ui.dxDataGrid.RowClickEvent) => {\r\n\t\t\t\tif (e.rowType === \"data\" && e.key != null) {\r\n\t\t\t\t\t//addOperation(e.key.key, \"\", 4)\r\n\t\t\t\t\tconst baseUrl = GetBaseUrl();\r\n\t\t\t\t\tconst linkParam = `?id=${e.key.hashKey}&browserTabGuid=${uuidv4()}`;\r\n\t\t\t\t\tconst linkToOpen = `${baseUrl}/Vario/VarioObject${linkParam}`;\r\n\t\t\t\t\twindow.open(linkToOpen, \"_blank\");\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tdataSource: newList,\r\n\t\t});\r\n\r\n\t\tconst popup = $(\"#devex-dialog\").data(\"dxPopup\");\r\n\t\tconst $popupContent = popup.content();\r\n\t\t$popupContent.empty();\r\n\t\t$popupContent.append($grid);\r\n\t\tpopup.option(\"maxHeight\", 800);\r\n\t\tpopup.option(\"maxWidth\", 1400);\r\n\t\tpopup.option(\"showTitle\", true);\r\n\t\tpopup.option(\"title\", \"Lista pozycji analizy\");\r\n\t\tpopup.show();\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t?.parent()\r\n\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t?.addClass(\"popupTitleAccent\");\r\n\t}\r\n}\r\n", "import \"../types/dx.all.d.ts\";\r\nimport { LayoutControlWeb } from \"../types/models/Enums/layoutControlWeb\";\r\nimport {\r\n\ttype ChangeCurrentItemParams,\r\n\tIsCreatedFrom,\r\n\ttype LogonRequired,\r\n\ttype PageUrlHelper,\r\n\ttype ServiceResponse,\r\n} from \"../types/models/vario-types\";\r\nimport type { NavigationPanelElement } from \"../types/models/vario-types\";\r\nimport type { VarioObjectType } from \"../types/models/vario-types\";\r\nimport {\r\n\tCancelRequests,\r\n\tInitPageSizeButtons,\r\n\tUnselectAndUnfocusDxTable,\r\n\tcheckIfGridInEditMode,\r\n\tgetAddingInfoForGrid,\r\n\tgetCurrentRowFromGrid,\r\n\tgetRowFromGrid,\r\n\tgetSubelementsTitle,\r\n\tgetVisibleColumns,\r\n\tonGridBtnClick,\r\n\tparseDxGridItems,\r\n\trefreshDxGrid,\r\n\treloadDxGridDataSource,\r\n\trepaintDxGrid,\r\n\tsaveLastSelectedRows,\r\n\tselectRowInGrid,\r\n\ttoggleGridFunctionsForEditing,\r\n} from \"./devextreme-table-functions\";\r\nimport { clearGlobalBufferSession } from \"./edit-operations\";\r\n\r\nimport { isDirty } from \"./editor\";\r\nimport { shareCalendar } from \"./floating-actions\";\r\nimport {\r\n\tclearFloatingButton,\r\n\tcreateFloatingButton,\r\n\tfloatingButtonForNoSelection,\r\n} from \"./floating-buttons\";\r\nimport { clearNewNotifications, refreshNotifyNumber } from \"./notifications\";\r\nimport { refreshManager } from \"./refresh-manager\";\r\nimport { isDirtyDoc } from \"./richedit\";\r\nimport { loadSearchPanel } from \"./search\";\r\nimport {\r\n\tContainMinusID,\r\n\tShowPopupWarningUnsaved,\r\n\tShowPopupWarningUnsavedRichEditDoc,\r\n\taddSkeletonLoading,\r\n\tcheckWhereIsUser,\r\n\tremoveSkeletonLoading,\r\n\tsetSiteTitle,\r\n\tshowDxToast,\r\n\tstringIsNullOrEmpty,\r\n\tuuidv4,\r\n\tvarioObjectLoaded,\r\n} from \"./site\";\r\nimport {\r\n\tHideLoadingPanel,\r\n\tShowLoadingPanel,\r\n\tcleanUp,\r\n\tisRunningOnMobile,\r\n} from \"./site\";\r\n\r\ntype HistoryState = {\r\n\tid: string | null;\r\n\tcontainerId?: string | null;\r\n\thashId?: string | null;\r\n\thashContainerId?: string | null;\r\n\tinnerCall?: boolean;\r\n\tsubElementsOnly?: boolean;\r\n\tlink?: string | null;\r\n};\r\n\r\ndeclare global {\r\n\tvar globalBackBuffer: boolean | null;\r\n\tvar varioObjectLayoutKeyToChange: string | null;\r\n\tvar currentItemChangePromise: JQuery.jqXHR | null;\r\n}\r\n\r\nglobalThis.globalBackBuffer = null;\r\nglobalThis.varioObjectLayoutKeyToChange = null;\r\nglobalThis.currentItemChangePromise = null;\r\n\r\n//kod z gridem do szybkiego wklejenia na powrot\r\nlet gridHTML: JQuery | null = null;\r\n\r\nexport function GetBaseUrl() {\r\n\tconst getUrl = window.location;\r\n\tlet baseUrl = `${getUrl.protocol}//${getUrl.host}`;\r\n\ttry {\r\n\t\tconst parts = getUrl.pathname.split(\"/\");\r\n\t\tlet index = 1;\r\n\t\twhile (\r\n\t\t\tparts.length > index &&\r\n\t\t\t!(\r\n\t\t\t\tparts[index] === \"vario\" ||\r\n\t\t\t\tparts[index] === \"Vario\" ||\r\n\t\t\t\tparts[index] === \"Account\" ||\r\n\t\t\t\tparts[index] === \"Calendar\" ||\r\n\t\t\t\tparts[index] === \"Analytics\" ||\r\n\t\t\t\tparts[index] === \"Spreadsheet\"\r\n\t\t\t) &&\r\n\t\t\tparts[index] !== \"\"\r\n\t\t) {\r\n\t\t\tbaseUrl += `/${parts[index]}`;\r\n\t\t\tindex += 1;\r\n\t\t}\r\n\t} catch (exception) {\r\n\t\tconsole.log(exception);\r\n\t}\r\n\treturn baseUrl;\r\n}\r\n\r\nexport function openNav() {\r\n\ttry {\r\n\t\tif (!isRunningOnMobile()) localStorage.setItem(\"smallSidenav\", \"false\");\r\n\r\n\t\tdocument\r\n\t\t\t.getElementById(\"openControlPanel\")\r\n\t\t\t?.setAttribute(\"onclick\", \"closeNav(true)\");\r\n\t\t$(\".sidenav\").addClass(\"active\");\r\n\t\t$(\".sidenav\").addClass(\"desktop-client\");\r\n\t\tdocument.getElementById(\"bodyElement\")?.classList?.add(\"blur-for-mobile\");\r\n\t\tdocument.getElementById(\"bodyElement\")?.classList?.add(\"desktop-client\");\r\n\t\tdocument.getElementById(\"bodyElement\")?.classList?.remove(\"hidden-sidenav\");\r\n\t\tif ($(\"#Tabela\").length > 0 && !isRunningOnMobile()) {\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\trepaintDxGrid();\r\n\t\t\t}, 1000);\r\n\t\t}\r\n\t} catch (exception) {\r\n\t\tconsole.log(exception);\r\n\t}\r\n}\r\n\r\n//funkcja zamykajaca sidenav\r\nexport function closeNav(ignoreScreenSize?: boolean, automatic?: boolean) {\r\n\ttry {\r\n\t\tif (!ignoreScreenSize && ($(window).width() ?? 0) > 767) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t//zapisywanie czy uzytkownik chce miec zminimializowany sidenav\r\n\t\tif (!isRunningOnMobile() && !automatic)\r\n\t\t\tlocalStorage.setItem(\"smallSidenav\", \"true\");\r\n\r\n\t\tconst element = document.getElementById(\"navPanel\");\r\n\t\tif (element) {\r\n\t\t\telement.classList.remove(\"active\");\r\n\t\t\telement.classList.remove(\"desktop-client\");\r\n\t\t\t$(\".sidenav\").removeClass(\"active\");\r\n\t\t\t$(\".sidenav\").removeClass(\"desktop-client\");\r\n\t\t\tdocument\r\n\t\t\t\t.getElementById(\"openControlPanel\")\r\n\t\t\t\t?.setAttribute(\"onclick\", \"openNav()\");\r\n\t\t\tdocument\r\n\t\t\t\t.getElementById(\"bodyElement\")\r\n\t\t\t\t?.classList.remove(\"blur-for-mobile\");\r\n\t\t\tdocument\r\n\t\t\t\t.getElementById(\"bodyElement\")\r\n\t\t\t\t?.classList.remove(\"desktop-client\");\r\n\t\t\tdocument.getElementById(\"bodyElement\")?.classList.add(\"hidden-sidenav\");\r\n\r\n\t\t\t//odswiezenie grida zeby kolumny sie pokazaly\r\n\t\t\tif ($(\"#Tabela\").length > 0 && !isRunningOnMobile()) {\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t$(\"#Tabela\").dxDataGrid(\"instance\")?.repaint();\r\n\t\t\t\t}, 1000);\r\n\t\t\t}\r\n\t\t}\r\n\t} catch (exception) {\r\n\t\tconsole.log(exception);\r\n\t}\r\n}\r\n\r\nexport function SetMenu() {\r\n\tsessionStorage.removeItem(\"selectedRow\");\r\n\tcleanUp();\r\n\tclearGridBuffer();\r\n\tsetTimeout(clearFloatingButton);\r\n\tmarkAsActive(\"menu\");\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/SetMenu`,\r\n\t}).done(() => {\r\n\t\tif (currentUserId.length > 0 && Number(currentUserId) !== 0)\r\n\t\t\tchangeCurrentItem({ itemId: \"menu\" });\r\n\t\telse window.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t});\r\n}\r\n\r\nexport function HideNavBar() {\r\n\tconst navPanel = document.getElementsByClassName(\"dropDownActionNavBar\");\r\n\tif (navPanel && navPanel.length === 1) {\r\n\t\tnavPanel[0].classList.remove(\"in\");\r\n\t}\r\n}\r\n\r\nexport async function changeCurrentItem({\r\n\titemId,\r\n\tsubelementsOnly = false,\r\n\tremovePreviousPages = false,\r\n\tsubelementPageIndex = 1,\r\n\tcontainerKey = \"\",\r\n\tworkflowMediumItemKey = \"\",\r\n\tselectedControl = LayoutControlWeb.Any,\r\n\tinnerCall = true,\r\n\tforceVarioObject = false,\r\n\tdefinitionID,\r\n\tfromHistory = false,\r\n\tisCreated = IsCreatedFrom.NotCreated,\r\n\tdesigner = false,\r\n\tcontextKey = \"\",\r\n}: ChangeCurrentItemParams) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\tif (isDirtyDoc()) {\r\n\t\tconst res = await ShowPopupWarningUnsavedRichEditDoc(\r\n\t\t\t!(itemId === modelId)\r\n\t\t).catch(() => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\r\n\tif (isDirty()) {\r\n\t\tconst res = await ShowPopupWarningUnsaved(!(itemId === modelId)).catch(\r\n\t\t\t() => {}\r\n\t\t);\r\n\t\tif (!res) return;\r\n\t}\r\n\r\n\tif (itemId?.includes(\"CSchedule\")) {\r\n\t\tshareCalendar();\r\n\t\treturn;\r\n\t}\r\n\r\n\tcleanUp();\r\n\r\n\tif (typeof CancelRequests === \"function\") {\r\n\t\tCancelRequests();\r\n\t}\r\n\r\n\tif (!selectedControl) {\r\n\t\tselectedControl = LayoutControlWeb.Any;\r\n\t}\r\n\r\n\tif (!removePreviousPages) {\r\n\t\tremovePreviousPages = false;\r\n\t}\r\n\r\n\tif (!containerKey || containerKey === \"null\") {\r\n\t\tcontainerKey = \"\";\r\n\t}\r\n\r\n\tif (!subelementPageIndex) {\r\n\t\tsubelementPageIndex = 1;\r\n\t}\r\n\r\n\tif (!workflowMediumItemKey) {\r\n\t\tworkflowMediumItemKey = \"\";\r\n\t}\r\n\r\n\tif (innerCall === undefined) {\r\n\t\tinnerCall = true;\r\n\t}\r\n\r\n\tconst url = `${GetBaseUrl()}/Vario/VarioObject`;\r\n\tif (\r\n\t\turl &&\r\n\t\turl.length > 0 &&\r\n\t\tcurrentItemChangePromise?.state() !== \"pending\"\r\n\t) {\r\n\t\ttry {\r\n\t\t\tcurrentItemChangePromise = $.ajax({\r\n\t\t\t\turl: url,\r\n\t\t\t\ttype: \"Get\",\r\n\t\t\t\tcache: false,\r\n\t\t\t\tdata: {\r\n\t\t\t\t\tid: itemId,\r\n\t\t\t\t\tsubElementsOnly: subelementsOnly,\r\n\t\t\t\t\titemOnly: false,\r\n\t\t\t\t\tasPartialView: true,\r\n\t\t\t\t\tremovePreviousPages: removePreviousPages,\r\n\t\t\t\t\tcontainerKey: containerKey,\r\n\t\t\t\t\tworkflowMediumItemKey: workflowMediumItemKey,\r\n\t\t\t\t\tselectedControl: selectedControl,\r\n\t\t\t\t\tinnerCall: innerCall,\r\n\t\t\t\t\tforceVarioObject: forceVarioObject,\r\n\t\t\t\t\tdefinitionID: definitionID,\r\n\t\t\t\t\tlayoutKey: varioObjectLayoutKeyToChange,\r\n\t\t\t\t\tbrowserTabGuid: sessionStorage.getItem(\"browserTabGuid\"),\r\n\t\t\t\t\tisCreated: isCreated,\r\n\t\t\t\t\tdesigner: designer,\r\n\t\t\t\t\tcontextItemKey: contextKey,\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: (data: string & LogonRequired) => {\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tdata != null &&\r\n\t\t\t\t\t\tdata.logonRequired !== undefined &&\r\n\t\t\t\t\t\tdata.logonRequired === true\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (subelementsOnly) markAsActive(itemId, containerKey);\r\n\r\n\t\t\t\t\t\tconst hashContainerId =\r\n\t\t\t\t\t\t\tcontainerKey &&\r\n\t\t\t\t\t\t\ttypeof hashId !== \"undefined\" &&\r\n\t\t\t\t\t\t\t!stringIsNullOrEmpty(hashId)\r\n\t\t\t\t\t\t\t\t? hashId\r\n\t\t\t\t\t\t\t\t: null;\r\n\t\t\t\t\t\thashId = data?.split(\"var hashId = '\")[1]?.split(\"';\")[0] ?? hashId;\r\n\r\n\t\t\t\t\t\tglobalItemsSelectedByUser = [];\r\n\r\n\t\t\t\t\t\tif (!fromHistory) saveGridForBack(data);\r\n\r\n\t\t\t\t\t\t$(\"#bodyElement\").empty();\r\n\t\t\t\t\t\t$(\"#bodyElement\").append(data);\r\n\r\n\t\t\t\t\t\tvarioObjectLoaded(false, itemId, subelementPageIndex);\r\n\t\t\t\t\t\tcloseNav();\r\n\t\t\t\t\t\tif (!fromHistory)\r\n\t\t\t\t\t\t\tsaveCurrentPlaceInHistory(\r\n\t\t\t\t\t\t\t\titemId,\r\n\t\t\t\t\t\t\t\thashContainerId,\r\n\t\t\t\t\t\t\t\tcontainerKey,\r\n\t\t\t\t\t\t\t\tinnerCall,\r\n\t\t\t\t\t\t\t\tdata?.includes('modelSubElementsOnly = \"True\"')\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\terror: () => {},\r\n\t\t\t\tcomplete: () => {\r\n\t\t\t\t\tvarioObjectLayoutKeyToChange = null;\r\n\t\t\t\t\tHideLoadingPanel(true);\r\n\t\t\t\t},\r\n\t\t\t});\r\n\r\n\t\t\treturn currentItemChangePromise;\r\n\t\t} catch (_) {}\r\n\t}\r\n}\r\n\r\nexport function refreshCurrentPage(\r\n\tuseRefreshManager = true,\r\n\tforceReloadPage = false\r\n) {\r\n\treturn new Promise((resolve, reject) => {\r\n\t\tif (useRefreshManager) {\r\n\t\t\tforceReloadPage = true;\r\n\t\t}\r\n\r\n\t\t//zapisywanie ostatnio kliknietego panelu w sidepanel (varioobject)\r\n\t\tif ($(\"#sidepanelNavTabs li.active\").length > 0) {\r\n\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\"lastClickedSidePanelID\",\r\n\t\t\t\t$(\"#sidepanelNavTabs li.active\").attr(\"id\") ?? \"\"\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tforceReloadPage !== true &&\r\n\t\t\tdocument.getElementById(\"refreshVarioObjectButton\")\r\n\t\t) {\r\n\t\t\tglobalThis.refreshButtonClick();\r\n\t\t\tresolve(true);\r\n\t\t} else {\r\n\t\t\t$.ajax({\r\n\t\t\t\turl: `${GetBaseUrl()}/Vario/GetCurrentPage?browserTabGuid=${sessionStorage.getItem(\"browserTabGuid\")}`,\r\n\t\t\t\ttype: \"Get\",\r\n\t\t\t\tcache: false,\r\n\t\t\t\tsuccess: async (data: PageUrlHelper) => {\r\n\t\t\t\t\tif (data?.itemId) {\r\n\t\t\t\t\t\tif (useRefreshManager) {\r\n\t\t\t\t\t\t\tawait refreshManager?.refresh(data.itemId);\r\n\t\t\t\t\t\t\tresolve(true);\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tchangeCurrentItem({\r\n\t\t\t\t\t\t\titemId: data.itemId,\r\n\t\t\t\t\t\t\tsubelementsOnly: data.subelementsOnly,\r\n\t\t\t\t\t\t\tremovePreviousPages: false,\r\n\t\t\t\t\t\t\tsubelementPageIndex: data.currentPage,\r\n\t\t\t\t\t\t\tcontainerKey: data.containerKey,\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\tdata.previousActionName != null &&\r\n\t\t\t\t\t\tdata.previousActionName === \"SearchResult\"\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tloadSearchPanel({\r\n\t\t\t\t\t\t\tsearchText: data.searchOptions.searchText,\r\n\t\t\t\t\t\t\tremovePrevPage: true,\r\n\t\t\t\t\t\t\titemType: data.searchOptions.searchItemType,\r\n\t\t\t\t\t\t\tfileType: data.searchOptions.searchFileType,\r\n\t\t\t\t\t\t\tsearchBy: data.searchOptions.searchBy,\r\n\t\t\t\t\t\t\tsearchByName: data.searchOptions.searchByName,\r\n\t\t\t\t\t\t\tcreationDateFrom: data.searchOptions.searchCreationDateFrom,\r\n\t\t\t\t\t\t\tcreationDateTo: data.searchOptions.searchCreationDateTo,\r\n\t\t\t\t\t\t\tpage: data.currentPage,\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\twindow.location.href = GetBaseUrl();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tresolve(true);\r\n\t\t\t\t},\r\n\t\t\t\terror: () => {\r\n\t\t\t\t\treject(false);\r\n\t\t\t\t},\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n}\r\n\r\n//funkcja wykonujaca po kliknieciu na nazwe pozycji w subelements\r\nexport function askChangeItem(\r\n\tdata: DevExpress.ui.dxDataGrid.RowPreparedEvent,\r\n\tevent: JQuery.ClickEvent,\r\n\telement: JQuery\r\n) {\r\n\tif (checkIfGridInEditMode(data?.component)) return;\r\n\r\n\tconst item = subElementsModel[modelSubElementsOnly].globalHoveredItem;\r\n\r\n\t//fix for broken selection during double retrieve\r\n\tconst gridIsLoadingAndSamePositionClicked =\r\n\t\t!(data.component.getDataSource() as any)._isLoaded &&\r\n\t\tlastSelectedRow?.find((x) => x.ItemID === item?.ItemID);\r\n\tlet isNotSelectedRow =\r\n\t\telement.parents(\".dx-row-focused.dx-selection\").length === 0 &&\r\n\t\t!gridIsLoadingAndSamePositionClicked;\r\n\tconst isMultiSelect = getVisibleColumns(data.component).find(\r\n\t\t(x) => x.type === \"selection\"\r\n\t);\r\n\tconst clickedSmallImage = element.find(\".smallImage\").length;\r\n\tif (clickedSmallImage) {\r\n\t\t//link powoduje brak select dx, a obrazek dziala normalnie wiec trzeba odwrocic logike\r\n\r\n\t\t//jesli klikamy obrazek z multi to odwracamy zaznaczenie\r\n\t\tisNotSelectedRow = false;\r\n\t}\r\n\r\n\t//ma zaznaczac kiedy jest multiselect\r\n\t//albo kiedy klikamy pojedynczo w link albo w obrazek (ale tylko jak jest zaznaczony albo sa modifier keys)\r\n\tif (\r\n\t\tisMultiSelect ||\r\n\t\t(event.type === \"click\" &&\r\n\t\t\t(event?.shiftKey || event?.ctrlKey || isNotSelectedRow))\r\n\t) {\r\n\t\tif (event.shiftKey) {\r\n\t\t\tlet firstKey = lastSelectedRow[0].RowNum;\r\n\t\t\tlet lastKey = item?.RowNum ?? -1;\r\n\t\t\tif (firstKey > lastKey) [firstKey, lastKey] = [lastKey, firstKey];\r\n\r\n\t\t\tconst array = [firstKey, lastKey];\r\n\t\t\tfor (let i = firstKey + 1; i < lastKey; i++) {\r\n\t\t\t\tarray.push(i);\r\n\t\t\t}\r\n\t\t\tdata.component.selectRows(array, true);\r\n\t\t} else if (event.ctrlKey && isNotSelectedRow) {\r\n\t\t\tdata.component.selectRows([item?.RowNum], true);\r\n\t\t} else if (isNotSelectedRow) {\r\n\t\t\tdata.component.selectRows([item?.RowNum], false);\r\n\t\t} else {\r\n\t\t\tdata.component.deselectRows([item?.RowNum]);\r\n\t\t}\r\n\r\n\t\treturn;\r\n\t}\r\n\tif (!item) return;\r\n\r\n\tonGridBtnClick(item, data.component);\r\n\r\n\tCancelRequests();\r\n\r\n\tif (item?.ItemID.includes(\"Binder\"))\r\n\t\t$(\".sidenavButton.active\").removeClass(\"active\");\r\n\r\n\t$(\".navigationPanelHeader.active\").removeClass(\"active\");\r\n\r\n\t$(`.sidenavButton[data-itemid=\"${item?.ItemID}\"]`).addClass(\"active\");\r\n\r\n\tif (checkWhereIsUser(true) === \"varioObjectWithSubElements\")\r\n\t\tsessionStorage.setItem(\r\n\t\t\t\"lastSubelementsTypeInVarioObject\",\r\n\t\t\t$(\".subElementsNavSpanItem.active\").attr(\"id\") ?? \"\"\r\n\t\t);\r\n\r\n\tShowLoadingPanel(\"Wczytywanie danych...\", true);\r\n\r\n\tconst defKey =\r\n\t\titem?.DefinitionVerID !== undefined\r\n\t\t\t? item.DefinitionVerID\r\n\t\t\t: item?.DefinitionVerId;\r\n\r\n\tchangeCurrentItem({\r\n\t\titemId: item.ItemID,\r\n\t\tcontainerKey: containerId,\r\n\t\tworkflowMediumItemKey:\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalItemWorkflowMediumItemKey ??\r\n\t\t\t\"\",\r\n\t\tinnerCall: true,\r\n\t\tdefinitionID: defKey,\r\n\t});\r\n}\r\n\r\nexport function GetSubElementsCount(\r\n\titemKeyElementId: string,\r\n\telementId: string,\r\n\tpositionType: string,\r\n\teachIndex: number\r\n) {\r\n\tconst itemKey = (\r\n\t\tdocument.getElementById(itemKeyElementId) as HTMLInputElement\r\n\t).value;\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetSubElementsCount`,\r\n\t\ttype: \"GET\",\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdataType: \"JSON\",\r\n\t\tcache: false,\r\n\t\tdata: { itemKey: itemKey, positionType: positionType },\r\n\t\tsuccess: (data: number) => {\r\n\t\t\tconst buttonElement = document.getElementById(elementId);\r\n\t\t\tif (buttonElement != null) {\r\n\t\t\t\tif (buttonElement.classList.contains(\"hidden\")) {\r\n\t\t\t\t\tbuttonElement.classList.remove(\"hidden\");\r\n\t\t\t\t}\r\n\t\t\t\tif (data > 0) buttonElement.textContent = data.toString();\r\n\t\t\t\telse buttonElement.textContent = \"\";\r\n\r\n\t\t\t\tconst saved = sessionStorage.getItem(\r\n\t\t\t\t\t\"lastSubelementsTypeInVarioObject\"\r\n\t\t\t\t);\r\n\t\t\t\tif (\r\n\t\t\t\t\tsaved &&\r\n\t\t\t\t\tObject.values(loadedSubElementsDictionaryaElementId)?.find((x) =>\r\n\t\t\t\t\t\tx.includes(saved)\r\n\t\t\t\t\t)\r\n\t\t\t\t) {\r\n\t\t\t\t\tkeyToLoad = saved;\r\n\r\n\t\t\t\t\tif (firstSubelementTabWithContentLoaded === false) {\r\n\t\t\t\t\t\tfirstSubelementTabWithContentLoaded = true;\r\n\t\t\t\t\t\t$(`#${keyToLoad}`).trigger(\"click\");\r\n\t\t\t\t\t\tsessionStorage.removeItem(\"lastSubelementsTypeInVarioObject\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (keyToLoad?.length <= 0) {\r\n\t\t\t\t\tloadedSubElementsDictionary[eachIndex] = data;\r\n\r\n\t\t\t\t\tfor (let i = 0; i <= subElementsDefinitionsCount; i++) {\r\n\t\t\t\t\t\tif (loadedSubElementsDictionary[i] > 0) {\r\n\t\t\t\t\t\t\t//console.log(\"Zaladowac to bo jest wartosci i to pierwsza zakladka z zawartoscia\");\r\n\t\t\t\t\t\t\tkeyToLoad = loadedSubElementsDictionaryaElementId[i];\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (i === subElementsDefinitionsCount) {\r\n\t\t\t\t\t\t\t//console.log(\"Zaladowac pierwsza zakladke, zadna nie ma wartosci\");\r\n\t\t\t\t\t\t\tkeyToLoad = loadedSubElementsDictionaryaElementId[0];\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (loadedSubElementsDictionary[i] > -1) {\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t//console.log(\"Nie ma warto\u015Bci porzedniech zak\u0142adek\");\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t($(\".subElementsNavTabs\") as any).responsiveTabs();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function clickNavigationButton(\r\n\titemKey: string,\r\n\tchangeParam: boolean,\r\n\tcontainer?: string\r\n) {\r\n\tclearGridBuffer();\r\n\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\tsessionStorage.removeItem(\"selectedRow\");\r\n\r\n\tglobalItemsSelectedByUser = [];\r\n\tif (typeof CancelRequests === \"function\") {\r\n\t\tCancelRequests();\r\n\t}\r\n\tchangeCurrentItem({\r\n\t\titemId: itemKey,\r\n\t\tcontainerKey: container,\r\n\t\tsubelementsOnly: changeParam,\r\n\t});\r\n}\r\n\r\nexport function hideUnfitPanels() {\r\n\ttry {\r\n\t\tresizeSidenavObserver.observe(document.body);\r\n\t} catch (_) {}\r\n\r\n\tconst cont = $(\".sidenav-container\");\r\n\tconst contHeight = cont.height() ?? 0;\r\n\tconst howMany = contHeight / 51;\r\n\tlet panels = $(\".sidenav-container .panel\");\r\n\tpanels.removeClass(\"hiddenForMiniClass\");\r\n\tpanels = panels.slice(howMany, panels.length);\r\n\tconst expander = $(\".miniSideNavExpand\");\r\n\tif (panels.length === 0) {\r\n\t\texpander.hide();\r\n\t\treturn;\r\n\t}\r\n\texpander.show();\r\n\r\n\tpanels.each((_, element) => {\r\n\t\t$(element).addClass(\"hiddenForMiniClass\");\r\n\t});\r\n}\r\n\r\nconst resizeSidenavObserver = new ResizeObserver(() => {\r\n\thideUnfitPanels();\r\n});\r\n\r\nlet isAddingToNavTab = false;\r\n\r\nexport function LoadDataToNavigationPanel() {\r\n\tconst menuElement = document.getElementById(\"accordionN\");\r\n\tif (menuElement == null) return;\r\n\r\n\taddSkeletonLoading(\"#navPanel\");\r\n\r\n\tlet getNewNotifications = false;\r\n\t//Zalogowali\u015Bmy si\u0119 i otworzy\u0142 si\u0119 ostatnio wybrany panel. Przez to nie pobior\u0105 si\u0119 notyfikacje kt\u00F3re pobieraj\u0105 si\u0119 na start na g\u0142\u00F3wnej stronie z kafelkami. Dlatego tutaj je pobieramy.\r\n\tif (\r\n\t\tsessionStorage.getItem(\"NewNotifyCollectionWorkflow\") == null ||\r\n\t\tsessionStorage.getItem(\"NewNotifyCollectionPost\") == null\r\n\t) {\r\n\t\tgetNewNotifications = true;\r\n\t}\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/LoadDataToNavigationPanel?getNotify=${getNewNotifications}`,\r\n\t\ttype: \"GET\",\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdataType: \"JSON\",\r\n\t\tcache: false,\r\n\t\tsuccess: (data: NavigationPanelElement[] & LogonRequired) => {\r\n\t\t\t$(\"#accordionN\").empty();\r\n\t\t\tif (\r\n\t\t\t\tdata != null &&\r\n\t\t\t\tdata.logonRequired !== undefined &&\r\n\t\t\t\tdata.logonRequired === true\r\n\t\t\t) {\r\n\t\t\t\t//window.location.href = GetBaseUrl() + \"/Account/LogIn\";\r\n\t\t\t} else {\r\n\t\t\t\tlet noReadWFCount = 0;\r\n\t\t\t\tlet noReadPostCount = 0;\r\n\t\t\t\tlet noReadTaskCount = 0;\r\n\r\n\t\t\t\tif (data != null && getNewNotifications) {\r\n\t\t\t\t\tfor (let i = 0; i < data.length; i++) {\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tdata[i]?.key?.includes(\"CPostOffice\") &&\r\n\t\t\t\t\t\t\tdata[i].notifications != null\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\t\t\t\t\"NewNotifyCollectionPost\",\r\n\t\t\t\t\t\t\t\tJSON.stringify(data[i].notifications)\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tdata[i]?.key?.includes(\"CTasksInbox\") &&\r\n\t\t\t\t\t\t\tdata[i].notifications != null\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\t\t\t\t\"NewNotifyCollectionTask\",\r\n\t\t\t\t\t\t\t\tJSON.stringify(data[i].notifications)\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tdata[i]?.key?.includes(\"CWorkflowBox\") &&\r\n\t\t\t\t\t\t\tdata[i].notifications != null\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\t\t\t\t\"NewNotifyCollectionWorkflow\",\r\n\t\t\t\t\t\t\t\tJSON.stringify(data[i].notifications)\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\trefreshNotifyNumber();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (sessionStorage.getItem(\"NewNotifyCollectionWorkflow\") != null) {\r\n\t\t\t\t\tconst NewNotifyCollectionWorkflow = JSON.parse(\r\n\t\t\t\t\t\tsessionStorage.getItem(\"NewNotifyCollectionWorkflow\") ?? \"[]\"\r\n\t\t\t\t\t);\r\n\t\t\t\t\tnoReadWFCount = NewNotifyCollectionWorkflow.noReadCount;\r\n\t\t\t\t}\r\n\t\t\t\tif (sessionStorage.getItem(\"NewNotifyCollectionPost\") != null) {\r\n\t\t\t\t\tconst NewNotifyCollectionPost = JSON.parse(\r\n\t\t\t\t\t\tsessionStorage.getItem(\"NewNotifyCollectionPost\") ?? \"[]\"\r\n\t\t\t\t\t);\r\n\t\t\t\t\tnoReadPostCount = NewNotifyCollectionPost.noReadCount;\r\n\t\t\t\t}\r\n\t\t\t\tif (sessionStorage.getItem(\"NewNotifyCollectionTask\") != null) {\r\n\t\t\t\t\tconst NewNotifyCollectionTask = JSON.parse(\r\n\t\t\t\t\t\tsessionStorage.getItem(\"NewNotifyCollectionTask\") ?? \"[]\"\r\n\t\t\t\t\t);\r\n\t\t\t\t\tnoReadTaskCount = NewNotifyCollectionTask.noReadCount;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$.each(data, (i, navItem) => {\r\n\t\t\t\t\tlet posRelativeClass = \"\";\r\n\t\t\t\t\tlet deleteBtn = \"\";\r\n\t\t\t\t\tconst keyToUse = navItem.mainViewKey\r\n\t\t\t\t\t\t? navItem.mainViewKey\r\n\t\t\t\t\t\t: navItem.key;\r\n\t\t\t\t\tconst defaultPanelBtn = ``;\r\n\t\t\t\t\tif (navItem.isCreatedUserPanel) {\r\n\t\t\t\t\t\tposRelativeClass = \"posRelative\";\r\n\t\t\t\t\t\tdeleteBtn = `
`;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst li = document.createElement(\"div\");\r\n\t\t\t\t\tmenuElement.appendChild(li);\r\n\t\t\t\t\tlet href = `${GetBaseUrl()}/Vario/VarioObject?id=${navItem.mainViewKey ?? navItem.hashKey}&subElementsOnly=true&asPartialView=false&innerCall=false&browserTabGuid=${uuidv4()}`;\r\n\r\n\t\t\t\t\tif (navItem.key === \"ShareCalendars\") {\r\n\t\t\t\t\t\thref = `${GetBaseUrl()}/Calendar/ShareCalendar?asPartialView=false`;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tlet linkClass = \"\";\r\n\t\t\t\t\tif (navItem?.key?.includes(\"CPostOffice\")) {\r\n\t\t\t\t\t\tif (noReadPostCount > 0) {\r\n\t\t\t\t\t\t\tnavItem.name = `${navItem.name} (${noReadPostCount})`;\r\n\t\t\t\t\t\t\tlinkClass = \"CPostOfficeLeftPanelLink\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if (navItem?.key?.includes(\"CTasksInbox\")) {\r\n\t\t\t\t\t\tif (noReadTaskCount > 0) {\r\n\t\t\t\t\t\t\tnavItem.name = `${navItem.name} (${noReadTaskCount})`;\r\n\t\t\t\t\t\t\tlinkClass = \"CTasksInboxLeftPanelLink\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if (navItem?.key?.includes(\"CWorkflowBox\")) {\r\n\t\t\t\t\t\tif (noReadWFCount > 0) {\r\n\t\t\t\t\t\t\tnavItem.name = `${navItem.name} (${noReadWFCount})`;\r\n\t\t\t\t\t\t\tlinkClass = \"CWorkflowBoxLeftPanelLink\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\thideUnfitPanels();\r\n\r\n\t\t\t\t\tli.outerHTML = `
\r\n
\r\n

\r\n ${defaultPanelBtn}\r\n ${deleteBtn}\r\n
\r\n
\r\n \r\n \r\n \r\n
\r\n \r\n
\r\n

\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
`;\r\n\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\t(navItem.redirectToObject === true &&\r\n\t\t\t\t\t\t\tnavItem.isExplorable === false) ||\r\n\t\t\t\t\t\tnavItem.key === \"ShareCalendars\"\r\n\t\t\t\t\t)\r\n\t\t\t\t\t\t$(`#navDataPanelIcon${i}`).remove();\r\n\r\n\t\t\t\t\t$(\r\n\t\t\t\t\t\t`#navDataPanelTitle${i}, #navigationPanelHeaderIcon-Container${i}`\r\n\t\t\t\t\t).on(\"click\", (event) => {\r\n\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t\tsessionStorage.removeItem(\"selectedRow\");\r\n\r\n\t\t\t\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\t\t\t\t\t\tmarkAsActive(keyToUse ?? \"\");\r\n\r\n\t\t\t\t\t\tclearGridBuffer();\r\n\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tnavItem.redirectToObject === true &&\r\n\t\t\t\t\t\t\tnavItem.key !== \"ShareCalendars\"\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tclickNavigationButton(\r\n\t\t\t\t\t\t\t\tnavItem.key ?? \"\",\r\n\t\t\t\t\t\t\t\tnavItem.subelementsOnly,\r\n\t\t\t\t\t\t\t\tnavItem.key\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t} else if (navItem.key === \"ShareCalendars\") {\r\n\t\t\t\t\t\t\tshareCalendar();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tchangeCurrentItem({\r\n\t\t\t\t\t\t\t\titemId: keyToUse ?? \"\",\r\n\t\t\t\t\t\t\t\tcontainerKey: navItem.key,\r\n\t\t\t\t\t\t\t\tsubelementsOnly: navItem.subelementsOnly,\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t$(`#navDataPanelIcon${i}`).on(\"click\", () => {\r\n\t\t\t\t\t\tif (!$(`#collapse${i}`).hasClass(\"in\")) {\r\n\t\t\t\t\t\t\tLoadDataToNavTab(\r\n\t\t\t\t\t\t\t\tnavItem.key ?? \"\",\r\n\t\t\t\t\t\t\t\t`navPanelBody${i}`,\r\n\t\t\t\t\t\t\t\t`navPanelLoader${i}`,\r\n\t\t\t\t\t\t\t\tfalse\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\tisAddingToNavTab = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t\t[].forEach.call(\r\n\t\t\t\t\tdocument.querySelectorAll(\".sidenavButton\"),\r\n\t\t\t\t\t(e: HTMLElement) => {\r\n\t\t\t\t\t\te.addEventListener(\"click\", function () {\r\n\t\t\t\t\t\t\t$(\".sidenavButton\").removeClass(\"active\");\r\n\t\t\t\t\t\t\t$(this).addClass(\"active\");\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\r\n\t\t\t\tisAddingToNavTab = false;\r\n\t\t\t\tremoveSkeletonLoading(\"#navPanel\");\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: () => {\r\n\t\t\t//console.log(error);\r\n\t\t\tremoveSkeletonLoading(\"#navPanel\");\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function LoadDataToNavTab(\r\n\tkey: string,\r\n\tnavPanelElementId: string,\r\n\tnavPanelLoaderId: string,\r\n\treload: boolean\r\n) {\r\n\tif (isAddingToNavTab === true) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tlet buttonKeyToSelect = \"\";\r\n\t[].forEach.call(document.querySelectorAll(\".sidenavButton.active\"), (e) => {\r\n\t\tbuttonKeyToSelect = $(e).data(\"itemid\");\r\n\t});\r\n\r\n\t$(`#${navPanelElementId}`).empty();\r\n\t$(`#${navPanelElementId}`).addClass(\"loading-panel\");\r\n\t$(`#${navPanelLoaderId}`).removeClass(\"hidden\");\r\n\r\n\tsetTimeout(\r\n\t\t() =>\r\n\t\t\t$(`#${navPanelLoaderId}`).dxLoadIndicator({\r\n\t\t\t\theight: 40,\r\n\t\t\t\twidth: 40,\r\n\t\t\t}),\r\n\t\t400\r\n\t);\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/LoadPositionToNavigationTab`,\r\n\t\ttype: \"GET\",\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdataType: \"JSON\",\r\n\t\tcache: false,\r\n\t\tdata: { id: key },\r\n\t\tsuccess: (data: NavigationPanelElement[] & LogonRequired) => {\r\n\t\t\tif (\r\n\t\t\t\tdata != null &&\r\n\t\t\t\tdata.logonRequired !== undefined &&\r\n\t\t\t\tdata.logonRequired === true\r\n\t\t\t) {\r\n\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t} else {\r\n\t\t\t\t$(`#${navPanelElementId}`).append(\r\n\t\t\t\t\t`
`\r\n\t\t\t\t);\r\n\t\t\t\t$(`#${navPanelElementId}-container`).hide();\r\n\r\n\t\t\t\tif (data?.length <= 0) {\r\n\t\t\t\t\t$(`#${navPanelElementId}-container`).append(\r\n\t\t\t\t\t\t`Brak zawarto\u015Bci`\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$.each(data, (_, dictValue) => {\r\n\t\t\t\t\t\tlet active = \"\";\r\n\t\t\t\t\t\tconst rndIndex = uuidv4();\r\n\t\t\t\t\t\tconst isExplorable =\r\n\t\t\t\t\t\t\tdictValue.isExplorable === true\r\n\t\t\t\t\t\t\t\t? ``\r\n\t\t\t\t\t\t\t\t: \"\";\r\n\r\n\t\t\t\t\t\tlet editedtemp = \"\";\r\n\t\t\t\t\t\tif (reload === true) {\r\n\t\t\t\t\t\t\tconst tempdirectory =\r\n\t\t\t\t\t\t\t\tdocument.getElementById(\"path-title\")?.innerHTML ?? \"\";\r\n\t\t\t\t\t\t\teditedtemp = tempdirectory;\r\n\t\t\t\t\t\t\tif (editedtemp.includes(\"(\") && editedtemp.includes(\")\")) {\r\n\t\t\t\t\t\t\t\teditedtemp = tempdirectory.slice(0, -4);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (dictValue.name.includes(editedtemp)) {\r\n\t\t\t\t\t\t\t\treloadDataToNavTab(dictValue.name);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t(buttonKeyToSelect &&\r\n\t\t\t\t\t\t\t\tbuttonKeyToSelect !== \"\" &&\r\n\t\t\t\t\t\t\t\tbuttonKeyToSelect === dictValue.key) ||\r\n\t\t\t\t\t\t\t(reload === true && dictValue.name.includes(editedtemp))\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tactive = \"active\";\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tlet changeParam = true;\r\n\t\t\t\t\t\tif (!dictValue.subelements && key.includes(\"Favourites\")) {\r\n\t\t\t\t\t\t\tchangeParam = false;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tlet isExplorableClass = \"\";\r\n\t\t\t\t\t\tif (isExplorable !== \"\") {\r\n\t\t\t\t\t\t\tisExplorableClass = \"isExplorable\";\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tconst href = `${GetBaseUrl()}/Vario/VarioObject?id=${dictValue.hashKey}&subElementsOnly=${changeParam}&asPartialView=false&innerCall=false&browserTabGuid=${uuidv4()}`;\r\n\r\n\t\t\t\t\t\t$(\r\n\t\t\t\t\t\t\t`#${navPanelElementId}-container`\r\n\t\t\t\t\t\t).append(`
\r\n ${isExplorable}\r\n
\r\n
\r\n \r\n
\r\n ${dictValue.name}\r\n
\r\n
`);\r\n\r\n\t\t\t\t\t\tif (isExplorable !== \"\") {\r\n\t\t\t\t\t\t\t$(\r\n\t\t\t\t\t\t\t\t`#${navPanelElementId}-container`\r\n\t\t\t\t\t\t\t).append(`
\r\n
\r\n
\r\n
`);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t$(`#sideNavButton-${rndIndex}`).on(\"click\", (event) => {\r\n\t\t\t\t\t\t\tevent.preventDefault();\r\n\r\n\t\t\t\t\t\t\tclickNavigationButton(\r\n\t\t\t\t\t\t\t\tdictValue.mainViewKey ?? dictValue.key ?? \"\",\r\n\t\t\t\t\t\t\t\tchangeParam,\r\n\t\t\t\t\t\t\t\tkey\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t$(`#chevron${rndIndex}`).on(\"click\", () => {\r\n\t\t\t\t\t\t\tif (!$(`#collapse${rndIndex}`).hasClass(\"in\")) {\r\n\t\t\t\t\t\t\t\tLoadDataToNavTab(\r\n\t\t\t\t\t\t\t\t\tdictValue.key ?? \"\",\r\n\t\t\t\t\t\t\t\t\t`navPanelBody${rndIndex}`,\r\n\t\t\t\t\t\t\t\t\t`navPanelLoader${rndIndex}`,\r\n\t\t\t\t\t\t\t\t\tfalse\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\tisAddingToNavTab = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tconst icon = $(`#chevron${rndIndex} i`);\r\n\t\t\t\t\t\t\tif (icon.css(\"transform\") !== \"none\") {\r\n\t\t\t\t\t\t\t\ticon.css(\"transform\", \"none\");\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\ticon.css(\"transform\", \"rotate(90deg)\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst panelToSelect = sessionStorage.getItem(\"panelToSelect\");\r\n\t\t\t\tif (panelToSelect) {\r\n\t\t\t\t\tsessionStorage.removeItem(\"panelToSelect\");\r\n\t\t\t\t\tmarkAsActive(panelToSelect);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tisAddingToNavTab = false;\r\n\r\n\t\t\t\t$(`#${navPanelLoaderId}`).addClass(\"hidden\");\r\n\t\t\t\t$(`#${navPanelElementId}`).removeClass(\"loading-panel\");\r\n\t\t\t\t$(`#${navPanelElementId}-container`).show();\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function reloadDataToNavTab(\r\n\titemsParam: string,\r\n\tcontainerParam?: string\r\n) {\r\n\tif (!itemsParam?.toString().includes(\"Type\")) {\r\n\t\t(document.getElementById(\"path-title\") as HTMLElement).innerHTML =\r\n\t\t\titemsParam;\r\n\t} else if (itemsParam) {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/LoadDataToNavigationPanel?getNotify=false`,\r\n\t\t\ttype: \"GET\",\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tdataType: \"JSON\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: (data: NavigationPanelElement[] & LogonRequired) => {\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t$.each(data, (i, navItem) => {\r\n\t\t\t\t\t\tif (itemsParam.includes(\"Correspondence\")) {\r\n\t\t\t\t\t\t\tif (navItem?.key?.includes(\"PostOffice\")) {\r\n\t\t\t\t\t\t\t\tLoadDataToNavTab(\r\n\t\t\t\t\t\t\t\t\tnavItem.key,\r\n\t\t\t\t\t\t\t\t\t`navPanelBody${i}`,\r\n\t\t\t\t\t\t\t\t\t`navPanelLoader${i}`,\r\n\t\t\t\t\t\t\t\t\ttrue\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else if (itemsParam.includes(\"Task\")) {\r\n\t\t\t\t\t\t\tif (navItem?.key?.includes(\"Inbox\")) {\r\n\t\t\t\t\t\t\t\tLoadDataToNavTab(\r\n\t\t\t\t\t\t\t\t\tnavItem.key,\r\n\t\t\t\t\t\t\t\t\t`navPanelBody${i}`,\r\n\t\t\t\t\t\t\t\t\t`navPanelLoader${i}`,\r\n\t\t\t\t\t\t\t\t\ttrue\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else if (\r\n\t\t\t\t\t\t\titemsParam.includes(\"Binder\") ||\r\n\t\t\t\t\t\t\titemsParam.includes(\"Resource\")\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tif (navItem?.key?.includes(\"Workflow\")) {\r\n\t\t\t\t\t\t\t\tLoadDataToNavTab(\r\n\t\t\t\t\t\t\t\t\tnavItem.key,\r\n\t\t\t\t\t\t\t\t\t`navPanelBody${i}`,\r\n\t\t\t\t\t\t\t\t\t`navPanelLoader${i}`,\r\n\t\t\t\t\t\t\t\t\ttrue\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t} else if (\r\n\t\t\t\t\t\t\t\tnavItem.key ===\r\n\t\t\t\t\t\t\t\t$(\"#accordionN .panel > .collapse.in\")\r\n\t\t\t\t\t\t\t\t\t.parent()\r\n\t\t\t\t\t\t\t\t\t.find(\".navigationPanelHeader\")\r\n\t\t\t\t\t\t\t\t\t.attr(\"data-itemId\")\r\n\t\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\t\t//zwykly folder\r\n\t\t\t\t\t\t\t\tconst mbid =\r\n\t\t\t\t\t\t\t\t\t$(`div[data-itemid=\"${containerParam}\"]`)\r\n\t\t\t\t\t\t\t\t\t\t?.attr(\"id\")\r\n\t\t\t\t\t\t\t\t\t\t?.split(/-(.*)/s)[1] ??\r\n\t\t\t\t\t\t\t\t\t$(`div[data-itemid=\"${containerParam}\"]`)\r\n\t\t\t\t\t\t\t\t\t\t?.attr(\"id\")\r\n\t\t\t\t\t\t\t\t\t\t?.split(\"navigationPanelHeader\")[1];\r\n\t\t\t\t\t\t\t\tif (!stringIsNullOrEmpty(mbid))\r\n\t\t\t\t\t\t\t\t\tLoadDataToNavTab(\r\n\t\t\t\t\t\t\t\t\t\tcontainerParam ?? \"\",\r\n\t\t\t\t\t\t\t\t\t\t`navPanelBody${mbid}`,\r\n\t\t\t\t\t\t\t\t\t\t`navPanelLoader${mbid}`,\r\n\t\t\t\t\t\t\t\t\t\tfalse\r\n\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t}, 1500);\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function LoadCreateNewMenu() {\r\n\tdownloadingDefinitionsAjax = $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetAllCreatableObjectTypes`,\r\n\t\ttype: \"GET\",\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdataType: \"JSON\",\r\n\t\tcache: false,\r\n\t\tsuccess: (data: ServiceResponse & LogonRequired) => {\r\n\t\t\tif (data?.logonRequired === true) {\r\n\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t} else if (data?.success) {\r\n\t\t\t\tdata.data.sort((a, b) => {\r\n\t\t\t\t\tconst nameA = a.displayName.toUpperCase();\r\n\t\t\t\t\tconst nameB = b.displayName.toUpperCase();\r\n\t\t\t\t\tif (nameA < nameB) {\r\n\t\t\t\t\t\treturn -1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (nameA > nameB) {\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t});\r\n\r\n\t\t\t\tallowedDefinitionsGlobalWorkflow = data.data ?? [];\r\n\t\t\t\tdownloadingDefinitionsAjax = null;\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"B\u0142\u0105d pobierania definicji.\", \"error\");\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: () => {},\r\n\t});\r\n\r\n\treturn downloadingDefinitionsAjax;\r\n}\r\n\r\nexport function redirectLogin() {\r\n\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n}\r\n\r\nexport async function Logout(reason: string) {\r\n\tif (isDirty()) {\r\n\t\tconst res = await ShowPopupWarningUnsaved(true).catch((_) => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\tShowLoadingPanel(\"Wylogowywanie...\");\r\n\r\n\tclearTimeout(checkIfTriggerWait4UserTimeoutID);\r\n\r\n\tconst url = `${GetBaseUrl()}/Account/Logoff`;\r\n\tif (url && url.length > 0) {\r\n\t\t$.ajax({\r\n\t\t\turl: url,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: (data: string) => {\r\n\t\t\t\tif (data) sessionStorage.setItem(\"logOutReason\", reason);\r\n\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n\tclearNewNotifications();\r\n\tclearGlobalBufferSession();\r\n\tlocalStorage.removeItem(\"logoutPending\");\r\n\t//clearRunningTriggerOperations();\r\n}\r\n\r\nexport function RefreshPageInfo() {\r\n\tif (typeof subElementsModel[modelSubElementsOnly].page !== \"undefined\") {\r\n\t\tif (subElementsModel[modelSubElementsOnly].page === 1) {\r\n\t\t\t$(\".prev-page\").each((_, item) => {\r\n\t\t\t\titem.setAttribute(\"disabled\", \"true\");\r\n\t\t\t\t//item.style = \"display: none !important\";\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t$(\".prev-page\").each((_, item) => {\r\n\t\t\t\titem.removeAttribute(\"disabled\");\r\n\t\t\t\t//item.style = \"display: flex !important\";\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tsubElementsModel[modelSubElementsOnly].page ===\r\n\t\t\tsubElementsModel[modelSubElementsOnly].lastPage\r\n\t\t) {\r\n\t\t\t$(\".next-page\").each((_, item) => {\r\n\t\t\t\titem.setAttribute(\"disabled\", \"true\");\r\n\t\t\t\t//item.style = \"display: none !important\";\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t$(\".next-page\").each((_, item) => {\r\n\t\t\t\titem.removeAttribute(\"disabled\");\r\n\t\t\t\t//item.style = \"display: flex !important\";\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tconst selectPageInput = document.getElementById(\r\n\t\t\"selectPageInput\"\r\n\t) as HTMLInputElement;\r\n\tif (selectPageInput != null) {\r\n\t\tif (isRunningOnMobile() === true) {\r\n\t\t\tselectPageInput.placeholder = `${subElementsModel[modelSubElementsOnly].page} z ${subElementsModel[modelSubElementsOnly].lastPage}`;\r\n\t\t} else {\r\n\t\t\tselectPageInput.placeholder = `Strona ${subElementsModel[modelSubElementsOnly].page} z ${subElementsModel[modelSubElementsOnly].lastPage}`;\r\n\t\t}\r\n\t\tselectPageInput.value = \"\";\r\n\t}\r\n\r\n\tInitPageSizeButtons();\r\n}\r\n\r\nexport function markAsActive(id: string, container?: string) {\r\n\t$(\".navigationPanelHeader.active\").removeClass(\"active\");\r\n\t$(\".sidenavButton.active\").removeClass(\"active\");\r\n\r\n\tconst header = $(`.navigationPanelHeader[data-itemid=\"${container}\"]`).length\r\n\t\t? $(`.navigationPanelHeader[data-itemid=\"${container}\"]`)\r\n\t\t: $(`.navigationPanelHeader[data-itemid=\"${id}\"]`);\r\n\tconst collapsedHeader = header.find(\".navDataPanelIcon.collapsed\");\r\n\tlet inside = header?.length\r\n\t\t? header.parent().find(`.sidenavButton[data-itemid=\"${id}\"]`)\r\n\t\t: $(`.sidenavButton[data-itemid=\"${id}\"]`);\r\n\r\n\t// Open header if collapsed and download data\r\n\tif (collapsedHeader?.length) {\r\n\t\tcollapsedHeader.trigger(\"click\");\r\n\t\tinside = $();\r\n\t}\r\n\r\n\tif (inside?.length) inside.addClass(\"active\");\r\n\telse if (header?.length) {\r\n\t\theader.addClass(\"active\");\r\n\r\n\t\tconst hasChildren = header.parent().find(\".sidenavButton\");\r\n\t\tif (!hasChildren?.length && collapsedHeader?.length)\r\n\t\t\tsessionStorage.setItem(\"panelToSelect\", id);\r\n\t}\r\n}\r\n\r\nexport function setPanelAsDefault(id: string, event: MouseEvent) {\r\n\tShowLoadingPanel(\"Ustawianie panelu...\");\r\n\r\n\tconst eventHtmlInput = event.currentTarget as HTMLInputElement;\r\n\r\n\tif (!eventHtmlInput.checked) id = \"\";\r\n\t$(\".setPanelAsDefaultBtn\").not(eventHtmlInput).prop(\"checked\", false);\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/SetPanelAsDefault?id=${id}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tif (id.length > 0) {\r\n\t\t\t\t\tshowDxToast(\"Panel zosta\u0142 ustawiony jako domy\u015Blny\", \"success\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshowDxToast(\"Panel domy\u015Blny zosta\u0142 usuni\u0119ty\", \"success\");\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"B\u0142\u0105d przy ustawianiu panelu domy\u015Blnego\", \"error\");\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d przy ustawianiu panelu domy\u015Blnego\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function sidenavSettingsToggle() {\r\n\t//settings ON/OFF\r\n\tconst sideNavContainer = $(\".sidenav-container\");\r\n\t$(\"#sidenavSettings\").toggleClass(\"sidenavSettings\");\r\n\tif (sideNavContainer.hasClass(\"sidenavSettings\")) {\r\n\t\tsideNavContainer.removeClass(\"sidenavSettings\");\r\n\t} else {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetDefaultPanel`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: (data: string) => {\r\n\t\t\t\t$(`.setPanelAsDefaultBtn[data-key=\"${data}\"]`).prop(\"checked\", true);\r\n\t\t\t\tsideNavContainer.addClass(\"sidenavSettings\");\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n}\r\n\r\n//funkcja przywracaj\u0105ca grida po powrocie z widoku karty\r\nexport async function goBackToSubelements() {\r\n\tif (!globalBackBuffer) return;\r\n\r\n\t//powiadomienie o niezapisanych zmianach\r\n\tif (isDirtyDoc()) {\r\n\t\tconst res = await ShowPopupWarningUnsavedRichEditDoc(true).catch(() => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\r\n\tif (isDirty()) {\r\n\t\tconst res = await ShowPopupWarningUnsaved(true).catch(() => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\r\n\tCancelRequests();\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\tglobalBackBuffer = false;\r\n\r\n\t//przywrocenie htmla grida\r\n\t$(\"#bodyElement\").empty();\r\n\tif (gridHTML) $(\"#bodyElement\").append(gridHTML);\r\n\tgridHTML = null;\r\n\r\n\t//jesli poczta to oznaczamy jako przeczytane\r\n\tif (containerKey.includes(\"Inbox\")) {\r\n\t\tconst items = parseDxGridItems();\r\n\t\tconst item = items?.find((x) => x.ItemID === modelId);\r\n\t\tif (item && \"IsNew\" in item) {\r\n\t\t\titem.IsNew = false;\r\n\t\t\trepaintDxGrid();\r\n\t\t}\r\n\t}\r\n\r\n\t//przywrocenie globalnych\r\n\tcontainerId = containerKey;\r\n\tmodelId = containerKey;\r\n\tdropArea = document.getElementById(\"Tabela\");\r\n\tmodelSubElementsOnly = \"True\";\r\n\tallowedDefinitionsGlobal = null;\r\n\tsubElementsModel.True.globalSelectedDefinitionId = \"\";\r\n\r\n\t//dodanie poprzedniej strony zeby historia byla aktualna\r\n\taddPreviousPage(containerKey);\r\n\r\n\tconst dataGrid = $(\"#Tabela\").dxDataGrid(\"instance\");\r\n\r\n\t//funkcja ta jest wykorzystywna do przywrocenia grida jak i searchpanela\r\n\tif (dataGrid) {\r\n\t\tgetSubelementsTitle(false);\r\n\t\tcreateFloatingButton();\r\n\r\n\t\t//jesli jest row do go highlightowac z powrotem (+ poprawia to virtual scrolling ze sie zaladuje poprawnie)\r\n\t\tlet item = JSON.parse(sessionStorage.getItem(\"selectedRow\") ?? \"null\");\r\n\r\n\t\tgetAddingInfoForGrid();\r\n\r\n\t\tif (\r\n\t\t\titem?.length &&\r\n\t\t\t(item[0]?.containerId !== containerId || item[0]?.isNew)\r\n\t\t) {\r\n\t\t\tconst currentFocusedRow = await getCurrentRowFromGrid();\r\n\t\t\tsaveLastSelectedRows(currentFocusedRow);\r\n\t\t\titem = lastSelectedRow;\r\n\t\t}\r\n\r\n\t\tif (!item?.length) {\r\n\t\t\tUnselectAndUnfocusDxTable();\r\n\t\t\tfloatingButtonForNoSelection();\r\n\t\t\trefreshDxGrid();\r\n\t\t} else {\r\n\t\t\tif (item.find((x) => x.workflowed)) reloadDxGridDataSource();\r\n\t\t\telse {\r\n\t\t\t\t//jesli pozycja zostala zapisana w widoku karty a byla wczesniej w edycji na gridzie to wylacz edycje\r\n\t\t\t\tif (forceDirtyVarioObject || changedVarioObjectFields?.length) {\r\n\t\t\t\t\tif (checkIfGridInEditMode(dataGrid)) {\r\n\t\t\t\t\t\t//dla zmiany i undo\r\n\t\t\t\t\t\tdataGrid.option({\r\n\t\t\t\t\t\t\tediting: {\r\n\t\t\t\t\t\t\t\teditRowKey: null,\r\n\t\t\t\t\t\t\t\tchanges: [],\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\tforceDirtyVarioObject = false;\r\n\t\t\t\t\t\ttoggleGridFunctionsForEditing(dataGrid, false);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t//fix dla klikniecie edytuj po raz kolejny (update danych)\r\n\t\t\t\t\tdoubleRetrieveRequest = refreshDxGrid();\r\n\r\n\t\t\t\t\tfor (const x of changedVarioObjectFields) {\r\n\t\t\t\t\t\tif (x === \"reload\") {\r\n\t\t\t\t\t\t\treloadDxGridDataSource();\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconst rowIndex = getRowFromGrid(\r\n\t\t\t\t\t\t\titem[0].ItemID,\r\n\t\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\t\tdataGrid\r\n\t\t\t\t\t\t)?.rowIndex;\r\n\t\t\t\t\t\tif (rowIndex) {\r\n\t\t\t\t\t\t\tdataGrid.cellValue(\r\n\t\t\t\t\t\t\t\trowIndex,\r\n\t\t\t\t\t\t\t\tx.FieldKey,\r\n\t\t\t\t\t\t\t\tx.dropdownText || x.Value\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tchangedVarioObjectFields = [];\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (subElementsModel.True?.formatConditions?.length) repaintDxGrid();\r\n\t\t\t\t\tselectRowInGrid(undefined, true);\r\n\t\t\t\t\t$(\"#Tabela\").scrollTop(($(\"#Tabela\").scrollTop() ?? 0) + 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (\"searchText\" in history.state) setSiteTitle(\"Wyszukiwanie\");\r\n\r\n\tHideLoadingPanel();\r\n}\r\n\r\nexport function clearGridBuffer() {\r\n\tgridHTML = null;\r\n\tglobalBackBuffer = false;\r\n}\r\n\r\nexport function addPreviousPage(itemId: string, containerKey?: string) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/AddPreviousPageToHistory`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tdata: {\r\n\t\t\tid: itemId,\r\n\t\t\tsubElementsOnly: modelSubElementsOnly,\r\n\t\t\tcontainerKey: containerKey,\r\n\t\t\tbrowserTabGuid: sessionStorage.getItem(\"browserTabGuid\"),\r\n\t\t},\r\n\t\tsuccess: (_: boolean) => {},\r\n\t});\r\n}\r\n\r\n//funkcja zapisujaca html grida do zmiennej zeby go szybciej przywrocic\r\nexport function saveGridForBack(newDestination: string) {\r\n\tlet saveGrid = modelSubElementsOnly === \"True\";\r\n\tclearFloatingButton();\r\n\t$(\"#contextMenu\").dxContextMenu(\"instance\").hide();\r\n\r\n\tconst node = $(\"#reportViewer\")[0];\r\n\tif (node) globalThis.ko.cleanNode(node);\r\n\r\n\t//jesli wchodzimy z grida na grida to nie\r\n\tsaveGrid =\r\n\t\tsaveGrid && !newDestination?.includes('modelSubElementsOnly = \"True\"');\r\n\t//jesli wchodzimy do raportow to nie bo sie psuje\r\n\tsaveGrid = saveGrid && !newDestination?.includes('id=\"reportViewer');\r\n\t//jesli jestesmy w wyszukiwarce to tak\r\n\tif (!saveGrid) saveGrid = $(\"#searchResult\").length > 0;\r\n\r\n\tglobalBackBuffer = saveGrid;\r\n\tgridHTML = saveGrid ? $(\"#bodyElement\").children().detach() : null;\r\n}\r\n\r\n//funkcja zapisujaca aktualna pozycje w historii przegladarki\r\nexport function saveCurrentPlaceInHistory(\r\n\titemId: string | null,\r\n\thashContainerId: string | null = null,\r\n\tcontainerid: string | null = null,\r\n\tinnerCall = true,\r\n\tsubElementsOnly = false\r\n) {\r\n\tif (!itemId)\r\n\t\titemId =\r\n\t\t\ttypeof modelId !== \"undefined\" && !stringIsNullOrEmpty(modelId)\r\n\t\t\t\t? modelId\r\n\t\t\t\t: null;\r\n\r\n\tif (\r\n\t\t!hashContainerId &&\r\n\t\titemId === history?.state?.id &&\r\n\t\t!stringIsNullOrEmpty(history?.state?.hashContainerId) &&\r\n\t\t(!containerid || history?.state?.id === containerid)\r\n\t)\r\n\t\thashContainerId = history.state.hashContainerId;\r\n\r\n\tif (typeof hashId !== \"undefined\" && !stringIsNullOrEmpty(hashId))\r\n\t\tsaveUrlInHistory(itemId === \"menu\" ? \"menu\" : \"\", {\r\n\t\t\tid: itemId,\r\n\t\t\tcontainerId: containerid ?? containerKey,\r\n\t\t\thashId: hashId,\r\n\t\t\thashContainerId: hashContainerId,\r\n\t\t\tinnerCall: innerCall,\r\n\t\t\tsubElementsOnly: subElementsOnly,\r\n\t\t});\r\n}\r\n\r\nexport async function navigateSite(event: PopStateEvent) {\r\n\tif (isDirtyDoc()) {\r\n\t\tconst res = await ShowPopupWarningUnsavedRichEditDoc(true).catch(() => {});\r\n\t\tif (!res) {\r\n\t\t\tsaveCurrentPlaceInHistory(null);\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\tif (isDirty()) {\r\n\t\tconst res = await ShowPopupWarningUnsaved(true).catch(() => {});\r\n\t\tif (!res) {\r\n\t\t\tsaveCurrentPlaceInHistory(null);\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\t//fix aby przeszedl checki dirty w innych funkcjach\r\n\tignoreIsDirty = true;\r\n\r\n\t//reset zmiennej\r\n\tconst isDirtyVarioObject = forceDirtyVarioObject;\r\n\tforceDirtyVarioObject = false;\r\n\r\n\tconst containerK = typeof containerKey !== \"undefined\" ? containerKey : null;\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\t//przywracanie poprzedniego rowa\r\n\tif (\r\n\t\tevent?.state?.selectedRows &&\r\n\t\t!JSON.parse(sessionStorage.getItem(\"selectedRow\") ?? \"null\")?.find(\r\n\t\t\t(x) => x.workflowed || x.isNew\r\n\t\t)\r\n\t) {\r\n\t\tsessionStorage.setItem(\"selectedRow\", event.state.selectedRows);\r\n\t}\r\n\r\n\t//jesli wracamy do menu\r\n\tif (event?.state?.link?.includes(\"id=menu\")) {\r\n\t\tSetMenu();\r\n\t\treturn;\r\n\t}\r\n\r\n\tmarkAsActive(history.state.id, history.state.containerId);\r\n\r\n\t//jesli mamy zapisany html\r\n\tif (\r\n\t\t(containerK === event?.state?.id ||\r\n\t\t\tevent?.state?.link?.includes(\"SearchResult\")) &&\r\n\t\tglobalBackBuffer &&\r\n\t\tgridHTML\r\n\t) {\r\n\t\tforceDirtyVarioObject = isDirtyVarioObject;\r\n\t\tgoBackToSubelements();\r\n\t\treturn;\r\n\t}\r\n\r\n\t//uzycie tego co przyszlo z api\r\n\tconst prevPage = $(\"#goBackArrow\").attr(\"data-prevPage\");\r\n\tif (\r\n\t\t!stringIsNullOrEmpty(prevPage) &&\r\n\t\t(prevPage?.includes(\"loadSearchPanel(\") ||\r\n\t\t\tprevPage?.includes(`changeCurrentItem('${event.state.id}',`))\r\n\t) {\r\n\t\teval(prevPage);\r\n\t\treturn;\r\n\t}\r\n\r\n\t//uzycie changeCurrentItem\r\n\tif (event?.state?.id && typeof event?.state?.id !== \"object\") {\r\n\t\tchangeCurrentItem({\r\n\t\t\titemId: event.state.id,\r\n\t\t\tcontainerKey: event.state.containerId,\r\n\t\t\tfromHistory: true,\r\n\t\t});\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (event?.state?.link) window.location.replace(event.state.link);\r\n\telse SetMenu();\r\n}\r\n\r\nexport function setHistoryState() {\r\n\t//na start strony (id sa ustawiane bo na start moze nam sie wlaczyc jakis folder)\r\n\tconst containerK = typeof containerKey !== \"undefined\" ? containerKey : null;\r\n\tconst modelK = typeof modelId !== \"undefined\" ? modelId : null;\r\n\twindow.history.replaceState(\r\n\t\t{ link: window.location.href, id: modelK, containerId: containerK },\r\n\t\t\"\",\r\n\t\t\"\"\r\n\t);\r\n\r\n\twindow.onpopstate = (event: PopStateEvent) => {\r\n\t\tnavigateSite(event);\r\n\t};\r\n}\r\n\r\nexport function saveUrlInHistory(\r\n\twhere: string,\r\n\tdata: HistoryState = { link: null, id: null, containerId: null }\r\n) {\r\n\t//link nowej pozycji\r\n\tlet href = GetBaseUrl();\r\n\tif (stringIsNullOrEmpty(where) && data?.id) {\r\n\t\thref += `/Vario/VarioObject?id=${data.hashId}&asPartialView=false`;\r\n\t\tif (data.hashContainerId) href += `&containerKey=${data.hashContainerId}`;\r\n\t\tif (sessionStorage.getItem(\"browserTabGuid\"))\r\n\t\t\thref += `&browserTabGuid=${sessionStorage.getItem(\"browserTabGuid\")}`;\r\n\t\tif (data?.subElementsOnly != null)\r\n\t\t\thref += `&subElementsOnly=${data?.subElementsOnly}`;\r\n\t\tif (data?.innerCall != null) href += `&innerCall=${data?.innerCall}`;\r\n\r\n\t\t//zapisywanie danych aktualnej strony\r\n\t\twindow.history.state.selectedRows = sessionStorage.getItem(\"selectedRow\");\r\n\r\n\t\tif (window.history.state.id && ContainMinusID(window.history.state.id)) {\r\n\t\t\t//podmiana nowej pozycji z minusowym id\r\n\t\t\tdata.link = href;\r\n\t\t\twindow.history.replaceState(data, \"\", href);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\twindow.history.replaceState(\r\n\t\t\twindow.history.state,\r\n\t\t\t\"\",\r\n\t\t\twindow.history.state.link\r\n\t\t);\r\n\t} else if (where === \"calendar\")\r\n\t\thref += \"/Calendar/ShareCalendar?asPartialView=false\";\r\n\telse if (where === \"menu\") href += \"/Vario/VarioObject?id=menu\";\r\n\telse if (where === \"search\") {\r\n\t\thref += \"/Vario/SearchResult?asPartialView=False\";\r\n\r\n\t\tfor (const key in data) {\r\n\t\t\tif (\r\n\t\t\t\tkey in data &&\r\n\t\t\t\tdata[key] &&\r\n\t\t\t\tkey !== \"removePreviousPages\" &&\r\n\t\t\t\tkey !== \"asPartialView\"\r\n\t\t\t) {\r\n\t\t\t\thref += `&${encodeURIComponent(key)}=${encodeURIComponent(data[key])}`;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tdata.link = href;\r\n\r\n\t//dodanie nowej pozycji do historii\r\n\tconst samePosition =\r\n\t\t(!stringIsNullOrEmpty(data?.id) && data.id === history.state.id) ||\r\n\t\thref === history.state.link;\r\n\tif (!samePosition) window.history.pushState(data, \"\", href);\r\n}\r\n", "\uFEFFimport \"../types/dx.all.d.ts\";\r\n\r\nimport { LayoutControlWeb } from \"../types/models/Enums/layoutControlWeb\";\r\nimport {\r\n\ttype ActionButtonsData,\r\n\ttype ActionsViewModel,\r\n\tAddressingScope,\r\n\ttype ChangedFields,\r\n\ttype CustomMenuItems,\r\n\ttype EditControlType,\r\n\ttype EditControlsTypeCollection,\r\n\ttype FilesFromVario,\r\n\ttype FloatingButtonData,\r\n\ttype FloatingButtonItem,\r\n\ttype FormatCondition,\r\n\tIsCreatedFrom,\r\n\ttype ModelSubElements,\r\n\ttype PreRetrieveStatusModel,\r\n\tRequestStatus,\r\n\ttype ResponseObject,\r\n\ttype SelectedRow,\r\n\ttype SelectedRowStorage,\r\n\ttype ServiceResponse,\r\n\ttype SimpleDxRowDataStructure,\r\n\ttype SubElementsFullModel,\r\n\ttype TryToChangeObjectProperitesResponse,\r\n\ttype VarioCategory,\r\n\ttype VarioMessageViewModel,\r\n\ttype VarioObjectFullModel,\r\n\ttype VarioObjectInitModel,\r\n\ttype VarioWorkflowStateDescription,\r\n} from \"../types/models/vario-types\";\r\nimport { appendGridSidePanel, reloadGridPanel } from \"./data-grid-side-panel\";\r\nimport {\r\n\teditCopy,\r\n\teditPaste,\r\n\teditPasteAsCopy,\r\n\teditPasteAsLink,\r\n\tsetToBuffer,\r\n} from \"./edit-operations\";\r\nimport {\r\n\tAddToGlobalListOfEditables,\r\n\tChangeFieldValue,\r\n\tChangeSelectedMPK,\r\n\tGetAllowedDefinitionsAjax,\r\n\tUndoItem,\r\n\tcheckRequired,\r\n\tcreateSelect2,\r\n\tdownloadDropDownDataSubElements,\r\n\tgetData,\r\n\tgetDropdownData,\r\n\tinitDummyDxDropDownBox,\r\n\tisDirty,\r\n\tsaveChoice,\r\n\tselectThisDefinitionInEditor,\r\n\tsetSelectedInSelect2,\r\n} from \"./editor\";\r\nimport { createRecipientTagInput, showLinkOptions } from \"./emails\";\r\nimport {\r\n\tTryDeleteVarioObjects,\r\n\tTryExecuteVarioAction,\r\n} from \"./floating-actions\";\r\nimport {\r\n\tappendCustomActionButtons,\r\n\tappendNotFloatingButtons,\r\n\tappendWorkflowButtons,\r\n\tappendWorkflowButtonsForVarioObject,\r\n\tclearDynamicWorkflowActionsForFloatingButton,\r\n\tclearDynamicWorkflowActionsForVarioObject,\r\n\tclearFloatingButton,\r\n\tcreateFloatingButton,\r\n\tfloatingButtonBackToViewCardWithSubElements,\r\n\tfloatingButtonForMultiSelect,\r\n\tfloatingButtonForNoSelection,\r\n\tfloatingButtonForOneSelection,\r\n\tgetContainer,\r\n\tgetEditOperations,\r\n\tgetMoreOperations,\r\n\tgetOperations,\r\n\tgetOtherWorkflowOperations,\r\n\tgetPossibleControlsToUse,\r\n\tgetWorkflowButtons,\r\n\tnewDocument,\r\n\tsendPossibleControlsToUseButtons,\r\n} from \"./floating-buttons\";\r\nimport { GetItemProperties, loadCategoriesPicker } from \"./item-properties\";\r\nimport {\r\n\tGetBaseUrl,\r\n\tRefreshPageInfo,\r\n\taskChangeItem,\r\n\tchangeCurrentItem,\r\n\trefreshCurrentPage,\r\n\treloadDataToNavTab,\r\n} from \"./page-navigation\";\r\nimport { refreshManager } from \"./refresh-manager\";\r\nimport { isDirtyDoc } from \"./richedit\";\r\nimport {\r\n\tChangeSaveBtnsStatus,\r\n\tHideLoadingPanel,\r\n\tShowLoadingPanel,\r\n\tShowPopupWarningUnsaved,\r\n\tShowPopupWarningUnsavedRichEditDoc,\r\n\taddOperation,\r\n\taddSkeletonLoading,\r\n\tcalcMinPopup,\r\n\tcheckWhereIsUser,\r\n\tclearDraggedFilesBuffer,\r\n\tconvertDate,\r\n\tdelayCallback,\r\n\tfixScrollInDx,\r\n\tflatten,\r\n\tisRunningOnMobile,\r\n\tmousePosition,\r\n\tremoveSkeletonLoading,\r\n\tsaveNewPositionAfterAddingToGrid,\r\n\tsetSiteTitle,\r\n\tshowDxToast,\r\n\tstringIsNullOrEmpty,\r\n\tuuidv4,\r\n\twait,\r\n\twaitForElm,\r\n} from \"./site\";\r\nimport {\r\n\tCloseVarioObjectButtonClick,\r\n\tgetBaseUrlToDownload,\r\n\tprepareVarioObjectModel,\r\n} from \"./vario-object\";\r\n\r\nexport class DragObject {\r\n\titemId: any;\r\n\ticon: any;\r\n\tname: any;\r\n\tbaseUrl: any;\r\n\tisFromVarioChat: boolean;\r\n\tcontainerId: string | null;\r\n\tisVarioObject: boolean;\r\n\tconstructor(\r\n\t\tisFromVarioChat = false,\r\n\t\tname = subElementsModel[modelSubElementsOnly]?.globalHoveredItem?.Caption,\r\n\t\titemId = subElementsModel[modelSubElementsOnly]?.globalHoveredItem?.ItemID,\r\n\t\tisVarioObject = true,\r\n\t\ticon = subElementsModel[modelSubElementsOnly]?.globalHoveredItem\r\n\t\t\t?.SmallImage,\r\n\t\tcontainerId = isFromVarioChat ? \"\" : globalThis.containerId\r\n\t) {\r\n\t\tthis.itemId = itemId;\r\n\t\tthis.icon = icon;\r\n\t\tthis.name = name;\r\n\t\tthis.baseUrl = GetBaseUrl();\r\n\t\tthis.isFromVarioChat = isFromVarioChat;\r\n\t\tthis.containerId = containerId;\r\n\t\tthis.isVarioObject = isVarioObject;\r\n\t}\r\n}\r\n\r\ndeclare global {\r\n\tvar actuallControlView: LayoutControlWeb;\r\n\r\n\tvar dxGridResizer: ResizeObserver | null;\r\n\r\n\tvar firstRequest: JQuery.jqXHR | null;\r\n\tvar firstWorkflowRequest: JQuery.jqXHR | null;\r\n\tvar secondRequest: JQuery.jqXHR | null;\r\n\tvar secondWorkflowRequest: JQuery.jqXHR | null;\r\n\tvar getPossibleControlsToUseRequest: JQuery.jqXHR | null;\r\n\tvar subElementsRequest: JQueryXHR | null;\r\n\r\n\tvar forcedGridRefresh: boolean | null;\r\n\r\n\tvar doubleRetrieveRequest: JQueryPromise | null;\r\n\r\n\tvar gridCellPromise: JQuery.jqXHR | null;\r\n\tvar saveDxGridChangePromise: Promise | JQuery.jqXHR | null;\r\n\tvar multiselectOnFirstGridLoad: boolean;\r\n\r\n\t//zeby byl variobject dirty jesli sie weszlo z edytora inline ktory byl dirty\r\n\tvar forceDirtyVarioObject: boolean;\r\n\r\n\tvar dropArea: HTMLElement | null;\r\n\tvar dragCounter: number;\r\n\r\n\tvar lastRowControlTypes: EditControlType[] | null;\r\n\tvar lastVarioObjectBaseData:\r\n\t\t| (Partial & {\r\n\t\t\t\tparentKey?: string;\r\n\t\t\t\tcontainerId?: string;\r\n\t\t\t\tforComponent?: boolean;\r\n\t\t\t\ttemplateId?: string;\r\n\t\t })\r\n\t\t| null;\r\n\r\n\t//model z parametrami globalnymi subelementow, \"True\" to wersja dla subelementsOnly, a \"False\" dla tabelka + karta\r\n\tvar subElementsModel: {\r\n\t\tTrue: ModelSubElements;\r\n\t\tFalse: ModelSubElements;\r\n\t};\r\n}\r\n\r\nglobalThis.actuallControlView = LayoutControlWeb.Loading;\r\nglobalThis.dxGridResizer = null;\r\nglobalThis.firstRequest = null;\r\nglobalThis.firstWorkflowRequest = null;\r\nglobalThis.secondRequest = null;\r\nglobalThis.secondWorkflowRequest = null;\r\nglobalThis.getPossibleControlsToUseRequest = null;\r\nglobalThis.subElementsRequest = null;\r\nglobalThis.forcedGridRefresh = null;\r\nglobalThis.doubleRetrieveRequest = null;\r\nglobalThis.gridCellPromise = null;\r\nglobalThis.saveDxGridChangePromise = null;\r\nglobalThis.multiselectOnFirstGridLoad = false;\r\nglobalThis.forceDirtyVarioObject = false;\r\nglobalThis.dropArea = null;\r\nglobalThis.dragCounter = 0;\r\nglobalThis.lastRowControlTypes = null;\r\nglobalThis.lastVarioObjectBaseData = null;\r\nglobalThis.modelSubElementsOnly = \"True\";\r\n\r\nconst initSubElementsModelParams: ModelSubElements = {\r\n\tsubelementsItemPropertiesExtra: null,\r\n\tglobalListOfEditables: [],\r\n\tglobalListOfRequiredFields: [],\r\n\tglobalItemWorkflowMediumItemKey: null,\r\n\tglobalHoveredItem: null,\r\n\tglobalSelectedDefinitionId: null,\r\n\tglobalOperationName: null,\r\n\tglobalInitializedItemId: null,\r\n\tglobalBuforSelectedDefinitionId: null,\r\n\tglobalBuforSelectedDefinitionTitle: null,\r\n\tcurrentUrlItemId: null,\r\n\tlayoutForWeb: null,\r\n\tadditionalColumns: null,\r\n\tcurrentFocusedRowIndex: -1,\r\n\r\n\tallowUnrefreshedData: true,\r\n\ttotalItemsCount: null,\r\n\tlastPage: null,\r\n\tpageSize: 50,\r\n\tpage: 1,\r\n\tdataFromLastYearOnly: canSetLastYearMode(),\r\n\taddedItemId: \"\",\r\n\tcanDecreeSubElements: null,\r\n\tjsonSorting: \"\",\r\n\r\n\ttotalRowBackgroundColor: null,\r\n\r\n\tcolumnListAsJson: null,\r\n\r\n\tformatConditions: null,\r\n\r\n\tmultiselectOnFirstGridLoad: false,\r\n\tforceRowSelect: false,\r\n\tcolumnsOptions: null,\r\n\tisCreated: IsCreatedFrom.NotCreated,\r\n\tlayoutKey: \"\",\r\n\tdisableSidePanelPreviewReload: false,\r\n};\r\n\r\nglobalThis.subElementsModel = {\r\n\tTrue: initSubElementsModelParams,\r\n\tFalse: initSubElementsModelParams,\r\n};\r\n\r\nlet forcedSorting = false;\r\n\r\nlet savedFilterValue: any = null;\r\n\r\nexport function prepareSubelementsModel() {\r\n\tconst model = subElementsModel[modelSubElementsOnly].columnsOptions;\r\n\r\n\treturn model;\r\n}\r\n\r\nexport function prepareSubViewModel(\r\n\tdataParam: SelectedRow,\r\n\tpossibleControlsToUse: LayoutControlWeb\r\n) {\r\n\tconst model: SubElementsFullModel = dataParam;\r\n\tconst url = `${getBaseUrlToDownload()}?id=${dataParam.ItemID}`;\r\n\r\n\tif (!stringIsNullOrEmpty(dataParam?.FileExtension)) {\r\n\t\tmodel.contentFileExists = true;\r\n\r\n\t\tmodel.linkToView = `${url}&download=false`;\r\n\r\n\t\tmodel.linkToDownload = `${url}&download=true`;\r\n\t}\r\n\r\n\tmodel.possibleControlsToUse = possibleControlsToUse;\r\n\tmodel.decreeIcon = `${GetBaseUrl()}/images/decree.ico\")`;\r\n\r\n\treturn model;\r\n}\r\n\r\nexport function prepareSubelements() {\r\n\tif (\r\n\t\ttypeof subElementsModel[modelSubElementsOnly]\r\n\t\t\t.subelementsItemPropertiesExtra === \"undefined\" ||\r\n\t\t!subElementsModel[modelSubElementsOnly].subelementsItemPropertiesExtra\r\n\t)\r\n\t\treturn;\r\n\r\n\tif (\r\n\t\tsubElementsModel[modelSubElementsOnly].subelementsItemPropertiesExtra\r\n\t\t\t?.canRead === false ||\r\n\t\tsubElementsModel[modelSubElementsOnly].subelementsItemPropertiesExtra\r\n\t\t\t?.licenseAvailable === false\r\n\t) {\r\n\t\tconst subelementsPanel = $(\"#subelementsPanel\");\r\n\t\tlet text = \"Brak uprawnie\u0144 do odczytu pozycji\";\r\n\r\n\t\tif (\r\n\t\t\tsubElementsModel[modelSubElementsOnly].subelementsItemPropertiesExtra\r\n\t\t\t\t?.licenseAvailable === false\r\n\t\t)\r\n\t\t\ttext = \"Wymagana licencja dla modu\u0142u Analiz Biznesowych\";\r\n\r\n\t\tHideLoadingPanel();\r\n\t\tsubelementsPanel.empty();\r\n\t\tsubelementsPanel.append(`\r\n
\r\n
\r\n \r\n
\r\n

${text}

\r\n
`);\r\n\t\t$(\"#refreshVarioObjectButton\").remove();\r\n\t}\r\n\r\n\tgetSubelementsTitle();\r\n}\r\n\r\nexport function getSubelementsTitle(init = true) {\r\n\tconst pathTitle = document.getElementById(\"path-title\");\r\n\tif (!pathTitle) return;\r\n\tconst titleFromSidenav = $(`[data-itemid=\"${containerId}\"]`)\r\n\t\t.last()\r\n\t\t.text()\r\n\t\t.trim();\r\n\tif (stringIsNullOrEmpty(pathTitle?.innerText) || !init) {\r\n\t\tconst pageTitle = !stringIsNullOrEmpty(titleFromSidenav)\r\n\t\t\t? titleFromSidenav\r\n\t\t\t: (subElementsModel[modelSubElementsOnly].subelementsItemPropertiesExtra\r\n\t\t\t\t\t?.caption ?? \"\");\r\n\t\tpathTitle.innerText = pageTitle;\r\n\t\tsetSiteTitle(pageTitle);\r\n\t\treturn pageTitle;\r\n\t}\r\n}\r\n\r\nexport function preventDefaults(e: Event) {\r\n\te.preventDefault();\r\n}\r\n\r\nexport function dragEnterFunc(event: DragEvent, dropArea: HTMLElement) {\r\n\tconst divFromMouse = document.elementFromPoint(event.clientX, event.clientY);\r\n\tif (\r\n\t\tdivFromMouse &&\r\n\t\t!$(dropArea).is(divFromMouse) &&\r\n\t\t$(dropArea).has(divFromMouse).length === 0\r\n\t)\r\n\t\treturn;\r\n\r\n\t$(\".dragNDropHighlight\").removeClass(\"dragNDropHighlight\");\r\n\t$(dropArea).addClass(\"dragNDropHighlight\");\r\n}\r\n\r\nexport function gridDragEnterFunc(event: DragEvent, dropArea: HTMLElement) {\r\n\tevent?.preventDefault();\r\n\r\n\tdragCounter++;\r\n\tif (dragCounter === 1) {\r\n\t\t$(dropArea).addClass(\"dragNDropHighlight\");\r\n\t}\r\n}\r\n\r\nexport function gridDragLeaveFunc(_, dropArea: HTMLElement) {\r\n\tdragCounter--;\r\n\tif (dragCounter === 0) {\r\n\t\t$(dropArea).removeClass(\"dragNDropHighlight\");\r\n\t}\r\n}\r\n\r\nexport function dragLeaveFunc(\r\n\tevent: DragEvent | undefined,\r\n\tdropArea: HTMLElement\r\n) {\r\n\tlet divFromMouse: HTMLElement | null = null;\r\n\tif (event)\r\n\t\tdivFromMouse = document.elementFromPoint(\r\n\t\t\tevent.clientX,\r\n\t\t\tevent.clientY\r\n\t\t) as HTMLElement;\r\n\r\n\tif (\r\n\t\t!event ||\r\n\t\t(divFromMouse &&\r\n\t\t\t!$(dropArea).is(divFromMouse) &&\r\n\t\t\t$(dropArea).has(divFromMouse).length === 0)\r\n\t) {\r\n\t\tdropArea?.classList?.remove(\"dragNDropHighlight\");\r\n\t}\r\n}\r\n\r\nexport function handleDrop(e: DragEvent) {\r\n\tdragCounter = 0;\r\n\r\n\tif (dropArea) dragLeaveFunc(undefined, dropArea);\r\n\tconst dt = e.dataTransfer;\r\n\r\n\tlet files: FilesFromVario[] | FileList | null = [];\r\n\r\n\t//kopiowanie z chatu/grida do grida\r\n\tconst fromDrag = dt?.getData(\"text/plain\") ?? \"\";\r\n\tif (!stringIsNullOrEmpty(fromDrag)) {\r\n\t\tlet parsedJSON: any = \"\";\r\n\t\ttry {\r\n\t\t\tparsedJSON = JSON.parse(fromDrag);\r\n\t\t} catch (err) {\r\n\t\t\tconsole.error(err, fromDrag);\r\n\t\t\tshowDxToast(\"Przeci\u0105gni\u0119ty obiekt nie jest wspierany\", \"warning\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!Array.isArray(parsedJSON)) parsedJSON = [parsedJSON];\r\n\r\n\t\tconst parsedFromDrag: FilesFromVario[] = parsedJSON;\r\n\r\n\t\tif (\r\n\t\t\t!parsedFromDrag.find((x) => x.isVarioObject) &&\r\n\t\t\tparsedFromDrag.find((x) => x.isFromVarioChat)\r\n\t\t) {\r\n\t\t\tfiles = parsedFromDrag.map((x) => ({\r\n\t\t\t\tfromChat: true,\r\n\t\t\t\titemId: x.itemId,\r\n\t\t\t\tname: x.name,\r\n\t\t\t}));\r\n\t\t} else {\r\n\t\t\teditCopy(\r\n\t\t\t\tparsedFromDrag.map((x) => x.itemId),\r\n\t\t\t\tcontainerId\r\n\t\t\t);\r\n\t\t\tif (\r\n\t\t\t\tcontainerId === parsedFromDrag.find((x) => x.containerId)?.containerId\r\n\t\t\t)\r\n\t\t\t\teditPasteAsCopy(containerId);\r\n\t\t\telse editPasteAsLink(containerId);\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\tif (!files?.length) files = dt?.files ?? null;\r\n\r\n\tctrlDown = e.ctrlKey || e.metaKey;\r\n\r\n\tif (files?.length) handleDropFiles(files);\r\n}\r\n\r\nexport async function handleDropFiles(files: FilesFromVario[] | FileList) {\r\n\tif (files?.length > 0) {\r\n\t\tdraggedFilesBuffer = files;\r\n\r\n\t\t//definitions allowed for the current container content\r\n\t\tif (!allowedDefinitionsGlobal)\r\n\t\t\tallowedDefinitionsGlobal = await GetAllowedDefinitionsAjax();\r\n\r\n\t\t//definitions allowed for upload files action\r\n\t\tconst allowedUpploadFileDefinitions =\r\n\t\t\tallowedDefinitionsGlobal?.filter((item) => item.canUploadFile) ?? [];\r\n\r\n\t\tif (isDirtyDoc()) {\r\n\t\t\tconst res = await ShowPopupWarningUnsavedRichEditDoc().catch(() => {});\r\n\t\t\tif (!res) return;\r\n\t\t}\r\n\r\n\t\tif (allowedUpploadFileDefinitions.length === 0) {\r\n\t\t\tshowDxToast(\"Brak mo\u017Cliwo\u015Bci dodania elementu\", \"warning\");\r\n\t\t} else if (allowedUpploadFileDefinitions.length === 1) {\r\n\t\t\t//import files for the only one allowed definition\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId =\r\n\t\t\t\tallowedUpploadFileDefinitions[0].key;\r\n\t\t\tselectThisDefinitionInEditor(1, true, undefined, false);\r\n\t\t} else {\r\n\t\t\t//choose the definition and then import files\r\n\t\t\tnewDocument({ forWhat: \"forGrid\", fromDrop: true });\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function cancelFloatingButtonRequests() {\r\n\ttry {\r\n\t\t(firstRequest?.catch(() => {}) as JQuery.jqXHR)?.abort();\r\n\t\t(secondRequest?.catch(() => {}) as JQuery.jqXHR)?.abort();\r\n\t\t(getPossibleControlsToUseRequest?.catch(() => {}) as JQuery.jqXHR)?.abort();\r\n\r\n\t\tfirstRequest = null;\r\n\t\tsecondRequest = null;\r\n\t\tgetPossibleControlsToUseRequest = null;\r\n\t} catch (_) {}\r\n}\r\n\r\nexport function CancelRequests() {\r\n\ttry {\r\n\t\tcancelFloatingButtonRequests();\r\n\t\tif (subElementsRequest) (subElementsRequest as JQuery.jqXHR)?.abort();\r\n\t\tif (pdfVerifiedSignatures) (pdfVerifiedSignatures as JQueryXHR)?.abort();\r\n\t\tif (downloadingDefinitionsAjax) downloadingDefinitionsAjax?.abort();\r\n\t\tif (refreshManager?.refreshObjectPromise)\r\n\t\t\t(refreshManager?.refreshObjectPromise as JQuery.jqXHR)?.abort();\r\n\t\tif (filePreviewPromise) filePreviewPromise?.abort();\r\n\t\tif (spreadSheetReloadPromise)\r\n\t\t\t(spreadSheetReloadPromise as JQuery.jqXHR)?.abort();\r\n\t\tif (doubleRetrieveRequest) doubleRetrieveRequest?.fail(() => {});\r\n\t\tif (firstWorkflowRequest)\r\n\t\t\t(firstWorkflowRequest?.catch(() => {}) as JQuery.jqXHR)?.abort();\r\n\t\tif (secondWorkflowRequest)\r\n\t\t\t(secondWorkflowRequest?.catch(() => {}) as JQuery.jqXHR)?.abort();\r\n\r\n\t\tsubElementsRequest = null;\r\n\t\tdownloadingDefinitionsAjax = null;\r\n\t\tpdfVerifiedSignatures = null;\r\n\t\trefreshManager.refreshObjectPromise = null;\r\n\t\tfilePreviewPromise = null;\r\n\t\tspreadSheetReloadPromise = null;\r\n\t\tdoubleRetrieveRequest = null;\r\n\t\tfirstWorkflowRequest = null;\r\n\t\tsecondWorkflowRequest = null;\r\n\t} catch (_) {}\r\n}\r\n\r\nexport function prepareFloatingButtonForTableView() {\r\n\tcreateFloatingButton();\r\n}\r\n\r\nexport function deleteEmptySpaceInDxGrid() {\r\n\tif (modelSubElementsOnly === \"True\" || debug) return;\r\n\r\n\tsetTimeout(() => {\r\n\t\t//usuwanie bialej przestrzeni pod elementami w dxgrid\r\n\t\tconst gridHeader = $(\"#Tabela .dx-datagrid-headers\")[0]?.scrollHeight;\r\n\t\tconst gridRows = $(\r\n\t\t\t\"#Tabela .dx-datagrid-rowsview .dx-datagrid-content tbody\"\r\n\t\t)[0]?.scrollHeight;\r\n\t\tconst gridFooter = $(\"#Tabela .dx-datagrid-total-footer\")[0]?.scrollHeight;\r\n\t\tif (!gridRows) return;\r\n\t\t$(\"#Tabela, #Tabela .dx-datagrid-columns-separator\").css(\r\n\t\t\t\"max-height\",\r\n\t\t\tgridRows + gridHeader + gridFooter\r\n\t\t);\r\n\t\t$(\"#Tabela .dx-datagrid-rowsview, #Tabela .dx-datagrid-rowsview *\").css(\r\n\t\t\t\"max-height\",\r\n\t\t\tgridRows + gridFooter\r\n\t\t);\r\n\t}, 100);\r\n}\r\n\r\nexport function onRowPrepared(e: DevExpress.ui.dxDataGrid.RowPreparedEvent) {\r\n\ttry {\r\n\t\tlet data: SelectedRow | null = null;\r\n\t\tif (e.data) data = \"items\" in e.data ? parseDxGridItems(e.data) : e.data;\r\n\t\tif (Array.isArray(data)) data = data[0];\r\n\r\n\t\tif (data) {\r\n\t\t\tif (data.IsNew) {\r\n\t\t\t\te.rowElement[0].style.cssText += \"font-weight:700\";\r\n\t\t\t}\r\n\r\n\t\t\tif (data.FormattingRowColor != null) {\r\n\t\t\t\te.rowElement[0].style.cssText += `color:${e.data.FormattingRowColor}`;\r\n\t\t\t}\r\n\r\n\t\t\tif (data.FormattingRowStrikeout != null) {\r\n\t\t\t\t$(e.rowElement).addClass(\"dx-grid-row-strikeout\");\r\n\t\t\t}\r\n\r\n\t\t\tif (\r\n\t\t\t\te.rowType === \"data\" &&\r\n\t\t\t\t(!JSON.parse(data.HasChildren?.toString() ?? \"null\") ||\r\n\t\t\t\t\tmodelId.includes(\"CSentItems\") ||\r\n\t\t\t\t\tmodelId.includes(\"CInbox\"))\r\n\t\t\t) {\r\n\t\t\t\tconst expandGridBtn = e?.rowElement?.find(\".dx-datagrid-expand\");\r\n\t\t\t\texpandGridBtn?.addClass(\"hiddenChildren\");\r\n\t\t\t}\r\n\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tif (data.HashID) {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tlet hasCaption = (e as any).cells?.find(\r\n\t\t\t\t\t\t\t(x) =>\r\n\t\t\t\t\t\t\t\tx.column?.dataField === \"Caption\" ||\r\n\t\t\t\t\t\t\t\tx.column?.dataField === \"RefCaption\" ||\r\n\t\t\t\t\t\t\t\tx.column?.dataField === \"ComplexWorkflowInfo\" ||\r\n\t\t\t\t\t\t\t\tx.column?.dataField === \"ComplexCorrespondenceInfo\" ||\r\n\t\t\t\t\t\t\t\tx.column?.dataField === \"ComplexCorrespondenceInstanceInfo\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\tif (!hasCaption)\r\n\t\t\t\t\t\t\thasCaption = (e as any)?.cells?.find(\r\n\t\t\t\t\t\t\t\t(x) =>\r\n\t\t\t\t\t\t\t\t\tx.column.dataType === \"string\" &&\r\n\t\t\t\t\t\t\t\t\tx.column.dataField !== \"SmallImage\" &&\r\n\t\t\t\t\t\t\t\t\t!stringIsNullOrEmpty(x.value)\r\n\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tif (data.Caption) addActionButtons({ ...e, row: e });\r\n\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tdata.Flags != null &&\r\n\t\t\t\t\t\t\t!$(e.rowElement).find(\".decreeIconCorrespondence\").length &&\r\n\t\t\t\t\t\t\t(containerId?.includes(\"CInbox\") ||\r\n\t\t\t\t\t\t\t\tcontainerId?.includes(\"Correspondence\"))\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tif ((e.data.Flags & 0x400000) !== 0) {\r\n\t\t\t\t\t\t\t\t$(e.rowElement)\r\n\t\t\t\t\t\t\t\t\t.find(\".dxGridLink\")\r\n\t\t\t\t\t\t\t\t\t.prepend(`\r\n\t\t\t\t\t\t\t\t\t`);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif ((e.data.Flags & 0x100000) !== 0) {\r\n\t\t\t\t\t\t\t\t$(e.rowElement)\r\n\t\t\t\t\t\t\t\t\t.find(\".dxGridLink\")\r\n\t\t\t\t\t\t\t\t\t.prepend(`\r\n\t\t\t\t\t\t\t\t\t`);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconst smallImage = (e as any).cells?.find(\r\n\t\t\t\t\t\t\t(x) => x.column?.dataField === \"SmallImage\"\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tif (smallImage) {\r\n\t\t\t\t\t\t\tsmallImage?.cellElement?.off(\"click\");\r\n\t\t\t\t\t\t\tsmallImage?.cellElement?.on(\r\n\t\t\t\t\t\t\t\t\"click\",\r\n\t\t\t\t\t\t\t\t(event: JQuery.ClickEvent) => {\r\n\t\t\t\t\t\t\t\t\taskChangeItem(e, event, $(event.currentTarget));\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (hasCaption?.rowType === \"data\") {\r\n\t\t\t\t\t\t\tlet cell = hasCaption.cellElement;\r\n\t\t\t\t\t\t\tif (!cell) return;\r\n\r\n\t\t\t\t\t\t\tconst link = `${GetBaseUrl()}/Vario/VarioObject?id=${data.HashID}&containerKey=${hashId}&asPartialView=false&innerCall=false&browserTabGuid=${uuidv4()}`;\r\n\t\t\t\t\t\t\tconst foundA = cell?.find(\"a\");\r\n\t\t\t\t\t\t\tif (foundA?.length) {\r\n\t\t\t\t\t\t\t\tcell = foundA;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tcell = $(cell).wrapInner(\r\n\t\t\t\t\t\t\t\t\t``\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tcell[0].href = link;\r\n\r\n\t\t\t\t\t\t\tcell.off(\"click\");\r\n\t\t\t\t\t\t\tcell.on(\"click\", (event: JQuery.ClickEvent) => {\r\n\t\t\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t\t\t\taskChangeItem(e, event, $(event.currentTarget));\r\n\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\tcell.off(\"dxdblclick\");\r\n\t\t\t\t\t\t\tcell.on(\"dxdblclick\", (event) => {\r\n\t\t\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t\t\t\taskChangeItem(e, event, $(event.currentTarget));\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\tconsole.log(e);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (e.rowType === \"data\" && data.IsCurrentVersion === false) {\r\n\t\t\t\t\tconst smallImageColumn = (e as any).cells?.find(\r\n\t\t\t\t\t\t(x) => x.column.dataField === \"SmallImage\"\r\n\t\t\t\t\t)?.cellElement;\r\n\t\t\t\t\tif (smallImageColumn)\r\n\t\t\t\t\t\tsmallImageColumn.append(\r\n\t\t\t\t\t\t\t`
`\r\n\t\t\t\t\t\t);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (e.rowType === \"data\" && data.IsMultisource) {\r\n\t\t\t\t\tconst sourceImageColumn = (e as any).cells\r\n\t\t\t\t\t\t?.find((x) => x.column.dataField === \"ChildSources\")\r\n\t\t\t\t\t\t?.cellElement?.find(\"div\");\r\n\t\t\t\t\tif (sourceImageColumn)\r\n\t\t\t\t\t\tsourceImageColumn.append(\r\n\t\t\t\t\t\t\t`
`\r\n\t\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}, 0);\r\n\r\n\t\t\tprepareFormatConditionGrid(e, data);\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\te.rowType === \"totalFooter\" &&\r\n\t\t\t(subElementsModel[modelSubElementsOnly].totalRowBackgroundColor?.length ??\r\n\t\t\t\t0) > 0\r\n\t\t) {\r\n\t\t\tif (\r\n\t\t\t\tsubElementsModel[\r\n\t\t\t\t\tmodelSubElementsOnly\r\n\t\t\t\t].totalRowBackgroundColor?.includes(\",\") &&\r\n\t\t\t\t!subElementsModel[\r\n\t\t\t\t\tmodelSubElementsOnly\r\n\t\t\t\t].totalRowBackgroundColor?.includes(\"rgb\")\r\n\t\t\t) {\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].totalRowBackgroundColor =\r\n\t\t\t\t\t`rgb(${subElementsModel[modelSubElementsOnly].totalRowBackgroundColor})`;\r\n\t\t\t}\r\n\t\t\te.rowElement.css(\r\n\t\t\t\t\"backgroundColor\",\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].totalRowBackgroundColor ?? \"\"\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\t//formatowanie w trybie edycji inline\r\n\t\tif (e.rowType === \"data\" && (e as any).isEditing) {\r\n\t\t\tconst $cells = $(e.rowElement).children();\r\n\t\t\te.columns.forEach((column, index) => {\r\n\t\t\t\tconst editRow = lastRowControlTypes?.find(\r\n\t\t\t\t\t(el) => el.fieldKey === column.dataField\r\n\t\t\t\t);\r\n\t\t\t\tif (editRow != null && editRow.fieldDecorator != null) {\r\n\t\t\t\t\tif (editRow.fieldDecorator.unconstrained === false)\r\n\t\t\t\t\t\t$cells[index]?.classList?.add(\"unconstrainedField\");\r\n\r\n\t\t\t\t\tif (editRow.fieldDecorator.workflowRequired)\r\n\t\t\t\t\t\t$cells[index]?.classList?.add(\"requiredWorkflowClassAtr\");\r\n\r\n\t\t\t\t\tif (editRow.fieldDecorator.workflowSuggested)\r\n\t\t\t\t\t\t$cells[index]?.classList?.add(\"suggestedWorkflowClassAtr\");\r\n\r\n\t\t\t\t\tif (editRow.fieldDecorator.required)\r\n\t\t\t\t\t\t$cells[index]?.classList?.add(\"requiredClassAtr\");\r\n\r\n\t\t\t\t\tif (data)\r\n\t\t\t\t\t\tcheckRequired(\r\n\t\t\t\t\t\t\tdata[editRow.fieldKey],\r\n\t\t\t\t\t\t\t$($cells[index]),\r\n\t\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\t\teditRow.fieldKey\r\n\t\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t//Adding new item to grid\r\n\t\t\tif (e.data.ItemID === undefined) {\r\n\t\t\t\te.data.ItemID =\r\n\t\t\t\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId;\r\n\t\t\t}\r\n\t\t\tif (e.data.DefinitionKey === undefined) {\r\n\t\t\t\te.data.DefinitionKey =\r\n\t\t\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId;\r\n\t\t\t}\r\n\t\t}\r\n\t} catch (ex) {\r\n\t\tconsole.error(e);\r\n\t\tconsole.error(ex);\r\n\t}\r\n}\r\n\r\nexport function ChangePageSpecial() {\r\n\tconst selectPage = document.getElementById(\r\n\t\t\"selectPageInput\"\r\n\t) as HTMLInputElement;\r\n\tif (!selectPage) return;\r\n\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\tconst lastPage = subElementsModel[modelSubElementsOnly]?.lastPage ?? -1;\r\n\r\n\tif (Number(selectPage?.value) < 1) selectPage.value = \"1\";\r\n\tif (Number(selectPage.value) > lastPage)\r\n\t\tselectPage.value = lastPage.toString();\r\n\r\n\tif (subElementsModel[modelSubElementsOnly]?.page)\r\n\t\tsubElementsModel[modelSubElementsOnly].page = Number.parseInt(\r\n\t\t\tselectPage.value\r\n\t\t);\r\n\r\n\tif (isRunningOnMobile() === true) {\r\n\t\tselectPage.placeholder = `${subElementsModel[modelSubElementsOnly].page} z ${lastPage}`;\r\n\t} else {\r\n\t\tselectPage.placeholder = `Strona ${subElementsModel[modelSubElementsOnly].page} z ${lastPage}`;\r\n\t}\r\n\tChangePage(Number(selectPage.value));\r\n}\r\n\r\nexport function ChangePage(value: number) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\tCancelRequests();\r\n\r\n\tsubElementsModel[modelSubElementsOnly].page = value;\r\n\t$(\"#Tabela\").dxDataGrid(\"instance\").refresh();\r\n\tRefreshPageInfo();\r\n}\r\n\r\nexport function HidePager() {\r\n\tif (\r\n\t\tsubElementsModel[modelSubElementsOnly].lastPage === 0 ||\r\n\t\t!Number.isFinite(subElementsModel[modelSubElementsOnly].lastPage)\r\n\t) {\r\n\t\t$(\"#toolbar-after\").addClass(\"hidden\");\r\n\t\t$(\"#toolbar-before\").addClass(\"hidden\");\r\n\t} else {\r\n\t\t$(\"#toolbar-after\").removeClass(\"hidden\");\r\n\t\t$(\"#toolbar-before\").removeClass(\"hidden\");\r\n\t}\r\n}\r\n\r\nexport function selectionModeChange() {\r\n\t$(\".dx-row.dx-data-row:first\").trigger(\"dxhold\");\r\n}\r\n\r\nexport function canSetLastYearMode(): boolean {\r\n\tconst allowedContainers = [\r\n\t\t\"CInbox\",\r\n\t\t\"CSentItems\",\r\n\t\t\"CWorkflowInbox\",\r\n\t\t\"CWorkflowOutboc\",\r\n\t\t\"CWorkflowSentItems\",\r\n\t];\r\n\treturn allowedContainers.some((x) => modelId?.includes(x));\r\n}\r\nexport function setlastYearMode(enabled: boolean) {\r\n\tif (enabled == null) enabled = canSetLastYearMode();\r\n\tsubElementsModel[modelSubElementsOnly].dataFromLastYearOnly = enabled;\r\n}\r\n\r\nexport function ChangePageSize(value: number, element: HTMLElement) {\r\n\tconst grid = $(\"#Tabela\").dxDataGrid(\"instance\");\r\n\tgrid.option(\"scrolling.mode\", value > 50 ? \"virtual\" : \"standard\");\r\n\tgrid.option(\r\n\t\t\"scrolling.rowRenderingMode\",\r\n\t\tvalue > 50 ? \"virtual\" : \"standard\"\r\n\t);\r\n\r\n\tsubElementsModel[modelSubElementsOnly].pageSize = value;\r\n\tif (value == null) {\r\n\t\tsubElementsModel[modelSubElementsOnly].lastPage = 0;\r\n\t} else {\r\n\t\tsubElementsModel[modelSubElementsOnly].lastPage = Math.ceil(\r\n\t\t\t(subElementsModel[modelSubElementsOnly].totalItemsCount ?? 0) / value\r\n\t\t);\r\n\t}\r\n\r\n\tconst dropBtn = document.getElementById(\r\n\t\t\"dropdownMenuButton\"\r\n\t) as HTMLButtonElement;\r\n\tif (dropBtn) {\r\n\t\tif (subElementsModel[modelSubElementsOnly].pageSize == null) {\r\n\t\t\tdropBtn.innerHTML =\r\n\t\t\t\t'';\r\n\t\t} else {\r\n\t\t\tdropBtn.innerHTML = `${subElementsModel[modelSubElementsOnly].pageSize}`;\r\n\t\t}\r\n\t}\r\n\r\n\t$(\"#MaxPageLabel\").text(\r\n\t\tsubElementsModel[modelSubElementsOnly].lastPage?.toString() ?? \"\"\r\n\t);\r\n\r\n\tgrid.refresh();\r\n\r\n\t$(\".page-size-button\").each((_, item) => {\r\n\t\t(item as HTMLElement).removeAttribute(\"disabled\");\r\n\t});\r\n\r\n\tif (element != null) {\r\n\t\telement.setAttribute(\"disabled\", \"true\");\r\n\t} else {\r\n\t\t$(\".page-size-button.default\")[0].setAttribute(\"disabled\", \"true\");\r\n\t}\r\n\r\n\tif (value == null) {\r\n\t\t$(\"#toolbar-after\").addClass(\"hidden\");\r\n\t} else {\r\n\t\t$(\"#toolbar-after\").removeClass(\"hidden\");\r\n\t}\r\n\r\n\tChangePage(1);\r\n\tUnselectAndUnfocusDxTable();\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n}\r\n\r\nexport function PreparePagination() {\r\n\tconst ds2 = $(\"#Tabela\")?.dxDataGrid(\"instance\");\r\n\tconst ds = ds2?.getDataSource();\r\n\r\n\tif (!(ds as any)?._isLoaded as any) return;\r\n\r\n\tif ((ds as any)?._items?.length > 0) {\r\n\t\tconst items = parseDxGridItems(ds);\r\n\r\n\t\tsubElementsModel[modelSubElementsOnly].totalItemsCount =\r\n\t\t\titems?.[0].TotalItemsCount;\r\n\t} else {\r\n\t\tsubElementsModel[modelSubElementsOnly].totalItemsCount = 0;\r\n\t}\r\n\r\n\tif (ds2?.getSelectedRowKeys().length === 0) {\r\n\t\t$(\"#SubElementsCounter\").html(\r\n\t\t\tgetCounterText(\r\n\t\t\t\tundefined,\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].totalItemsCount\r\n\t\t\t)\r\n\t\t);\r\n\t}\r\n\tsubElementsModel[modelSubElementsOnly].lastPage = Math.ceil(\r\n\t\t(subElementsModel[modelSubElementsOnly].totalItemsCount ?? 0) /\r\n\t\t\t(subElementsModel[modelSubElementsOnly].pageSize ?? 0)\r\n\t);\r\n\r\n\tif (ds2 != null) {\r\n\t\tconst filterString = ds2.getCombinedFilter();\r\n\t\tif (\r\n\t\t\tfilterString &&\r\n\t\t\tsubElementsModel[modelSubElementsOnly].page >\r\n\t\t\t\t(subElementsModel[modelSubElementsOnly].lastPage ?? 0)\r\n\t\t) {\r\n\t\t\tsubElementsModel[modelSubElementsOnly].page = 1;\r\n\t\t}\r\n\t}\r\n\r\n\tUpdatePanelCounter(\r\n\t\tsubElementsModel[modelSubElementsOnly].totalItemsCount ?? -1\r\n\t);\r\n\r\n\tHidePager();\r\n\tRefreshPageInfo();\r\n}\r\n\r\nexport function getCounterText(\r\n\tselectedItemsCount?: number | null,\r\n\ttotalItemsCount?: number | null\r\n) {\r\n\tif (totalItemsCount) {\r\n\t\tconst selectedItemsText =\r\n\t\t\tselectedItemsCount && selectedItemsCount > 0\r\n\t\t\t\t? `${selectedItemsCount}/`\r\n\t\t\t\t: \"\";\r\n\t\tif (($(window).width() ?? 0) > 767)\r\n\t\t\treturn `Pozycji: ${selectedItemsText}${totalItemsCount}`;\r\n\t\treturn `(${selectedItemsText}${totalItemsCount})`;\r\n\t}\r\n\treturn \"\";\r\n}\r\n\r\nexport function InitPageSizeButtons() {\r\n\t$(\".page-size-button\").each((_, item) => {\r\n\t\tconst isCurrentPageSize =\r\n\t\t\titem.innerText?.trim() ===\r\n\t\t\t\t(subElementsModel[modelSubElementsOnly].pageSize?.toString() ?? \"\") &&\r\n\t\t\t$(item).hasClass(\"actualPageSizeBtn\");\r\n\r\n\t\tif (\r\n\t\t\tsubElementsModel[modelSubElementsOnly].totalItemsCount &&\r\n\t\t\t!isCurrentPageSize\r\n\t\t)\r\n\t\t\titem.removeAttribute(\"disabled\");\r\n\t\telse item.setAttribute(\"disabled\", \"true\");\r\n\t});\r\n}\r\n\r\nexport function UpdatePanelCounter(count: number) {\r\n\tconst activePanel = document.getElementsByClassName(\r\n\t\t\"subElementsNavSpanItem active\"\r\n\t);\r\n\tif (activePanel != null && activePanel.length > 0) {\r\n\t\tconst counter = activePanel[0].querySelector(\r\n\t\t\t\".positonTypeElement\"\r\n\t\t) as HTMLElement;\r\n\t\tif (counter != null)\r\n\t\t\tcounter.innerText =\r\n\t\t\t\tNumber.parseInt(count.toString()) && count > 0 ? count.toString() : \"\";\r\n\t}\r\n}\r\n\r\nexport function reloadDxGridDataSource(forceRefresh = true) {\r\n\tconst ds = $(\"#Tabela\").dxDataGrid(\"instance\")?.getDataSource();\r\n\tds?.reload();\r\n\tdeleteEmptySpaceInDxGrid();\r\n\r\n\tforcedGridRefresh = forceRefresh;\r\n}\r\n\r\nexport function refreshDxGrid(\r\n\tmsg: string | null = \"Wczytywanie danych...\",\r\n\tgrid = $(\"#Tabela\").dxDataGrid(\"instance\")\r\n) {\r\n\tif (msg) ShowLoadingPanel(msg);\r\n\tconst refresh = grid?.refresh();\r\n\tdeleteEmptySpaceInDxGrid();\r\n\r\n\tforcedGridRefresh = true;\r\n\r\n\treturn refresh;\r\n}\r\n\r\nexport function repaintDxGrid(\r\n\tforceRefresh = true,\r\n\tds = $(\"#Tabela\").dxDataGrid(\"instance\")\r\n) {\r\n\t//fix dla zapisu grid inline w pozycji z minusowym id (po reload, robil sie repaint z changebtnvisibility i lecial blad)\r\n\tif (\r\n\t\ttypeof (ds as any)?._contentReadyAction !== \"undefined\" &&\r\n\t\t!(ds as any)?._contentReadyAction\r\n\t)\r\n\t\treturn;\r\n\r\n\tds?.repaint();\r\n\tshowLoadingForFiltering();\r\n\tshowLoadingForSorting();\r\n\r\n\tforcedGridRefresh = forceRefresh;\r\n}\r\n\r\nexport function UnselectAndUnfocusDxTable(\r\n\tds = $(\"#Tabela\").dxDataGrid(\"instance\")\r\n) {\r\n\tds?.option(\"focusedRowIndex\", -1);\r\n\tds?.deselectAll();\r\n\tglobalItemsSelectedByUser = [];\r\n}\r\n\r\nexport function UnfocusDxTable() {\r\n\tconst ds = $(\"#Tabela\").dxDataGrid(\"instance\");\r\n\tds?.option(\"focusedRowIndex\", -1);\r\n}\r\n\r\nexport function contentReady(\r\n\te: DevExpress.ui.dxDataGrid.ContentReadyEvent,\r\n\tparentID: string\r\n) {\r\n\tremoveSkeletonLoading(e.element);\r\n\r\n\tif (parentID) {\r\n\t\te.element.attr(\"data-parentID\", parentID);\r\n\t}\r\n\r\n\tfixScrollInDx(e.element.attr(\"id\") ?? \"\");\r\n\r\n\tprepareRestOfGridFunctions(e);\r\n\r\n\tHideLoadingPanel();\r\n\r\n\tHideColumnHeadersIfNoData();\r\n}\r\n\r\nexport function HideColumnHeadersIfNoData() {\r\n\tconst dataGrid = $(\"#Tabela\")?.dxDataGrid(\"instance\");\r\n\tif (!dataGrid) return;\r\n\r\n\tif (getVisibleRows(dataGrid)?.length > 0) {\r\n\t\tdataGrid.beginUpdate();\r\n\t\tdataGrid.option(\"showColumnHeaders\", true);\r\n\t\tdataGrid.endUpdate();\r\n\t} else {\r\n\t\tdataGrid.beginUpdate();\r\n\t\tdataGrid.option(\"showColumnHeaders\", false);\r\n\t\tdataGrid.endUpdate();\r\n\r\n\t\t//There is a problem with the DoubleRetrieve mechanism , when hiding a row of totals :(\r\n\t\t//dataGrid.beginUpdate();\r\n\t\t//dataGrid.option('summary.groupItems', []);\r\n\t\t//dataGrid.option('summary.totalItems', []);\r\n\t\t//dataGrid.endUpdate();\r\n\t}\r\n}\r\n\r\nexport function prepareRestOfGridFunctions(\r\n\te: DevExpress.ui.dxDataGrid.ContentReadyEvent\r\n) {\r\n\t//\u017Ceby si\u0119 wykona\u0142o asynchronicznie i grid si\u0119 za\u0142adowa\u0142 szybciej\r\n\tsetTimeout(() => {\r\n\t\tPreparePagination();\r\n\r\n\t\tconst selectPageInput = document.getElementById(\r\n\t\t\t\"selectPageInput\"\r\n\t\t) as HTMLInputElement;\r\n\r\n\t\tif (selectPageInput != null) {\r\n\t\t\tif (isRunningOnMobile()) {\r\n\t\t\t\tselectPageInput.placeholder = `${subElementsModel[modelSubElementsOnly].page} z ${subElementsModel[modelSubElementsOnly].lastPage}`;\r\n\t\t\t} else {\r\n\t\t\t\tselectPageInput.placeholder = `Strona ${subElementsModel[modelSubElementsOnly].page} z ${subElementsModel[modelSubElementsOnly].lastPage}`;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tglobalItemsSelectedByUser?.length &&\r\n\t\t\tglobalItemsSelectedByUser[0] === modelId\r\n\t\t) {\r\n\t\t\tglobalItemsSelectedByUser = [];\r\n\t\t}\r\n\r\n\t\tshowLoadingForFiltering();\r\n\t\tshowLoadingForSorting();\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t\tstartDoubleRetrieve(e.component);\r\n\t\t}, 300);\r\n\r\n\t\tconst showGroupPanel =\r\n\t\t\t($(\"#Tabela\")?.dxDataGrid(\"instance\")?.getDataSource() as any)\r\n\t\t\t\t?._storeLoadOptions?.group != null;\r\n\t\t$(\"#Tabela\")\r\n\t\t\t?.dxDataGrid(\"instance\")\r\n\t\t\t?.option(\"groupPanel.visible\", showGroupPanel);\r\n\t\t$(\".dx-datagrid-header-panel\").toggleClass(\r\n\t\t\t\"show-dx-toolbar\",\r\n\t\t\tshowGroupPanel\r\n\t\t);\r\n\r\n\t\t//scroll albo checkboxy\r\n\t\tif (\r\n\t\t\tforcedGridRefresh === false &&\r\n\t\t\t!subElementsModel[modelSubElementsOnly]?.forceRowSelect\r\n\t\t)\r\n\t\t\treturn;\r\n\t\tforcedGridRefresh = false;\r\n\r\n\t\tconst selectedItems = e?.component?.getSelectedRowKeys();\r\n\t\tconst subCounter = document.getElementById(\r\n\t\t\t\"SubElementsCounter\"\r\n\t\t) as HTMLElement;\r\n\t\tif (subCounter)\r\n\t\t\tsubCounter.innerHTML = getCounterText(\r\n\t\t\t\tselectedItems?.length,\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].totalItemsCount\r\n\t\t\t);\r\n\r\n\t\t//forceRowSelect to obejscie dla niewykrywalnego refresha grida stworzonego przez ustawienie opcji grida z editing w onSavingDxGrid\r\n\t\tif (!subElementsModel[modelSubElementsOnly]?.forceRowSelect)\r\n\t\t\tsubElementsModel[modelSubElementsOnly].jsonSorting = \"\";\r\n\r\n\t\tdeleteEmptySpaceInDxGrid();\r\n\t\tdxGridResizer = new ResizeObserver(\r\n\t\t\tdelayCallback(() => {\r\n\t\t\t\tdeleteEmptySpaceInDxGrid();\r\n\t\t\t}, 100)\r\n\t\t);\r\n\r\n\t\tconst grid = document.getElementById(\"Tabela\");\r\n\t\tif (grid) dxGridResizer?.observe(grid);\r\n\r\n\t\tInitPageSizeButtons();\r\n\r\n\t\t//zaznaczenie poprzedniego rowa\r\n\t\tselectRowInGrid(e?.component);\r\n\t}, 0);\r\n}\r\n\r\nexport function startDoubleRetrieve(\r\n\tgrid = $(\"#Tabela\")?.dxDataGrid(\"instance\")\r\n) {\r\n\tif (!grid) return;\r\n\r\n\t//hide the refreshing icon when the data is loaded\r\n\tconst ds = grid?.getDataSource();\r\n\tif (!ds) return;\r\n\r\n\tconst refreshIconContainer = document.getElementById(\r\n\t\t\"modelTitleRefreshIconContainer\"\r\n\t);\r\n\tif ((ds as any)?._isLoaded && refreshIconContainer?.style)\r\n\t\trefreshIconContainer.style.display = \"none\";\r\n\r\n\t//allowUnrefreshedData is set to true only once at the beginning of an open action\r\n\t//double retrieve only for main grid\r\n\tif (\r\n\t\tsubElementsModel[modelSubElementsOnly].allowUnrefreshedData &&\r\n\t\tgrid.element().attr(\"id\") === \"Tabela\" &&\r\n\t\t$(`#${grid.element().attr(\"id\")}`).dxDataGrid(\"instance\")\r\n\t) {\r\n\t\tsetTimeout(() => {\r\n\t\t\twait4DataPreparation(grid, 0);\r\n\t\t}, 1000);\r\n\r\n\t\tgrid.option(\"noDataText\", \"To miejsce nie posiada zawarto\u015Bci\");\r\n\t}\r\n}\r\n\r\n//Po wej\u015Bciu do folderu i pobraniu danych bie\u017C\u0105cych, inicjowany jest proces pobierania zaktualizowanych danych,\r\n//wykonywany przez dedykowany serwis.Funkcja sprawdza (GetPreRetrieveDataStatus) cyklicznie co 300 ms, czy dane zosta\u0142y ju\u017C przygotowane\r\n//i w takim przypadku od\u015Bwie\u017Ca zawarto\u015B\u0107 (RefreshGridForDoubleRetrieve). Je\u017Celi w ci\u0105gu 5000 ms dane nie zostan\u0105 przygotowane,\r\n//zostanie wymuszone od\u015Bwie\u017Cenie zawarto\u015Bci.\r\nexport function wait4DataPreparation(\r\n\tgrid: DevExpress.ui.dxDataGrid,\r\n\tperiod: number\r\n) {\r\n\tif (period < 5000) {\r\n\t\tsetTimeout(() => {\r\n\t\t\t$.ajax({\r\n\t\t\t\turl: `${GetBaseUrl()}/Vario/GetPreRetrieveDataStatus`,\r\n\t\t\t\ttype: \"Get\",\r\n\t\t\t\tdata: {\r\n\t\t\t\t\tid: subElementsModel[modelSubElementsOnly].currentUrlItemId,\r\n\t\t\t\t\tposType:\r\n\t\t\t\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId,\r\n\t\t\t\t\tcolumnList: subElementsModel[modelSubElementsOnly].columnListAsJson,\r\n\t\t\t\t\tpage: subElementsModel[modelSubElementsOnly].page,\r\n\t\t\t\t\tpageSize: subElementsModel[modelSubElementsOnly].pageSize,\r\n\t\t\t\t\tonlyChildren: false,\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: (res: PreRetrieveStatusModel) => {\r\n\t\t\t\t\tif (res.resultExists) {\r\n\t\t\t\t\t\tif (!res.isDataUpToDate) {\r\n\t\t\t\t\t\t\tRefreshGridForDoubleRetrieve(grid);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if ($(\"#Tabela\").length) {\r\n\t\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\t\twait4DataPreparation(grid, period + 300);\r\n\t\t\t\t\t\t}, 300);\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\terror: () => {},\r\n\t\t\t\tcomplete: () => {},\r\n\t\t\t});\r\n\t\t}, 500);\r\n\t} else {\r\n\t\tRefreshGridForDoubleRetrieve(grid);\r\n\t}\r\n}\r\n\r\nexport function RefreshGridForDoubleRetrieve(grid: DevExpress.ui.dxDataGrid) {\r\n\tif (!grid || !$(\"#Tabela\")?.length || checkIfAnyGridInEditMode()) return;\r\n\tsubElementsModel[modelSubElementsOnly].allowUnrefreshedData = false;\r\n\tsubElementsModel[modelSubElementsOnly].disableSidePanelPreviewReload = true;\r\n\r\n\tInitPageSizeButtons();\r\n\r\n\tconst refreshIconContainer = document.getElementById(\r\n\t\t\"modelTitleRefreshIconContainer\"\r\n\t);\r\n\r\n\t//show the refreshing icon\r\n\tif (refreshIconContainer) refreshIconContainer.style.display = \"flex\";\r\n\tdoubleRetrieveRequest = refreshDxGrid(null, grid) as JQueryPromise;\r\n}\r\n\r\nexport function addKeyboardShortcuts() {\r\n\t$(document).on(\"keydown\", (e) => {\r\n\t\t// Document Ctrl + C/V\r\n\t\tif (\r\n\t\t\t$(\"#Tabela\").length > 0 &&\r\n\t\t\twindow.getSelection()?.toString() === \"\" &&\r\n\t\t\te.target instanceof HTMLElement &&\r\n\t\t\t(e.target as HTMLElement).nodeName !== \"INPUT\" &&\r\n\t\t\t(e.target as HTMLElement).nodeName !== \"TEXTAREA\" &&\r\n\t\t\t(e.target as HTMLElement).nodeName !== \"SPAN\"\r\n\t\t) {\r\n\t\t\te.stopImmediatePropagation();\r\n\t\t\tconst dataGrid = $(\"#Tabela\").dxDataGrid(\"instance\");\r\n\t\t\tlet keys: string[] = [];\r\n\t\t\tif ((e.ctrlKey || e.metaKey) && (e.key === \"c\" || e.key === \"x\")) {\r\n\t\t\t\tif (dataGrid.getSelectedRowsData().length === 0) {\r\n\t\t\t\t\tconst key =\r\n\t\t\t\t\t\tgetVisibleRows(dataGrid)[\r\n\t\t\t\t\t\t\tsubElementsModel[modelSubElementsOnly].currentFocusedRowIndex\r\n\t\t\t\t\t\t]?.data?.ItemID;\r\n\r\n\t\t\t\t\tif (key) keys.push(key);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tkeys = dataGrid.getSelectedRowsData().map((x) => x.ItemID);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (keys.length > 0) {\r\n\t\t\t\t\tswitch (e.key) {\r\n\t\t\t\t\t\tcase \"x\":\r\n\t\t\t\t\t\t\tkeyboardShortcutEdits(modelId, keys, \"CUT\");\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"c\":\r\n\t\t\t\t\t\t\tkeyboardShortcutEdits(modelId, keys, \"COPY\");\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else if ((e.ctrlKey || e.metaKey) && e.key === \"v\") {\r\n\t\t\t\tkeyboardShortcutEdits(modelId);\r\n\t\t\t} else if (\r\n\t\t\t\t(e.ctrlKey || e.metaKey) &&\r\n\t\t\t\t(e.key === \"d\" || e.key === \"Backspace\")\r\n\t\t\t) {\r\n\t\t\t\tif (!globalItemsSelectedByUser?.length) return;\r\n\t\t\t\te.preventDefault();\r\n\r\n\t\t\t\tconst single = globalItemsSelectedByUser?.length === 1;\r\n\t\t\t\tconst ids: string[] = single\r\n\t\t\t\t\t? [globalItemsSelectedByUser[0]]\r\n\t\t\t\t\t: globalItemsSelectedByUser;\r\n\r\n\t\t\t\tTryDeleteVarioObjects(single, globalItemsSelectedByUser);\r\n\t\t\t\taddOperation(ids, \"Edycja.Usu\u0144\");\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function forceRefreshRow() {\r\n\tconst row = JSON.parse(sessionStorage.getItem(\"selectedRow\") ?? \"null\");\r\n\tif (!row?.length) return;\r\n\r\n\tclearDynamicWorkflowActionsForFloatingButton();\r\n\tclearDynamicWorkflowActionsForVarioObject();\r\n\trow[0].refresh = true;\r\n\r\n\tsessionStorage.setItem(\"selectedRow\", JSON.stringify(row));\r\n}\r\n\r\nexport function saveLastSelectedRows(\r\n\tdata: SelectedRow[],\r\n\tgrid = $(\"#Tabela\")?.dxDataGrid(\"instance\")\r\n) {\r\n\tif (!data) return;\r\n\r\n\tlastSelectedRow = data.map((x) => ({\r\n\t\t...x,\r\n\t\tgridEl: grid?.element()?.attr(\"id\"),\r\n\t\tcontainerId: x.containerId ?? modelId,\r\n\t}));\r\n\r\n\tconst toSave: SelectedRowStorage[] = [];\r\n\tfor (const x of data) {\r\n\t\tif (toSave.find((a) => a.id === x.ItemID)) continue;\r\n\r\n\t\ttoSave.push({\r\n\t\t\tid: x.ItemID,\r\n\t\t\tpage: subElementsModel[modelSubElementsOnly].page,\r\n\t\t\tlastPageSize: subElementsModel[modelSubElementsOnly].pageSize,\r\n\t\t\tcontainerId: x.containerId ?? modelId,\r\n\t\t\tcurrentFocusedRowIndex:\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].currentFocusedRowIndex,\r\n\t\t});\r\n\t}\r\n\r\n\tsessionStorage.setItem(\"selectedRow\", JSON.stringify(toSave));\r\n\r\n\treturn toSave;\r\n}\r\n\r\nexport function onFocusedCellChanging(\r\n\te: DevExpress.ui.dxDataGrid.FocusedCellChangingEvent\r\n) {\r\n\tif (e.prevRowIndex === -1) {\r\n\t\t$(\".dx-row-inserted\").addClass(\r\n\t\t\t\"dx-row-focused dx-cell-focus-disabled dx-selection\"\r\n\t\t);\r\n\t}\r\n\r\n\tif (isDirtyDoc()) {\r\n\t\tShowPopupWarningUnsavedRichEditDoc().catch(() => {});\r\n\t\te.isHighlighted = false;\r\n\t\te?.event?.stopImmediatePropagation();\r\n\t\te?.event?.stopPropagation();\r\n\t\te.cancel = true;\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (\r\n\t\tcheckIfGridInEditMode(e?.component) &&\r\n\t\te.prevRowIndex !== -1 &&\r\n\t\te.prevRowIndex !== e.newRowIndex\r\n\t) {\r\n\t\te.isHighlighted = false;\r\n\t\te?.event?.stopImmediatePropagation();\r\n\t\te?.event?.stopPropagation();\r\n\t\te.cancel = true;\r\n\t\treturn;\r\n\t}\r\n}\r\n\r\nexport function onFocusedRowChanging(\r\n\te: DevExpress.ui.dxDataGrid.FocusedRowChangingEvent\r\n) {\r\n\tif (isDirtyDoc()) {\r\n\t\tShowPopupWarningUnsavedRichEditDoc().catch(() => {});\r\n\t\te?.event?.stopImmediatePropagation();\r\n\t\te?.event?.stopPropagation();\r\n\t\te.cancel = true;\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst clickedOnDetails = e?.event?.target?.classList?.contains(\r\n\t\t\"dx-datagrid-adaptive-more\"\r\n\t);\r\n\tif (checkIfGridInEditMode(e?.component) || clickedOnDetails) {\r\n\t\te?.event?.stopImmediatePropagation();\r\n\t\te?.event?.stopPropagation();\r\n\t\te.cancel = true;\r\n\t\treturn;\r\n\t}\r\n}\r\n\r\nexport function onFocusedRowChanged(\r\n\te: DevExpress.ui.dxDataGrid.FocusedRowChangedEvent\r\n) {\r\n\t//Wiersz grupowania\r\n\tif (e.row?.rowType === \"group\") {\r\n\t\treturn;\r\n\t}\r\n\r\n\t//danie focusu (niebieski kolor row)\r\n\tsubElementsModel[modelSubElementsOnly].currentFocusedRowIndex = e.rowIndex;\r\n}\r\n\r\nexport function onRowClick(e: DevExpress.ui.dxDataGrid.RowClickEvent) {\r\n\tif (e?.rowType === \"detailAdaptive\") return;\r\n\tconst grid = e?.element;\r\n\tconst childrenGrids = $(\r\n\t\t'.dx-master-detail-cell .dx-widget[id^=\"dx-\"][role=\"presentation\"]'\r\n\t);\r\n\r\n\tif (grid?.length && childrenGrids.length) {\r\n\t\tif (!checkIfRightGrid(grid)) return;\r\n\r\n\t\tif (checkIfMainGrid(grid) === false) UnselectAndUnfocusDxTable();\r\n\t\telse unselectChildrenGrids(grid);\r\n\t}\r\n}\r\n\r\nexport function onCellClick(e: DevExpress.ui.dxDataGrid.CellClickEvent) {\r\n\tif (isDirtyDoc()) {\r\n\t\tShowPopupWarningUnsavedRichEditDoc().catch(() => {});\r\n\t\te?.event?.stopImmediatePropagation();\r\n\t\te?.event?.stopPropagation();\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (checkIfGridInEditMode(e?.component)) {\r\n\t\te?.event?.stopImmediatePropagation();\r\n\t\te?.event?.stopPropagation();\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (\r\n\t\te?.column?.type === \"detailExpand\" &&\r\n\t\t!!JSON.parse(e.data.HasChildren?.toString() ?? \"null\")\r\n\t)\r\n\t\tonGridBtnClick(e?.row?.data, e?.component);\r\n\r\n\t//fix dla bledu dx gdzie nie mozna zaznaczyc multi na start po selectRowInGrid\r\n\tif (subElementsModel[modelSubElementsOnly]?.multiselectOnFirstGridLoad)\r\n\t\tsubElementsModel[modelSubElementsOnly].multiselectOnFirstGridLoad =\r\n\t\t\te?.event?.ctrlKey || e?.event?.metaKey\r\n\t\t\t\t? \"ctrl\"\r\n\t\t\t\t: e?.event?.shiftKey\r\n\t\t\t\t\t? \"shift\"\r\n\t\t\t\t\t: false;\r\n}\r\n\r\nexport async function onSelectionChanged(\r\n\tselectedItems: DevExpress.ui.dxDataGrid.SelectionChangedEvent\r\n) {\r\n\tconst grid = selectedItems?.component.element();\r\n\tconst childrenGrids = $(\r\n\t\t'.dx-master-detail-cell .dx-widget[id^=\"dx-\"][role=\"presentation\"]'\r\n\t);\r\n\r\n\tif (grid?.length && childrenGrids.length) {\r\n\t\tif (!checkIfRightGrid(grid)) return;\r\n\t}\r\n\r\n\tif (isDirtyDoc()) {\r\n\t\tconst res = await ShowPopupWarningUnsavedRichEditDoc().catch(() => {});\r\n\t\tif (!res) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\tif (checkIfGridInEditMode(selectedItems?.component)) {\r\n\t\treturn;\r\n\t}\r\n\r\n\ttry {\r\n\t\t//fix dla bledu dx gdzie nie mozna zaznaczyc multi na start po selectRowInGrid\r\n\t\tconst saved = JSON.parse(sessionStorage.getItem(\"selectedRow\") ?? \"null\");\r\n\t\tif (\r\n\t\t\t(subElementsModel[modelSubElementsOnly]?.multiselectOnFirstGridLoad ===\r\n\t\t\t\t\"ctrl\" ||\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly]?.multiselectOnFirstGridLoad ===\r\n\t\t\t\t\t\"shift\") &&\r\n\t\t\tsaved?.length &&\r\n\t\t\tsaved[0]?.id !== selectedItems?.selectedRowsData[0]?.ItemID &&\r\n\t\t\tsaved[0]?.containerId === modelId\r\n\t\t) {\r\n\t\t\tconst rowNumsFromSelected = selectedItems?.selectedRowsData?.map(\r\n\t\t\t\t(x) => x.RowNum\r\n\t\t\t);\r\n\t\t\tconst rows = [\r\n\t\t\t\t...lastSelectedRow.map((x) => x.RowNum),\r\n\t\t\t\t...rowNumsFromSelected,\r\n\t\t\t]?.sort((a, b) => a - b);\r\n\r\n\t\t\tif (\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly]?.multiselectOnFirstGridLoad ===\r\n\t\t\t\t\t\"shift\" &&\r\n\t\t\t\trows?.length\r\n\t\t\t) {\r\n\t\t\t\tconst last = rows[rows.length - 1];\r\n\t\t\t\tfor (let i = rows[0]; i <= last; i++) {\r\n\t\t\t\t\trows.push(i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tsubElementsModel[modelSubElementsOnly].multiselectOnFirstGridLoad = false;\r\n\r\n\t\t\tselectedItems?.component?.selectRows(rows, false);\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t//przez virtual scrolling grid nie zaznacza wszystkich pozycji na select all\r\n\t\t//timeout bo checkbox jest zaznaczony dopiero po wykonaniu tej funkcji\r\n\t\tsetTimeout(() => {\r\n\t\t\t//jak sa wszystkie pozycje to nie ma pagesize\r\n\t\t\tconst allOnPage =\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly]?.pageSize ??\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly]?.totalItemsCount;\r\n\r\n\t\t\tif (\r\n\t\t\t\t$(\r\n\t\t\t\t\t\".dx-header-row .dx-command-select .dx-checkbox-checked.dx-select-checkbox\"\r\n\t\t\t\t).length &&\r\n\t\t\t\tselectedItems?.selectedRowsData?.length !== allOnPage\r\n\t\t\t) {\r\n\t\t\t\tconst rows: number[] = [];\r\n\t\t\t\tconst first = selectedItems?.currentSelectedRowKeys[0] ?? 0;\r\n\t\t\t\tconst last = first + allOnPage;\r\n\t\t\t\tfor (let i = first; i <= last; i++) {\r\n\t\t\t\t\trows.push(i);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tselectedItems?.component?.selectRows(rows, true);\r\n\t\t\t}\r\n\t\t});\r\n\t} catch (err) {\r\n\t\tconsole.log(err);\r\n\t\tsubElementsModel[modelSubElementsOnly].multiselectOnFirstGridLoad = false;\r\n\t}\r\n\r\n\tconst subCounter = document.getElementById(\r\n\t\t\"SubElementsCounter\"\r\n\t) as HTMLElement;\r\n\tif (subCounter)\r\n\t\tsubCounter.innerHTML = getCounterText(\r\n\t\t\tselectedItems?.selectedRowsData?.length,\r\n\t\t\tsubElementsModel[modelSubElementsOnly].totalItemsCount\r\n\t\t);\r\n\r\n\tsaveLastSelectedRows(\r\n\t\tselectedItems.selectedRowsData,\r\n\t\tselectedItems?.component\r\n\t);\r\n\r\n\tconst data: string[] = [];\r\n\tif (selectedItems.selectedRowsData.length === 1) {\r\n\t\tdata.push(selectedItems.selectedRowsData[0].ItemID);\r\n\t\tif (data) {\r\n\t\t\tglobalItemsSelectedByUser = data;\r\n\t\t}\r\n\r\n\t\t//floating button dla multiselect jednej pozycji\r\n\t\tfloatingButtonForOneSelection();\r\n\t} else if (selectedItems.selectedRowsData.length > 1) {\r\n\t\tfor (let i = 0; i < selectedItems.selectedRowsData.length; i++) {\r\n\t\t\tdata.push(selectedItems.selectedRowsData[i].ItemID);\r\n\t\t}\r\n\t\tif (data) {\r\n\t\t\tglobalItemsSelectedByUser = data;\r\n\t\t}\r\n\r\n\t\t//floating button dla multiselect wielu pozycji\r\n\t\tfloatingButtonForMultiSelect(selectedItems.selectedRowsData);\r\n\t} else {\r\n\t\t//unselect\r\n\t\tglobalItemsSelectedByUser = null;\r\n\t\tUnselectAndUnfocusDxTable();\r\n\t\tfloatingButtonForNoSelection();\r\n\r\n\t\tsessionStorage.removeItem(\"selectedRow\");\r\n\t}\r\n}\r\n\r\nexport function showLoadingForFiltering() {\r\n\tconst $container = $(\r\n\t\t\".dx-datagrid-filter-row .dx-texteditor-input-container, .dx-datagrid-filter-range-overlay\"\r\n\t);\r\n\r\n\t$(\"input\", $container).on(\"focusout keyup\", (e) => {\r\n\t\tif (e.type === \"focusout\" || e.key === \"Enter\") {\r\n\t\t\tapplyFilter();\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function showLoadingForSorting() {\r\n\t$(\".dx-datagrid-text-content\")\r\n\t\t.closest(\".dx-datagrid-action\")\r\n\t\t.on(\"click\", () => {\r\n\t\t\tUnfocusDxTable();\r\n\t\t\tShowLoadingPanel(\"Sortowanie...\");\r\n\t\t});\r\n}\r\n\r\nexport function selectNewlyAddedRow(newItemId: string | string[]) {\r\n\tif (!Array.isArray(newItemId)) newItemId = [newItemId];\r\n\tforceSortingByCreationDateInGrid(true);\r\n\r\n\tif (newItemId?.length) {\r\n\t\tsubElementsModel[modelSubElementsOnly].forceRowSelect = true;\r\n\r\n\t\tconst ids = newItemId.map((string) => {\r\n\t\t\treturn { id: string, containerId: containerId, isNew: true };\r\n\t\t});\r\n\t\tsessionStorage.setItem(\"selectedRow\", JSON.stringify(ids));\r\n\t}\r\n}\r\n\r\nexport function forceSortingByCreationDateInGrid(\r\n\tnewItem: boolean,\r\n\tevent?: MouseEvent\r\n) {\r\n\tif (\r\n\t\t!newItem &&\r\n\t\tevent?.target &&\r\n\t\t!$(event?.target).parents(\".dx-row-focused.dx-selection\").length\r\n\t)\r\n\t\treturn;\r\n\r\n\t//Je\u017Celi jest ustawione grupowanie to nie chcemy dodatkowo zmienia\u0107 sortowania\r\n\tconst dataGrid = $(\"#Tabela\").dxDataGrid(\"instance\");\r\n\tif (!dataGrid) return;\r\n\r\n\tconst rows = getVisibleRows(dataGrid);\r\n\tfor (let i = 0; i < rows.length; i++) {\r\n\t\tif (rows[i]?.rowType === \"group\") {\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\t//force sortowanie od najnowszego jesli nie ma kolumny z creationDate\r\n\tif (!newItem) dataGrid.clearSorting();\r\n\tif (forcedSorting || newItem)\r\n\t\tsubElementsModel[modelSubElementsOnly].jsonSorting =\r\n\t\t\t'[{\"Descending\":true,\"FieldKey\":\"CreationDate\"}]';\r\n\telse\r\n\t\tsubElementsModel[modelSubElementsOnly].jsonSorting =\r\n\t\t\t'[{\"Descending\":false,\"FieldKey\":\"CreationDate\"}]';\r\n\r\n\tif (!newItem) {\r\n\t\tforcedSorting = !forcedSorting;\r\n\t\tShowLoadingPanel(\"Sortowanie danych...\");\r\n\t\trefreshDxGrid();\r\n\t}\r\n}\r\n\r\nexport function selectRowInGrid(\r\n\tdataGrid = $(\"#Tabela\")?.dxDataGrid(\"instance\"),\r\n\trequery = false\r\n) {\r\n\tlet selectedRow = JSON.parse(sessionStorage.getItem(\"selectedRow\") ?? \"null\");\r\n\tif (!selectedRow) return;\r\n\t//console.log('selectRowInGrid selectedRow', selectedRow)\r\n\r\n\tif (!Array.isArray(selectedRow)) selectedRow = [selectedRow];\r\n\tif (!selectedRow.length) return;\r\n\r\n\tif (selectedRow[0].containerId && selectedRow[0].containerId !== modelId)\r\n\t\treturn;\r\n\r\n\tconst isNew = selectedRow.find((x) => x.isNew);\r\n\tif (isNew) {\r\n\t\t$(\"#Tabela .dx-datagrid-rowsview .dx-scrollable-container\").scrollTop(0);\r\n\t\tisNew.isNew = false;\r\n\t\tsessionStorage.setItem(\"selectedRow\", JSON.stringify(selectedRow));\r\n\t\tforceSortingByCreationDateInGrid(true);\r\n\t\treloadDxGridDataSource();\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (!dataGrid) return;\r\n\r\n\tconst selectedRowIndex = selectedRow[0].currentFocusedRowIndex;\r\n\r\n\t// Finding rows\r\n\tconst rows = getVisibleRows(dataGrid)?.filter(\r\n\t\t(obj) => obj.rowType === \"data\"\r\n\t);\r\n\r\n\t// Finding rows' data\r\n\tlet rowData = rows?.filter((item) =>\r\n\t\tselectedRow.some((obj) => obj.id === item.data.ItemID)\r\n\t);\r\n\r\n\t// if row is forced to be refreshed\r\n\tif (selectedRow.find((x) => x.refresh)) requery = true;\r\n\r\n\t// If is getting workflowed then select next row\r\n\tconst workflowed = selectedRow.find((x) => \"workflowed\" in x);\r\n\tif (workflowed) {\r\n\t\t//console.log('selectRowInGrid workflowed', selectedRowIndex, workflowed)\r\n\t\t// Finding the next row\r\n\t\tlet foundRow = rows.find(\r\n\t\t\t(obj) => obj.data.RowNum === workflowed.workflowed\r\n\t\t);\r\n\t\tif (foundRow) rowData = [foundRow];\r\n\t\tif (!rowData[0])\r\n\t\t\tfoundRow = rows.find(\r\n\t\t\t\t(obj) =>\r\n\t\t\t\t\tobj.data.ItemID !== workflowed.id &&\r\n\t\t\t\t\t(obj as any).loadIndex >= selectedRowIndex\r\n\t\t\t);\r\n\t\tif (foundRow) rowData = [foundRow];\r\n\t\t// Force requery\r\n\t\tif (rowData.find((x) => (x as any).loadIndex === selectedRowIndex))\r\n\t\t\trequery = true;\r\n\t}\r\n\r\n\t// If no row found then try to scroll to the row\r\n\tif (!rowData[0]) {\r\n\t\t//console.log('selectRowInGrid no rowData', rows, selectedRowIndex, selectedRow)\r\n\t\t// Check if the LoadIndexes do not contain last selected row\r\n\t\tif (\r\n\t\t\t(selectedRowIndex < (rows[0] as any)?.loadIndex ||\r\n\t\t\t\tselectedRowIndex > (rows[rows.length - 1] as any)?.loadIndex) &&\r\n\t\t\tselectedRowIndex > -1\r\n\t\t) {\r\n\t\t\t// If index is higher than last row then select last row in table\r\n\t\t\tif (\r\n\t\t\t\tselectedRowIndex >=\r\n\t\t\t\t(subElementsModel[modelSubElementsOnly].totalItemsCount ?? 0)\r\n\t\t\t) {\r\n\t\t\t\tselectedRow[0].currentFocusedRowIndex--;\r\n\t\t\t\tsessionStorage.setItem(\"selectedRow\", JSON.stringify(selectedRow));\r\n\t\t\t\t//console.log('selectRowInGrid lastRow', selectedRow)\r\n\t\t\t\trepaintDxGrid();\r\n\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t// Navigate to unloaded index\r\n\t\t\tforcedGridRefresh = true;\r\n\r\n\t\t\tconst scrollToIndex = selectedRowIndex === 0 ? 1 : selectedRowIndex;\r\n\t\t\t//console.log('selectRowInGrid navigateAndReload', scrollToIndex);\r\n\t\t\tdataGrid.navigateToRow(scrollToIndex);\r\n\t\t}\r\n\t\treturn;\r\n\t}\r\n\t//console.log('selectRowInGrid - rowData', rowData)\r\n\r\n\tif (checkIfMainGrid(dataGrid.element()) === false)\r\n\t\tUnselectAndUnfocusDxTable();\r\n\tunselectChildrenGrids(dataGrid.element());\r\n\r\n\t// Finding key of the row (especially for new row)\r\n\tconst itemsDx = rowData.map((item) => item.data.RowNum);\r\n\tconst selectedRowData = rowData.map((item) => item.data);\r\n\r\n\t//console.log('selectRowInGrid - itemsDx', itemsDx)\r\n\t//console.log('selectRowInGrid - selectedRowData', selectedRowData)\r\n\r\n\t// Setting the row\r\n\tdataGrid.option(\"focusedRowIndex\", (rowData[0] as any).loadIndex);\r\n\tdataGrid.selectRows(itemsDx, false);\r\n\tif (requery)\r\n\t\tonSelectionChanged({\r\n\t\t\tcomponent: dataGrid,\r\n\t\t\tselectedRowsData: selectedRowData,\r\n\t\t} as any);\r\n\telse reloadGridPanel(selectedRowData);\r\n\tdataGrid.navigateToRow(itemsDx[0]);\r\n\tsubElementsModel[modelSubElementsOnly].forceRowSelect = false;\r\n\tHideLoadingPanel(true);\r\n}\r\n\r\nexport function showFilter() {\r\n\tif (checkIfGridInEditMode()) return;\r\n\r\n\tconst current = $(\"#Tabela\").dxDataGrid(\"instance\").option(\"filterRow\");\r\n\t$(\"#Tabela\")\r\n\t\t.dxDataGrid(\"instance\")\r\n\t\t.option(\"filterRow\", { visible: !current?.visible });\r\n\tshowLoadingForFiltering();\r\n}\r\n\r\nexport function showFilterBuilder() {\r\n\tif (checkIfGridInEditMode()) return;\r\n\r\n\t$(\"#Tabela\")\r\n\t\t.dxDataGrid(\"instance\")\r\n\t\t.option(\"filterBuilderPopup\", { visible: true });\r\n\tconst titlePopup = $(\r\n\t\t\".dx-toolbar.dx-widget.dx-visibility-change-handler.dx-collection.dx-popup-title.dx-has-close-button\"\r\n\t);\r\n\tif (titlePopup && titlePopup.length > 0) {\r\n\t\ttitlePopup[0].classList.add(\"popupTitleAccent\");\r\n\t}\r\n\tconst filterPopup = $(\".dx-overlay-content.dx-popup-normal.dx-resizable\");\r\n\tif (filterPopup && filterPopup.length > 0) {\r\n\t\tfilterPopup[0].classList.add(\"filterPopup\");\r\n\r\n\t\tconst filterButtons = $(\r\n\t\t\t\".filterPopup .dx-toolbar.dx-popup-bottom .dx-button.dx-button-normal.dx-button-mode-contained\"\r\n\t\t);\r\n\t\tif (filterButtons && filterButtons.length > 0) {\r\n\t\t\tfor (const [key, _] of Object.entries(filterButtons)) {\r\n\t\t\t\tif (Number.isInteger(Number.parseInt(key))) {\r\n\t\t\t\t\tfilterButtons[key].classList.add(\"btn\");\r\n\t\t\t\t\tfilterButtons[key].classList.add(\"btn-docusoft\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function onWorkflowIconClick(\r\n\te:\r\n\t\t| DevExpress.ui.dxDataGrid.ColumnButtonTemplateData\r\n\t\t| SimpleDxRowDataStructure,\r\n\ttype = \"subView\"\r\n) {\r\n\tif (!e?.row?.data) return;\r\n\t$(\"#contextMenu\").dxContextMenu(\"instance\").hide();\r\n\r\n\tconst itemId = e.row?.data.ItemID;\r\n\tconst caption = e.row?.data.Caption;\r\n\tconst data = e.row?.data;\r\n\tlet model: SubElementsFullModel | VarioObjectFullModel | null = null;\r\n\tif (type === \"varioObject\") model = prepareVarioObjectModel();\r\n\telse if (type === \"subView\")\r\n\t\tmodel = prepareSubViewModel(data, LayoutControlWeb.Loading);\r\n\r\n\tconst isReport = e.row.data.FileExtension?.toLowerCase() === \".repx\";\r\n\r\n\t//zwykle guziki\r\n\tsetTimeout(() => {\r\n\t\tconst normalDiv = $(\".threeDots-Popover #normalActionsSubelementsView\");\r\n\t\tnormalDiv.empty();\r\n\r\n\t\t//guziki edycji\r\n\t\tlet editOperations = getEditOperations(\r\n\t\t\titemId,\r\n\t\t\tcontainerId,\r\n\t\t\tcaption,\r\n\t\t\tdata?.DefinitionKey ?? \"\",\r\n\t\t\te.row?.data.HashID ?? \"\",\r\n\t\t\ttype === \"varioObject\",\r\n\t\t\tisReport\r\n\t\t);\r\n\t\teditOperations = editOperations.filter((x) => x.important);\r\n\t\tif (type === \"varioObject\")\r\n\t\t\teditOperations = editOperations.filter((x) => x.text !== \"Edytuj\");\r\n\r\n\t\t//guziki operacji\r\n\t\tlet operations = getOperations(model, type);\r\n\t\toperations = operations.filter((x) => x.important);\r\n\t\tif (type !== \"varioObject\")\r\n\t\t\toperations = operations.filter((x) => x.text !== \"Udost\u0119pnij link\");\r\n\t\telse\r\n\t\t\toperations = operations.filter(\r\n\t\t\t\t(x) =>\r\n\t\t\t\t\t!x.text.includes(\"Odpowiedz\") &&\r\n\t\t\t\t\tx.text !== \"Przeka\u017C dalej\" &&\r\n\t\t\t\t\tx.text !== \"Dekretuj\"\r\n\t\t\t);\r\n\t\tlet moreOperations = getMoreOperations(model, type);\r\n\t\tmoreOperations = moreOperations.filter((x) => x.important);\r\n\t\tif (type !== \"varioObject\")\r\n\t\t\tmoreOperations = moreOperations.filter(\r\n\t\t\t\t(x) =>\r\n\t\t\t\t\tx.text !== \"Dodaj notatk\u0119\" &&\r\n\t\t\t\t\tx.text !== \"Historia operacji\" &&\r\n\t\t\t\t\tx.text !== \"Historia zmian pliku\" &&\r\n\t\t\t\t\tx.text !== \"W\u0142a\u015Bciwo\u015Bci\"\r\n\t\t\t);\r\n\r\n\t\tconst items = [...operations, ...moreOperations, ...editOperations];\r\n\r\n\t\tappendNotFloatingButtons(items, normalDiv);\r\n\t}, 0);\r\n\r\n\t//workflowe guziki\r\n\t//timeout bo cancelrequest z floating buttona psuje czasami\r\n\tsetTimeout(async () => {\r\n\t\tCancelRequests();\r\n\t\tlet workflowBtnsToCheck = workflowActionsButtons;\r\n\t\tif (type === \"varioObject\")\r\n\t\t\tworkflowBtnsToCheck = workflowActionsButtonsForVarioObject;\r\n\r\n\t\tconst isSameSelected = workflowBtnsToCheck?.filter(\r\n\t\t\t(btn) => btn.itemKey === itemId\r\n\t\t);\r\n\r\n\t\tif (workflowBtnsToCheck?.length === 0 || isSameSelected?.length === 0) {\r\n\t\t\tclearDynamicWorkflowActionsForFloatingButton();\r\n\t\t\tgetWorkflowButtons(\r\n\t\t\t\titemId,\r\n\t\t\t\tgetContainer(containerId, containerKey),\r\n\t\t\t\tcaption\r\n\t\t\t);\r\n\t\t\tif (firstRequest) {\r\n\t\t\t\tawait firstRequest.then(() => {}).catch(() => {});\r\n\t\t\t\tif (secondRequest) {\r\n\t\t\t\t\tawait secondRequest.then(() => {}).catch(() => {});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t//usuniecie ladowania\r\n\t\t$(\"#workflowButtonsSubelementsView\").empty();\r\n\r\n\t\tif (type === \"varioObject\") appendWorkflowButtonsForVarioObject();\r\n\t\telse appendWorkflowButtons();\r\n\r\n\t\tif (\r\n\t\t\tcustomActionsButtons?.length &&\r\n\t\t\t$(\"#customActionsSubelementsView\").length\r\n\t\t) {\r\n\t\t\tif (\r\n\t\t\t\tworkflowActionsButtons?.length &&\r\n\t\t\t\t!$(\"#customActionsSubelementsView\").find(\"hr\").length\r\n\t\t\t)\r\n\t\t\t\t$(\"#customActionsSubelementsView\").append(\"
\");\r\n\r\n\t\t\tappendCustomActionButtons(\"#customActionsSubelementsView\");\r\n\t\t}\r\n\t}, 5);\r\n}\r\n\r\nexport async function onRowRightClick(\r\n\te: DevExpress.ui.dxDataGrid.ContextMenuPreparingEvent\r\n) {\r\n\te.items = [];\r\n\tif (!e.row || !(\"data\" in e.row)) return;\r\n\r\n\tlet itemId = e.row.data.ItemID;\r\n\tlet caption = e.row.data.Caption;\r\n\r\n\tif (!caption || !itemId || caption.includes(\"Brak uprawnie\u0144 do odczytu\"))\r\n\t\treturn;\r\n\r\n\tlet cancelReloading = false;\r\n\r\n\tconst customContextMenu = $(\"#contextMenu\").dxContextMenu(\"instance\");\r\n\r\n\t//zeby znikal context menu na scrollu\r\n\tfunction hideContextMenuOnScroll() {\r\n\t\tsetTimeout(() => {\r\n\t\t\tcustomContextMenu.hide();\r\n\t\t\tCancelRequests();\r\n\t\t}, 50);\r\n\t}\r\n\r\n\t$(\"#Tabela .dx-scrollable-container\").one(\"scroll\", hideContextMenuOnScroll);\r\n\r\n\tlet customItems: CustomMenuItems[] = [\r\n\t\t{\r\n\t\t\ttext: \"Edycja\",\r\n\t\t\ticon: \"fas fa-chevron-circle-right\",\r\n\t\t\titems: [],\r\n\t\t},\r\n\t\t{\r\n\t\t\ttext: \"Operacje\",\r\n\t\t\ticon: \"fas fa-chevron-circle-right\",\r\n\t\t\titems: [],\r\n\t\t},\r\n\t];\r\n\r\n\tif (workflowIsAvailable) {\r\n\t\tcustomItems.push(\r\n\t\t\t{\r\n\t\t\t\ttext: \"Polecenia obiegu\",\r\n\t\t\t\ticon: \"fas fa-chevron-circle-right\",\r\n\t\t\t\titems: [],\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\ttext: \"Opcje obiegu\",\r\n\t\t\t\ticon: \"fas fa-chevron-circle-right\",\r\n\t\t\t\titems: [],\r\n\t\t\t}\r\n\t\t);\r\n\t}\r\n\r\n\tlet model: FloatingButtonData | null = null;\r\n\tlet type = \"subView\";\r\n\tlet data: SelectedRow | null = e.row.data;\r\n\tconst multiselect = (globalItemsSelectedByUser?.length ?? 0) > 1;\r\n\tif (multiselect) {\r\n\t\ttype = \"subViewMultiSelect\";\r\n\t\titemId = globalItemsSelectedByUser;\r\n\t\tcaption = \"\";\r\n\t\tdata = null;\r\n\r\n\t\t//ukrywamy opcje obiegu\r\n\t\tcustomItems = customItems.filter((x) => x.text !== \"Opcje obiegu\");\r\n\t} else {\r\n\t\tif (data) model = prepareSubViewModel(data, -1);\r\n\r\n\t\tcustomItems.unshift({\r\n\t\t\ttext: \"Dodaj do wybranej pozycji\",\r\n\t\t\ticon: \"fas fa-folder-plus\",\r\n\t\t\tonItemClick: () => {\r\n\t\t\t\tnewDocument({ forWhat: \"forSelectedItem\" });\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n\r\n\t//guziki edycji\r\n\tconst editBtns = customItems.find((x) => x.text === \"Edycja\")?.items;\r\n\tconst editOperations = getEditOperations(\r\n\t\titemId,\r\n\t\tcontainerId,\r\n\t\tcaption,\r\n\t\tdata?.DefinitionKey ?? \"\",\r\n\t\te.row.data.HashID\r\n\t);\r\n\r\n\tfor (const btn of editOperations) {\r\n\t\teditBtns?.push({\r\n\t\t\ttext: btn.text,\r\n\t\t\ticon: btn.icon,\r\n\t\t\tonItemClick: () => {\r\n\t\t\t\tif (btn.functions)\r\n\t\t\t\t\tfor (const func of btn.functions) {\r\n\t\t\t\t\t\tfunc();\r\n\t\t\t\t\t}\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n\r\n\t//guziki operacji\r\n\tconst operationBtns = customItems.find((x) => x.text === \"Operacje\")?.items;\r\n\tconst operations = getOperations(model, type);\r\n\r\n\tfor (const btn of operations) {\r\n\t\tif (btn.text === \"Wi\u0119cej...\") {\r\n\t\t\toperationBtns?.push({\r\n\t\t\t\ttext: btn.text,\r\n\t\t\t\ticon: btn.icon,\r\n\t\t\t\titems: [],\r\n\t\t\t});\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tif (btn.icon.includes(\" {\r\n\t\t\t\tif (btn.functions)\r\n\t\t\t\t\tfor (const func of btn.functions) {\r\n\t\t\t\t\t\tfunc();\r\n\t\t\t\t\t}\r\n\t\t\t},\r\n\t\t};\r\n\r\n\t\tif (btn.customHTML) {\r\n\t\t\tadd = {\r\n\t\t\t\ttemplate: btn.customHTML,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\toperationBtns?.push(add);\r\n\t}\r\n\r\n\tconst moreOperationBtns = operationBtns?.find(\r\n\t\t(x) => x.text === \"Wi\u0119cej...\"\r\n\t)?.items;\r\n\tif (moreOperationBtns) {\r\n\t\tconst moreOperations = getMoreOperations(model, type);\r\n\r\n\t\tfor (const btn of moreOperations) {\r\n\t\t\tif (btn.icon.includes(\" {\r\n\t\t\t\t\tif (btn.functions)\r\n\t\t\t\t\t\tfor (const func of btn.functions) {\r\n\t\t\t\t\t\t\tfunc();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t};\r\n\r\n\t\t\tif (btn.customHTML) {\r\n\t\t\t\tadd = {\r\n\t\t\t\t\ttemplate: btn.customHTML,\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\tmoreOperationBtns.push(add);\r\n\t\t}\r\n\t}\r\n\r\n\t//\u0142adowanie guzik\u00F3w\r\n\tconst workflowBtns = customItems.find(\r\n\t\t(x) => x.text === \"Polecenia obiegu\"\r\n\t)?.items;\r\n\tconst otherWorkflowBtns = customItems.find(\r\n\t\t(x) => x.text === \"Opcje obiegu\"\r\n\t)?.items;\r\n\r\n\tconst loading = `
\r\n
\r\n
.
\r\n
.
\r\n
.
\r\n
\r\n
`;\r\n\r\n\tfunction hideLoading(array) {\r\n\t\t//usuniecie ladowania (referencyjne)\r\n\t\tarray?.splice(\r\n\t\t\t0,\r\n\t\t\tarray.length,\r\n\t\t\t...array.filter((x) => x.text !== \"Loading\")\r\n\t\t);\r\n\t}\r\n\r\n\tworkflowBtns?.push({\r\n\t\ttext: \"Loading\",\r\n\t\ttemplate: loading,\r\n\t});\r\n\r\n\totherWorkflowBtns?.push({\r\n\t\ttext: \"Loading\",\r\n\t\ttemplate: loading,\r\n\t});\r\n\r\n\toperationBtns?.push({\r\n\t\ttext: \"Loading\",\r\n\t\ttemplate: loading,\r\n\t});\r\n\r\n\tcustomContextMenu.option({\r\n\t\titems: customItems,\r\n\t\ttarget: e.targetElement,\r\n\t\tonItemClick: (e) => {\r\n\t\t\tif ((e as any)?.itemData?.onItemClick) {\r\n\t\t\t\tcancelReloading = true;\r\n\t\t\t\t(e as any).itemData.onItemClick();\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n\tcustomContextMenu.show();\r\n\r\n\t//workflowe guziki\r\n\t//timeout bo cancelrequest z floating buttona psuje czasami\r\n\tsetTimeout(async () => {\r\n\t\tcancelFloatingButtonRequests();\r\n\t\tconst isSameSelected = workflowActionsButtons?.filter(\r\n\t\t\t(btn) => btn.itemKey === itemId\r\n\t\t);\r\n\r\n\t\tif (workflowActionsButtons?.length === 0 || isSameSelected?.length === 0) {\r\n\t\t\tclearDynamicWorkflowActionsForFloatingButton();\r\n\t\t\tgetWorkflowButtons(\r\n\t\t\t\titemId,\r\n\t\t\t\tgetContainer(containerId, containerKey),\r\n\t\t\t\tcaption\r\n\t\t\t);\r\n\t\t\tif (firstRequest) {\r\n\t\t\t\tawait firstRequest\r\n\t\t\t\t\t.then(() => {\r\n\t\t\t\t\t\t//usuniecie ladowania\r\n\t\t\t\t\t\thideLoading(workflowBtns);\r\n\t\t\t\t\t\thideLoading(otherWorkflowBtns);\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.catch(() => {});\r\n\r\n\t\t\t\tif (secondRequest) {\r\n\t\t\t\t\tawait secondRequest\r\n\t\t\t\t\t\t.then(() => {\r\n\t\t\t\t\t\t\thideLoading(workflowBtns);\r\n\t\t\t\t\t\t\thideLoading(otherWorkflowBtns);\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\t.catch(() => {});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t//usuniecie ladowania\r\n\t\t\thideLoading(workflowBtns);\r\n\t\t\thideLoading(otherWorkflowBtns);\r\n\t\t}\r\n\r\n\t\tif (workflowActionsButtons && workflowActionsButtons?.length > 0) {\r\n\t\t\tfor (const element of workflowActionsButtons) {\r\n\t\t\t\tworkflowBtns?.push({\r\n\t\t\t\t\ttext: element.displayName,\r\n\t\t\t\t\ticon: element.actionIcon,\r\n\t\t\t\t\tonItemClick: () => {\r\n\t\t\t\t\t\tTryExecuteVarioAction(element);\r\n\t\t\t\t\t},\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tworkflowBtns?.push({\r\n\t\t\t\ttemplate: `

Brak dost\u0119pnych opcji

`,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tlet controlBtns: FloatingButtonItem[] = [];\r\n\t\tif (!getPossibleControlsToUseRequest?.readyState)\r\n\t\t\tgetPossibleControlsToUse();\r\n\r\n\t\tawait getPossibleControlsToUseRequest\r\n\t\t\t?.then((res) => {\r\n\t\t\t\tcontrolBtns = sendPossibleControlsToUseButtons(data, res);\r\n\t\t\t\t//usuniecie ladowania\r\n\t\t\t\thideLoading(operationBtns);\r\n\r\n\t\t\t\tfor (const btn of controlBtns) {\r\n\t\t\t\t\toperationBtns?.push({\r\n\t\t\t\t\t\ttext: btn.text,\r\n\t\t\t\t\t\ticon: btn.icon,\r\n\t\t\t\t\t\tonItemClick: () => {\r\n\t\t\t\t\t\t\tif (btn.functions)\r\n\t\t\t\t\t\t\t\tfor (const func of btn.functions) {\r\n\t\t\t\t\t\t\t\t\tfunc();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\t.catch(() => {\r\n\t\t\t\t//usuniecie ladowania\r\n\t\t\t\thideLoading(operationBtns);\r\n\t\t\t});\r\n\r\n\t\t//customowe guziki\r\n\t\tconst whereToAdd = moreOperationBtns ?? operationBtns;\r\n\t\tif (customActionsButtons)\r\n\t\t\tfor (const element of customActionsButtons) {\r\n\t\t\t\twhereToAdd?.push({\r\n\t\t\t\t\ttext: element.displayName,\r\n\t\t\t\t\ticon: element.actionIcon,\r\n\t\t\t\t\tonItemClick: () => {\r\n\t\t\t\t\t\tTryExecuteVarioAction(element);\r\n\t\t\t\t\t},\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\tconst otherWorkflowOperations = getOtherWorkflowOperations(\r\n\t\t\titemId,\r\n\t\t\t\"True\",\r\n\t\t\tcanShowWorkflowMessageParam ?? false,\r\n\t\t\tothersWorkflowState\r\n\t\t);\r\n\r\n\t\tif (otherWorkflowOperations?.length > 0) {\r\n\t\t\tfor (const btn of otherWorkflowOperations) {\r\n\t\t\t\totherWorkflowBtns?.push({\r\n\t\t\t\t\ttext: btn.text,\r\n\t\t\t\t\ticon: btn.icon,\r\n\t\t\t\t\tonItemClick: () => {\r\n\t\t\t\t\t\tif (btn.functions)\r\n\t\t\t\t\t\t\tfor (const func of btn.functions) {\r\n\t\t\t\t\t\t\t\tfunc();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t},\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\totherWorkflowBtns?.push({\r\n\t\t\t\ttemplate: `

Brak dost\u0119pnych opcji

`,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t//jesli kliknelismy na inny row to nie pokazujemy znowu context menu bo sie pojawi w innym miejscu\r\n\t\tif (workflowBtns?.find((x) => x.text === \"Loading\") || cancelReloading)\r\n\t\t\treturn;\r\n\r\n\t\tcustomContextMenu.option({ items: customItems, target: e.targetElement });\r\n\t\tcustomContextMenu.show();\r\n\t}, 5);\r\n}\r\n\r\nexport function onShareIconClick(e: ActionButtonsData) {\r\n\tif (!e?.row?.data) return;\r\n\tonGridBtnClick(e.row?.data, e.component);\r\n\r\n\tconst id = e.row?.data.ItemID;\r\n\tconst name = e.row?.data.Caption;\r\n\tconst hasFile = e.row?.data.FileExtension ?? \"\";\r\n\r\n\tshowLinkOptions(id, name, hasFile);\r\n\taddOperation(id, \"Udost\u0119pnij link\");\r\n}\r\n\r\nexport function onPropertiesIconClick(e: ActionButtonsData) {\r\n\tif (!e?.row?.data) return;\r\n\tonGridBtnClick(e.row?.data, e.component);\r\n\r\n\tconst id = e.row?.data.ItemID;\r\n\r\n\tGetItemProperties(id);\r\n\taddOperation(id, \"W\u0142a\u015Bciwo\u015Bci\");\r\n}\r\n\r\nexport function onGridBtnClick(\r\n\trow: SelectedRow,\r\n\tdataGrid = $(\"#Tabela\").dxDataGrid(\"instance\")\r\n) {\r\n\tif (!row) return;\r\n\tsetTimeout(() => {\r\n\t\tdataGrid.selectRows([row.RowNum], false);\r\n\t}, 0);\r\n}\r\n\r\nexport function hover(e: DevExpress.ui.dxDataGrid.CellHoverChangedEvent) {\r\n\t//Wiersz grupowania\r\n\tif (e?.rowType === \"group\") {\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst grid = e?.element;\r\n\tconst childrenGrids = $(\r\n\t\t'.dx-master-detail-cell .dx-widget[id^=\"dx-\"][role=\"presentation\"]'\r\n\t);\r\n\r\n\tif (grid?.length && childrenGrids.length) {\r\n\t\tif (!checkIfRightGrid(grid)) return;\r\n\t}\r\n\r\n\tif (e?.data?.RefItemID != null) {\r\n\t\tsubElementsModel[modelSubElementsOnly].globalItemWorkflowMediumItemKey =\r\n\t\t\te.data.RefItemID;\r\n\t}\r\n\r\n\tif (e?.data?.HashID) {\r\n\t\tsubElementsModel[modelSubElementsOnly].globalHoveredItem = e.data;\r\n\t}\r\n\r\n\t//Obs\u0142uga drag and drop z przegl\u0105darki na desktop\r\n\ttry {\r\n\t\tif (\r\n\t\t\te != null &&\r\n\t\t\te.column != null &&\r\n\t\t\t(e.column.name === \"SmallImage\" ||\r\n\t\t\t\te.column.name === \"ChildSources\" ||\r\n\t\t\t\te.column.name === \"Caption\") &&\r\n\t\t\te.cellElement != null &&\r\n\t\t\te.cellElement.length === 1\r\n\t\t) {\r\n\t\t\tconst imageHref = $(\r\n\t\t\t\t(e.cellElement[0].firstElementChild ?? \"\") as HTMLElement\r\n\t\t\t);\r\n\t\t\timageHref.off(\"dragstart\");\r\n\r\n\t\t\tif (!stringIsNullOrEmpty(e?.data?.FileExtension)) {\r\n\t\t\t\tconst hoveredId =\r\n\t\t\t\t\tsubElementsModel[modelSubElementsOnly].globalHoveredItem?.ItemID ??\r\n\t\t\t\t\t\"\";\r\n\t\t\t\tconst mimeType = \"text/plain\";\r\n\t\t\t\tlet urlBase = \"\";\r\n\t\t\t\tlet fileExtension = e.data.FileExtension;\r\n\t\t\t\tlet caption = e.data.Caption;\r\n\r\n\t\t\t\tif (lastSelectedRow?.length > 1) {\r\n\t\t\t\t\tconst ids = lastSelectedRow.map((x) => x.ItemID);\r\n\t\t\t\t\tif (!ids.includes(hoveredId)) ids.push(hoveredId);\r\n\t\t\t\t\turlBase = `${GetBaseUrl()}/Vario/DownloadMultipleFilesDrag?ids=${JSON.stringify(ids)}`;\r\n\t\t\t\t\tfileExtension = \".zip\";\r\n\t\t\t\t\tcaption += \" (+Inne)\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\turlBase = getBaseUrlToDownload();\r\n\t\t\t\t\turlBase += `?id=${hoveredId}&download=true`;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcaption += fileExtension;\r\n\r\n\t\t\t\timageHref.on(\"dragstart\", (evt) => {\r\n\t\t\t\t\tif (!(window as any).chrome) {\r\n\t\t\t\t\t\tevt.preventDefault();\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Ta przegl\u0105darka nie obs\u0142uguje pobierania plik\u00F3w przez przeci\u0105ganie\",\r\n\t\t\t\t\t\t\t\"warning\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (lastSelectedRow?.length > 50) {\r\n\t\t\t\t\t\tevt.preventDefault();\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Mo\u017Cesz wykona\u0107 t\u0119 operacj\u0119 dla maksymalnie 50 pozycji. Aby pobra\u0107 wi\u0119cej, u\u017Cyj opcji 'Pobierz'\",\r\n\t\t\t\t\t\t\t\"warning\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tevt?.originalEvent?.dataTransfer?.setData(\r\n\t\t\t\t\t\t\"DownloadURL\",\r\n\t\t\t\t\t\t`${mimeType}:${caption.replace(\":\", \"\")}:${urlBase}`\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\timageHref.on(\"dragend\", (evt) => {\r\n\t\t\t\t\t\tevt.stopImmediatePropagation();\r\n\t\t\t\t\t\tevt.stopPropagation();\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t`Rozpocz\u0119to pobieranie ${lastSelectedRow?.length > 1 ? \"plik\u00F3w...\" : \"pliku...\"}`,\r\n\t\t\t\t\t\t\t\"info\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t//Obs\u0142uga kopiowania z grida na grida/chat\r\n\t\t\timageHref.on(\"dragstart\", (evt) => {\r\n\t\t\t\tconst dragObject = new DragObject();\r\n\t\t\t\tlet arr = [dragObject];\r\n\t\t\t\tif (lastSelectedRow?.length > 1) {\r\n\t\t\t\t\tarr = [\r\n\t\t\t\t\t\t...arr,\r\n\t\t\t\t\t\t...lastSelectedRow\r\n\t\t\t\t\t\t\t.filter((x) => x.ItemID !== arr[0].itemId)\r\n\t\t\t\t\t\t\t.map(\r\n\t\t\t\t\t\t\t\t(x) =>\r\n\t\t\t\t\t\t\t\t\tnew DragObject(\r\n\t\t\t\t\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\t\t\t\t\tx.Caption,\r\n\t\t\t\t\t\t\t\t\t\tx.ItemID,\r\n\t\t\t\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\t\t\t\tx.SmallImage,\r\n\t\t\t\t\t\t\t\t\t\tcontainerId\r\n\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t),\r\n\t\t\t\t\t];\r\n\t\t\t\t}\r\n\r\n\t\t\t\tevt?.originalEvent?.dataTransfer?.setData(\r\n\t\t\t\t\t\"text/plain\",\r\n\t\t\t\t\tJSON.stringify(arr)\r\n\t\t\t\t);\r\n\r\n\t\t\t\timageHref.off(\"dragend\");\r\n\t\t\t});\r\n\t\t}\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t}\r\n}\r\n\r\nexport function keyboardShortcutEdits(\r\n\tcontainerId: string,\r\n\tkeys?: string[],\r\n\ttype?: string\r\n) {\r\n\tswitch (type) {\r\n\t\tcase \"CUT\":\r\n\t\tcase \"COPY\":\r\n\t\t\tsetToBuffer(type, keys ?? [], containerId);\r\n\t\t\taddOperation(keys ?? [], type === \"CUT\" ? \"Wytnij\" : \"Kopiuj\");\r\n\t\t\tbreak;\r\n\t\tdefault: {\r\n\t\t\tconst GlobalCopyBufferFromSession = JSON.parse(\r\n\t\t\t\tlocalStorage.GlobalCopyBuffer ?? \"null\"\r\n\t\t\t);\r\n\t\t\tif (\r\n\t\t\t\tGlobalCopyBufferFromSession?.itemsId?.length > 0 &&\r\n\t\t\t\tGlobalCopyBufferFromSession?.operation === \"CUT\"\r\n\t\t\t) {\r\n\t\t\t\teditPaste(containerId);\r\n\t\t\t\taddOperation(containerId, \"Wklej\");\r\n\t\t\t} else if (\r\n\t\t\t\tGlobalCopyBufferFromSession?.itemsId?.length > 0 &&\r\n\t\t\t\tGlobalCopyBufferFromSession?.operation === \"COPY\"\r\n\t\t\t) {\r\n\t\t\t\tif (GlobalCopyBufferFromSession?.containerId !== containerId) {\r\n\t\t\t\t\teditPasteAsLink(containerId);\r\n\t\t\t\t\taddOperation(containerId, \"Wklej\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\teditPasteAsCopy(containerId);\r\n\t\t\t\t\taddOperation(containerId, \"Wklej jako kopia\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function GroupingValuesGenerator(dataField: string) {\r\n\treturn (rowData) => {\r\n\t\ttry {\r\n\t\t\tif (rowData && dataField in rowData) {\r\n\t\t\t\tlet newDate = new Date(rowData[dataField]);\r\n\t\t\t\tnewDate = new Date(\r\n\t\t\t\t\tnewDate.getFullYear(),\r\n\t\t\t\t\tnewDate.getMonth(),\r\n\t\t\t\t\tnewDate.getDate()\r\n\t\t\t\t);\r\n\t\t\t\treturn newDate;\r\n\t\t\t}\r\n\t\t} catch (e) {\r\n\t\t\tconsole.log(e);\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n}\r\n\r\nexport function customGroupCellTemplate(cellElement, cellInfo) {\r\n\tconst value = cellInfo?.value;\r\n\tif (value) {\r\n\t\tconst date = new Date(value);\r\n\t\tif (date) {\r\n\t\t\tconst formattedDate = `${(`0${date.getDate()}`).slice(-2)}.${(`0${date.getMonth() + 1}`).slice(-2)}.${date.getFullYear()}`;\r\n\t\t\tconst cellCaption = cellInfo?.column?.caption ?? \"\";\r\n\t\t\tconst itemsCount = cellInfo?.data?.items?.length ?? 0;\r\n\t\t\tconst itemsCountText = itemsCount > 0 ? `(element\u00F3w: ${itemsCount})` : \"\";\r\n\t\t\tcellElement.empty();\r\n\r\n\t\t\tcellElement.append(`\r\n\t\t\t\t${cellCaption}: ${formattedDate} ${itemsCountText}\r\n\t\t\t `);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function addColumnAdditionalPropertiesPopup(containerId: string) {\r\n\tconst popup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(500));\r\n\tpopup.option(\"minHeight\", calcMinPopup(250, true));\r\n\tpopup.option(\"title\", \"Dodaj kolumn\u0119 p\u00F3l dodatkowych\");\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t$(\"#BigDialog\").empty();\r\n\tpopup.content().find(\".DialogFooter\").empty();\r\n\t$(\"#BigDialog\").append(`
\r\n \r\n \r\n
\r\n
\r\n \r\n \r\n
`);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.append(`
\r\n \r\n \r\n
`);\r\n}\r\n\r\nexport function onContextMenuPreparing(\r\n\te: DevExpress.ui.dxDataGrid.ContextMenuPreparingEvent\r\n) {\r\n\tif (e.target === \"header\") {\r\n\t\t// e.items can be undefined\r\n\t\tif (!e.items) e.items = [];\r\n\t\t// Add a custom menu item\r\n\t\te.items.push(\r\n\t\t\t{\r\n\t\t\t\ttext: \"Dodaj kolumn\u0119 p\u00F3l dodatkowych\",\r\n\t\t\t\ticon: \"fas fa-grip-horizontal\",\r\n\t\t\t\tonItemClick: () => {\r\n\t\t\t\t\taddColumnAdditionalPropertiesPopup(modelId);\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\ttext: \"Wybierz kolumny\",\r\n\t\t\t\ticon: \"column-chooser\",\r\n\t\t\t\tonItemClick: () => {\r\n\t\t\t\t\t$(\".dx-datagrid-column-chooser-button\").trigger(\"click\");\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\ttext: \"Panel grupowania\",\r\n\t\t\t\ticon: \"group\",\r\n\t\t\t\tonItemClick: () => {\r\n\t\t\t\t\tif (checkIfGridInEditMode(e.component)) return;\r\n\r\n\t\t\t\t\tconst isVisible = e.component.option(\"groupPanel.visible\");\r\n\t\t\t\t\te.component.option(\"groupPanel.visible\", !isVisible);\r\n\r\n\t\t\t\t\t$(\".dx-datagrid-header-panel\").toggleClass(\"show-dx-toolbar\");\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\ttext: $(\".filterBtn\").length\r\n\t\t\t\t\t? \"Filtr\"\r\n\t\t\t\t\t: \"Filtrowanie w ramach bie\u017C\u0105cej strony\",\r\n\t\t\t\ticon: \"fas fa-filter\",\r\n\t\t\t\tonItemClick: () => {\r\n\t\t\t\t\tshowFilter();\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\ttext: $(\".filterBtn\").length\r\n\t\t\t\t\t? \"Zaawansowane filtrowanie\"\r\n\t\t\t\t\t: \"Zaawansowane filtrowanie w ramach bie\u017C\u0105cej strony\",\r\n\t\t\t\ticon: \"find\",\r\n\t\t\t\tonItemClick: () => {\r\n\t\t\t\t\tshowFilterBuilder();\r\n\t\t\t\t},\r\n\t\t\t}\r\n\t\t);\r\n\t} else if (e.target === \"content\") {\r\n\t\tif ($(\".dx-freespace-row\").has(e.targetElement[0]).length > 0) return;\r\n\t\tif ($(\".dx-group-row\").has(e.targetElement[0]).length > 0) return;\r\n\t\tif (isRunningOnMobile()) return;\r\n\r\n\t\tif ($(\".dx-master-detail-row\").has(e.targetElement[0]).length > 0) {\r\n\t\t\tconst copy = [...(globalItemsSelectedByUser ?? [])];\r\n\t\t\tUnselectAndUnfocusDxTable();\r\n\t\t\tglobalItemsSelectedByUser = copy;\r\n\t\t} else {\r\n\t\t\tunselectChildrenGrids(e.component.element());\r\n\t\t}\r\n\r\n\t\te.component?.selectRows(\r\n\t\t\te?.row?.data.RowNum,\r\n\t\t\t(globalItemsSelectedByUser?.length ?? 0) > 1\r\n\t\t);\r\n\r\n\t\tif ($(e.targetElement).is(\"a.white-text.dxGridLink\")) return;\r\n\r\n\t\tonRowRightClick(e);\r\n\t}\r\n}\r\n\r\nexport function storeChangedLayout() {}\r\n\r\nexport function parseDxGridItems(\r\n\tdsDataSource = $(\"#Tabela\")?.dxDataGrid(\"instance\")?.getDataSource()\r\n) {\r\n\tconst dxItems = (dsDataSource as any)?._items ?? null;\r\n\tif (!dxItems) return;\r\n\r\n\treturn flatten(dxItems);\r\n}\r\n\r\nexport function onInitializedGrid(\r\n\te: DevExpress.ui.dxDataGrid.InitializedEvent\r\n) {\r\n\tforcedGridRefresh = null;\r\n\tsubElementsModel[modelSubElementsOnly].multiselectOnFirstGridLoad = true;\r\n\tsetTimeout(() => {\r\n\t\tif (modelSubElementsOnly === \"True\") {\r\n\t\t\tprepareFloatingButtonForTableView();\r\n\t\t}\r\n\t}, 0);\r\n\r\n\tif (e.element) {\r\n\t\taddSkeletonLoading(e.element);\r\n\r\n\t\tif (isRunningOnMobile()) {\r\n\t\t\te.component?.option(\"columnAutoWidth\", false);\r\n\t\t\te.component?.option(\"scrolling\", { showScrollbar: \"never\" });\r\n\t\t\te.component?.option(\"columnResizingMode\", \"nextColumn\");\r\n\t\t\te.component?.option(\"columnHidingEnabled\", true);\r\n\r\n\t\t\te.element.on(\"dxmousewheel\", (e) => {\r\n\t\t\t\te.stopPropagation();\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tappendGridSidePanel();\r\n}\r\n\r\nexport function addCommonColumns(parsedData: string) {\r\n\tconst commonColumns = [\r\n\t\t\"ItemID\",\r\n\t\t\"HashID\",\r\n\t\t\"ItemType\",\r\n\t\t\"Flags\",\r\n\t\t\"RefFlags\",\r\n\t\t\"FileExtension\",\r\n\t\t\"RefSenderName\",\r\n\t\t\"RefDateReceived\",\r\n\t\t\"Version\",\r\n\t\t\"IsMultisource\",\r\n\t\t\"IsCurrentVersion\",\r\n\t\t\"HasChildren\",\r\n\t];\r\n\r\n\t// Create a new set by merging the two arrays\r\n\tconst mergedSet = new Set([...parsedData, ...commonColumns]);\r\n\r\n\t// Convert the set back to an array\r\n\tconst mergedArray = Array.from(mergedSet);\r\n\r\n\treturn mergedArray;\r\n}\r\n\r\nexport function applyFilter() {\r\n\tconst filterApplyBtn = $(\r\n\t\t'.dx-datagrid-toolbar-button.dx-apply-button:not([aria-disabled=\"true\"])'\r\n\t);\r\n\tif (!filterApplyBtn.length) return;\r\n\r\n\tfilterApplyBtn.trigger(\"dxclick\");\r\n\r\n\t//fix bo jak jest to samo to grid sie nie odswiezy i wtedy by ladowalo w nieskonczonosc\r\n\tconst filterValue =\r\n\t\t$(\"#Tabela\").dxDataGrid(\"instance\").option(\"filterValue\") ?? \"\";\r\n\tif (savedFilterValue !== filterValue) ShowLoadingPanel(\"Filtrowanie...\");\r\n\tsavedFilterValue = filterValue;\r\n\r\n\tUnselectAndUnfocusDxTable();\r\n}\r\n\r\nexport function processDataColumns(columns: DevExpress.ui.dxDataGrid.Column[]) {\r\n\tconst tableWidth = $(\"#Tabela .dx-row.dx-header-row\").width();\r\n\tif (!tableWidth) return columns;\r\n\r\n\tfor (const column of columns) {\r\n\t\tif (!column.width) continue;\r\n\r\n\t\tconst columnWidth = column?.width?.toString() ?? \"\";\r\n\t\tif (columnWidth.includes(\"%\"))\r\n\t\t\tcolumn.width = Number.parseInt(\r\n\t\t\t\t((Number.parseFloat(columnWidth) / 100) * tableWidth).toString()\r\n\t\t\t);\r\n\t}\r\n\r\n\treturn columns;\r\n}\r\n\r\nexport function getRowFromGrid(\r\n\titemId?: string,\r\n\trowIndex?: number,\r\n\tdataGrid = $(\"#Tabela\").dxDataGrid(\"instance\"),\r\n\tnotSelected = false\r\n): DevExpress.ui.dxDataGrid.Row | undefined {\r\n\tif (!dataGrid) return;\r\n\r\n\tconst rows = getVisibleRows(dataGrid);\r\n\r\n\t//szukanie data dodanej pozycji\r\n\tlet rowData = rows.find(\r\n\t\t(item) =>\r\n\t\t\titem.data.ItemID === itemId || (item as any).loadIndex === rowIndex\r\n\t);\r\n\r\n\t// If notSelected is true, we need to skip selected items and only find a non-selected one after finding the match\r\n\tif (notSelected && rowData) {\r\n\t\trowData = rows\r\n\t\t\t.slice(rows.indexOf(rowData))\r\n\t\t\t.find(\r\n\t\t\t\t(item) => !lastSelectedRow?.some((x) => x.ItemID === item.data.ItemID)\r\n\t\t\t);\r\n\t}\r\n\r\n\treturn rowData;\r\n}\r\n\r\nexport function afterWorkflowInitiatedInWorkflowBox(\r\n\titemId: string,\r\n\tselectedRow: SelectedRow[] | SelectedRowStorage[] = JSON.parse(\r\n\t\tsessionStorage.getItem(\"selectedRow\") ?? \"null\"\r\n\t)\r\n) {\r\n\tif (!selectedRow?.length && lastSelectedRow?.length) {\r\n\t\tlastSelectedRow[0].containerId =\r\n\t\t\tcheckWhereIsUser() === \"varioObject\" ? containerKey : modelId;\r\n\t\tselectedRow = saveLastSelectedRows(lastSelectedRow) ?? [];\r\n\t}\r\n\tif (!selectedRow?.length) return;\r\n\r\n\tif (checkWhereIsUser() === \"varioObject\") {\r\n\t\tCloseVarioObjectButtonClick();\r\n\t\twaitForElm(\".subelementsDatagridPanel\").then(() => {\r\n\t\t\tafterWorkflowInitiatedInWorkflowBox(itemId, selectedRow);\r\n\t\t});\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst grid = $(\"#Tabela\")?.dxDataGrid(\"instance\");\r\n\r\n\tconsole.log(\"afterWorkflowInitiatedInWorkflowBox id\", itemId);\r\n\tconst currentRow = selectedRow.find(\r\n\t\t(x) =>\r\n\t\t\t(x as SelectedRowStorage).id === itemId ||\r\n\t\t\t(x as SelectedRow).ItemID === itemId\r\n\t);\r\n\tif (currentRow)\r\n\t\t(currentRow as SelectedRowStorage).workflowed = getRowFromGrid(\r\n\t\t\t\"\",\r\n\t\t\t(currentRow as SelectedRowStorage).currentFocusedRowIndex + 1,\r\n\t\t\tgrid,\r\n\t\t\ttrue\r\n\t\t)?.data?.RowNum;\r\n\tsessionStorage.setItem(\"selectedRow\", JSON.stringify(selectedRow));\r\n\r\n\tsubElementsModel[modelSubElementsOnly].forceRowSelect = true;\r\n\r\n\tgrid?.option(\"focusedRowIndex\", -1);\r\n\r\n\treloadDxGridDataSource();\r\n}\r\n\r\nexport function getAddingInfoForGrid() {\r\n\t//Pobranie listy dozwolonych definicji i uprawnie\u0144 do dodawania\r\n\tGetAllowedDefinitionsAjax();\r\n}\r\n\r\nexport function onDataErrorOccurred(\r\n\te: DevExpress.ui.dxDataGrid.DataErrorOccurredEvent\r\n) {\r\n\tif (!e?.error) return;\r\n\tconsole.error(e?.error?.stack);\r\n\r\n\tsetTimeout(() => {\r\n\t\t$(\".dx-error-message\").remove();\r\n\t\t$(\".dx-error-message\").remove();\r\n\t}, 0);\r\n\r\n\t$(\".dx-datagrid-rowsview .dx-datagrid-content\").append(\r\n\t\t`
\r\n \r\n

Nie uda\u0142o si\u0119 pobra\u0107 zawarto\u015Bci ekranu.

\r\n
`\r\n\t);\r\n\r\n\tclearFloatingButton();\r\n}\r\n\r\nexport function prepareFormatConditionGrid(\r\n\te: DevExpress.ui.dxDataGrid.RowPreparedEvent,\r\n\tdata: SelectedRow\r\n) {\r\n\tif (data.Caption && e?.rowType === \"data\") {\r\n\t\tif (subElementsModel[modelSubElementsOnly].formatConditions != null) {\r\n\t\t\tfor (\r\n\t\t\t\tlet i = 0;\r\n\t\t\t\ti <\r\n\t\t\t\t(subElementsModel[modelSubElementsOnly].formatConditions?.length ?? 0);\r\n\t\t\t\ti++\r\n\t\t\t) {\r\n\t\t\t\tconst formatting =\r\n\t\t\t\t\tsubElementsModel[modelSubElementsOnly].formatConditions?.[i];\r\n\t\t\t\tconst formattingKey = formatting?.colKey;\r\n\t\t\t\tif (formattingKey && formattingKey in data) {\r\n\t\t\t\t\tif (shouldFormat(data, formatting, formattingKey)) {\r\n\t\t\t\t\t\tformatConditionGrid(e, formatting);\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\r\nexport function shouldFormat(\r\n\tdata: SelectedRow,\r\n\tformatting: FormatCondition,\r\n\tformattingKey: string\r\n) {\r\n\ttry {\r\n\t\tconst isValidNumber =\r\n\t\t\t!Number.isNaN(data[formattingKey]) && !Number.isNaN(formatting.value1);\r\n\t\tconst formattingDate = convertDate(formatting.value1);\r\n\t\tconst formattingDate2 = convertDate(formatting.value2);\r\n\t\tconst formattingKeyDate = convertDate(data[formattingKey]);\r\n\t\tconst isValidDate =\r\n\t\t\t!Number.isNaN(formattingDate) && !Number.isNaN(formattingKeyDate);\r\n\r\n\t\tswitch (formatting.conditionOperator) {\r\n\t\t\t//r\u00F3wny\r\n\t\t\tcase null:\r\n\t\t\t\tif (data[formattingKey] === formatting.value1) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"NotEqual\":\r\n\t\t\t\tif (data[formattingKey] !== formatting.value1) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"GreaterThan\":\r\n\t\t\t\tif (isValidNumber) {\r\n\t\t\t\t\tif (Number(data[formattingKey]) > Number(formatting.value1)) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (isValidDate) {\r\n\t\t\t\t\tif (formattingKeyDate > formattingDate) return true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"LessThan\":\r\n\t\t\t\tif (isValidNumber) {\r\n\t\t\t\t\tif (Number(data[formattingKey]) < Number(formatting.value1)) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (isValidDate) {\r\n\t\t\t\t\tif (formattingKeyDate < formattingDate) return true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"GreaterThanOrEqualTo\":\r\n\t\t\t\tif (isValidNumber) {\r\n\t\t\t\t\tif (Number(data[formattingKey]) >= Number(formatting.value1)) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (isValidDate) {\r\n\t\t\t\t\tif (formattingKeyDate >= formattingDate) return true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"LessThanOrEqualTo\":\r\n\t\t\t\tif (isValidNumber) {\r\n\t\t\t\t\tif (Number(data[formattingKey]) <= Number(formatting.value1)) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (isValidDate) {\r\n\t\t\t\t\tif (formattingKeyDate <= formattingDate) return true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"Contains\":\r\n\t\t\t\tif (\r\n\t\t\t\t\tdata[formattingKey]\r\n\t\t\t\t\t\t?.toString()\r\n\t\t\t\t\t\t.toUpperCase()\r\n\t\t\t\t\t\t.includes(formatting.value1.toString().toUpperCase())\r\n\t\t\t\t) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"NotContains\":\r\n\t\t\t\tif (\r\n\t\t\t\t\tdata[formattingKey] == null ||\r\n\t\t\t\t\t!data[formattingKey]\r\n\t\t\t\t\t\t.toString()\r\n\t\t\t\t\t\t.toUpperCase()\r\n\t\t\t\t\t\t.includes(formatting.value1.toString().toUpperCase())\r\n\t\t\t\t) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"BeginsWith\":\r\n\t\t\t\tif (data[formattingKey]?.startsWith(formatting.value1)) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"EndsWith\":\r\n\t\t\t\tif (data[formattingKey]?.endsWith(formatting.value1)) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"IsEmpty\":\r\n\t\t\t\tif (data[formattingKey] == null) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"NotIsNull\":\r\n\t\t\t\tif (data[formattingKey] != null) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"Between\":\r\n\t\t\t\tif (\r\n\t\t\t\t\tdata[formattingKey] != null &&\r\n\t\t\t\t\tformatting.value1 != null &&\r\n\t\t\t\t\tformatting.value2 != null\r\n\t\t\t\t) {\r\n\t\t\t\t\t//liczby\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\t!Number.isNaN(Number(formatting.value1)) &&\r\n\t\t\t\t\t\t!Number.isNaN(Number(formatting.value2))\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tdata[formattingKey] > Number(formatting.value1) &&\r\n\t\t\t\t\t\t\tdata[formattingKey] < Number(formatting.value2)\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//daty\r\n\t\t\t\t\tif (isValidDate && !Number.isNaN(formattingDate2)) {\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tformattingKeyDate >= formattingDate &&\r\n\t\t\t\t\t\t\tformattingKeyDate <= formattingDate2\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"NotBetween\":\r\n\t\t\t\tif (\r\n\t\t\t\t\tdata[formattingKey] != null &&\r\n\t\t\t\t\tformatting.value1 != null &&\r\n\t\t\t\t\tformatting.value2 != null\r\n\t\t\t\t) {\r\n\t\t\t\t\t//liczby\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\t!Number.isNaN(Number(formatting.value1)) &&\r\n\t\t\t\t\t\t!Number.isNaN(Number(formatting.value2))\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t!(\r\n\t\t\t\t\t\t\t\tdata[formattingKey] > Number(formatting.value1) &&\r\n\t\t\t\t\t\t\t\tdata[formattingKey] < Number(formatting.value2)\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//daty\r\n\t\t\t\t\tif (isValidDate && !Number.isNaN(formattingDate2)) {\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t!(\r\n\t\t\t\t\t\t\t\tformattingKeyDate >= formattingDate &&\r\n\t\t\t\t\t\t\t\tformattingKeyDate <= formattingDate2\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\treturn false;\r\n\t} catch (ex) {\r\n\t\tconsole.log(ex);\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nexport function formatConditionGrid(e, formatting) {\r\n\tlet formatText = \"\";\r\n\r\n\tif (formatting.forceColor) formatText += `color:${formatting.forceColor};`;\r\n\r\n\tif (formatting.fontBold) formatText += \"font-weight: bold;\";\r\n\r\n\tif (formatting.fontItalic) formatText += \"font-style: italic;\";\r\n\r\n\tif (formatting.fontStrikeout && formatting.fontUnderline) {\r\n\t\tformatText += \"text-decoration: line-through underline;\";\r\n\t} else if (formatting.fontStrikeout) {\r\n\t\tformatText += \"text-decoration: line-through;\";\r\n\t} else if (formatting.fontUnderline) {\r\n\t\tformatText += \"text-decoration: underline;\";\r\n\t}\r\n\r\n\tif (formatting.backColor)\r\n\t\tformatText += `background-color:${formatting.backColor};`;\r\n\r\n\tif (formatting.backgroundGradientMode) {\r\n\t\tlet degValue = 0;\r\n\t\tswitch (formatting.backgroundGradientMode) {\r\n\t\t\tcase \"Vertical\":\r\n\t\t\t\tdegValue = 180;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"Horizontal\":\r\n\t\t\t\tdegValue = 90;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"Diagonal\":\r\n\t\t\t\tdegValue = 135;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"DiagonalBackwards\":\r\n\t\t\t\tdegValue = 295;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tif (degValue !== 0)\r\n\t\t\tformatText += `background:linear-gradient(${degValue}deg, ${formatting.backColor}, ${formatting.backColorGradient});`;\r\n\t}\r\n\r\n\tif (formatText.length > 0) e.rowElement[0].style.cssText += formatText;\r\n}\r\n\r\n//DETAIL TABLE\r\nexport function unselectChildrenGrids(currentGridTarget: JQuery) {\r\n\tconst grids = $(\"#Tabela\").find(\r\n\t\t'.dx-master-detail-cell .dx-widget[id^=\"dx-\"][role=\"presentation\"]'\r\n\t);\r\n\tconst currentGrid = $(currentGridTarget).closest(\r\n\t\t'.dx-widget[id^=\"dx-\"][role=\"presentation\"]'\r\n\t);\r\n\r\n\tconst index = grids.index(currentGrid);\r\n\tif (index > -1) grids.toArray().splice(index, 1);\r\n\r\n\tgrids.each((_, element) => {\r\n\t\tUnselectAndUnfocusDxTable($(element as HTMLElement).dxDataGrid(\"instance\"));\r\n\t});\r\n}\r\n\r\nexport function checkIfRightGrid(grid: JQuery) {\r\n\tconst divFromMouse = document.elementFromPoint(\r\n\t\tmousePosition.x,\r\n\t\tmousePosition.y\r\n\t);\r\n\tif (!divFromMouse) return;\r\n\r\n\tconst parentGrid = $(divFromMouse).closest('.dx-widget[role=\"presentation\"]');\r\n\r\n\treturn parentGrid.is(grid);\r\n}\r\n\r\nexport function checkIfMainGrid(grid: JQuery) {\r\n\tconst divFromMouse = document.elementFromPoint(\r\n\t\tmousePosition.x,\r\n\t\tmousePosition.y\r\n\t);\r\n\tif (!divFromMouse) return;\r\n\r\n\tconst mainGrid = $(divFromMouse).parents(\"#Tabela\");\r\n\tif (!mainGrid.length) return null;\r\n\r\n\treturn mainGrid.is(grid);\r\n}\r\n\r\nexport function getGridFromSelected() {\r\n\tconst selectedRow = $(\".dx-row.dx-selection\");\r\n\tconst parentGrid = $(selectedRow).closest('.dx-widget[role=\"presentation\"]');\r\n\r\n\tif (parentGrid.length) {\r\n\t\ttry {\r\n\t\t\treturn parentGrid.dxDataGrid(\"instance\");\r\n\t\t} catch (_) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\treturn;\r\n}\r\n\r\nexport async function getCurrentRowFromGrid(\r\n\tgrid = $(\"#Tabela\").dxDataGrid(\"instance\")\r\n) {\r\n\tconst rowKey = grid?.getKeyByRowIndex(\r\n\t\tsubElementsModel[modelSubElementsOnly]?.currentFocusedRowIndex\r\n\t);\r\n\tconst row = await grid?.byKey(rowKey);\r\n\treturn [row];\r\n}\r\n\r\nexport function getSelectedRows(grid = $(\"#Tabela\").dxDataGrid(\"instance\")) {\r\n\treturn grid?.getSelectedRowsData();\r\n}\r\n\r\nexport function getVisibleRows(grid = $(\"#Tabela\").dxDataGrid(\"instance\")) {\r\n\treturn grid?.getVisibleRows();\r\n}\r\n\r\nexport function getVisibleColumns(grid = $(\"#Tabela\").dxDataGrid(\"instance\")) {\r\n\treturn grid?.getVisibleColumns();\r\n}\r\n\r\nexport function editCellTemplate(\r\n\tcellElement: JQuery,\r\n\tcellInfo: DevExpress.ui.dxDataGrid.ColumnEditCellTemplateData\r\n) {\r\n\tconst fieldKey = cellInfo.column.dataField ?? \"\";\r\n\r\n\tconst colFound = lastRowControlTypes?.find((o) => {\r\n\t\treturn o.fieldKey === fieldKey;\r\n\t});\r\n\tif (!colFound || colFound?.controlType === \"NoEdit\") return;\r\n\r\n\tconst definitionKey = cellInfo.data.DefinitionKey;\r\n\tconst defAndKey = `${definitionKey}-${fieldKey}`;\r\n\r\n\tif (definitionKey !== undefined) {\r\n\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId =\r\n\t\t\tdefinitionKey;\r\n\t}\r\n\r\n\tif (cellInfo?.data?.ItemID !== undefined) {\r\n\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId =\r\n\t\t\tcellInfo.data.ItemID;\r\n\t}\r\n\r\n\tconst editRow = lastRowControlTypes?.find((el) => el.fieldKey === fieldKey);\r\n\tif (editRow?.fieldDecorator) {\r\n\t\tif (editRow.fieldDecorator.unconstrained === false)\r\n\t\t\tcellElement[0]?.classList?.add(\"unconstrainedField\");\r\n\r\n\t\tif (editRow.fieldDecorator.workflowRequired)\r\n\t\t\tcellElement[0]?.classList?.add(\"requiredWorkflowClassAtr\");\r\n\r\n\t\tif (editRow.fieldDecorator.workflowSuggested)\r\n\t\t\tcellElement[0]?.classList?.add(\"suggestedWorkflowClassAtr\");\r\n\r\n\t\tif (editRow.fieldDecorator.required)\r\n\t\t\tcellElement[0]?.classList?.add(\"requiredClassAtr\");\r\n\r\n\t\tcheckRequired(cellInfo.value, cellElement, false, null, fieldKey);\r\n\t}\r\n\r\n\t$(`.${defAndKey}-container`).remove();\r\n\r\n\tconst cellClass = colFound.advancedDictionary\r\n\t\t? \"inlineEditorDropdownAdvancedDictionary\"\r\n\t\t: \"\";\r\n\r\n\tconst mainDiv = $(\"
\")\r\n\t\t.attr(\"class\", `${defAndKey}-container inlineEditorDropdown ${cellClass}`)\r\n\t\t.css({\r\n\t\t\tdisplay: \"flex\",\r\n\t\t});\r\n\r\n\tif (colFound.fieldKey === \"Operators\") {\r\n\t\t$(\"\")\r\n\t\t\t.css(\"overflow-x\", \"hidden\")\r\n\t\t\t.addClass(\"form-control\")\r\n\t\t\t.val(cellInfo.value ?? \"\")\r\n\t\t\t.attr({\r\n\t\t\t\t\"data-Id\": fieldKey,\r\n\t\t\t\tid: defAndKey,\r\n\t\t\t})\r\n\t\t\t.on(\"change\", function () {\r\n\t\t\t\tconst val = (this as HTMLInputElement).value;\r\n\r\n\t\t\t\tinputIsDirty = true;\r\n\r\n\t\t\t\tcheckRequired(val, defAndKey, true, definitionKey, fieldKey);\r\n\t\t\t\tif (colFound.advancedDictionary)\r\n\t\t\t\t\tChangeSelectedMPK(defAndKey, val, fieldKey);\r\n\t\t\t\tChangeFieldValue(\r\n\t\t\t\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId ?? \"\",\r\n\t\t\t\t\tcontainerKey,\r\n\t\t\t\t\tdefinitionKey,\r\n\t\t\t\t\tfieldKey,\r\n\t\t\t\t\tval\r\n\t\t\t\t);\r\n\r\n\t\t\t\tAddToGlobalListOfEditables(\r\n\t\t\t\t\tfieldKey,\r\n\t\t\t\t\tval,\r\n\t\t\t\t\t(val as any) instanceof Number\r\n\t\t\t\t);\r\n\t\t\t\tcellInfo.setValue(val);\r\n\t\t\t})\r\n\t\t\t.appendTo(mainDiv);\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t\tcreateRecipientTagInput(\r\n\t\t\t\tdocument.getElementById(defAndKey) as HTMLInputElement,\r\n\t\t\t\teditRow?.fieldDecorator?.required ?? false,\r\n\t\t\t\tAddressingScope.InternalRecipients\r\n\t\t\t);\r\n\t\t});\r\n\t} else if (colFound.fieldKey === \"Categories\") {\r\n\t\tconst treeBoxID = `${defAndKey}-treeBoxCategories`;\r\n\t\t$(`
\r\n
\r\n
`).appendTo(mainDiv);\r\n\r\n\t\tconst dummyCategories = [] as VarioCategory[];\r\n\t\tconst category = {\r\n\t\t\tcategoryCode: \"\",\r\n\t\t\tcategoryID: \"-1\",\r\n\t\t\tname: cellInfo.displayValue,\r\n\t\t\tparentID: \"-1\",\r\n\t\t} as VarioCategory;\r\n\r\n\t\tdummyCategories.push(category);\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t\tinitDummyDxDropDownBox(`#${treeBoxID}`, dummyCategories);\r\n\t\t}, 1);\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t\tloadCategoriesPicker(\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId ?? \"\",\r\n\t\t\t\t`#${treeBoxID}`\r\n\t\t\t);\r\n\t\t}, 2);\r\n\t} else {\r\n\t\t// Create inner div\r\n\t\tconst innerDiv = $(\"
\")\r\n\t\t\t.attr(\"class\", \"select2containerInlineDropdown\")\r\n\t\t\t.css({\r\n\t\t\t\t\"padding-right\": \"0px\",\r\n\t\t\t\twidth: \"100%\",\r\n\t\t\t})\r\n\t\t\t.appendTo(mainDiv);\r\n\r\n\t\t// Create dropdown container\r\n\t\tconst dropdownContainer = $(\"
\")\r\n\t\t\t.css(\"position\", \"relative\")\r\n\t\t\t.addClass(\"dropdown\")\r\n\t\t\t.appendTo(innerDiv);\r\n\r\n\t\tconst dropdownClass = colFound.advancedDictionary\r\n\t\t\t? \"subelementsDropDownLoadAsync\"\r\n\t\t\t: \"subelementsDropDownLoadProject\";\r\n\r\n\t\t// Create select element\r\n\t\t$(\"\")\r\n\t\t\t\t.addClass(\r\n\t\t\t\t\t\"js-example-basic-single form-control subelementsDropDownDictionariesLoadAsync dropDownDictionaryChild\"\r\n\t\t\t\t)\r\n\t\t\t\t.attr({\r\n\t\t\t\t\ttitle: definitionKey,\r\n\t\t\t\t\t\"data-Id\": fieldKey,\r\n\t\t\t\t\tid: `DictionaryFor-${fieldKey}-${definitionKey}`,\r\n\t\t\t\t})\r\n\t\t\t\t.on(\"change\", function () {\r\n\t\t\t\t\tconst val = (this as HTMLSelectElement).value;\r\n\r\n\t\t\t\t\tsaveChoice(val);\r\n\t\t\t\t\tgetDropdownData(\r\n\t\t\t\t\t\tdefAndKey,\r\n\t\t\t\t\t\tfieldKey,\r\n\t\t\t\t\t\tmodelId,\r\n\t\t\t\t\t\tval,\r\n\t\t\t\t\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId ??\r\n\t\t\t\t\t\t\t\"\",\r\n\t\t\t\t\t\tmodelId,\r\n\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\ttrue\r\n\t\t\t\t\t);\r\n\t\t\t\t\tChangeFieldValue(\r\n\t\t\t\t\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId ??\r\n\t\t\t\t\t\t\t\"\",\r\n\t\t\t\t\t\tmodelId,\r\n\t\t\t\t\t\tdefinitionKey,\r\n\t\t\t\t\t\tfieldKey,\r\n\t\t\t\t\t\t$(`#${defAndKey}`).val()?.valueOf().toString() ?? \"\"\r\n\t\t\t\t\t);\r\n\t\t\t\t})\r\n\t\t\t\t.appendTo(dictionaryContainer);\r\n\t\t}\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t\tif (colFound.advancedDictionary) {\r\n\t\t\t\tgetData(\r\n\t\t\t\t\tfieldKey,\r\n\t\t\t\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId ?? \"\",\r\n\t\t\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId ??\r\n\t\t\t\t\t\t\"\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\t//fix dla dx - inline editor - lekki scroll gdy mamy select2 - wywala div z selectem poza trzy kropki i nie da sie zrobic select2\r\n\t\t\tif (($(`#${defAndKey}.ToSelect`).width() ?? 0) > 0) {\r\n\t\t\t\tcreateSelect2(defAndKey);\r\n\t\t\t\tsetSelectedInSelect2(defAndKey, cellInfo.value);\r\n\t\t\t} else repaintDxGrid();\r\n\t\t}, 100);\r\n\t}\r\n\r\n\treturn mainDiv;\r\n}\r\n\r\nexport async function onSavingDxGrid(e: DevExpress.ui.dxDataGrid.SavingEvent) {\r\n\te.cancel = true;\r\n\r\n\tconst change = e.changes[0];\r\n\tif (!change) {\r\n\t\te.component.option({\r\n\t\t\tdataSource: e.component.option(\"dataSource\"),\r\n\t\t\tediting: {\r\n\t\t\t\teditRowKey: null,\r\n\t\t\t\tchanges: [],\r\n\t\t\t},\r\n\t\t});\r\n\t\tsetTimeout(() => {\r\n\t\t\texitGridInlineEdit(e);\r\n\t\t\trefreshDxGrid(undefined, e.component);\r\n\t\t}, 10);\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\tsaveDxGridChangePromise = new Promise(async (resolve, reject) => {\r\n\t\tShowLoadingPanel(\"Zapisywanie...\");\r\n\t\ttry {\r\n\t\t\tawait saveDxRow();\r\n\t\t} catch (e) {\r\n\t\t\tconsole.error(e);\r\n\t\t}\r\n\r\n\t\tif (itemReadyToSubmit) {\r\n\t\t\tShowLoadingPanel(\"Zapisywanie...\");\r\n\t\t\te.promise = saveDxGridChange(change, e)\r\n\t\t\t\t.then((data) => {\r\n\t\t\t\t\tif (typeof data === \"string\") return;\r\n\r\n\t\t\t\t\tif (data?.status === RequestStatus.success) {\r\n\t\t\t\t\t\tshowDxToast(\"Zapisano zmiany\", \"success\");\r\n\t\t\t\t\t\tShowLoadingPanel(\"Od\u015Bwie\u017Canie danych...\");\r\n\r\n\t\t\t\t\t\tconst dataSource = e.component.option(\"dataSource\");\r\n\r\n\t\t\t\t\t\t//if (change.type === \"insert\") {\r\n\t\t\t\t\t\t// change.data = data;\r\n\t\t\t\t\t\t//}\r\n\t\t\t\t\t\t//dataSource = DevExpress.data.applyChanges(dataSource, [change], { keyExpr: \"key\" });\r\n\r\n\t\t\t\t\t\tconst filesInput = document.getElementById(\r\n\t\t\t\t\t\t\t\"files\"\r\n\t\t\t\t\t\t) as HTMLInputElement;\r\n\t\t\t\t\t\tif (filesInput) filesInput.value = \"\";\r\n\r\n\t\t\t\t\t\tsubElementsModel[modelSubElementsOnly].forceRowSelect = true;\r\n\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tchange.type !== \"update\" &&\r\n\t\t\t\t\t\t\te.component.element().attr(\"id\") === \"Tabela\"\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tconst key =\r\n\t\t\t\t\t\t\t\t(data as VarioMessageViewModel)?.itemKey ??\r\n\t\t\t\t\t\t\t\t(data as ResponseObject)?.varioObject?.key;\r\n\t\t\t\t\t\t\treloadDataToNavTab(key, containerId);\r\n\t\t\t\t\t\t\tfloatingButtonForNoSelection();\r\n\t\t\t\t\t\t\tselectNewlyAddedRow(key);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tfloatingButtonForOneSelection();\r\n\t\t\t\t\t\t\trefreshDxGrid(undefined, e.component);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\te.component.option({\r\n\t\t\t\t\t\t\tdataSource: dataSource,\r\n\t\t\t\t\t\t\tediting: {\r\n\t\t\t\t\t\t\t\teditRowKey: null,\r\n\t\t\t\t\t\t\t\tchanges: [],\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\tif (modelSubElementsOnly === \"False\") {\r\n\t\t\t\t\t\t\trefreshManager.needRefresh = new Set([\r\n\t\t\t\t\t\t\t\trefreshManager?.refreshArea?.varioObjectForm,\r\n\t\t\t\t\t\t\t]);\r\n\t\t\t\t\t\t\trefreshCurrentPage();\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t//child grid\r\n\t\t\t\t\t\tif (e.component.element().attr(\"id\") !== \"Tabela\") {\r\n\t\t\t\t\t\t\te.component\r\n\t\t\t\t\t\t\t\t.element()\r\n\t\t\t\t\t\t\t\t.parents(\".dx-row\")\r\n\t\t\t\t\t\t\t\t.prev()\r\n\t\t\t\t\t\t\t\t.find(\".hiddenChildren\")\r\n\t\t\t\t\t\t\t\t.removeClass(\"hiddenChildren\");\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\ttoggleGridFunctionsForEditing(e.component, false);\r\n\r\n\t\t\t\t\t\tsubElementsModel[modelSubElementsOnly].globalListOfEditables = [];\r\n\t\t\t\t\t\tinputIsDirty = false;\r\n\r\n\t\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\t\tShowLoadingPanel(\"Od\u015Bwie\u017Canie danych...\");\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\tresolve(data);\r\n\t\t\t\t\t} else if (data?.status?.toString() === \"0\") {\r\n\t\t\t\t\t\tHideLoadingPanel(true);\r\n\t\t\t\t\t\tshowDxToast(data?.message ?? \"B\u0142\u0105d zapisu pozycji\", \"error\");\r\n\t\t\t\t\t\treject(false);\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\t.catch(() => {\r\n\t\t\t\t\tHideLoadingPanel(true);\r\n\t\t\t\t\treject(false);\r\n\t\t\t\t})\r\n\t\t\t\t.finally(() => {\r\n\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\tHideLoadingPanel(true);\r\n\t\t\t\t\t}, 15000);\r\n\t\t\t\t});\r\n\t\t}\r\n\t});\r\n\r\n\treturn saveDxGridChangePromise;\r\n}\r\n\r\nexport function saveDxGridChange(\r\n\tchange: DevExpress.common.grids.DataChange,\r\n\te: DevExpress.ui.dxDataGrid.SavingEvent\r\n) {\r\n\treturn new Promise(\r\n\t\tasync (resolve, reject) => {\r\n\t\t\tShowLoadingPanel(\"Zapisywanie...\");\r\n\r\n\t\t\tconst fields: ChangedFields[] = [];\r\n\t\t\tfor (const [key, value] of Object.entries(change.data)) {\r\n\t\t\t\tfields.push({\r\n\t\t\t\t\tFieldKey: key,\r\n\t\t\t\t\tValue: value?.toString(),\r\n\t\t\t\t\tModified: true,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tconsole.log(\"zapisane pola\", fields);\r\n\r\n\t\t\tconst currentRow = await getCurrentRowFromGrid(e.component);\r\n\r\n\t\t\tconst itemKey =\r\n\t\t\t\te?.changes[0]?.data?.Key ??\r\n\t\t\t\te?.changes[0]?.data?.ItemID ??\r\n\t\t\t\tcurrentRow[0]?.ItemID;\r\n\t\t\tif (!itemKey) {\r\n\t\t\t\tshowDxToast(\"Zapis nie powi\u00F3d\u0142 si\u0119\", \"error\");\r\n\t\t\t\treject(\"Zapis nie powi\u00F3d\u0142 si\u0119\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tlet containerKey: string | boolean = modelId;\r\n\r\n\t\t\t//DLa trybu edycji cell - zrobic 2 requesty, try to cahnge i update\r\n\t\t\t//const url = GetBaseUrl() + '/Vario/TryToChangeObjectProperites';\r\n\t\t\t//$.ajax(url, {\r\n\t\t\t// method: method,\r\n\t\t\t// data: {\r\n\t\t\t// 'itemKey': itemKey,\r\n\t\t\t// 'fields': fields,\r\n\t\t\t// 'definitionKey': definitionKey,\r\n\t\t\t// 'containerKey': containerKey,\r\n\t\t\t// \"messageContainer\": \".subElementsMessagePartial\"\r\n\t\t\t// },\r\n\t\t\t// cache: false,\r\n\t\t\t// xhrFields: { withCredentials: true }\r\n\t\t\t//}).done(function (result) {\r\n\t\t\t// if (result?.message?.status == 1) {\r\n\r\n\t\t\t// const url2 = GetBaseUrl() + '/Vario/PutObject';\r\n\r\n\t\t\t// let values = `[`;\r\n\r\n\t\t\t// for (const [key, value] of Object.entries(change.data)) {\r\n\t\t\t// values += `\"${key}:::${value}\"`\r\n\t\t\t// }\r\n\r\n\t\t\t// values += `]`\r\n\r\n\t\t\t// $.ajax({\r\n\t\t\t// url: url2,\r\n\t\t\t// type: 'PUT',\r\n\t\t\t// data: {\r\n\t\t\t// 'key': itemKey,\r\n\t\t\t// 'values': values,\r\n\t\t\t// 'containerId': containerKey,\r\n\t\t\t// },\r\n\t\t\t// success: function (data) {\r\n\t\t\t// resolve(data)\r\n\t\t\t// },\r\n\t\t\t// error: function (data) {\r\n\t\t\t// showDxToast(\"Zapis nie powi\u00F3d\u0142 si\u0119\", \"error\");\r\n\t\t\t// }\r\n\t\t\t// });\r\n\t\t\t// }\r\n\t\t\t// else {\r\n\t\t\t// showDxToast(\"Zapis nie powi\u00F3d\u0142 si\u0119\", \"error\");\r\n\t\t\t// }('.AddDocumentsButtonMenu #okButton').att\r\n\t\t\t//}).fail(function (xhr) {\r\n\t\t\t// reject(xhr.responseJSON ? xhr.responseJSON.Message : xhr.statusText);\r\n\t\t\t// showDxToast(\"Zapis nie powi\u00F3d\u0142 si\u0119\", \"error\");\r\n\t\t\t//});\r\n\r\n\t\t\t//Dla tryby ecyji row - try to change na zmiane wartosci i potem update\r\n\r\n\t\t\tlet url = `${GetBaseUrl()}/Vario/PutObject`;\r\n\r\n\t\t\tlet values = \"[\";\r\n\r\n\t\t\tfor (const [key, value] of Object.entries(change.data)) {\r\n\t\t\t\tvalues += `\"${key}:::${value}\"`;\r\n\t\t\t}\r\n\r\n\t\t\tvalues += \"]\";\r\n\r\n\t\t\tif (\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalOperationName === \"Post\"\r\n\t\t\t) {\r\n\t\t\t\turl = `${GetBaseUrl()}/Vario/PostNewObject`;\r\n\r\n\t\t\t\tconst form_data = new FormData();\r\n\t\t\t\tform_data.append(\"key\", itemKey);\r\n\t\t\t\tform_data.append(\"values\", values);\r\n\r\n\t\t\t\tconst files = (document.getElementById(\"files\") as HTMLInputElement)\r\n\t\t\t\t\t?.files;\r\n\t\t\t\tif (files)\r\n\t\t\t\t\tfor (const file of files) {\r\n\t\t\t\t\t\tform_data.append(\"file\", file);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\tconst parentId = e.element.attr(\"data-parentId\");\r\n\r\n\t\t\t\tcontainerKey = await saveNewPositionAfterAddingToGrid(containerKey);\r\n\t\t\t\tif (containerKey === false) return;\r\n\r\n\t\t\t\tif (parentId) {\r\n\t\t\t\t\tform_data.append(\"parentKey\", parentId);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tform_data.append(\"containerKey\", containerKey);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tawait $.ajax({\r\n\t\t\t\t\turl: url,\r\n\t\t\t\t\ttype: \"POST\",\r\n\t\t\t\t\tdata: form_data,\r\n\t\t\t\t\tprocessData: false,\r\n\t\t\t\t\tcontentType: false,\r\n\t\t\t\t\tsuccess: (data: VarioMessageViewModel) => {\r\n\t\t\t\t\t\tif (!lastSelectedRow?.length) prepareFloatingButtonForTableView();\r\n\t\t\t\t\t\telse if (checkWhereIsUser() === \"varioObject\")\r\n\t\t\t\t\t\t\tfloatingButtonBackToViewCardWithSubElements();\r\n\r\n\t\t\t\t\t\tresolve(data);\r\n\t\t\t\t\t},\r\n\t\t\t\t\terror: () => {\r\n\t\t\t\t\t\tshowDxToast(\"Zapis nie powi\u00F3d\u0142 si\u0119\", \"error\");\r\n\t\t\t\t\t\treject(\"Zapis nie powi\u00F3d\u0142 si\u0119\");\r\n\t\t\t\t\t},\r\n\t\t\t\t});\r\n\t\t\t} else if (\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalOperationName === \"Put\"\r\n\t\t\t) {\r\n\t\t\t\tawait $.ajax({\r\n\t\t\t\t\turl: url,\r\n\t\t\t\t\ttype: \"PUT\",\r\n\t\t\t\t\tdata: {\r\n\t\t\t\t\t\tkey: itemKey,\r\n\t\t\t\t\t\tvalues: values,\r\n\t\t\t\t\t\tcontainerId: containerKey,\r\n\t\t\t\t\t},\r\n\t\t\t\t\tsuccess: (data: ResponseObject) => {\r\n\t\t\t\t\t\tif (!lastSelectedRow?.length) prepareFloatingButtonForTableView();\r\n\t\t\t\t\t\telse if (checkWhereIsUser() === \"varioObject\")\r\n\t\t\t\t\t\t\tfloatingButtonBackToViewCardWithSubElements();\r\n\r\n\t\t\t\t\t\tresolve(data);\r\n\t\t\t\t\t},\r\n\t\t\t\t\terror: () => {\r\n\t\t\t\t\t\tshowDxToast(\"Zapis nie powi\u00F3d\u0142 si\u0119\", \"error\");\r\n\t\t\t\t\t\treject(\"Zapis nie powi\u00F3d\u0142 si\u0119\");\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\r\nexport function onEditorPreparing(\r\n\te: DevExpress.ui.dxDataGrid.EditorPreparingEvent\r\n) {\r\n\tif ((e as any).type === \"selection\") return;\r\n\tif (e.parentType === \"filterRow\") return;\r\n\r\n\tconst colFound = lastRowControlTypes?.find((o) => {\r\n\t\treturn o.fieldKey === (e as any).name;\r\n\t});\r\n\r\n\tif (colFound?.controlType === \"NoEdit\" || colFound?.fieldKey === \"Categories\")\r\n\t\te.editorOptions.disabled = true;\r\n\r\n\tcheckRequired(\r\n\t\te.value,\r\n\t\te.editorElement.parents(\r\n\t\t\t\".requiredClassAtr,.requiredWorkflowClassAtr,.suggestedWorkflowClassAtr\"\r\n\t\t),\r\n\t\tfalse,\r\n\t\tnull,\r\n\t\t(e as any).name\r\n\t);\r\n\tchangedVarioObjectFields = [];\r\n\r\n\tif (e.dataField === \"Caption\" && e.row)\r\n\t\taddActionButtons({\r\n\t\t\t...e.row,\r\n\t\t\trow: e.row,\r\n\t\t\trowElement: e.editorElement.parents(\".dx-row\"),\r\n\t\t\tcomponent: e.component,\r\n\t\t\telement: e.element,\r\n\t\t});\r\n\r\n\te.editorOptions.onValueChanged = (evt) => {\r\n\t\t//Ustawiamy tu a nie w success ajaxa bo inaczej po klikneciu \"zapisz\", nic si\u0119 nie wywo\u0142a - nie b\u0119dzie zmian\r\n\t\te.setValue(evt.value);\r\n\r\n\t\titemReadyToSubmit = false;\r\n\r\n\t\tlet value = evt.value;\r\n\t\tconst fieldKey = (e as any).name;\r\n\r\n\t\tAddToGlobalListOfEditables(fieldKey, value, value instanceof Number);\r\n\t\tinputIsDirty = true;\r\n\r\n\t\tconst containerKey = modelId;\r\n\t\tconst definitionKey = e.row?.data.DefinitionKey;\r\n\r\n\t\tconst itemKey = e.row?.data?.Key ?? e.row?.data?.ItemID;\r\n\r\n\t\tconst fields: ChangedFields[] = [];\r\n\r\n\t\tif (value instanceof Date) {\r\n\t\t\tvalue = value.toISOString();\r\n\t\t}\r\n\r\n\t\tfields.push({\r\n\t\t\tFieldKey: fieldKey,\r\n\t\t\tValue: value,\r\n\t\t\tModified: true,\r\n\t\t});\r\n\r\n\t\tcheckRequired(\r\n\t\t\tvalue,\r\n\t\t\tevt.element.parents(\r\n\t\t\t\t\".requiredClassAtr,.requiredWorkflowClassAtr,.suggestedWorkflowClassAtr\"\r\n\t\t\t),\r\n\t\t\tfalse,\r\n\t\t\tnull,\r\n\t\t\tfieldKey\r\n\t\t);\r\n\r\n\t\tgridCellPromise = cellValueChanged(\r\n\t\t\titemKey,\r\n\t\t\tfields,\r\n\t\t\tdefinitionKey,\r\n\t\t\tcontainerKey\r\n\t\t);\r\n\t\tgridCellPromise\r\n\t\t\t.done((result) => {\r\n\t\t\t\tgridCellPromise = null;\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tgetRowFromGrid(itemKey, undefined, e.component)?.data?.ItemID !==\r\n\t\t\t\t\te?.row?.data?.ItemID\r\n\t\t\t\t)\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\t//Powoduje to problem z dropdownem - nie wyswietla wynikow po kliknieciu\r\n\t\t\t\tif (result?.message?.status === RequestStatus.success) {\r\n\t\t\t\t\tconst focusedCell = $(\".dx-editor-cell.dx-focused\").attr(\r\n\t\t\t\t\t\t\"aria-colindex\"\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tfor (let i = 0; i < result.fields.length; i++) {\r\n\t\t\t\t\t\tconst current = e.component.cellValue(\r\n\t\t\t\t\t\t\te.row?.rowIndex ?? -1,\r\n\t\t\t\t\t\t\tresult.fields[i].fieldKey\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\tif (current !== result.fields[i].value)\r\n\t\t\t\t\t\t\te.component.cellValue(\r\n\t\t\t\t\t\t\t\te.row?.rowIndex ?? -1,\r\n\t\t\t\t\t\t\t\tresult.fields[i].fieldKey,\r\n\t\t\t\t\t\t\t\tresult.fields[i].value\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tif (Number(focusedCell)) {\r\n\t\t\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\t\t\tconst el = e.component.getCellElement(\r\n\t\t\t\t\t\t\t\t\te.row?.rowIndex ?? -1,\r\n\t\t\t\t\t\t\t\t\tNumber(focusedCell) - 1\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\tif (el) e.component.focus(el);\r\n\t\t\t\t\t\t\t}, 200);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} catch (_) {}\r\n\r\n\t\t\t\t\t//const defAndKey = definitionKey + \"-\" + fieldKey;\r\n\t\t\t\t\t//createSelect2(defAndKey);\r\n\t\t\t\t\tdownloadDropDownDataSubElements();\r\n\t\t\t\t}\r\n\t\t\t\tconsole.log(`done change: '${value}'`);\r\n\t\t\t\titemReadyToSubmit = true;\r\n\t\t\t\t//e.setValue(evt.value);\r\n\t\t\t})\r\n\t\t\t.fail((xhr) => {\r\n\t\t\t\tif (xhr?.statusText !== \"abort\")\r\n\t\t\t\t\tshowDxToast(\"Zmiana warto\u015Bci nie powiod\u0142a si\u0119\", \"error\");\r\n\t\t\t})\r\n\t\t\t.always(() => {\r\n\t\t\t\tcheckRequired(\r\n\t\t\t\t\tvalue,\r\n\t\t\t\t\tevt.element.parents(\r\n\t\t\t\t\t\t\".requiredClassAtr,.requiredWorkflowClassAtr,.suggestedWorkflowClassAtr\"\r\n\t\t\t\t\t),\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tnull,\r\n\t\t\t\t\tfieldKey\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t};\r\n}\r\n\r\nexport async function onEditRowClick(\r\n\te:\r\n\t\t| DevExpress.ui.dxDataGrid.ColumnButtonClickEvent\r\n\t\t| SimpleDxRowDataStructure\r\n) {\r\n\tif (!e?.row?.data?.ItemID) return;\r\n\r\n\tif (isDirtyDoc()) {\r\n\t\tconst res = await ShowPopupWarningUnsavedRichEditDoc().catch(() => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\r\n\tif (isDirty()) {\r\n\t\tconst res = await ShowPopupWarningUnsaved().catch(() => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\r\n\tShowLoadingPanel(\"Wczytywanie...\");\r\n\r\n\tconst columns = getVisibleColumns(e.component)\r\n\t\t.map((x) => x.name)\r\n\t\t.join(\";\");\r\n\r\n\tif (\r\n\t\t!(e?.component?.getDataSource() as any)?._isLoaded &&\r\n\t\tdoubleRetrieveRequest\r\n\t)\r\n\t\tawait doubleRetrieveRequest;\r\n\telse {\r\n\t\tawait wait(200);\r\n\t}\r\n\r\n\tlet rowIndex = (e as DevExpress.ui.dxDataGrid.ColumnButtonClickEvent)?.row\r\n\t\t?.rowIndex;\r\n\tif (rowIndex == null) {\r\n\t\trowIndex =\r\n\t\t\tgetRowFromGrid(e?.row?.data?.ItemID, undefined, e?.component)?.rowIndex ??\r\n\t\t\t-1;\r\n\t}\r\n\r\n\tif (rowIndex <= -1) return;\r\n\r\n\tonGridBtnClick(e.row.data, e.component);\r\n\r\n\tconst editRowDefKey = e.row.data.DefinitionKey;\r\n\tconst editRowItemID = e.row.data.ItemID;\r\n\r\n\tconst contID =\r\n\t\t$(e.element as any as HTMLElement)?.attr(\"data-parentID\") ?? modelId;\r\n\r\n\t//TODO Sprawdzamy czy dla tego row mamy juz pobrane podsumowanie kontrolek edycyjnych.\r\n\t//Jak tak to zastosowa\u0107. Jak nie to pobra\u0107 i poczeka\u0107.\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetEditControlType`,\r\n\t\ttype: \"Post\",\r\n\t\tdata: {\r\n\t\t\tcolumns: columns,\r\n\t\t\tdefKey: editRowDefKey,\r\n\t\t\titemID: editRowItemID,\r\n\t\t\tcontainerId: contID,\r\n\t\t},\r\n\t\tsuccess: (res: ServiceResponse) => {\r\n\t\t\tif (res?.success) {\r\n\t\t\t\tsetTimeout(clearFloatingButton);\r\n\t\t\t\tlastRowControlTypes = res?.data?.editControlsType;\r\n\t\t\t\te.component?.editRow(\r\n\t\t\t\t\tgetRowFromGrid(e.row?.data?.ItemID ?? \"\", undefined, e.component)\r\n\t\t\t\t\t\t?.rowIndex ?? -1\r\n\t\t\t\t);\r\n\t\t\t\titemReadyToSubmit = true;\r\n\t\t\t\tdeleteOnUndo = false;\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalOperationName = \"Put\";\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tdownloadDropDownDataSubElements();\r\n\t\t\t\t\t//jesli klikniemy na edytuj, wczytuje sie a potem sie kliknie na inna pozycje to potrzebne jest przeniesienie focusa\r\n\t\t\t\t\t$(\".dx-row-focused:not(.dx-edit-row)\").removeClass(\r\n\t\t\t\t\t\t\"dx-row-focused dx-cell-focus-disabled dx-selection\"\r\n\t\t\t\t\t);\r\n\t\t\t\t\t$(\".dx-edit-row\").addClass(\r\n\t\t\t\t\t\t\"dx-row-focused dx-cell-focus-disabled dx-selection\"\r\n\t\t\t\t\t);\r\n\t\t\t\t}, 1000);\r\n\t\t\t\ttoggleGridFunctionsForEditing(e.component, true);\r\n\t\t\t} else showDxToast(\"Edycja jest niewspierana\", \"warning\");\r\n\t\t},\r\n\t\terror: () => {\r\n\t\t\tshowDxToast(\"Pobranie danych nie powiod\u0142o si\u0119\", \"error\");\r\n\t\t},\r\n\t\tcomplete: () => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport async function addNewPosition(\r\n\tdefKey: string,\r\n\tforSelectedItem: boolean,\r\n\tparentId = \"\",\r\n\t_containId = \"\"\r\n) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\tlet templateDef: string | null = null;\r\n\tconst selectTemplate = document.getElementById(\r\n\t\t\"selectTemplate\"\r\n\t) as HTMLSelectElement;\r\n\tif (\r\n\t\t$(\"#useTemplate\").prop(\"checked\") &&\r\n\t\tselectTemplate?.value !== \"---Wybierz wzorzec---\"\r\n\t) {\r\n\t\ttemplateDef = selectTemplate.value;\r\n\t\tdeleteOnUndo = true;\r\n\t}\r\n\r\n\tif (subElementsModel[modelSubElementsOnly].globalSelectedDefinitionId) {\r\n\t\tconst btnSaveMain = document.querySelector(\r\n\t\t\t\".dx-datagrid-form-buttons-container .dx-button[aria-label='Save']\"\r\n\t\t) as HTMLElement;\r\n\t\t$(btnSaveMain).removeClass(\"hidden\");\r\n\t}\r\n\r\n\tlet forComponent = false;\r\n\tif (forSelectedItem) {\r\n\t\tif (!stringIsNullOrEmpty(parentId)) {\r\n\t\t\tforComponent = !!allowedDefinitionsGlobal4SelectedItem?.find(\r\n\t\t\t\t(x) =>\r\n\t\t\t\t\tx.key ===\r\n\t\t\t\t\t\tsubElementsModel[modelSubElementsOnly]\r\n\t\t\t\t\t\t\t.globalBuforSelectedDefinitionId &&\r\n\t\t\t\t\tx.displayName ===\r\n\t\t\t\t\t\tsubElementsModel[modelSubElementsOnly]\r\n\t\t\t\t\t\t\t.globalBuforSelectedDefinitionTitle\r\n\t\t\t)?.forComponent;\r\n\r\n\t\t\tif (forComponent) {\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId =\r\n\t\t\t\t\tsubElementsModel[\r\n\t\t\t\t\t\tmodelSubElementsOnly\r\n\t\t\t\t\t].globalBuforSelectedDefinitionId;\r\n\t\t\t\t$(\"#Tabela\")\r\n\t\t\t\t\t.dxDataGrid(\"instance\")\r\n\t\t\t\t\t.expandRow(getRowFromGrid(parentId)?.key);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tlet gridSelector: JQuery;\r\n\tif (forComponent) {\r\n\t\tgridSelector = $(\r\n\t\t\tawait waitForElm(\r\n\t\t\t\t`.dx-widget[id^=\"dx-\"][role=\"presentation\"][data-parentid=\"${parentId}\"]`\r\n\t\t\t)\r\n\t\t);\r\n\t} else {\r\n\t\tgridSelector = $(\"#Tabela\");\r\n\t}\r\n\r\n\tconst contID = gridSelector.attr(\"data-parentID\") ?? modelId;\r\n\tconst grid = gridSelector.dxDataGrid(\"instance\");\r\n\r\n\tconst columns = getVisibleColumns(grid)\r\n\t\t.map((x) => x.name)\r\n\t\t.join(\";\");\r\n\r\n\tconst getEditControlTypeRequest = (columns, defKey, itemID, containerId) =>\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetEditControlType`,\r\n\t\t\ttype: \"Post\",\r\n\t\t\tdata: {\r\n\t\t\t\tcolumns: columns,\r\n\t\t\t\tdefKey: defKey,\r\n\t\t\t\titemID: itemID,\r\n\t\t\t\tcontainerId: containerId,\r\n\t\t\t},\r\n\t\t\tsuccess: (res: ServiceResponse) => {\r\n\t\t\t\tif (res?.success) {\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: () => {\r\n\t\t\t\tshowDxToast(\"Pobranie danych nie powiod\u0142o si\u0119\", \"error\", 3000);\r\n\t\t\t},\r\n\t\t});\r\n\r\n\tconst getVarioObjectBaseDataRequest = $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetVarioObjectBaseData`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tdata: {\r\n\t\t\tdefinitionKey: defKey,\r\n\t\t\tparentId: parentId,\r\n\t\t\tcontainerId: containerId,\r\n\t\t\ttemplateId: templateDef,\r\n\t\t},\r\n\t\tsuccess: (data: VarioObjectInitModel) => {\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId = data.key;\r\n\t\t\tsubElementsModel[modelSubElementsOnly].isCreated =\r\n\t\t\t\tIsCreatedFrom.CreatedFromUnknown;\r\n\t\t},\r\n\t});\r\n\r\n\tconst promises = [getVarioObjectBaseDataRequest, doubleRetrieveRequest];\r\n\tPromise.all(promises)\r\n\t\t.then(async (results) => {\r\n\t\t\tlastVarioObjectBaseData = {\r\n\t\t\t\t...results[0],\r\n\t\t\t\tparentKey: parentId,\r\n\t\t\t\tcontainerId: forComponent ? null : containerId,\r\n\t\t\t\tforComponent: forComponent,\r\n\t\t\t\ttemplateId: templateDef,\r\n\t\t\t};\r\n\r\n\t\t\ttry {\r\n\t\t\t\tconst editControlResult = await getEditControlTypeRequest(\r\n\t\t\t\t\tcolumns,\r\n\t\t\t\t\tdefKey,\r\n\t\t\t\t\tresults[0]?.key,\r\n\t\t\t\t\tcontID\r\n\t\t\t\t);\r\n\t\t\t\tlastRowControlTypes = editControlResult?.data?.editControlsType;\r\n\t\t\t} catch (error) {\r\n\t\t\t\tconsole.error(\"Error fetching edit control type:\", error);\r\n\t\t\t}\r\n\r\n\t\t\titemReadyToSubmit = true;\r\n\r\n\t\t\t//jesli wzorzec to wyswietlac ze sa zmiany\r\n\t\t\tif (!stringIsNullOrEmpty(templateDef)) inputIsDirty = true;\r\n\r\n\t\t\tawait grid?.addRow();\r\n\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tdownloadDropDownDataSubElements();\r\n\r\n\t\t\t\t$(\".dx-row-inserted\").addClass(\r\n\t\t\t\t\t\"dx-row-focused dx-cell-focus-disabled dx-selection\"\r\n\t\t\t\t);\r\n\t\t\t}, 1000);\r\n\t\t})\r\n\t\t.catch(() => {});\r\n}\r\n\r\nexport function onSaveRowClick(e: ActionButtonsData) {\r\n\te.component?.saveEditData();\r\n}\r\n\r\nexport async function saveDxRow() {\r\n\tShowLoadingPanel(\"Zapisywanie...\");\r\n\ttry {\r\n\t\tif (gridCellPromise) await gridCellPromise;\r\n\t} catch (e) {\r\n\t\tconsole.error(e);\r\n\t}\r\n\r\n\treturn new Promise(async (resolve, reject) => {\r\n\t\t// export function to periodically check the variable\r\n\t\tconst checkInterval = setInterval(async () => {\r\n\t\t\tif (itemReadyToSubmit) {\r\n\t\t\t\tclearInterval(checkInterval); // Stop checking\r\n\r\n\t\t\t\tSubmitAttemps = 0;\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalListOfEditables = [];\r\n\t\t\t\tinputIsDirty = false;\r\n\t\t\t\tignoreIsDirty = true;\r\n\t\t\t\tdeleteOnUndo = false;\r\n\r\n\t\t\t\tresolve(true);\r\n\t\t\t} else if (SubmitAttemps > 25) {\r\n\t\t\t\tshowDxToast(\"Nie uda\u0142o si\u0119 zapisa\u0107 pozycji\", \"error\");\r\n\t\t\t\titemReadyToSubmit = true;\r\n\t\t\t\tHideLoadingPanel(true);\r\n\t\t\t\t$(\".subElementsEditorSaveBtn\").attr(\"disabled\", null);\r\n\t\t\t\t$(\".submitAndLeave\").attr(\"disabled\", null);\r\n\t\t\t\tclearInterval(checkInterval);\r\n\t\t\t\treject(false);\r\n\t\t\t} else {\r\n\t\t\t\tconst popupVisible = $(\"#devex-dialog-trigger\")\r\n\t\t\t\t\t.dxPopup(\"instance\")\r\n\t\t\t\t\t.option(\"visible\");\r\n\r\n\t\t\t\tif (popupVisible) {\r\n\t\t\t\t\tSubmitAttemps = 0;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tSubmitAttemps++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}, 500);\r\n\t});\r\n}\r\n\r\nexport function onEditCanceled(e: DevExpress.ui.dxDataGrid.EditCanceledEvent) {\r\n\tconsole.log(e);\r\n\tif (gridCellPromise) gridCellPromise.abort();\r\n\r\n\texitGridInlineEdit(e);\r\n\r\n\tconst parentId =\r\n\t\te.element.attr(\"data-parentId\") &&\r\n\t\te.element.attr(\"data-parentId\") !== \"undefined\"\r\n\t\t\t? e.element.attr(\"data-parentId\")\r\n\t\t\t: modelId;\r\n\tUndoItem(true, false, e?.changes[0]?.data?.ItemID, parentId ?? \"\");\r\n}\r\n\r\nfunction exitGridInlineEdit(e: DevExpress.ui.dxDataGrid.EditCanceledEvent) {\r\n\tif (e?.changes[0]?.type === \"insert\") {\r\n\t\tfloatingButtonForNoSelection();\r\n\t\tsetTimeout(UnselectAndUnfocusDxTable, 100);\r\n\t} else floatingButtonForOneSelection();\r\n\ttoggleGridFunctionsForEditing(e.component, false);\r\n}\r\n\r\nexport async function onUndoRowClick(e: ActionButtonsData) {\r\n\tif (e.row?.data.ItemID) {\r\n\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId =\r\n\t\t\te.row?.data.ItemID;\r\n\t}\r\n\te?.component?.cancelEditData();\r\n}\r\n\r\nexport function onSaved(_e: DevExpress.ui.dxDataGrid.SavedEvent) {\r\n\t//Event not fired\r\n}\r\n\r\nexport function onRowUpdated(_e: DevExpress.ui.dxDataGrid.RowUpdatedEvent) {}\r\n\r\nexport function onInitNewRow(e: DevExpress.ui.dxDataGrid.InitNewRowEvent) {\r\n\tif (lastVarioObjectBaseData) {\r\n\t\tconst parsedObj = Object.fromEntries(\r\n\t\t\tlastVarioObjectBaseData?.initFields?.map((item) => [\r\n\t\t\t\titem.fieldKey,\r\n\t\t\t\titem.value,\r\n\t\t\t]) ?? []\r\n\t\t);\r\n\t\tconsole.log(\"init row base data\", parsedObj);\r\n\t\tfor (const key in parsedObj) {\r\n\t\t\te.data[key] = parsedObj[key];\r\n\t\t}\r\n\r\n\t\tconst files = document.getElementById(\"files\") as HTMLInputElement;\r\n\t\tlet addedFiles: FileList | FilesFromVario[] | null = files?.files;\r\n\t\tif (draggedFilesBuffer?.[0] && \"fromChat\" in draggedFilesBuffer[0])\r\n\t\t\taddedFiles = draggedFilesBuffer;\r\n\r\n\t\tif (addedFiles && addedFiles.length === 1) {\r\n\t\t\tconst fileName = addedFiles[0].name;\r\n\t\t\tconst fileNameNoExt = fileName.replace(/\\.[^/.]+$/, \"\");\r\n\t\t\te.data.Caption = fileNameNoExt;\r\n\r\n\t\t\tclearDraggedFilesBuffer();\r\n\r\n\t\t\tconst fields: ChangedFields[] = [];\r\n\t\t\tfields.push({\r\n\t\t\t\tFieldKey: \"Caption\",\r\n\t\t\t\tValue: fileNameNoExt,\r\n\t\t\t\tModified: true,\r\n\t\t\t});\r\n\r\n\t\t\tcellValueChanged(\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId ?? \"\",\r\n\t\t\t\tfields,\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly]\r\n\t\t\t\t\t.globalBuforSelectedDefinitionId ?? \"\",\r\n\t\t\t\tmodelId\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function cellValueChanged(\r\n\titemKey: string,\r\n\tfields: ChangedFields[],\r\n\tdefinitionKey: string,\r\n\tcontainerKey: string\r\n): JQuery.jqXHR {\r\n\tconst url = `${GetBaseUrl()}/Vario/TryToChangeObjectProperites`;\r\n\treturn $.ajax(url, {\r\n\t\tmethod: \"POST\",\r\n\t\tdata: {\r\n\t\t\titemKey: itemKey,\r\n\t\t\tfields: fields,\r\n\t\t\tdefinitionKey: definitionKey,\r\n\t\t\tcontainerKey: containerKey,\r\n\t\t\tmessageContainer: \".subElementsMessagePartial\",\r\n\t\t},\r\n\t\tcache: false,\r\n\t\txhrFields: { withCredentials: true },\r\n\t});\r\n}\r\n\r\nexport function checkIfAnyGridInEditMode() {\r\n\tconst grids = $(\r\n\t\t`#Tabela, #Tabela .dx-master-detail-cell .dx-widget[id^=\"dx-\"][role=\"presentation\"]`\r\n\t);\r\n\r\n\tlet isInEdit = false;\r\n\tgrids.each((_, el) => {\r\n\t\tif (checkIfGridInEditMode($(el as HTMLElement).dxDataGrid(\"instance\")))\r\n\t\t\tisInEdit = true;\r\n\t});\r\n\r\n\treturn isInEdit;\r\n}\r\n\r\nexport function checkIfGridInEditMode(\r\n\tgrid = $(\"#Tabela\").dxDataGrid(\"instance\")\r\n) {\r\n\tif (!grid) return;\r\n\r\n\treturn (grid as any).getController(\"editing\").isEditing();\r\n}\r\n\r\nexport function toggleGridFunctionsForEditing(\r\n\tgrid = $(\"#Tabela\").dxDataGrid(\"instance\"),\r\n\teditMode = false\r\n) {\r\n\tif (!grid) return;\r\n\r\n\tsetTimeout(() => {\r\n\t\t//Psuje focus w editrow\r\n\t\t//grid.option('grouping.contextMenuEnabled', !editMode)\r\n\t\t//grid.option('allowColumnReordering', !editMode)\r\n\t\t//grid.option('allowColumnResizing', !editMode)\r\n\t\tgrid.option(\"sorting.mode\", editMode ? \"none\" : \"single\");\r\n\t\t$(\"[id='slectionModeCheckbox']\").attr(\r\n\t\t\t\"disabled\",\r\n\t\t\teditMode ? \"disabled\" : null\r\n\t\t);\r\n\t});\r\n}\r\n\r\nexport async function openCardViewEditor(e: ActionButtonsData) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\tsetTimeout(async () => {\r\n\t\tconst isDirtyGrid = isDirty();\r\n\t\tignoreIsDirty = true;\r\n\r\n\t\tsubElementsModel[modelSubElementsOnly].globalListOfEditables = [];\r\n\t\tawait gridCellPromise;\r\n\t\tawait changeCurrentItem({\r\n\t\t\titemId: e?.row?.data?.ItemID,\r\n\t\t\tcontainerKey: modelId,\r\n\t\t\tinnerCall: true,\r\n\t\t\tforceVarioObject: true,\r\n\t\t\tisCreated: subElementsModel[modelSubElementsOnly].isCreated,\r\n\t\t});\r\n\r\n\t\tif (isDirtyGrid) {\r\n\t\t\tforceDirtyVarioObject = true;\r\n\t\t\tChangeSaveBtnsStatus(true);\r\n\t\t}\r\n\r\n\t\tif (lastVarioObjectBaseData?.parentKey)\r\n\t\t\t$(\"input[name='ParentKey']\").val(lastVarioObjectBaseData.parentKey);\r\n\t});\r\n}\r\n\r\nexport function addActionButtons(e: ActionButtonsData) {\r\n\tconst editMode =\r\n\t\t!!e.rowElement.find(\".dx-editor-cell\").length && checkIfAnyGridInEditMode();\r\n\tconst where = editMode\r\n\t\t? (e as any).cells?.find((x) => x.column?.name === \"Caption\")?.cellElement\r\n\t\t: e.rowElement.find(\".dxGridLink\").parent();\r\n\r\n\tconst btns = $(`\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t
`).appendTo(where);\r\n\r\n\tif (editMode) {\r\n\t\tbtns.empty().append(`\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t`);\r\n\t}\r\n\r\n\tbtns.find(`#dxGridIconsHover--workflow-${e.key}`).on(\"pointerdown\", () => {\r\n\t\t//ustawianie rowa\r\n\t\tonGridBtnClick(e.data, e.component);\r\n\t});\r\n\r\n\tbtns.find(`#dxGridIconsHover--workflow-${e.key}`).on(\"pointerup\", () => {\r\n\t\tif (!$(`#popover-${e.key}`).length) {\r\n\t\t\t$(\".subElements\").append(\r\n\t\t\t\t`
`\r\n\t\t\t);\r\n\r\n\t\t\tconst contentTemp = `
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
.
\r\n
.
\r\n
.
\r\n
\r\n
\r\n
\r\n
\r\n
`;\r\n\r\n\t\t\tfunction disposePopover(popover) {\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tpopover?.dispose();\r\n\t\t\t\t\t$(`#popover-${e.key}`).remove();\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t$(`#popover-${e.key}`).dxPopover({\r\n\t\t\t\ttarget: `#dxGridIconsHover--workflow-${e.key}`,\r\n\t\t\t\tshowEvent: \"click\",\r\n\t\t\t\tposition: \"bottom\",\r\n\t\t\t\tshading: true,\r\n\t\t\t\tonShown: function () {\r\n\t\t\t\t\t(this as any)._$wrapper.on(\"pointerdown\", () => {\r\n\t\t\t\t\t\tdisposePopover(this);\r\n\t\t\t\t\t});\r\n\t\t\t\t},\r\n\t\t\t\tonHidden: function () {\r\n\t\t\t\t\tdisposePopover(this);\r\n\t\t\t\t},\r\n\t\t\t\tcontentTemplate: contentTemp,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tonWorkflowIconClick(e);\r\n\t});\r\n\r\n\tbtns.find(\".dx-icon-share\").on(\"click\", () => {\r\n\t\tonShareIconClick(e);\r\n\t});\r\n\r\n\tbtns.find(\".dx-icon-info\").on(\"click\", () => {\r\n\t\tonPropertiesIconClick(e);\r\n\t});\r\n\r\n\tbtns.find(\".editBtnGrid\").on(\"click\", () => onEditRowClick(e));\r\n\r\n\tbtns.find(\".dx-icon-revert\").on(\"click\", (event) => {\r\n\t\tevent?.stopPropagation();\r\n\t\tevent?.stopImmediatePropagation();\r\n\t\tonUndoRowClick(e);\r\n\t});\r\n\r\n\tbtns.find(\".fa-save\").on(\"click\", (event) => {\r\n\t\tevent?.stopPropagation();\r\n\t\tevent?.stopImmediatePropagation();\r\n\t\tonSaveRowClick(e);\r\n\t});\r\n\r\n\tbtns.find(\".OpenCardViewEditorBtn\").on(\"click\", (event) => {\r\n\t\tevent?.stopPropagation();\r\n\t\tevent?.stopImmediatePropagation();\r\n\t\topenCardViewEditor(e);\r\n\t});\r\n}\r\n", "\uFEFFimport \"../types/dx.all.d.ts\";\r\nimport { LayoutControlWeb } from \"../types/models/Enums/layoutControlWeb\";\r\nimport type {\r\n\tFloatingButtonItem,\r\n\tSelectedRow,\r\n\tSubElementsFullModel,\r\n\tVarioObjectFullModel,\r\n} from \"../types/models/vario-types\";\r\nimport {\r\n\tgetRowFromGrid,\r\n\tprepareSubViewModel,\r\n\trepaintDxGrid,\r\n} from \"./devextreme-table-functions\";\r\nimport { markAsRead } from \"./floating-actions\";\r\nimport {\r\n\tappendNotFloatingButtons,\r\n\tappendWorkflowButtonsForSubelements,\r\n\tappendWorkflowButtonsForVarioObject,\r\n\tclearDynamicWorkflowActionsForVarioObject,\r\n\tgetEditOperations,\r\n\tgetMoreOperations,\r\n\tgetOperations,\r\n} from \"./floating-buttons\";\r\nimport { GetBaseUrl } from \"./page-navigation\";\r\nimport {\r\n\taddSkeletonLoading,\r\n\tdisposePDF,\r\n\tisRunningOnMobile,\r\n\tsupportedContent,\r\n} from \"./site\";\r\nimport { prepareThreeDotsVarioObject } from \"./vario-object\";\r\nimport { addFilePreview, getSignedPdfInfo } from \"./vario-object-side-panel\";\r\n\r\nlet resizeTimer: number;\r\nlet sidePanelGridPreviewPromise: JQuery.jqXHR | null = null;\r\n\r\nexport function appendGridSidePanel() {\r\n\tif (modelSubElementsOnly === \"False\") $(\"#toggleGridPanel\").remove();\r\n\r\n\tif (modelSubElementsOnly !== \"True\" || $(\"#subelementsSidePanel\").length)\r\n\t\treturn;\r\n\r\n\tconst showInfo =\r\n\t\tJSON.parse(\r\n\t\t\tlocalStorage.getItem(\"defaultGridSidePanelModeMain\") ?? \"null\"\r\n\t\t) ?? true;\r\n\tconst width = localStorage.getItem(\"gridSidePanelWidth\")\r\n\t\t? `style=\"width: ${localStorage.getItem(\"gridSidePanelWidth\")}px\"`\r\n\t\t: \"\";\r\n\r\n\t$(`
\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n Informacje\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n Polecenia obiegu\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n Polecenia podr\u0119czne\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
Podgl\u0105d tre\u015Bci
\r\n
\r\n
\r\n
\r\n
`).insertAfter($(\"#Tabela\"));\r\n\r\n\tconst toObserve = document.querySelector(\"#subelementsSidePanel\");\r\n\r\n\tif (toObserve)\r\n\t\tnew ResizeObserver((e) => {\r\n\t\t\tclearTimeout(resizeTimer);\r\n\t\t\tresizeTimer = setTimeout(() => {\r\n\t\t\t\t// Run code here, resizing has \"stopped\"\r\n\t\t\t\tif (e[0]?.target?.classList?.contains(\"hidden\")) return;\r\n\r\n\t\t\t\trepaintDxGrid(false);\r\n\t\t\t\trichEdit?.resize();\r\n\t\t\t\tif (e[0].contentRect.width > 100)\r\n\t\t\t\t\tlocalStorage.setItem(\r\n\t\t\t\t\t\t\"gridSidePanelWidth\",\r\n\t\t\t\t\t\te[0].contentRect.width.toString()\r\n\t\t\t\t\t);\r\n\t\t\t}, 500) as any as number;\r\n\t\t}).observe(toObserve);\r\n}\r\n\r\nexport function chooseWhichDataToAddToGridPanel(\r\n\tdata: SelectedRow | SelectedRow[] | null\r\n) {\r\n\tconst showInfo =\r\n\t\tJSON.parse(\r\n\t\t\tlocalStorage.getItem(\"defaultGridSidePanelModeMain\") ?? \"null\"\r\n\t\t) ?? true;\r\n\r\n\tsetTimeout(() => {\r\n\t\t//timeout zeby animacja sie ladnie wykonala i nie bylo lagu az takiego\r\n\t\t$(\"#subelementsSidePanelFilePreview\").toggleClass(\"hidden\", showInfo);\r\n\t\t$(\r\n\t\t\t\"#subelementsSidePanelOperationsContainer, #subelementsSidePanelWorkflowContainer, #subelementsSidePanelInfoContainer\"\r\n\t\t).toggleClass(\"hidden\", !showInfo);\r\n\t\t$(\"#subelementsSidePanel\").toggleClass(\"previewVisible\", !showInfo);\r\n\t}, 310);\r\n\r\n\tconst itemId = Array.isArray(data) ? data[0]?.ItemID : data?.ItemID;\r\n\tconst requery =\r\n\t\titemId !== $(\"#subelementsSidePanel\").attr(\"data-id\") ||\r\n\t\t!$(\"#subelementsSideFilePreview\").find(\"#displayEmail\").length ||\r\n\t\t!$(\"#subelementsSidePanelInfoContainer\").find(\"#subElementsInfoContainer\")\r\n\t\t\t.length;\r\n\r\n\tif (requery) {\r\n\t\tif (showInfo) addDataToGridPanel(data);\r\n\t\telse addPreviewDataToGridPreviewPanel(data);\r\n\t}\r\n\r\n\tconst switcher = $(\".sidePanelSwitcher#sidePanelSwitcher\");\r\n\r\n\tswitcher.off(\"change.switcher\");\r\n\tswitcher.one(\"change.switcher\", () => {\r\n\t\tlocalStorage.setItem(\r\n\t\t\t\"defaultGridSidePanelModeMain\",\r\n\t\t\t(!showInfo).toString()\r\n\t\t);\r\n\t\tchooseWhichDataToAddToGridPanel(data);\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t\t//timeout zeby animacja sie ladnie wykonala i nie bylo lagu az takiego\r\n\t\t\trepaintDxGrid(false);\r\n\t\t}, 350);\r\n\t});\r\n}\r\n\r\nexport function toggleSubelementsSidePanel(\r\n\tdata: SelectedRow | SelectedRow[] | null\r\n) {\r\n\tsetTimeout(() => {\r\n\t\tconst panel = $(\"#subelementsSidePanel\");\r\n\r\n\t\tpanel.find(\".sidePanelContent\").empty();\r\n\r\n\t\tif (\r\n\t\t\tisRunningOnMobile() ||\r\n\t\t\tJSON.parse(localStorage.getItem(\"gridSidePanel\") ?? \"null\") === false\r\n\t\t) {\r\n\t\t\tpanel.addClass(\"hidden\");\r\n\t\t\t$(\".subElements\").removeClass(\"panelShown\");\r\n\t\t\t$(\"#toggleGridPanel\").addClass(\"collapsed\");\r\n\r\n\t\t\t$(\"#toggleGridPanel\").toggleClass(\r\n\t\t\t\t\"disabled\",\r\n\t\t\t\t!data || isRunningOnMobile()\r\n\t\t\t);\r\n\t\t\t$(\"#toggleGridPanel\").attr(\r\n\t\t\t\t\"disabled\",\r\n\t\t\t\t!data || isRunningOnMobile() ? \"disabled\" : null\r\n\t\t\t);\r\n\r\n\t\t\tif (isRunningOnMobile()) return;\r\n\t\t} else {\r\n\t\t\tpanel.removeClass(\"hidden\");\r\n\t\t\t$(\".subElements\").addClass(\"panelShown\");\r\n\t\t\t$(\"#toggleGridPanel\").removeClass(\"collapsed disabled\");\r\n\t\t\t$(\"#toggleGridPanel\").attr(\"disabled\", null);\r\n\t\t\t$(\"#toggleGridPanel\").removeClass(\"hidden\");\r\n\r\n\t\t\tchooseWhichDataToAddToGridPanel(data);\r\n\t\t}\r\n\r\n\t\t$(\"#subelementsSidePanel\").attr(\r\n\t\t\t\"data-id\",\r\n\t\t\tArray.isArray(data)\r\n\t\t\t\t? (getRowFromGrid(\r\n\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\tsubElementsModel.True.currentFocusedRowIndex\r\n\t\t\t\t\t)?.data?.ItemID ?? data[0]?.ItemID)\r\n\t\t\t\t: (data?.ItemID ?? \"\")\r\n\t\t);\r\n\t}, 5);\r\n}\r\n\r\nexport function toggleGridPanel() {\r\n\tlet gridSidePanel = JSON.parse(\r\n\t\tlocalStorage.getItem(\"gridSidePanel\") ?? \"null\"\r\n\t);\r\n\tgridSidePanel = !gridSidePanel;\r\n\tlocalStorage.setItem(\"gridSidePanel\", gridSidePanel);\r\n\r\n\t$(\"#subelementsSidePanel\").toggleClass(\"hidden\", !gridSidePanel);\r\n\t$(\"#toggleGridPanel\").toggleClass(\"collapsed\", !gridSidePanel);\r\n\t$(\".subElements\").toggleClass(\"panelShown\", gridSidePanel);\r\n\r\n\tif (gridSidePanel) {\r\n\t\tconst data =\r\n\t\t\tlastSelectedRow?.length > 1\r\n\t\t\t\t? lastSelectedRow\r\n\t\t\t\t: (lastSelectedRow[0] ?? null);\r\n\t\tchooseWhichDataToAddToGridPanel(data);\r\n\t}\r\n\r\n\tsetTimeout(() => {\r\n\t\trepaintDxGrid(false);\r\n\t}, 300);\r\n}\r\n\r\nexport function dockSidePanel() {\r\n\t$(\".subElements\").toggleClass(\"floatPanelShown\");\r\n\t$(\"#subelementsSidePanel\").toggleClass(\"floatSidePanel\");\r\n\tsetTimeout(() => {\r\n\t\trepaintDxGrid(false);\r\n\t}, 0);\r\n}\r\n\r\nexport function addDataToGridPanel(data: SelectedRow | SelectedRow[] | null) {\r\n\tconst panel = $(\"#subelementsSidePanel\");\r\n\r\n\tif (!data) {\r\n\t\t$(\"#subelementsSidePanelInfo\").empty();\r\n\t\t$(\"#subelementsSidePanelInfo\").append(\r\n\t\t\t\"Zaznacz pozycj\u0119 aby otrzyma\u0107 informacje o niej.\"\r\n\t\t);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst operationsDiv = panel.find(\"#subelementsSidePanelOperations\");\r\n\toperationsDiv.append(`\r\n
\r\n
\r\n
\r\n
\r\n
.
\r\n
.
\r\n
.
\r\n
\r\n
\r\n
\r\n
\r\n `);\r\n\r\n\tif (!workflowIsAvailable) {\r\n\t\t$(\"#subelementsSidePanelWorkflowContainer\").remove();\r\n\t\t$(\"#subelementsSidePanelOperationsOther\").remove();\r\n\t}\r\n\r\n\tappendWorkflowButtonsForSubelements();\r\n\r\n\tlet type = \"subView\";\r\n\tif (data.length) type = \"subViewMultiSelect\";\r\n\tlet infoData = structuredClone(data);\r\n\tconst infos: string[] = [];\r\n\tlet model: SubElementsFullModel | VarioObjectFullModel | null = null;\r\n\tlet itemId: string | string[] = (data as SelectedRow)?.ItemID;\r\n\tlet caption = (data as SelectedRow)?.Caption;\r\n\tif (type === \"subView\") {\r\n\t\tinfoData = Array.isArray(infoData) ? infoData : [infoData];\r\n\t\tmodel = prepareSubViewModel(data as SelectedRow, LayoutControlWeb.Loading);\r\n\t} else {\r\n\t\titemId = globalItemsSelectedByUser ?? [];\r\n\t\tcaption = \"\";\r\n\t\tinfoData =\r\n\t\t\tinfoData.find(\r\n\t\t\t\t(x) => x.RowNum === subElementsModel.True.currentFocusedRowIndex + 1\r\n\t\t\t) ?? infoData[0];\r\n\t\tinfoData = Array.isArray(infoData) ? infoData : [infoData];\r\n\r\n\t\t$(\"#subelementsSidePanelOperationsOther\").remove();\r\n\t}\r\n\r\n\tfor (const inf of infoData) {\r\n\t\tconst date =\r\n\t\t\tnew Date(inf.CreationDate ?? \"\")?.toLocaleString(\"pl-PL\") ?? null;\r\n\t\tconst smallImage = inf.SmallImage ?? null;\r\n\t\tconst caption = inf.Caption ?? null;\r\n\t\tlet author =\r\n\t\t\tinf.RefCreatedByName ??\r\n\t\t\tinf.RefSenderName ??\r\n\t\t\tinf.CreatedByName ??\r\n\t\t\tinf.CreatedBy ??\r\n\t\t\tnull;\r\n\t\tif (Number.isInteger(author)) author = null;\r\n\r\n\t\tconst div = `
\r\n
\r\n ${\r\n\t\t\t\t\t\t\t\t\tsmallImage\r\n\t\t\t\t\t\t\t\t\t\t? `\"Ikona`\r\n\t\t\t\t\t\t\t\t\t\t: \"\"\r\n\t\t\t\t\t\t\t\t}\r\n ${caption ? `
${caption}
` : \"\"}\r\n
\r\n\t\t\t${inf.FileExtension ? `

\u0179r\u00F3d\u0142o: ${inf.FileExtension.replace(\".\", \"\")} ${inf.SourcesSize ? `(${inf.SourcesSize}kB)` : \"\"}

` : \"\"}\r\n ${date ? `

Data utworzenia: ${date}

` : \"\"}\r\n ${author ? `

Autor: ${author}

` : \"\"}\r\n
\r\n `;\r\n\t\tinfos.push(div);\r\n\t}\r\n\r\n\tconst info = panel.find(\"#subelementsSidePanelInfo\");\r\n\tinfo.append(`\r\n
\r\n
\r\n `);\r\n\r\n\tfor (const infoDiv of infos) {\r\n\t\tinfo.find(\"#subElementsInfoContainer\").append(infoDiv);\r\n\t}\r\n\r\n\tlet operations = getOperations(model, type);\r\n\tlet moreOperations: FloatingButtonItem[] = [];\r\n\tif (operations.find((x) => x.text === \"Wi\u0119cej...\")) {\r\n\t\tmoreOperations = getMoreOperations(model, type);\r\n\t\tmoreOperations = moreOperations.filter((x) => x.important);\r\n\t}\r\n\toperations = operations.filter((x) => x.important);\r\n\r\n\tlet editOperations = getEditOperations(\r\n\t\titemId,\r\n\t\tcontainerId,\r\n\t\tcaption,\r\n\t\tArray.isArray(data) ? data[0]?.DefinitionKey : (data?.DefinitionKey ?? \"\"),\r\n\t\tArray.isArray(data) ? data[0]?.HashID : data.HashID,\r\n\t\tundefined,\r\n\t\tArray.isArray(data)\r\n\t\t\t? data[0]?.FileExtension?.toLowerCase() === \".repx\"\r\n\t\t\t: data.FileExtension?.toLowerCase() === \".repx\"\r\n\t);\r\n\teditOperations = editOperations.filter((x) => x.important);\r\n\r\n\tconst items = [...operations, ...moreOperations, ...editOperations];\r\n\r\n\tconst normalOperationsDiv = operationsDiv.find(\r\n\t\t\"#subelementsSidePanelOperationsNormal\"\r\n\t);\r\n\tappendNotFloatingButtons(items, normalOperationsDiv);\r\n}\r\n\r\nexport function addPreviewDataToGridPreviewPanel(\r\n\tdata: SelectedRow | SelectedRow[] | null\r\n) {\r\n\t//dodawanie preview zrodla\r\n\tdisposePDF(\r\n\t\tdocument.querySelector(\r\n\t\t\t\"#subelementsSidePanel #pdf-js-viewer\"\r\n\t\t) as HTMLElement\r\n\t);\r\n\r\n\tif (Array.isArray(data))\r\n\t\tdata =\r\n\t\t\tgetRowFromGrid(undefined, subElementsModel.True.currentFocusedRowIndex)\r\n\t\t\t\t?.data ?? data[0];\r\n\r\n\tif (data?.ItemID !== $(\"#subelementsSidePanel\").attr(\"data-id\"))\r\n\t\tclearDynamicWorkflowActionsForVarioObject();\r\n\r\n\t$(\"#subelementsSideFilePreview\").empty();\r\n\r\n\t$(\"#subelementsSideFilePreview\").append(`\r\n
\r\n
\r\n
\r\n
\r\n
.
\r\n
.
\r\n
.
\r\n
\r\n
\r\n
\r\n\r\n \r\n
\r\n
\r\n
\r\n
\r\n

Tre\u015B\u0107 korespondencji:

\r\n
\r\n
\r\n
`);\r\n\r\n\t//TODO - dodac z API sprawdzanie canDecree i canForward\r\n\tconst canForward = modelId.includes(\"Inbox\") || modelId.includes(\"SentItems\");\r\n\r\n\tconst canDecree =\r\n\t\tsubElementsModel[modelSubElementsOnly]?.canDecreeSubElements === \"True\";\r\n\tconst subElementsStatus = data?.Status ?? \"Zatwierdzony\";\r\n\tconst isApproved = subElementsStatus === \"Zatwierdzony\";\r\n\tconst isEdited =\r\n\t\tsubElementsStatus === \"Edytowalny\" || subElementsStatus === \"10\";\r\n\tconst statusGood = data?.Status ? !isEdited && isApproved : true;\r\n\r\n\tif (data?.ItemID?.includes(\"Correspondence\") && statusGood) {\r\n\t\tif (canDecree)\r\n\t\t\t$(``).insertBefore(\r\n\t\t\t\t\"#subelementsSideFilePreview #workflowOperationsOptions\"\r\n\t\t\t);\r\n\r\n\t\tif (canForward)\r\n\t\t\t$(`\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t`).insertBefore(\r\n\t\t\t\t\"#subelementsSideFilePreview #workflowOperationsOptions\"\r\n\t\t\t);\r\n\t}\r\n\r\n\taddSkeletonLoading(\"#subelementsSideFilePreview #emailEmbed\");\r\n\r\n\tprepareThreeDotsVarioObject();\r\n\tappendWorkflowButtonsForVarioObject();\r\n\r\n\tfunction unSupportedPreview() {\r\n\t\t$(\"#subelementsSideFilePreview #displayEmail\").remove();\r\n\t\t$(\"#subelementsSideFilePreview\").append(`\r\n
\r\n
\r\n \r\n
\r\n

Podgl\u0105d niedost\u0119pny

\r\n
`);\r\n\t}\r\n\r\n\tif (!data) $(\"#subelementsSideFilePreview #buttonsToolbar\").remove();\r\n\r\n\tif (\r\n\t\t!data?.ItemID?.includes(\"Correspondence\") &&\r\n\t\t!supportedContent.checkWhichTypeOfFile(data?.FileExtension ?? \"\")\r\n\t) {\r\n\t\tunSupportedPreview();\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (data?.ItemID?.includes(\"Correspondence\")) {\r\n\t\tif (data.IsNew) markAsRead([data.ItemID]);\r\n\r\n\t\taddCorrespondenceInfoToGridPanel(data);\r\n\t}\r\n\r\n\tlet fileType: string | undefined;\r\n\tlet link = `${GetBaseUrl()}/Vario/DownloadContentFile?id=${data?.ItemID}&download=false`;\r\n\tlet xhrFields: any = {\r\n\t\tresponseType: \"blob\",\r\n\t};\r\n\tif (\r\n\t\tsupportedContent.checkWhichTypeOfFile(data?.FileExtension ?? \"\") ===\r\n\t\t\"document\"\r\n\t) {\r\n\t\tlink = `${GetBaseUrl()}/Vario/GetRichEditFile?id=${data?.ItemID}`;\r\n\t\tfileType = \"document\";\r\n\t\txhrFields = null;\r\n\t} else if (\r\n\t\tsupportedContent.checkWhichTypeOfFile(data?.FileExtension ?? \"\") === \"email\"\r\n\t) {\r\n\t\txhrFields = null;\r\n\t} else if (\r\n\t\tsupportedContent.checkWhichTypeOfFile(data?.FileExtension ?? \"\") ===\r\n\t\t\"spreadsheet\"\r\n\t) {\r\n\t\tlink = `${GetBaseUrl()}/Spreadsheet/Spreadsheet?id=${data?.ItemID}`;\r\n\t\txhrFields = null;\r\n\t\tfileType = \"spreadsheet\";\r\n\t}\r\n\r\n\tif (!data?.FileExtension || data?.FileExtension?.includes(\"pdf\"))\r\n\t\tgetSignedPdfInfo(data?.ItemID ?? \"\");\r\n\r\n\tsidePanelGridPreviewPromise?.abort();\r\n\r\n\tsidePanelGridPreviewPromise = $.ajax({\r\n\t\turl: link,\r\n\t\ttype: \"GET\",\r\n\t\tcache: true,\r\n\t\txhrFields: xhrFields,\r\n\t\tsuccess: (res: Blob, _, request) => {\r\n\t\t\tif (\r\n\t\t\t\t$(\"#subelementsSideFilePreview #emailEmbed\").length &&\r\n\t\t\t\t$(\"#emailEmbed\").children('*:not(\".skeleton\")').length === 0\r\n\t\t\t) {\r\n\t\t\t\tconst contentType =\r\n\t\t\t\t\tsidePanelGridPreviewPromise?.getResponseHeader(\"ContentType\");\r\n\r\n\t\t\t\tconst sourceFile = res;\r\n\t\t\t\tif (!fileType)\r\n\t\t\t\t\tfileType = supportedContent.checkWhichTypeOfFile(\r\n\t\t\t\t\t\tsourceFile.type ?? contentType\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t$(\"#loadingContainerPreview\").remove();\r\n\t\t\t\tif (fileType) {\r\n\t\t\t\t\taddFilePreview(\r\n\t\t\t\t\t\t\"emailEmbed\",\r\n\t\t\t\t\t\tsourceFile,\r\n\t\t\t\t\t\tfileType,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\trequest\r\n\t\t\t\t\t\t\t.getResponseHeader(\"content-disposition\")\r\n\t\t\t\t\t\t\t?.split('filename=\"')[1]\r\n\t\t\t\t\t\t\t?.split('\";')[0] ?? data?.Caption,\r\n\t\t\t\t\t\tdata?.ItemID\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tunSupportedPreview();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (ex) => {\r\n\t\t\tconsole.error(ex);\r\n\t\t\tif (ex?.statusText !== \"abort\") unSupportedPreview();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function reloadGridPanel(rows: SelectedRow[]) {\r\n\tif (!$(\"#subelementsSidePanel #displayEmail\").length) return;\r\n\tif (subElementsModel[modelSubElementsOnly].disableSidePanelPreviewReload) {\r\n\t\tsubElementsModel[modelSubElementsOnly].disableSidePanelPreviewReload =\r\n\t\t\tfalse;\r\n\t\treturn;\r\n\t}\r\n\r\n\t$(\"#subelementsSidePanel #displayEmail\").remove();\r\n\ttoggleSubelementsSidePanel(rows?.length > 1 ? rows : rows[0]);\r\n}\r\n\r\nexport function addCorrespondenceInfoToGridPanel(data: SelectedRow) {\r\n\tif (\r\n\t\t!data?.RefSenderName &&\r\n\t\t!data?.RefRecipientName &&\r\n\t\t!data?.RefCCName &&\r\n\t\t!data?.RefBCCName\r\n\t) {\r\n\t\treturn;\r\n\t}\r\n\r\n\t$(`
\r\n\t\t${data.RefSenderName ? `Od: ${data.RefSenderName}` : \"\"}\r\n\t\t${data.RefRecipientName ? `Do: ${data.RefRecipientName}` : \"\"}\r\n\t\t${data.RefCCName ? `DW: ${data.RefCCName}` : \"\"}\r\n\t\t${data.RefBCCName ? `UDW: ${data.RefBCCName}` : \"\"}\r\n\t\t
`).insertBefore(\"#subelementsSideFilePreview #displayEmail\");\r\n}\r\n", "import \"../types/dx.all.d.ts\";\r\nimport { CustomOperationType } from \"../types/models/Enums/customOperationType\";\r\nimport type { LayoutControlWeb } from \"../types/models/Enums/layoutControlWeb\";\r\nimport {\r\n\tAddressingScope,\r\n\ttype DocumentVersionsContainer,\r\n\ttype LogonRequired,\r\n\ttype NewVersionParams,\r\n\ttype OperationOnVarioObject,\r\n\ttype PermissionsForItem,\r\n\ttype ReplyEmailModel,\r\n\tRequestStatus,\r\n\ttype ResponseObject,\r\n\ttype ServiceResponse,\r\n\ttype SourceHistory,\r\n\ttype VarioEmployee,\r\n\ttype VarioMessageViewModel,\r\n\ttype VarioObjectDeleteViewModel,\r\n\ttype VarioStatus,\r\n\ttype VarioWorkflowStateDescription,\r\n\ttype WorkFlowStep,\r\n} from \"../types/models/vario-types\";\r\nimport { createUserIcon } from \"./chat.js\";\r\nimport {\r\n\tCancelRequests,\r\n\tUnselectAndUnfocusDxTable,\r\n\tafterWorkflowInitiatedInWorkflowBox,\r\n\tgetRowFromGrid,\r\n\treloadDxGridDataSource,\r\n\tselectRowInGrid,\r\n} from \"./devextreme-table-functions\";\r\nimport { CloseEditor, isDirty, isHidden } from \"./editor\";\r\nimport {\r\n\ttype WorkflowButton,\r\n\tclearDynamicWorkflowActionsForFloatingButton,\r\n\tclearDynamicWorkflowActionsForVarioObject,\r\n\tfloatingButtonBackToViewCardWithSubElements,\r\n\tfloatingButtonForNoSelection,\r\n\tnewDocument,\r\n} from \"./floating-buttons\";\r\nimport { prepareSourceHistory, previewFile } from \"./item-sources\";\r\nimport {\r\n\tGetBaseUrl,\r\n\tLoadDataToNavigationPanel,\r\n\tRefreshPageInfo,\r\n\tchangeCurrentItem,\r\n\tcloseNav,\r\n\trefreshCurrentPage,\r\n\treloadDataToNavTab,\r\n\tsaveUrlInHistory,\r\n} from \"./page-navigation\";\r\nimport {\r\n\tappendRecipientsList,\r\n\tcreateRecipientsList,\r\n\tgetAutoCompleteRecipientsData,\r\n} from \"./recipients\";\r\nimport { isDirtyDoc } from \"./richedit\";\r\nimport {\r\n\tCloseAdditionalDialog,\r\n\tCloseBigDialog,\r\n\tCloseDialog,\r\n\tCloseExtraDialog,\r\n\tHideLoadingPanel,\r\n\tReloadScheduler,\r\n\tShowLoadingPanel,\r\n\tShowPopupWarningUnsaved,\r\n\tShowPopupWarningUnsavedRichEditDoc,\r\n\tcalcMinPopup,\r\n\tcheckIfHasRequestReadReceipt,\r\n\tcheckWhereIsUser,\r\n\tdownloadFileFromLink,\r\n\tfixScrollInDx,\r\n\tgetConvertedDateAndTime,\r\n\tgroupBy,\r\n\tshowDxToast,\r\n\tstringIsNullOrEmpty,\r\n\tsupportedContent,\r\n\ttranslator,\r\n\tuuidv4,\r\n\tworkflowActionTitleClick,\r\n} from \"./site\";\r\nimport {\r\n\taddToRunningTriggerOperations,\r\n\trestartCheckIfTriggerWait4UserRequests,\r\n} from \"./trigger\";\r\nimport {\r\n\tCloseVarioObjectButtonClick,\r\n\tTryDeepDeleteVarioObject,\r\n\tTryDeleteVarioObject,\r\n\tsendReadConfirmationPopup,\r\n\tsetEverythingAsDisabledInVarioObject,\r\n} from \"./vario-object\";\r\nimport { addFilePreview, needFallBackPdf } from \"./vario-object-side-panel\";\r\n\r\ndeclare global {\r\n\tvar deleteVersion: boolean;\r\n}\r\n\r\nglobalThis.deleteVersion = false;\r\n\r\n//------------------------------------funkcje guzikow wewn\u0119trznych floating buttona---------------------------------------\r\n\r\nexport function ChooseWorkflowActionIcon(type: string) {\r\n\tswitch (type) {\r\n\t\tcase \"ActionRight\":\r\n\t\tcase \"RightArrow\":\r\n\t\t\treturn \"fas fa-arrow-right\";\r\n\t\tcase \"ActionNext\":\r\n\t\tcase \"Next\":\r\n\t\t\treturn \"fas fa-forward\";\r\n\t\tcase \"ActionPrevious\":\r\n\t\tcase \"Previous\":\r\n\t\t\treturn \"fas fa-backward\";\r\n\t\tcase \"ActionLeft\":\r\n\t\tcase \"LeftArrow\":\r\n\t\t\treturn \"fas fa-arrow-left\";\r\n\t\tcase \"Action\":\r\n\t\t\treturn \"fas fa-check\";\r\n\t\tcase \"ActionYes\":\r\n\t\tcase \"Yes\":\r\n\t\t\treturn \"fas fa-thumbs-up\";\r\n\t\tcase \"ActionNo\":\r\n\t\tcase \"No\":\r\n\t\t\treturn \"fas fa-times-circle\";\r\n\t\tcase \"ActionCircleDotSolid\":\r\n\t\tcase \"CircleDotSolid\":\r\n\t\t\treturn \"fas fa-dot-circle\";\r\n\t\tcase \"ActionCircleDot\":\r\n\t\tcase \"CircleDot\":\r\n\t\t\treturn \"far fa-dot-circle\";\r\n\t\tcase \"ActionCircleSolid\":\r\n\t\tcase \"CircleSolid\":\r\n\t\t\treturn \"fas fa-circle\";\r\n\t\tcase \"ActionCircle\":\r\n\t\tcase \"Circle\":\r\n\t\t\treturn \"far fa-circle\";\r\n\t\tdefault:\r\n\t\t\tconsole.log(type);\r\n\t\t\treturn \"fas fa-check\";\r\n\t}\r\n}\r\n\r\nexport async function markAsRead(\r\n\titemsParam: string[],\r\n\thasRequestReadReceipt?: boolean,\r\n\tsendReadReceipt?: boolean\r\n) {\r\n\tconst showInfo =\r\n\t\t!$(\".subElements\").hasClass(\"panelShown\") &&\r\n\t\t(sendReadReceipt !== false || modelSubElementsOnly === \"True\");\r\n\tif (showInfo) ShowLoadingPanel(\"Trwa oznaczanie...\");\r\n\r\n\tlet itemsToMark: string[] = [];\r\n\r\n\tif (itemsParam) {\r\n\t\titemsToMark = itemsParam;\r\n\t} else {\r\n\t\titemsToMark = globalItemsSelectedByUser ?? [];\r\n\t}\r\n\r\n\tif (\r\n\t\ttypeof hasRequestReadReceipt === \"undefined\" ||\r\n\t\thasRequestReadReceipt == null\r\n\t) {\r\n\t\thasRequestReadReceipt = await checkIfHasRequestReadReceipt(itemsToMark);\r\n\t}\r\n\r\n\tif (\r\n\t\thasRequestReadReceipt &&\r\n\t\t(typeof sendReadReceipt === \"undefined\" || sendReadReceipt == null)\r\n\t) {\r\n\t\tsendReadConfirmationPopup(itemsParam, hasRequestReadReceipt);\r\n\t\tHideLoadingPanel();\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/MarkThemAsRead`,\r\n\t\ttype: \"Post\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: { items: itemsToMark, sendReadReceipt: sendReadReceipt },\r\n\t\tsuccess: (data: ResponseObject) => {\r\n\t\t\tif (data?.status === RequestStatus.error) {\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\tdata?.message ? data.message : \"Nie uda\u0142o si\u0119 wykona\u0107 operacji\",\r\n\t\t\t\t\t\"error\"\r\n\t\t\t\t);\r\n\t\t\t} else if (showInfo) showDxToast(\"Oznaczono jako przeczytane\", \"success\");\r\n\r\n\t\t\tmarkCorrespondenceInGrid(itemsToMark, true);\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n\r\n\treloadDataToNavTab(itemsToMark[0]);\r\n}\r\n\r\nexport function markAsUnread(itemsParam: string[]) {\r\n\tShowLoadingPanel(\"Trwa oznaczanie...\");\r\n\r\n\tlet itemsToMark: string[] = [];\r\n\r\n\tif (itemsParam) {\r\n\t\titemsToMark = itemsParam;\r\n\t} else {\r\n\t\titemsToMark = globalItemsSelectedByUser ?? [];\r\n\t}\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/MarkAsUnread`,\r\n\t\ttype: \"Post\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: { items: itemsToMark },\r\n\t\tsuccess: (data: ResponseObject) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tif (data?.status === RequestStatus.error) {\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\tdata?.message ? data.message : \"Nie uda\u0142o si\u0119 wykona\u0107 operacji\",\r\n\t\t\t\t\t\"error\"\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"Oznaczono jako nieprzeczytane\", \"success\");\r\n\t\t\t}\r\n\t\t\tmarkCorrespondenceInGrid(itemsToMark, false);\r\n\t\t},\r\n\t});\r\n\treloadDataToNavTab(itemsToMark[0]);\r\n}\r\n\r\nexport function markCorrespondenceInGrid(\r\n\titemsToMark: string[],\r\n\t_read: boolean\r\n) {\r\n\tfor (const item of itemsToMark) {\r\n\t\tconst curr = getRowFromGrid(item) as any;\r\n\t\tif (!curr) continue;\r\n\t\tcurr.cells\r\n\t\t\t.find((x) => x.column.dataField === \"Caption\")\r\n\t\t\t.cellElement.parent()\r\n\t\t\t.css(\"font-weight\", 400);\r\n\t}\r\n}\r\n\r\nexport function shareCalendar() {\r\n\tconst url = `${GetBaseUrl()}/Calendar/ShareCalendar`;\r\n\tif (url && url.length > 0) {\r\n\t\t$.ajax({\r\n\t\t\turl: url,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: (data: string) => {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t$(\"#bodyElement\").empty();\r\n\t\t\t\t$(\"#bodyElement\").append(data);\r\n\t\t\t\tcloseNav();\r\n\t\t\t\tsaveUrlInHistory(\"calendar\");\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n}\r\n\r\n//otwieranie w subelements albo w kalendarzu\r\nexport function OpenInSelectedControll(id: string, control: LayoutControlWeb) {\r\n\tCancelRequests();\r\n\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\tchangeCurrentItem({\r\n\t\titemId: id,\r\n\t\tcontainerKey: containerId,\r\n\t\tworkflowMediumItemKey:\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalItemWorkflowMediumItemKey ??\r\n\t\t\t\"\",\r\n\t\tselectedControl: control,\r\n\t});\r\n}\r\n\r\nexport function AcceptParticipation(id: string, containerId: string) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Calendar/AcceptParticipation`,\r\n\t\ttype: \"GET\",\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdataType: \"JSON\",\r\n\t\tcache: false,\r\n\t\tdata: { id: id },\r\n\t\tsuccess: (_: boolean) => {\r\n\t\t\tshowDxToast(\"Zaakceptowano uczestnictwo.\", \"success\");\r\n\t\t\tlastAppointmentData = null;\r\n\t\t\tReloadScheduler(containerId);\r\n\t\t},\r\n\t\terror: (error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function RejectParticipation(\r\n\tid: string,\r\n\trejectWithInfo: boolean,\r\n\tcontainerID: string\r\n) {\r\n\tif (rejectWithInfo) {\r\n\t\tconst popup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\t\tpopup.option(\"minWidth\", calcMinPopup(500));\r\n\t\tpopup.option(\"minHeight\", calcMinPopup(420, true));\r\n\t\tpopup.option(\"title\", \"Podaj przyczyn\u0119 odrzucenia terminu: \");\r\n\t\tpopup.option(\"showTitle\", true);\r\n\t\tpopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t?.parent()\r\n\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t?.addClass(\"popupTitleAccent\");\r\n\t\tpopup.show();\r\n\r\n\t\t$(\"#BigDialog\").empty();\r\n\t\t$(\"#DialogFooter\").empty();\r\n\t\t$(\"#BigDialog\").append(\r\n\t\t\t'
'\r\n\t\t\t);\r\n\t\t\tif (workflowButton.messageDescription) {\r\n\t\t\t\t$(\"#MessageTextArea\").attr(\r\n\t\t\t\t\t\"placeholder\",\r\n\t\t\t\t\tworkflowButton.messageDescription\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//dodawanie czasu wykonania\r\n\t\tif (workflowButton.duration && workflowButton.duration === \"00:00:00\") {\r\n\t\t\t$(\"#BigDialog\").append(\r\n\t\t\t\t'
'\r\n\t\t\t);\r\n\t\t\theight += 50;\r\n\t\t}\r\n\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t.find(\".DialogFooter\")\r\n\t\t\t.append(\r\n\t\t\t\t`
`\r\n\t\t\t);\r\n\r\n\t\t$(\"#ExecuteButton\").on(\"click\", () => {\r\n\t\t\tExecuteVarioAction(\r\n\t\t\t\tworkflowButton.actionKey,\r\n\t\t\t\tworkflowButton.displayName,\r\n\t\t\t\tworkflowButton.closeOnSuccess.toString(),\r\n\t\t\t\tworkflowButton.ignoreEmptyMessage,\r\n\t\t\t\tworkflowButton.isCustomButton,\r\n\t\t\t\tworkflowButton.itemName,\r\n\t\t\t\tworkflowButton.itemKey,\r\n\t\t\t\tworkflowButton.removeFromList\r\n\t\t\t);\r\n\t\t\tRefreshPageInfo();\r\n\t\t});\r\n\r\n\t\tpopup.option(\"minHeight\", calcMinPopup(height, true));\r\n\t}\r\n}\r\n\r\nexport function showPopupWorkflowEmptyMessageWarning(\r\n\tactionKey: string,\r\n\tdisplayName: string,\r\n\tcloseOnSuccess: string,\r\n\t_ignoreEmptyMessage: boolean,\r\n\tisCustomButton: boolean,\r\n\titemName: string | string[],\r\n\titemKey: string | string[]\r\n) {\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(300));\r\n\tpopup.option(\"minHeight\", calcMinPopup(120, true));\r\n\tpopup.option(\"showTitle\", false);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\tpopup.show();\r\n\r\n\t$(\"#Dialog\").empty();\r\n\t$(\"#Dialog\").append(\r\n\t\t`

Czy na pewno chcesz wykona\u0107 polecenie obiegu z pust\u0105 tre\u015Bci\u0105?

`\r\n\t);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(`\r\n\t
`);\r\n\r\n\t$(\"#popupDialogVarioAction\").on(\"click\", () => {\r\n\t\tExecuteVarioAction(\r\n\t\t\tactionKey,\r\n\t\t\tdisplayName,\r\n\t\t\tcloseOnSuccess,\r\n\t\t\ttrue,\r\n\t\t\tisCustomButton,\r\n\t\t\titemName,\r\n\t\t\titemKey\r\n\t\t);\r\n\t\tCloseDialog();\r\n\t});\r\n}\r\n\r\nexport function ExecuteVarioAction(\r\n\tactionKey = \"\",\r\n\tdisplayName = \"\",\r\n\tcloseOnSuccess = \"\",\r\n\tignoreEmptyMessage = false,\r\n\tisCustomButton = false,\r\n\titemCaption: string | string[] = \"\",\r\n\titemId: string | string[] = \"\",\r\n\tremoveFromList = false\r\n) {\r\n\t//Po wykonaniu akcji workflow zmieni si\u0119 tre\u015B\u0107 polcenia\r\n\tworkflowActionId = \"\";\r\n\tworkflowActionTitle = \"\";\r\n\tworkflowActionDescription = \"\";\r\n\r\n\tconst responseMsgArea = document.getElementById(\"MessageTextArea\");\r\n\tconst responseMsg = (\r\n\t\tdocument.getElementById(\"MessageTextArea\") as HTMLTextAreaElement\r\n\t)?.value;\r\n\tif (\r\n\t\tresponseMsgArea &&\r\n\t\tresponseMsg?.length === 0 &&\r\n\t\t(ignoreEmptyMessage === undefined ||\r\n\t\t\tignoreEmptyMessage == null ||\r\n\t\t\tignoreEmptyMessage === false)\r\n\t) {\r\n\t\tshowPopupWorkflowEmptyMessageWarning(\r\n\t\t\tactionKey,\r\n\t\t\tdisplayName,\r\n\t\t\tcloseOnSuccess,\r\n\t\t\tignoreEmptyMessage,\r\n\t\t\tisCustomButton,\r\n\t\t\titemCaption,\r\n\t\t\titemId\r\n\t\t);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst recipientsArray: string[] = [];\r\n\r\n\tfor (const item of globalSelectedRecipients) {\r\n\t\trecipientsArray.push(item.id);\r\n\t}\r\n\r\n\tconst recipients = JSON.stringify(recipientsArray);\r\n\tconst globalItemsSelectedByUserCopy = Array.isArray(itemId)\r\n\t\t? itemId\r\n\t\t: [itemId];\r\n\r\n\tconst durationCheched = (\r\n\t\tdocument.getElementById(\"checkSelectDuration\") as HTMLInputElement\r\n\t)?.checked;\r\n\tlet durationValue = 0;\r\n\tif (durationCheched) {\r\n\t\tdurationValue = Number(\r\n\t\t\t(document.getElementById(\"selectedDuration\") as HTMLInputElement)?.value\r\n\t\t);\r\n\t}\r\n\r\n\tconst divPartialMessage = document.getElementsByClassName(\r\n\t\t\"varioObjectMessagePartial\"\r\n\t);\r\n\tconst selectNext =\r\n\t\t!isCustomButton &&\r\n\t\t(containerId?.includes(\"Workflow\") ||\r\n\t\t\tcontainerKey?.includes(\"Workflow\") ||\r\n\t\t\tremoveFromList);\r\n\r\n\t$(\"#ExecuteButton\").addClass(\"disabled\");\r\n\r\n\tCloseDialog();\r\n\tCloseBigDialog();\r\n\r\n\t//wyszarzenie guzikow na toolbarze w varioobject\r\n\t$(\"#buttonsPanelMiddle .workflowActionButton\").attr(\"disabled\", \"disabled\");\r\n\t$(\"#buttonsPanelMiddle .workflowActionButton\").addClass(\"disabled\");\r\n\t$(\"#buttonsPanelMiddle\").addClass(\"disabled\");\r\n\t$(\"#workflowOperationsOptions\").addClass(\"disabled\");\r\n\r\n\tif (!isCustomButton)\r\n\t\tLoadActionMessage(globalItemsSelectedByUserCopy[0], actionKey, displayName);\r\n\r\n\tconst itemNamesCopy = Array.isArray(itemCaption)\r\n\t\t? itemCaption\r\n\t\t: [itemCaption];\r\n\r\n\tconst mergedArray = globalItemsSelectedByUserCopy.map((id, index) => {\r\n\t\treturn {\r\n\t\t\tid: id,\r\n\t\t\tcontainerID: containerId,\r\n\t\t\tcaption: translator(itemNamesCopy[index]),\r\n\t\t};\r\n\t});\r\n\r\n\tconst idsWithCaptionJSON = JSON.stringify(mergedArray);\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/RegisterExecuteAction`,\r\n\t\ttype: \"Post\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: {\r\n\t\t\tid: idsWithCaptionJSON,\r\n\t\t\tactionKey: actionKey,\r\n\t\t\tdisplayName: displayName,\r\n\t\t\trecipients: recipients,\r\n\t\t\tresponseMessage: responseMsg,\r\n\t\t\telementId: \".actionPartialMessage\",\r\n\t\t\tduration: durationValue,\r\n\t\t\tisCustomButton: isCustomButton,\r\n\t\t\tremoveFromList: removeFromList,\r\n\t\t},\r\n\t\tsuccess: (\r\n\t\t\tdata: VarioMessageViewModel & VarioObjectDeleteViewModel & LogonRequired\r\n\t\t) => {\r\n\t\t\tif (\r\n\t\t\t\tdata != null &&\r\n\t\t\t\tdata.logonRequired !== undefined &&\r\n\t\t\t\tdata.logonRequired === true\r\n\t\t\t) {\r\n\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t} else if (\r\n\t\t\t\tdata?.status === RequestStatus.success &&\r\n\t\t\t\tcloseOnSuccess === \"True\"\r\n\t\t\t) {\r\n\t\t\t\tCloseVarioObjectButtonClick();\r\n\t\t\t\tshowDxToast(data.message, \"success\");\r\n\t\t\t} else {\r\n\t\t\t\tif (debug) console.log(data);\r\n\r\n\t\t\t\tif (data?.status === RequestStatus.success) {\r\n\t\t\t\t\t$(globalItemsSelectedByUserCopy).each(() => {\r\n\t\t\t\t\t\taddToRunningTriggerOperations();\r\n\t\t\t\t\t\trestartCheckIfTriggerWait4UserRequests();\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tif (!isCustomButton) {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t`Akcja polecenia obiegu zosta\u0142a przekazana do wykonania (${globalItemsSelectedByUserCopy.length})`,\r\n\t\t\t\t\t\t\t\"success\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tclearDynamicWorkflowActionsForFloatingButton();\r\n\t\t\t\t\tclearDynamicWorkflowActionsForVarioObject();\r\n\r\n\t\t\t\t\tif (selectNext) {\r\n\t\t\t\t\t\tconst id =\r\n\t\t\t\t\t\t\tglobalItemsSelectedByUserCopy[\r\n\t\t\t\t\t\t\t\tglobalItemsSelectedByUserCopy.length - 1\r\n\t\t\t\t\t\t\t];\r\n\t\t\t\t\t\tafterWorkflowInitiatedInWorkflowBox(id);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tselectRowInGrid(undefined, true);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t//Widok karty\r\n\t\t\t\t\tif (globalItemsSelectedByUserCopy.includes(modelId)) {\r\n\t\t\t\t\t\tif (!selectNext) {\r\n\t\t\t\t\t\t\t$(\".actionPartialMessage\").each((_, item) => {\r\n\t\t\t\t\t\t\t\tconst url = `${GetBaseUrl()}/Vario/VarioActionExecuted`;\r\n\t\t\t\t\t\t\t\tif (url && url.length > 0) {\r\n\t\t\t\t\t\t\t\t\t$(item as HTMLInputElement).load(url, { result: data });\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\tsetEverythingAsDisabledInVarioObject();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//Nie powiod\u0142o si\u0119, info i prze\u0142adowanie strony. Zweryfikowa\u0107 dzia\u0142anie\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tdata.message &&\r\n\t\t\t\t\t\t!data.message.includes(\"'System.Exception' was thrown\") &&\r\n\t\t\t\t\t\t!data.message.includes(\"The operation was canceled\")\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tshowDxToast(`${data.message}`, \"error\");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t//Widok tabelaryczny\r\n\t\t\t\t\tif (divPartialMessage && divPartialMessage.length === 0) {\r\n\t\t\t\t\t\treloadDxGridDataSource();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//Widok karty\r\n\t\t\t\t\telse if (globalItemsSelectedByUserCopy.includes(modelId)) {\r\n\t\t\t\t\t\t$(\"#buttonsPanelMiddle .workflowActionButton\").attr(\r\n\t\t\t\t\t\t\t\"disabled\",\r\n\t\t\t\t\t\t\tnull\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\t$(\"#buttonsPanelMiddle .workflowActionButton\").removeClass(\r\n\t\t\t\t\t\t\t\"disabled\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\t$(\"#buttonsPanelMiddle\").removeClass(\"disabled\");\r\n\t\t\t\t\t\t$(\"#workflowOperationsOptions\").removeClass(\"disabled\");\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\terror: (error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function ShowWorkflowStateDescription(\r\n\ttitle: VarioWorkflowStateDescription\r\n) {\r\n\t$(\"#actionModalTitle\").empty();\r\n\t$(\"#actionModalTitle\").append(title.title);\r\n\r\n\t$(\"#actionModalBody\").empty();\r\n\tif (title.description) {\r\n\t\t$(\"#actionModalBody\").append(\r\n\t\t\t``\r\n\t\t);\r\n\t}\r\n\r\n\t$(\"#actionModalFooter\").empty();\r\n\t$(\"#actionModalFooter\").append(\r\n\t\t''\r\n\t);\r\n\t($(\"#actionModal\") as any).modal(\"show\");\r\n}\r\n\r\n//funkcja pobierajaca lub wyswietlajaca wiadomo\u015B\u0107 workflow w widoku karty\r\nexport function workflowMessage(id: string) {\r\n\tif (id === workflowActionId) {\r\n\t\tworkflowMessageDisplay(\r\n\t\t\tworkflowActionTitle,\r\n\t\t\tworkflowActionDescription,\r\n\t\t\tworkflowActionCaption,\r\n\t\t\tworkflowActionCreatedBy,\r\n\t\t\tworkflowActionCreationdDate\r\n\t\t);\r\n\t} else {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/VarioWorkflowStateDescriptionDev`,\r\n\t\t\ttype: \"GET\",\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tdataType: \"JSON\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: { id: id },\r\n\t\t\tsuccess: (data: VarioWorkflowStateDescription) => {\r\n\t\t\t\tif (data) {\r\n\t\t\t\t\tworkflowMessageDisplay(\r\n\t\t\t\t\t\tdata.title,\r\n\t\t\t\t\t\tdata.description,\r\n\t\t\t\t\t\tdata.watcherNotificationCaption,\r\n\t\t\t\t\t\tdata.createdBy,\r\n\t\t\t\t\t\tdata.creationDate\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\r\n//popup na wiadomosc workflow\r\nexport function workflowMessageDisplay(\r\n\ttitle: string,\r\n\tdescription: string,\r\n\tcaption: string,\r\n\tcreatedBy: string,\r\n\tcreationDate: string | Date\r\n) {\r\n\tconst popup = $(\"#devex-dialog-information\").dxPopup(\"instance\");\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog-Information\"));\r\n\tpopup.option(\"maxWidth\", 600);\r\n\tpopup.option(\"maxHeight\", \"80vh\");\r\n\tpopup.option(\"minHeight\", 140);\r\n\tpopup.option(\"height\", \"auto\");\r\n\tpopup.option(\"title\", \"Szczeg\u00F3\u0142y polecenia\");\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.show();\r\n\r\n\t$(\"#Dialog-Information\").empty();\r\n\t$(\"#Dialog-Information\").append(\r\n\t\t'
'\r\n\t);\r\n\t$(\"#DialogLoader\").dxLoadIndicator({\r\n\t\theight: 60,\r\n\t\twidth: 60,\r\n\t});\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t.addClass(\"popupTitleAccent\");\r\n\r\n\t$(\"#Dialog-Information\").empty();\r\n\t$(\"#Dialog-Information\").append(\r\n\t\t'
'\r\n\t);\r\n\r\n\tif (caption !== \"null\" && caption?.length) {\r\n\t\tconst staticTitle = caption;\r\n\t\tconst staticTitleContent = `Od: ${createdBy}, Otrzymano: ${creationDate}`;\r\n\r\n\t\t$(\"#workflowMessagePanelContainer\").append(\r\n\t\t\t`
\r\n
\r\n ${staticTitle} \r\n
\r\n
\r\n ${staticTitleContent}\r\n
\r\n
\r\n
`\r\n\t\t);\r\n\t}\r\n\r\n\tif (title !== \"null\" && title?.length) {\r\n\t\tconst titleTitle = \"Tre\u015B\u0107\";\r\n\t\t$(\"#workflowMessagePanelContainer\").append(\r\n\t\t\t`
\r\n
\r\n ${titleTitle} \r\n
\r\n
\r\n ${title}\r\n
\r\n
\r\n
`\r\n\t\t);\r\n\t}\r\n\r\n\tif (description !== \"null\" && description?.length) {\r\n\t\tconst titleDescription = \"Opis\";\r\n\t\t$(\"#workflowMessagePanelContainer\").append(\r\n\t\t\t`
\r\n
\r\n ${titleDescription} \r\n
\r\n
\r\n ${description}\r\n
\r\n
\r\n
`\r\n\t\t);\r\n\t}\r\n\r\n\tfixScrollInDx(\".workflowMessagePanel\");\r\n\tfixScrollInDx(\"#workflowMessagePanelContainer\");\r\n\r\n\tpopup.repaint();\r\n}\r\n\r\n//funkcja rozszerzajaca popup z wiadomoscia workflow\r\nexport function changeMinSizeForPanel(target: HTMLElement, check: HTMLElement) {\r\n\tif (target && check.classList.contains(\"in\")) {\r\n\t\ttarget.style.minHeight = `${45}px`;\r\n\t} else {\r\n\t\tif (target) {\r\n\t\t\ttarget.style.minHeight = `${75}px`;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n//popup historii obiegu\r\nexport function workflowHistory(itemID: string) {\r\n\tCloseDialog();\r\n\tif (itemID) {\r\n\t\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\t\tpopup.option(\"minWidth\", calcMinPopup(1000));\r\n\t\tpopup.option(\"minHeight\", calcMinPopup(200, true));\r\n\t\tpopup.option(\"title\", \"Historia obiegu\");\r\n\t\tpopup.option(\"showTitle\", true);\r\n\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\t\tpopup.show();\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t?.parent()\r\n\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t$(\"#Dialog\").empty();\r\n\t\t$(\"#Dialog\").append('
');\r\n\t\t$(\"#Dialog #DialogLoader\").dxLoadIndicator({\r\n\t\t\theight: 60,\r\n\t\t\twidth: 60,\r\n\t\t});\r\n\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetWorkflowSteps`,\r\n\t\t\ttype: \"GET\",\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tdataType: \"JSON\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: { itemFullID: itemID },\r\n\t\t\tsuccess: (data: WorkFlowStep[] & LogonRequired) => {\r\n\t\t\t\t$(\"#Dialog\").empty();\r\n\t\t\t\tconst steps = data;\r\n\r\n\t\t\t\tif (steps?.length === 1 && steps[0].action === \"NoPermittions\") {\r\n\t\t\t\t\tshowDxToast(\"Brak uprawnie\u0144 do odczytu!\", \"error\");\r\n\t\t\t\t\tCloseDialog();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t'
StanPolecenieOperatorZast\u0119pcaOtrzymanoZako\u0144czonoAkcjaW czasie
'\r\n\t\t\t\t);\r\n\r\n\t\t\t\tconst table = document\r\n\t\t\t\t\t.getElementById(\"workflowStepsTable\")\r\n\t\t\t\t\t?.getElementsByTagName(\"tbody\")[0];\r\n\t\t\t\tlet counter = 0;\r\n\t\t\t\tconst lastState = steps[steps.length - 1].stateName;\r\n\r\n\t\t\t\tconst grouped = steps\r\n\t\t\t\t\t.reduce((r, a) => {\r\n\t\t\t\t\t\tr[a.stateOrd] = r[a.stateOrd] || [];\r\n\t\t\t\t\t\tr[a.stateOrd].push(a);\r\n\t\t\t\t\t\treturn r;\r\n\t\t\t\t\t}, new Array())\r\n\t\t\t\t\t.filter((x) => x);\r\n\r\n\t\t\t\tfor (const items of grouped) {\r\n\t\t\t\t\tif (items[0].ord === 1) {\r\n\t\t\t\t\t\titems[0].stateName = \"01: Start\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst row = table?.insertRow(counter);\r\n\t\t\t\t\tcounter += 1;\r\n\t\t\t\t\tconst cell1 = row?.insertCell(0);\r\n\r\n\t\t\t\t\tif (!row || !cell1) continue;\r\n\r\n\t\t\t\t\tcell1.innerHTML = items[0].stateName;\r\n\t\t\t\t\trow.setAttribute(\r\n\t\t\t\t\t\t\"style\",\r\n\t\t\t\t\t\t\"background: rgb(100 131 162 / 77%); color: white;\"\r\n\t\t\t\t\t);\r\n\t\t\t\t\tcell1.setAttribute(\r\n\t\t\t\t\t\t\"style\",\r\n\t\t\t\t\t\t\"text-align:left !important; padding: 15px;\"\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tfor (const item of items) {\r\n\t\t\t\t\t\t// item.medium == 1 Notification\r\n\t\t\t\t\t\tif (item.additional || item.medium !== 1) {\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (!table) return;\r\n\r\n\t\t\t\t\t\tconst row = table.insertRow(counter);\r\n\t\t\t\t\t\tconst cell1 = row.insertCell(0);\r\n\t\t\t\t\t\tconst cell2 = row.insertCell(1);\r\n\t\t\t\t\t\tconst cell3 = row.insertCell(2);\r\n\t\t\t\t\t\tconst cell4 = row.insertCell(3);\r\n\t\t\t\t\t\tconst cell5 = row.insertCell(4);\r\n\t\t\t\t\t\tconst cell6 = row.insertCell(5);\r\n\t\t\t\t\t\tconst cell7 = row.insertCell(6);\r\n\t\t\t\t\t\tconst cell8 = row.insertCell(7);\r\n\t\t\t\t\t\tcell1.innerHTML = item.stateName;\r\n\t\t\t\t\t\tcell2.innerHTML = item.action;\r\n\t\t\t\t\t\tcell3.innerHTML = item.operator;\r\n\t\t\t\t\t\tcell4.innerHTML = item.substituteOperator;\r\n\t\t\t\t\t\tcell5.innerHTML = item.creationTime;\r\n\t\t\t\t\t\tcell6.innerHTML = item.finishedTime;\r\n\t\t\t\t\t\tcell7.innerHTML = item.actionResult;\r\n\t\t\t\t\t\tcell8.innerHTML = item.duration;\r\n\r\n\t\t\t\t\t\tif (item.stateName === lastState) {\r\n\t\t\t\t\t\t\trow.className += \"WorkflowActualStep\";\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\trow.className += \" WorkflowTableChild\";\r\n\t\t\t\t\t\tcounter += 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfixScrollInDx(\".stylizedTableContainer\");\r\n\r\n\t\t\t\tpopup.repaint();\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function publishPDF(itemID?: string) {\r\n\tif (!itemID) {\r\n\t\tconsole.trace();\r\n\t\tconsole.error(\"brak ID\");\r\n\t\treturn;\r\n\t}\r\n\r\n\tShowLoadingPanel(\"Publikacja pliku pdf...\");\r\n\tCloseDialog();\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/PublishPDF`,\r\n\t\ttype: \"POST\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: { itemFullID: itemID },\r\n\t\tsuccess: (response: ServiceResponse & LogonRequired) => {\r\n\t\t\tif (response) {\r\n\t\t\t\tif (response.success) {\r\n\t\t\t\t\tshowDxToast(\"Publikacja pliku do PDF zako\u0144czona sukcesem\", \"success\");\r\n\t\t\t\t\tif (checkWhereIsUser() === \"varioObject\") {\r\n\t\t\t\t\t\trefreshCurrentPage();\r\n\t\t\t\t\t\tchangedVarioObjectFields = [\"reload\"];\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\t\t\t\t\tif (sessionStorage.getItem(\"selectedRow\")) {\r\n\t\t\t\t\t\t\tconst row = JSON.parse(\r\n\t\t\t\t\t\t\t\tsessionStorage.getItem(\"selectedRow\") ?? \"null\"\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\trow[0].refresh = true;\r\n\t\t\t\t\t\t\tsessionStorage.setItem(\"selectedRow\", JSON.stringify(row));\r\n\t\t\t\t\t\t\t$(\"#Tabela\")\r\n\t\t\t\t\t\t\t\t.dxDataGrid(\"instance\")\r\n\t\t\t\t\t\t\t\t.cellValue(row[0].RowNum, \"FileExtension\", \".pdf\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treloadDxGridDataSource();\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t!stringIsNullOrEmpty(response?.message)\r\n\t\t\t\t\t\t\t? (response.message ?? \"\")\r\n\t\t\t\t\t\t\t: \"B\u0142\u0105d podczas publikacji pliku do PDF\",\r\n\t\t\t\t\t\t\"error\"\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"B\u0142\u0105d podczas publikacji pliku do PDF\", \"error\");\r\n\t\t\t}\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.error(err);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d podczas publikacji pliku do PDF\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function GetTemporaryPDF(itemID: string) {\r\n\tif (!itemID) {\r\n\t\tconsole.trace();\r\n\t\tconsole.error(\"brak ID\");\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (needFallBackPdf(itemID)) {\r\n\t\tshowDxToast(\r\n\t\t\t\"Opcja 'Podgl\u0105d zmian na dokumencie' wymaga skonfigurowanej kontrolki podgl\u0105du pdf. Skontaktuj si\u0119 z administratorem.\",\r\n\t\t\t\"warning\"\r\n\t\t);\r\n\t\treturn;\r\n\t}\r\n\r\n\tShowLoadingPanel(\"Wczytywanie podgl\u0105du...\");\r\n\tCloseDialog();\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetTemporaryPDF`,\r\n\t\ttype: \"POST\",\r\n\t\txhrFields: {\r\n\t\t\tresponseType: \"blob\",\r\n\t\t},\r\n\t\tcache: false,\r\n\t\tdata: { itemFullID: itemID },\r\n\r\n\t\tsuccess: (response: Blob, _status, request) => {\r\n\t\t\tif (response) {\r\n\t\t\t\tconst popup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\t\t\t\tpopup.option(\"minWidth\", calcMinPopup(\"80vw\"));\r\n\t\t\t\tpopup.option(\"minHeight\", calcMinPopup(\"80vh\", true));\r\n\t\t\t\tpopup.option(\"title\", \"Podgl\u0105d zmian na dokumencie\");\r\n\t\t\t\tpopup.option(\"showTitle\", true);\r\n\t\t\t\tpopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\t\t\t\tpopup.show();\r\n\t\t\t\tpopup\r\n\t\t\t\t\t.content()\r\n\t\t\t\t\t?.parent()\r\n\t\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t\t\t$(\"#BigDialog\").empty();\r\n\t\t\t\t$(\"#DialogFooter\").empty();\r\n\t\t\t\t$(\"#BigDialog\").append('
');\r\n\r\n\t\t\t\taddFilePreview(\r\n\t\t\t\t\t\"sourcePreview\",\r\n\t\t\t\t\tresponse,\r\n\t\t\t\t\tsupportedContent.checkWhichTypeOfFile(response.type) ?? \"\",\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\trequest\r\n\t\t\t\t\t\t.getResponseHeader(\"content-disposition\")\r\n\t\t\t\t\t\t?.split('filename=\"')[1]\r\n\t\t\t\t\t\t?.split('\";')[0],\r\n\t\t\t\t\titemID\r\n\t\t\t\t);\r\n\t\t\t} else showDxToast(\"B\u0142\u0105d podczas \u0142adowania podgl\u0105du pliku\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.error(err);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d podczas \u0142adowania podgl\u0105du pliku\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function RefreshWorkflowMessageContainer() {\r\n\tconst workflowMessageContainer = document.getElementById(\r\n\t\t\"workflowMessageContainer\"\r\n\t);\r\n\tconst messageTitle = document.getElementById(\"workflowMessageTitle\");\r\n\tconst messageDesc = document.getElementById(\"workflowMessageDescription\");\r\n\tif (workflowMessageContainer && messageTitle && messageDesc) {\r\n\t\tif (!workflowActionTitle && !workflowActionDescription) {\r\n\t\t\tworkflowMessageContainer.innerHTML = \"\";\r\n\t\t} else {\r\n\t\t\t//Usuwamy
z tytu\u0142u\r\n\t\t\tconst workflowActionTitleParesd = workflowActionTitle.replace(\r\n\t\t\t\t/(<|<)br\\s*\\/*(>|>)/g,\r\n\t\t\t\t\" \"\r\n\t\t\t);\r\n\t\t\tmessageTitle.innerHTML = \"\";\r\n\t\t\tmessageTitle.innerHTML = `${workflowActionTitleParesd}`;\r\n\r\n\t\t\tif (workflowActionDescription) {\r\n\t\t\t\tconst workflowActionDescriptionParsed =\r\n\t\t\t\t\tworkflowActionDescription?.replace(/(<|<)br\\s*\\/*(>|>)/g, \" \");\r\n\t\t\t\tmessageDesc.innerHTML = \"\";\r\n\t\t\t\tmessageDesc.innerHTML = workflowActionDescriptionParsed;\r\n\t\t\t}\r\n\r\n\t\t\tif (\r\n\t\t\t\t!containerKey?.includes(\"WorkflowInbox\") &&\r\n\t\t\t\t!sessionStorage.getItem(\"dontShowWorkflowMessage\")\r\n\t\t\t) {\r\n\t\t\t\tworkflowActionTitleClick();\r\n\t\t\t}\r\n\r\n\t\t\tsessionStorage.removeItem(\"dontShowWorkflowMessage\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function getOperationsHistory(id: string) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetOperationsHistory?id=${id}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tif (response?.success === true) {\r\n\t\t\t\tif (debug) console.log(response);\r\n\r\n\t\t\t\tHideLoadingPanel();\r\n\r\n\t\t\t\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\t\t\t\tpopup.option(\"minWidth\", calcMinPopup(1400));\r\n\t\t\t\tpopup.option(\"minHeight\", calcMinPopup(800, true));\r\n\t\t\t\tpopup.option(\r\n\t\t\t\t\t\"title\",\r\n\t\t\t\t\t`Historia operacji dla: ${response?.data[0]?.objectName}`\r\n\t\t\t\t);\r\n\t\t\t\tpopup.option(\"showTitle\", true);\r\n\t\t\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\t\t\t\tpopup.show();\r\n\t\t\t\tpopup\r\n\t\t\t\t\t.content()\r\n\t\t\t\t\t?.parent()\r\n\t\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t\t\t$(\"#Dialog\").empty();\r\n\r\n\t\t\t\t$(\r\n\t\t\t\t\t\"#Dialog\"\r\n\t\t\t\t).append(`
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Rodzaj operacjiOperatorCzas operacji
`);\r\n\r\n\t\t\t\tfor (const operation of response.data) {\r\n\t\t\t\t\t$(\"#operationsHistory tbody\").append(`\r\n \r\n \r\n ${operation.operationName}\r\n \r\n \r\n ${\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toperation.executedOnDesktop\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? ``\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: ``\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n ${operation.operatorName} ${\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toperation.operatorSubstitute\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? `(zast\u0119pca: ${operation.operatorSubstitute})`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: \"\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} \r\n ${operation.operationDate}\r\n \r\n `);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfixScrollInDx(\".stylizedTableContainer\");\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\tresponse?.message ??\r\n\t\t\t\t\t\t\"Nie uda\u0142o si\u0119 pobra\u0107 historii operacji. Spr\u00F3buj ponownie.\",\r\n\t\t\t\t\t\"error\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function saveStatus(id: string) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\tconst selectedStatus = $(\r\n\t\t\"#statusListContainer input[name=status]:checked\"\r\n\t).val();\r\n\r\n\taddToRunningTriggerOperations();\r\n\trestartCheckIfTriggerWait4UserRequests();\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/UpdateStatus`,\r\n\t\ttype: \"POST\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: { id: id, status: selectedStatus },\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tif (response?.success === true) {\r\n\t\t\t\tconsole.log(response);\r\n\t\t\t\tshowDxToast(\"Zmiana statusu powiod\u0142a si\u0119\", \"success\");\r\n\t\t\t\t$(\"#statusListSave\").addClass(\"disabled\").attr(\"disabled\", \"disabled\");\r\n\t\t\t\tCloseDialog();\r\n\t\t\t\tconst where = checkWhereIsUser();\r\n\r\n\t\t\t\tif (where === \"varioObject\") {\r\n\t\t\t\t\trefreshCurrentPage();\r\n\t\t\t\t} else if (where === \"subElements\") {\r\n\t\t\t\t\treloadDxGridDataSource();\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\tresponse?.message ??\r\n\t\t\t\t\t\t\"Nie mo\u017Cna zmieni\u0107 statusu pozycji. Nie masz uprawnie\u0144.\",\r\n\t\t\t\t\t\"error\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function openListOfStatuses(id: string) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetStatus?id=${id}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tif (response?.success === true) {\r\n\t\t\t\tif (debug) console.log(response);\r\n\r\n\t\t\t\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\t\t\t\tpopup.option(\"minWidth\", calcMinPopup(300));\r\n\t\t\t\tpopup.option(\"minHeight\", calcMinPopup(400, true));\r\n\t\t\t\tpopup.option(\"title\", \"Zmiana statusu\");\r\n\t\t\t\tpopup.option(\"showTitle\", true);\r\n\t\t\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\t\t\t\tpopup.show();\r\n\t\t\t\tpopup\r\n\t\t\t\t\t.content()\r\n\t\t\t\t\t?.parent()\r\n\t\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t\t\t$(\"#Dialog\").empty();\r\n\r\n\t\t\t\tpopup\r\n\t\t\t\t\t.content()\r\n\t\t\t\t\t.find(\".DialogFooter\")\r\n\t\t\t\t\t.empty()\r\n\t\t\t\t\t.append(\r\n\t\t\t\t\t\t``\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t$(\"#Dialog\").append(`
`);\r\n\r\n\t\t\t\tconst statuses: VarioStatus[] = [\r\n\t\t\t\t\t{ name: \"Anulowany\", type: \"Canceled\" },\r\n\t\t\t\t\t{ name: \"Edytowalny\", type: \"Edited\" },\r\n\t\t\t\t\t{ name: \"Sprawdzony\", type: \"Checked\" },\r\n\t\t\t\t\t{ name: \"Zatwierdzony\", type: \"Approved\" },\r\n\t\t\t\t\t{ name: \"Wzorzec\", type: \"ApprovedAsTemplate\" },\r\n\t\t\t\t];\r\n\r\n\t\t\t\tif (response.data.toLowerCase() === \"approvedastemplate\") {\r\n\t\t\t\t\tconst approved = statuses.find(\r\n\t\t\t\t\t\t(x) => x.type === \"ApprovedAsTemplate\"\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (approved) approved.checked = true;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconst found = statuses.find((x) =>\r\n\t\t\t\t\t\tresponse.data.toLowerCase().includes(x.type.toLowerCase())\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (found) found.checked = true;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (const status of statuses) {\r\n\t\t\t\t\tlet icon = \"\";\r\n\t\t\t\t\tlet color = \"var(--main)\";\r\n\t\t\t\t\tswitch (status.type) {\r\n\t\t\t\t\t\tcase \"Canceled\":\r\n\t\t\t\t\t\t\tcolor = \"var(--red)\";\r\n\t\t\t\t\t\t\ticon = '';\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"Edited\":\r\n\t\t\t\t\t\t\ticon = '';\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"Checked\":\r\n\t\t\t\t\t\t\ticon = '';\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"Approved\":\r\n\t\t\t\t\t\t\ticon = '';\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"ApprovedAsTemplate\":\r\n\t\t\t\t\t\t\ticon = '';\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t$(\"#statusListContainer\").append(`\r\n
\r\n \r\n \r\n
\r\n `);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfixScrollInDx(\"#statusListContainer\");\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\tresponse?.message ?? \"Nie uda\u0142o si\u0119 pobra\u0107 statusu pozycji.\",\r\n\t\t\t\t\t\"error\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function executeProgressStatusAction(id: string) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\tconst selectedStatus = $(\r\n\t\t\"#statusListContainer input[name=status]:checked\"\r\n\t).val();\r\n\r\n\taddToRunningTriggerOperations();\r\n\trestartCheckIfTriggerWait4UserRequests();\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/ExecuteProgressStatus`,\r\n\t\ttype: \"POST\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: { id: id, status: selectedStatus },\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tHideLoadingPanel();\r\n\r\n\t\t\tif (response?.success === true) {\r\n\t\t\t\tconsole.log(response);\r\n\t\t\t\tshowDxToast(\"Zmieniono status realizacji\", \"success\");\r\n\t\t\t\t$(\"#statusListSave\").addClass(\"disabled\").attr(\"disabled\", \"disabled\");\r\n\t\t\t\tCloseDialog();\r\n\t\t\t\tconst where = checkWhereIsUser();\r\n\r\n\t\t\t\tif (where === \"varioObject\") {\r\n\t\t\t\t\trefreshCurrentPage();\r\n\t\t\t\t} else if (where === \"subElements\") {\r\n\t\t\t\t\treloadDxGridDataSource();\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\tresponse?.message ??\r\n\t\t\t\t\t\t\"Nie mo\u017Cna zmieni\u0107 statusu realizacji pozycji. Nie masz uprawnie\u0144.\",\r\n\t\t\t\t\t\"error\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\nexport function openListOfProgressStatuses(id: string) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetProgressStatusActions?id=${id}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (response: ServiceResponse>) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tif (response?.success === true) {\r\n\t\t\t\tif (debug) console.log(response);\r\n\r\n\t\t\t\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\t\t\t\tpopup.option(\"minWidth\", calcMinPopup(300));\r\n\t\t\t\tpopup.option(\"minHeight\", calcMinPopup(400, true));\r\n\t\t\t\tpopup.option(\"title\", \"Zmiana statusu realizacji\");\r\n\t\t\t\tpopup.option(\"showTitle\", true);\r\n\t\t\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\t\t\t\tpopup.show();\r\n\t\t\t\tpopup\r\n\t\t\t\t\t.content()\r\n\t\t\t\t\t?.parent()\r\n\t\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t\t\t$(\"#Dialog\").empty();\r\n\r\n\t\t\t\tpopup\r\n\t\t\t\t\t.content()\r\n\t\t\t\t\t.find(\".DialogFooter\")\r\n\t\t\t\t\t.empty()\r\n\t\t\t\t\t.append(\r\n\t\t\t\t\t\t``\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t$(\"#Dialog\").append(`
`);\r\n\t\t\t\tconst statuses = [\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tname: \"Przeka\u017C do realizacji\",\r\n\t\t\t\t\t\ttype: \"OperationsPassOnExecution\",\r\n\t\t\t\t\t\tenabled: response.data.OperationsPassOnExecution,\r\n\t\t\t\t\t\ticon: '',\r\n\t\t\t\t\t},\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tname: \"Zako\u0144cz\",\r\n\t\t\t\t\t\ttype: \"OperationsFinishExecution\",\r\n\t\t\t\t\t\tenabled: response.data.OperationsFinishExecution,\r\n\t\t\t\t\t\ticon: '',\r\n\t\t\t\t\t},\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tname: \"Zako\u0144cz jako niezrealizowane\",\r\n\t\t\t\t\t\ttype: \"OperationsFinishExecutionAsUncompleted\",\r\n\t\t\t\t\t\tenabled: response.data.OperationsFinishExecutionAsUncompleted,\r\n\t\t\t\t\t\ticon: '',\r\n\t\t\t\t\t},\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tname: \"Przyjmij do realizacji\",\r\n\t\t\t\t\t\ttype: \"OperationsAcceptForExecution\",\r\n\t\t\t\t\t\tenabled: response.data.OperationsAcceptForExecutione,\r\n\t\t\t\t\t\ticon: '',\r\n\t\t\t\t\t},\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tname: \"Odrzu\u0107 zlecenie realizacji\",\r\n\t\t\t\t\t\ttype: \"OperationsRejectExecution\",\r\n\t\t\t\t\t\tenabled: response.data.OperationsRejectExecution,\r\n\t\t\t\t\t\ticon: '',\r\n\t\t\t\t\t},\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tname: \"Wzn\u00F3w realizacj\u0119\",\r\n\t\t\t\t\t\ttype: \"OperationsRestartTask\",\r\n\t\t\t\t\t\tenabled: response.data.OperationsRestartTask,\r\n\t\t\t\t\t\ticon: '',\r\n\t\t\t\t\t},\r\n\t\t\t\t];\r\n\r\n\t\t\t\tfor (const status of statuses) {\r\n\t\t\t\t\tconst labelStyle = `${status.enabled ? \"\" : 'style=\"color: gray\"'}`;\r\n\t\t\t\t\tconst iconStyle = `style = \"background: ${status.enabled ? \"var(--main)\" : \"gray\"}\"`;\r\n\r\n\t\t\t\t\t$(\"#statusListContainer\").append(`\r\n
\r\n \r\n \r\n
\r\n `);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfixScrollInDx(\"#statusListContainer\");\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\"Nie uda\u0142o si\u0119 pobra\u0107 statusu realizacji pozycji.\",\r\n\t\t\t\t\t\"error\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function getSourceHistory(id: string) {\r\n\tShowLoadingPanel(\"Pobieranie historii \u017Ar\u00F3d\u0142a...\");\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetSourceHistory?id=${id}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tHideLoadingPanel();\r\n\r\n\t\t\tif (response?.success === true) {\r\n\t\t\t\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\t\t\t\tpopup.option(\"minWidth\", calcMinPopup(700));\r\n\t\t\t\tpopup.option(\"minHeight\", calcMinPopup(800, true));\r\n\t\t\t\tpopup.option(\"title\", \"Historia zmian pliku\");\r\n\t\t\t\tpopup.option(\"showTitle\", true);\r\n\t\t\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\t\t\t\tpopup.show();\r\n\t\t\t\tpopup\r\n\t\t\t\t\t.content()\r\n\t\t\t\t\t?.parent()\r\n\t\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t\t\t$(\"#Dialog\").empty();\r\n\r\n\t\t\t\tconst responseData = [...response.data];\r\n\t\t\t\tprepareSourceHistory(responseData);\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\tresponse?.message\r\n\t\t\t\t\t\t? response.message\r\n\t\t\t\t\t\t: \"B\u0142\u0105d pobierania historii \u017Ar\u00F3d\u0142a.\",\r\n\t\t\t\t\t\"error\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d pobierania historii \u017Ar\u00F3d\u0142a.\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function createPanel(id: string) {\r\n\tShowLoadingPanel(\"Dodawanie panelu...\");\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/CreatePanel`,\r\n\t\ttype: \"Post\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: { id: id },\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tshowDxToast(\"Panel zosta\u0142 dodany\", \"success\");\r\n\t\t\t\tLoadDataToNavigationPanel();\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\tresponse?.message ? response.message : \"Panel nie zosta\u0142 dodany\",\r\n\t\t\t\t\t\"error\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"Panel nie zosta\u0142 dodany\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function removePanel(id: string) {\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(300));\r\n\tpopup.option(\"minHeight\", calcMinPopup(120, true));\r\n\tpopup.option(\"showTitle\", false);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\tpopup.show();\r\n\t$(\"#Dialog\").empty();\r\n\t$(\"#Dialog\").append(\r\n\t\t`

Czy na pewno chcesz usun\u0105\u0107 ten panel?

`\r\n\t);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(`\r\n\t
\r\n\t\t\r\n\t\t\r\n\t\t
`);\r\n}\r\n\r\nexport function removePanelExecute(id: string) {\r\n\tShowLoadingPanel(\"Usuwanie panelu...\");\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/RemovePanel?id=${id}`,\r\n\t\ttype: \"Delete\",\r\n\t\tcache: false,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tshowDxToast(\"Panel zosta\u0142 usuni\u0119ty\", \"success\");\r\n\t\t\t\tLoadDataToNavigationPanel();\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"Panel nie zosta\u0142 usuni\u0119ty\", \"error\");\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"Panel nie zosta\u0142 usuni\u0119ty\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function getDocVersionHistory(\r\n\tid = $(\".docVerContainer\").attr(\"data-id\") ?? \"\",\r\n\tmodelTitle = $(\".docVerContainer\").attr(\"data-name\") ?? \"\",\r\n\tcontainerID = $(\".docVerContainer\").attr(\"data-containerId\") ?? \"\"\r\n) {\r\n\tShowLoadingPanel(\"Pobieranie danych...\");\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetVersions?itemID=${id}&containerID=${containerID}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tHideLoadingPanel();\r\n\r\n\t\t\tif (response?.success === true) {\r\n\t\t\t\tconst popup = $(\"#devex-extra-dialog\").dxPopup(\"instance\");\r\n\t\t\t\tpopup.option(\"minWidth\", calcMinPopup(1100));\r\n\t\t\t\tpopup.option(\"minHeight\", calcMinPopup(250, true));\r\n\t\t\t\tpopup.option(\"title\", `Lista wersji dla: ${modelTitle}`);\r\n\t\t\t\tpopup.option(\"showTitle\", true);\r\n\t\t\t\tpopup.option(\"contentTemplate\", $(\"#MainDevExtraDialog\"));\r\n\t\t\t\tpopup.show();\r\n\t\t\t\tpopup\r\n\t\t\t\t\t.content()\r\n\t\t\t\t\t?.parent()\r\n\t\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t\t\t$(\"#ExtraDialog\").empty();\r\n\r\n\t\t\t\tprepareDocVersionHistory(\r\n\t\t\t\t\tstructuredClone(response.data),\r\n\t\t\t\t\tid,\r\n\t\t\t\t\tmodelTitle,\r\n\t\t\t\t\tcontainerID\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\tresponse?.message\r\n\t\t\t\t\t\t? response.message\r\n\t\t\t\t\t\t: \"B\u0142\u0105d pobierania wersji dokumentu.\",\r\n\t\t\t\t\t\"error\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d pobierania wersji dokumentu.\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function prepareDocVersionHistory(\r\n\tdata: DocumentVersionsContainer,\r\n\tid: string,\r\n\tfileName: string,\r\n\tcontainerID: string\r\n) {\r\n\tif (debug) console.log(data);\r\n\r\n\tconst responseData = data.documentVersions;\r\n\r\n\tconst newVersionParams: NewVersionParams = {\r\n\t\tforWhat: \"forNewVersion\",\r\n\t\tid: id,\r\n\t\tfromId: id,\r\n\t\tdefinition: { key: data.defKey, displayName: data.defCaption },\r\n\t};\r\n\r\n\tlet currentContainerName =\r\n\t\tstringIsNullOrEmpty(containerID) ||\r\n\t\tcontainerID === \"null\" ||\r\n\t\tresponseData[0].containerCaption === \"null\"\r\n\t\t\t? \"brak\"\r\n\t\t\t: responseData[0].containerCaption;\r\n\tconst versionInCurrentContainer = responseData.find((x) => x.id === id);\r\n\tif (currentContainerName !== \"brak\")\r\n\t\tcurrentContainerName += ` (Wersja nr ${versionInCurrentContainer?.version})`;\r\n\r\n\t$(\r\n\t\t\"#ExtraDialog\"\r\n\t).append(`
\r\n
Bie\u017C\u0105ca lokalizacja: ${currentContainerName}
\r\n
\r\n `);\r\n\r\n\t$(\"#ExtraDialog + .DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(`\r\n\t\t\r\n\t`);\r\n\r\n\t//guzik tworzenia nowej wersji\r\n\t$(\"#addVersionBtn\").on(\"click\", () => {\r\n\t\tnewVersionParams.fromId = id;\r\n\t\tnewVersionComment(newVersionParams, false);\r\n\t});\r\n\r\n\t//dodawanie listy wersji\r\n\tresponseData\r\n\t\t.sort((a, b) => b.version - a.version)\r\n\t\t.forEach((value, key) => {\r\n\t\t\tconst section = `${key}-version`;\r\n\t\t\tconst sectionTitle = value.caption + value.fileExtension;\r\n\t\t\tconst creationDate = getConvertedDateAndTime(value.creationDate);\r\n\t\t\tconst extensionIcon = !stringIsNullOrEmpty(value.fileExtension)\r\n\t\t\t\t? ``\r\n\t\t\t\t: \"\";\r\n\t\t\tconst isActualVersion = value.isActualVersion\r\n\t\t\t\t? \"(Aktualna wersja)\"\r\n\t\t\t\t: \"\";\r\n\r\n\t\t\tconst noComment = !value.comment ? \"disabled\" : \"\";\r\n\t\t\tconst noFileExtension = stringIsNullOrEmpty(value.fileExtension)\r\n\t\t\t\t? \"disabled\"\r\n\t\t\t\t: \"\";\r\n\t\t\tconst disableVersionChangeBtn =\r\n\t\t\t\tvalue.id === id || currentContainerName === \"brak\" ? \"disabled\" : \"\";\r\n\t\t\tconst disableDeleteBtn = value.id === id ? \"disabled\" : \"\";\r\n\r\n\t\t\t// TYPESCRIPT DILEMMA nie ma operatorName\r\n\r\n\t\t\t$(\"#ExtraDialog #editListContainer\").append(`\r\n
\r\n
\r\n
\r\n \r\n
\r\n

Nr wersji: ${\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue.version\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}
Status: ${value.status}

\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n `);\r\n\r\n\t\t\t//usuwanie bo nie ma komentarza\r\n\t\t\tif (noComment === \"disabled\") $(`#${section}Container`).remove();\r\n\t\t\telse\r\n\t\t\t\t$(`#${section}`).append(\r\n\t\t\t\t\t`Komentarz do wersji: ${value.comment}`\r\n\t\t\t\t);\r\n\r\n\t\t\t//zeby nie otwieral sie dropdown\r\n\t\t\t$(`#${section}-panel`)\r\n\t\t\t\t.find(\".editList-edit-buttons\")\r\n\t\t\t\t.on(\"click\", (event) => {\r\n\t\t\t\t\tevent.stopPropagation();\r\n\t\t\t\t});\r\n\r\n\t\t\t$(`#${section}Title`)\r\n\t\t\t\t.find(\".panel-title-link\")\r\n\t\t\t\t.on(\"click\", (event) => {\r\n\t\t\t\t\tevent.stopPropagation();\r\n\t\t\t\t\tevent.preventDefault();\r\n\r\n\t\t\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\t\t\t\tCloseExtraDialog();\r\n\t\t\t\t\tchangeCurrentItem({\r\n\t\t\t\t\t\titemId: value.id,\r\n\t\t\t\t\t\tforceVarioObject: true,\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\r\n\t\t\t//guzik podgl\u0105du zrodla wersji\r\n\t\t\t$(`#editList-edit-buttons-preview${key}:not(.disabled)`).on(\r\n\t\t\t\t\"click\",\r\n\t\t\t\t() => {\r\n\t\t\t\t\tlet fileSupported = false;\r\n\t\t\t\t\tif (value.fileExtension && value.fileExtension !== \"\") {\r\n\t\t\t\t\t\tfileSupported = supportedContent.checkIfSupported(\r\n\t\t\t\t\t\t\tvalue.fileExtension\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (fileSupported) {\r\n\t\t\t\t\t\tpreviewFile(\r\n\t\t\t\t\t\t\tvalue.id,\r\n\t\t\t\t\t\t\tcreationDate,\r\n\t\t\t\t\t\t\tvalue.caption + value.fileExtension,\r\n\t\t\t\t\t\t\t`${GetBaseUrl()}/Vario/DownloadContentFile?id=${value.id}&download=false`\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tdownloadFileFromLink(\r\n\t\t\t\t\t\t\t\"\",\r\n\t\t\t\t\t\t\tvalue.id,\r\n\t\t\t\t\t\t\tvalue.caption + value.fileExtension\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t);\r\n\r\n\t\t\t//guzik pobierania zrodla wersji\r\n\t\t\t$(`#editList-edit-buttons-download${key}:not(.disabled)`).on(\r\n\t\t\t\t\"click\",\r\n\t\t\t\t() => {\r\n\t\t\t\t\tdownloadFileFromLink(\r\n\t\t\t\t\t\t\"\",\r\n\t\t\t\t\t\tvalue.id,\r\n\t\t\t\t\t\tvalue.caption + value.fileExtension\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t);\r\n\r\n\t\t\t//guzik zmiany aktualnej wersji\r\n\t\t\t$(`#editList-edit-buttons-restore${key}:not(.disabled)`).on(\r\n\t\t\t\t\"click\",\r\n\t\t\t\t() => {\r\n\t\t\t\t\treplaceVersion(containerID, id, value.id);\r\n\t\t\t\t}\r\n\t\t\t);\r\n\r\n\t\t\t//guzik usuwania wersji\r\n\t\t\t$(`#editList-edit-buttons-delete${key}:not(.disabled)`).on(\r\n\t\t\t\t\"click\",\r\n\t\t\t\t() => {\r\n\t\t\t\t\tdeleteVersion = true;\r\n\t\t\t\t\tTryDeleteVarioObject(value.id, \"\", false);\r\n\t\t\t\t}\r\n\t\t\t);\r\n\r\n\t\t\t//guzik duplikowania wersji\r\n\t\t\t$(`#editList-edit-buttons-duplicate${key}:not(.disabled)`).on(\r\n\t\t\t\t\"click\",\r\n\t\t\t\t() => {\r\n\t\t\t\t\tnewVersionParams.fromId = value.id;\r\n\t\t\t\t\tnewVersionComment(newVersionParams, true);\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t});\r\n\r\n\tfixScrollInDx(\"#editListContainer\");\r\n}\r\n\r\nexport function newVersionComment(\r\n\tnewVersionParams: NewVersionParams,\r\n\tduplicate = false\r\n) {\r\n\tconst popup = $(\"#devex-dialog-additional\").dxPopup(\"instance\");\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog-Additional\"));\r\n\tpopup.option(\"minWidth\", calcMinPopup(600));\r\n\tpopup.option(\"minHeight\", calcMinPopup(150, true));\r\n\tpopup.option(\"height\", \"auto\");\r\n\tpopup.option(\"title\", \"Generowanie wersji\");\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t.addClass(\"popupTitleAccent\");\r\n\r\n\t$(\"#Dialog-Additional\").empty();\r\n\r\n\t$(\"#Dialog-Additional\").append(\r\n\t\t`
\r\n
Wprowad\u017A wymagany opis zmiany:
\r\n\r\n \r\n
`\r\n\t);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(`\r\n\t
\r\n \r\n \r\n
`);\r\n\r\n\t$(\"#newVersionComment\").on(\"keyup\", function () {\r\n\t\tconst comment = $(this as HTMLElement).val();\r\n\t\tconst confirmBtn = $(\"#confirmNewVersion\");\r\n\r\n\t\tif (stringIsNullOrEmpty(comment)) {\r\n\t\t\tconfirmBtn.addClass(\"disabled\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconfirmBtn.removeClass(\"disabled\");\r\n\t});\r\n\r\n\t$(\"#confirmNewVersion\").on(\"click\", () => {\r\n\t\tconst comment = $(\"#newVersionComment\").val()?.valueOf().toString();\r\n\t\tif (stringIsNullOrEmpty(comment)) return;\r\n\r\n\t\tnewVersionParams.comment = comment;\r\n\t\tcreateNewVersion(newVersionParams, duplicate);\r\n\t\tCloseAdditionalDialog();\r\n\t});\r\n\r\n\t$(\"#cancelNewVersion\").on(\"click\", () => {\r\n\t\tCloseAdditionalDialog();\r\n\t});\r\n}\r\n\r\nexport function TryDeleteVarioObjects(\r\n\tsingle: boolean,\r\n\titemId?: string | string[]\r\n) {\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(300));\r\n\tpopup.option(\"minHeight\", calcMinPopup(120, true));\r\n\tpopup.option(\"showTitle\", false);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\tpopup.show();\r\n\r\n\t$(\"#Dialog\").empty();\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(`\r\n\t
\r\n\t\t\r\n\t\t\r\n\t
\r\n\t`);\r\n\tif (single) {\r\n\t\t$(\"#Dialog\").append(\"

Czy na pewno chcesz usun\u0105\u0107 wybran\u0105 pozycj\u0119?

\");\r\n\t} else {\r\n\t\t$(\"#Dialog\").append(\r\n\t\t\t\"

Czy na pewno chcesz usun\u0105\u0107 zaznaczone pozycje?

\"\r\n\t\t);\r\n\t}\r\n\r\n\t$(\"#deleteObjectBtn\").on(\"click\", () => {\r\n\t\tif (single) FinallyDeleteVarioObjects(itemId ?? \"\");\r\n\t\telse FinallyDeleteVarioObjects(itemId ?? \"\", false);\r\n\r\n\t\tCloseDialog();\r\n\t});\r\n\r\n\tpopup.repaint();\r\n\r\n\t$(document).one(\"keypress\", (event) => {\r\n\t\tif (\r\n\t\t\t$(\"#deleteObjectBtn\").length > 0 &&\r\n\t\t\tevent.originalEvent?.key === \"Enter\"\r\n\t\t) {\r\n\t\t\t$(\"#deleteObjectBtn\").trigger(\"click\");\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function FinallyDeleteVarioObjects(\r\n\titemIdParam: string | string[],\r\n\tsingle = true\r\n) {\r\n\tShowLoadingPanel(\"Usuwanie danych...\");\r\n\r\n\tlet itemId: string[] | string = \"\";\r\n\tif (itemIdParam) {\r\n\t\titemId = itemIdParam;\r\n\t} else if (!single) {\r\n\t\titemId = lastSelectedRow?.map((x) => x.ItemID) ?? [];\r\n\t}\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/DeleteVarioObjects`,\r\n\t\ttype: \"Post\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: { ids: itemId, parentId: containerId },\r\n\t\tsuccess: (\r\n\t\t\tdata: VarioMessageViewModel & VarioObjectDeleteViewModel & LogonRequired\r\n\t\t) => {\r\n\t\t\tif (\r\n\t\t\t\tdata != null &&\r\n\t\t\t\tdata.logonRequired !== undefined &&\r\n\t\t\t\tdata.logonRequired === true\r\n\t\t\t) {\r\n\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t} else {\r\n\t\t\t\tconst totalItemsCount =\r\n\t\t\t\t\t!itemId || typeof itemId === \"string\" ? 1 : itemId.length;\r\n\t\t\t\tconst undeletedItemsCount = data.undeletedItemsIds\r\n\t\t\t\t\t? data.undeletedItemsIds.length\r\n\t\t\t\t\t: totalItemsCount;\r\n\t\t\t\tconst deletedItemsCount = totalItemsCount - undeletedItemsCount;\r\n\t\t\t\tconst error = !data.status;\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tdata?.status === RequestStatus.error &&\r\n\t\t\t\t\tdata?.deepDeleteModeRequired\r\n\t\t\t\t)\r\n\t\t\t\t\tTryDeepDeleteVarioObject(\r\n\t\t\t\t\t\tdata,\r\n\t\t\t\t\t\tcontainerId,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\t!itemIdParam,\r\n\t\t\t\t\t\tdeletedItemsCount,\r\n\t\t\t\t\t\ttotalItemsCount,\r\n\t\t\t\t\t\tfalse\r\n\t\t\t\t\t);\r\n\t\t\t\telse if (\r\n\t\t\t\t\tdata?.status === RequestStatus.error &&\r\n\t\t\t\t\tdata?.unlinkAvailable\r\n\t\t\t\t) {\r\n\t\t\t\t\tconsole.log(\"unlinkAvailable\");\r\n\t\t\t\t\tTryDeepDeleteVarioObject(\r\n\t\t\t\t\t\tdata,\r\n\t\t\t\t\t\tcontainerId,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\t!itemIdParam,\r\n\t\t\t\t\t\tdeletedItemsCount,\r\n\t\t\t\t\t\ttotalItemsCount,\r\n\t\t\t\t\t\ttrue\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t`Usuni\u0119to element\u00F3w: ${deletedItemsCount}/${totalItemsCount}\\n${\r\n\t\t\t\t\t\t\tdata.message ? data.message : \"\"\r\n\t\t\t\t\t\t}`,\r\n\t\t\t\t\t\terror ? \"warning\" : \"success\"\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\r\n\t\t\t\treloadDxGridDataSource();\r\n\t\t\t\tUnselectAndUnfocusDxTable();\r\n\t\t\t\tclearDynamicWorkflowActionsForFloatingButton();\r\n\t\t\t\tfloatingButtonForNoSelection();\r\n\r\n\t\t\t\tif (itemId === subElementsModel[modelSubElementsOnly].addedItemId) {\r\n\t\t\t\t\tCloseEditor();\r\n\t\t\t\t\tRefreshPageInfo();\r\n\t\t\t\t}\r\n\t\t\t\t//Od\u015Bwie\u017Cenie floating buttona po usuni\u0119ciu pozycji w widoku karta + sub elementy\r\n\t\t\t\tif (modelSubElementsOnly === \"False\") {\r\n\t\t\t\t\tfloatingButtonBackToViewCardWithSubElements();\r\n\t\t\t\t} else {\r\n\t\t\t\t\treloadDataToNavTab(\r\n\t\t\t\t\t\tArray.isArray(itemId) ? itemId[0] : itemId,\r\n\t\t\t\t\t\tcontainerId\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function TryUnlinkVarioObjects(\r\n\tsingle: boolean,\r\n\titemId?: string | string[]\r\n) {\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(300));\r\n\tpopup.option(\"minHeight\", calcMinPopup(120, true));\r\n\tpopup.option(\"showTitle\", false);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\tpopup.show();\r\n\r\n\t$(\"#Dialog\").empty();\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(`\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t
\r\n\t`);\r\n\r\n\tif (single) {\r\n\t\t$(\"#Dialog\").append(\r\n\t\t\t\"

Czy na pewno chcesz wypi\u0105\u0107 wybran\u0105 pozycj\u0119 z tego miejsca?

Pozycja nadal b\u0119dzie dost\u0119pna w systemie.

\"\r\n\t\t);\r\n\t} else {\r\n\t\t$(\"#Dialog\").append(\r\n\t\t\t\"

Czy na pewno chcesz wypi\u0105\u0107 zaznaczone pozycje z tego miejsca?

Pozycje nadal b\u0119d\u0105 dost\u0119pne w systemie.

\"\r\n\t\t);\r\n\t}\r\n\r\n\t$(\"#unlinkObjectBtn\").on(\"click\", () => {\r\n\t\tif (single) FinallyUnlinkVarioObjects(itemId ?? \"\");\r\n\t\telse FinallyUnlinkVarioObjects(\"\");\r\n\r\n\t\tCloseDialog();\r\n\t});\r\n\r\n\tpopup.repaint();\r\n\r\n\t$(document).one(\"keypress\", (event) => {\r\n\t\tif (\r\n\t\t\t$(\"#unlinkObjectBtn\").length > 0 &&\r\n\t\t\tevent.originalEvent?.key === \"Enter\"\r\n\t\t) {\r\n\t\t\t$(\"#unlinkObjectBtn\").trigger(\"click\");\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function FinallyUnlinkVarioObjects(itemIdParam: string | string[]) {\r\n\tShowLoadingPanel(\"Wypinanie danych...\");\r\n\r\n\tlet itemId: string[] | string = \"\";\r\n\tif (itemIdParam) {\r\n\t\titemId = itemIdParam;\r\n\t} else {\r\n\t\titemId = globalItemsSelectedByUser ?? [];\r\n\t}\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/DeleteVarioObjects`,\r\n\t\ttype: \"Post\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: { ids: itemId, parentId: containerId, unlink: true },\r\n\t\tsuccess: (data: VarioObjectDeleteViewModel & LogonRequired) => {\r\n\t\t\tif (\r\n\t\t\t\tdata != null &&\r\n\t\t\t\tdata.logonRequired !== undefined &&\r\n\t\t\t\tdata.logonRequired === true\r\n\t\t\t) {\r\n\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t} else {\r\n\t\t\t\tconst totalItemsCount =\r\n\t\t\t\t\t!itemId || typeof itemId === \"string\" ? 1 : itemId.length;\r\n\t\t\t\tconst undeletedItemsCount = data.undeletedItemsIds\r\n\t\t\t\t\t? data.undeletedItemsIds.length\r\n\t\t\t\t\t: totalItemsCount;\r\n\t\t\t\tconst deletedItemsCount = totalItemsCount - undeletedItemsCount;\r\n\t\t\t\tconst error = !data.status;\r\n\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\t`Wypi\u0119to element\u00F3w: ${deletedItemsCount}/${totalItemsCount}\\n${\r\n\t\t\t\t\t\tdata.message ? data.message : \"\"\r\n\t\t\t\t\t}`,\r\n\t\t\t\t\terror ? \"warning\" : \"success\"\r\n\t\t\t\t);\r\n\r\n\t\t\t\treloadDxGridDataSource();\r\n\t\t\t\tUnselectAndUnfocusDxTable();\r\n\t\t\t\tclearDynamicWorkflowActionsForFloatingButton();\r\n\r\n\t\t\t\tif (itemId === subElementsModel[modelSubElementsOnly].addedItemId) {\r\n\t\t\t\t\tCloseEditor();\r\n\t\t\t\t\tRefreshPageInfo();\r\n\t\t\t\t}\r\n\t\t\t\t//Od\u015Bwie\u017Cenie floating buttona po usuni\u0119ciu pozycji w widoku karta + sub elementy\r\n\t\t\t\tif (modelSubElementsOnly === \"False\") {\r\n\t\t\t\t\tfloatingButtonBackToViewCardWithSubElements();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n\treloadDataToNavTab(Array.isArray(itemId) ? itemId[0] : itemId);\r\n}\r\n\r\nexport function createNewVersion(\r\n\tnewVersionParams: NewVersionParams,\r\n\tduplicate: boolean\r\n) {\r\n\tif (!duplicate) newDocument(newVersionParams);\r\n\telse GenerateNewVersion(newVersionParams, duplicate);\r\n}\r\n\r\nexport function GenerateNewVersion(\r\n\tnewVersionParams: NewVersionParams,\r\n\tduplicate: boolean\r\n) {\r\n\tif (!newVersionParams) {\r\n\t\tshowDxToast(\"B\u0142\u0105d tworzenia nowej wersji dokumentu.\", \"error\");\r\n\t\treturn;\r\n\t}\r\n\tShowLoadingPanel(\"Tworzenie nowej wersji...\");\r\n\r\n\tconst containerID = !stringIsNullOrEmpty(containerKey)\r\n\t\t? containerKey\r\n\t\t: modelId;\r\n\r\n\tconst generateFromPosition = duplicate;\r\n\tconst templateID = globalUseTemplate\r\n\t\t? ((document.getElementById(\"selectTemplate\") as HTMLSelectElement)\r\n\t\t\t\t?.value ?? \"\")\r\n\t\t: \"\";\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GenerateNewVersion?comment=${newVersionParams.comment}&itemID=${newVersionParams.id}&fromItemID=${newVersionParams.fromId}&templateID=${templateID}&generateFromPosition=${generateFromPosition}&containerID=${containerID}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tCloseBigDialog();\r\n\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tgetDocVersionHistory(newVersionParams.id);\r\n\t\t\t} else {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\tresponse?.message ?? \"B\u0142\u0105d tworzenia nowej wersji dokumentu.\",\r\n\t\t\t\t\t\"error\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d tworzenia nowej wersji dokumentu.\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tCloseBigDialog();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function replaceVersion(\r\n\tcontainerID: string,\r\n\toldVersionID: string,\r\n\tnewVersionID: string\r\n) {\r\n\tShowLoadingPanel(\"Zamiana wersji...\");\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/ReplaceVersion?containerID=${containerID}&oldVersionID=${oldVersionID}&newVersionID=${newVersionID}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tconst whereIsUser = checkWhereIsUser();\r\n\t\t\t\tsessionStorage.removeItem(\"selectedRow\");\r\n\r\n\t\t\t\tif (whereIsUser === \"varioObject\" && oldVersionID === modelId) {\r\n\t\t\t\t\tCloseExtraDialog();\r\n\t\t\t\t\tchangeCurrentItem({\r\n\t\t\t\t\t\titemId: newVersionID,\r\n\t\t\t\t\t\tcontainerKey: containerID,\r\n\t\t\t\t\t\tinnerCall: false,\r\n\t\t\t\t\t});\r\n\t\t\t\t} else {\r\n\t\t\t\t\tUnselectAndUnfocusDxTable();\r\n\t\t\t\t\treloadDxGridDataSource();\r\n\r\n\t\t\t\t\tgetDocVersionHistory(newVersionID);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\tresponse?.message\r\n\t\t\t\t\t\t? response.message\r\n\t\t\t\t\t\t: \"B\u0142\u0105d zamiany wersji dokumentu.\",\r\n\t\t\t\t\t\"error\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d zamiany wersji dokumentu.\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function copyVarioObjectLink(itemId: string) {\r\n\tconst link = `${GetBaseUrl()}/Vario/VarioObject/${itemId}?asPartialView=false&innerCall=false&browserTabGuid=${uuidv4()}`;\r\n\tnavigator.clipboard.writeText(link);\r\n}\r\n\r\nexport function getPermissions(\r\n\tid: string\r\n): JQuery.jqXHR> {\r\n\treturn $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetPermissions?id=${id}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (response: ServiceResponse) => response,\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d pobierania uprawnie\u0144 dla pozycji.\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport async function openPermissionPopup(id: string) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\tconst response = await getPermissions(id);\r\n\tHideLoadingPanel();\r\n\r\n\tif (response?.success) {\r\n\t\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\t\tpopup.option(\"minWidth\", calcMinPopup(350));\r\n\t\tpopup.option(\"minHeight\", calcMinPopup(120, true));\r\n\t\tpopup.option(\"title\", \"Uprawnienia do pozycji:\");\r\n\t\tpopup.option(\"showTitle\", true);\r\n\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\t\tpopup.show();\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t?.parent()\r\n\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t$(\"#Dialog\").empty().append('
');\r\n\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t.find(\".DialogFooter\")\r\n\t\t\t.empty()\r\n\t\t\t.append(`\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t`);\r\n\r\n\t\tif (debug) console.log(response);\r\n\t\tif (response.data?.length) {\r\n\t\t\tresponse.data.map((x) => addPermission(x, id));\r\n\t\t} else $(\"#permissionsContainer\").text(\"Brak nadanych uprawnie\u0144.\");\r\n\r\n\t\t$(\"#addToPermissionsBtn\").on(\"click\", () => {\r\n\t\t\tglobalSelectedRecipients = $(\"#permissionsContainer\")\r\n\t\t\t\t.find(\"> div\")\r\n\t\t\t\t.map(function () {\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tid: $(this).data(\"operatorid\"), // Get data-operatorId\r\n\t\t\t\t\t\tname: $(this).data(\"operatorcaption\"), // Get data-operatorCaption\r\n\t\t\t\t\t};\r\n\t\t\t\t})\r\n\t\t\t\t.get(); // Use .get() to convert the jQuery object to a regular array\r\n\r\n\t\t\topenAddPermissionView(id);\r\n\t\t});\r\n\t} else {\r\n\t\tshowDxToast(\r\n\t\t\tresponse?.message\r\n\t\t\t\t? response.message\r\n\t\t\t\t: \"B\u0142\u0105d pobierania uprawnie\u0144 dla pozycji.\",\r\n\t\t\t\"error\"\r\n\t\t);\r\n\t}\r\n}\r\n\r\nfunction addPermission(perm: PermissionsForItem, id: string) {\r\n\tconst div = $(\"#permissionsContainer\");\r\n\tif (!div.length) return;\r\n\r\n\tif (!perm) return;\r\n\r\n\tif (!div.find(\"select\").length) div.empty();\r\n\r\n\tconst icon = createUserIcon(perm);\r\n\r\n\tdiv.append(`
\r\n\t \r\n\t
`);\r\n\r\n\tconst readPermissionsRequired = [\r\n\t\t\"Read\",\r\n\t\t\"ReadContent\",\r\n\t\t\"DelegateItemPermissions\",\r\n\t];\r\n\tconst editPermissionsRequired = [\r\n\t\t...readPermissionsRequired,\r\n\t\t\"Add\",\r\n\t\t\"AddContent\",\r\n\t\t\"Modify\",\r\n\t\t\"ModifyContent\",\r\n\t\t\"OperateItem\",\r\n\t];\r\n\r\n\tconst allReadPerms = readPermissionsRequired.every((element) =>\r\n\t\tperm?.permissions?.includes(element)\r\n\t);\r\n\tconst allEditPerms = editPermissionsRequired.every((element) =>\r\n\t\tperm?.permissions?.includes(element)\r\n\t);\r\n\r\n\tlet permissionValue: \"edit\" | \"read\" | \"none\" | \"other\";\r\n\tif (!perm.permissions?.length || perm.permissions[0] === \"0\") {\r\n\t\tpermissionValue = \"none\";\r\n\t} else if (allEditPerms) {\r\n\t\tpermissionValue = \"edit\";\r\n\t} else if (allReadPerms) {\r\n\t\tpermissionValue = \"read\";\r\n\t} else {\r\n\t\t$(`#permission${perm.operatorID}`).append(\r\n\t\t\t``\r\n\t\t);\r\n\t\tpermissionValue = \"other\";\r\n\t}\r\n\r\n\t$(`#permission${perm.operatorID}`).val(permissionValue);\r\n\t$(`#permission${perm.operatorID}`).on(\"change\", function () {\r\n\t\tsetPermission($(this).val(), perm.permInstanceID, perm.operatorID, id);\r\n\t});\r\n}\r\n\r\nexport async function openAddPermissionView(id: string) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\tconst rec = await getAutoCompleteRecipientsData(\r\n\t\tAddressingScope.InternalRecipients & ~AddressingScope.AddressablesGroups\r\n\t);\r\n\r\n\tconst popup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(450));\r\n\tpopup.option(\"minHeight\", calcMinPopup(320, true));\r\n\tpopup.option(\"title\", \"Dodaj uprawnienia:\");\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t$(\"#BigDialog\").empty().append('
');\r\n\r\n\tif (\r\n\t\t$(\"#recipientCounter\").length === 0 ||\r\n\t\t$(\"#recipientCounter\").is(\":empty\")\r\n\t) {\r\n\t\t$(\"#recipientsContainer\").append(\r\n\t\t\t`
Wybierz:
`\r\n\t\t);\r\n\t\tif (globalSelectedRecipients?.length > 0) {\r\n\t\t\t$(\"#recipientCounter\")\r\n\t\t\t\t.empty()\r\n\t\t\t\t.append(`Wybranych: ${globalSelectedRecipients.length}`);\r\n\t\t}\r\n\t}\r\n\r\n\t//tworzenie glownego elementu wraz z wyszukiwark\u0105\r\n\t$(\r\n\t\t\"#recipientsContainer\"\r\n\t).append(`
\r\n
\r\n \r\n \r\n
\r\n \r\n
\r\n
`);\r\n\r\n\t//dodawanie adresat\u00F3w bez grupowania\r\n\tappendRecipientsList(\r\n\t\tgroupBy(rec, \"recipientType\"),\r\n\t\ttrue,\r\n\t\tfalse,\r\n\t\t\"type\",\r\n\t\tfalse\r\n\t);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(\r\n\t\t\t`
`\r\n\t\t);\r\n\r\n\t$(\"#addPermission\").on(\"click\", () => {\r\n\t\tif (globalSelectedRecipients)\r\n\t\t\tfor (const x of globalSelectedRecipients.filter((x) => {\r\n\t\t\t\treturn !$(`#permissionsContainer div[data-operatorId=\"${x.id}\"`).length; // Only include if not already in the DOM\r\n\t\t\t}))\r\n\t\t\t\taddPermission(\r\n\t\t\t\t\t{ operatorID: x.id.split(\"Key:\")[1], operatorCaption: x.name },\r\n\t\t\t\t\tid\r\n\t\t\t\t);\r\n\r\n\t\tglobalSelectedRecipients = [];\r\n\r\n\t\tCloseBigDialog();\r\n\t});\r\n\r\n\tfixScrollInDx(\".select-recipients-table\");\r\n\tHideLoadingPanel();\r\n}\r\n\r\nexport function setPermission(mode, permId, operatorId, itemId) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/SetPermission`,\r\n\t\ttype: \"POST\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tdata: {\r\n\t\t\tmode: mode,\r\n\t\t\tpermId: permId,\r\n\t\t\toperatorId: operatorId,\r\n\t\t\titemId: itemId,\r\n\t\t},\r\n\t\tsuccess: async (response) => {\r\n\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\t\tif (debug) console.log(response);\r\n\t\t\tif (!permId) {\r\n\t\t\t\tconst data = await getPermissions(itemId);\r\n\t\t\t\tif (data?.success) {\r\n\t\t\t\t\tif (data?.data)\r\n\t\t\t\t\t\tfor (const perm of data.data) {\r\n\t\t\t\t\t\t\t$(`#permission${perm.operatorID}`).off(\"change\");\r\n\r\n\t\t\t\t\t\t\t$(`#permission${perm.operatorID}`).on(\"change\", function () {\r\n\t\t\t\t\t\t\t\tsetPermission(\r\n\t\t\t\t\t\t\t\t\t$(this).val(),\r\n\t\t\t\t\t\t\t\t\tperm.permInstanceID,\r\n\t\t\t\t\t\t\t\t\tperm.operatorID,\r\n\t\t\t\t\t\t\t\t\titemId\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else if (mode === \"none\") {\r\n\t\t\t\t$(`#permission${operatorId}`).off(\"change\");\r\n\r\n\t\t\t\t$(`#permission${operatorId}`).on(\"change\", function () {\r\n\t\t\t\t\tsetPermission($(this).val(), \"\", operatorId, itemId);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tshowDxToast(\"Zmiana uprawnie\u0144 powiod\u0142a si\u0119.\", \"success\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d pobierania uprawnie\u0144 dla pozycji.\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function openInNewTab(id: string, container?: string) {\r\n\tif (!id) return;\r\n\r\n\tconst link = document.createElement(\"a\");\r\n\tlink.href = `${GetBaseUrl()}/Vario/VarioObject?id=${id}&asPartialView=false`;\r\n\tif (container) link.href += `&containerKey=${container}`;\r\n\tlink.target = \"_blank\";\r\n\r\n\t// Append the link to the body (it's required for the click event)\r\n\tdocument.body.appendChild(link);\r\n\t$(link)[0].click();\r\n\tdocument.body.removeChild(link);\r\n}\r\n", "\uFEFFimport \"../types/dx.all.d.ts\";\r\nimport type {\r\n\tCreateMessageResponse,\r\n\tFilesFromVario,\r\n\tMessageReactions,\r\n\tPermissionsForItem,\r\n\tReactions,\r\n\tRecipient,\r\n\tRetrievedChat,\r\n\tRetrievedChatUsers,\r\n\tRetrievedHubMessageDetails,\r\n\tRetrievedHubMessages,\r\n\tServiceResponse,\r\n\tVarioEmployee,\r\n\tVarioHubModels,\r\n\tVarioObject,\r\n\tVarioObjectContent,\r\n} from \"../types/models/vario-types\";\r\nimport {\r\n\tDragObject,\r\n\tdragEnterFunc,\r\n\tdragLeaveFunc,\r\n\tpreventDefaults,\r\n} from \"./devextreme-table-functions\";\r\nimport { AddFiles } from \"./editor\";\r\nimport { prepareLink, validateEmail } from \"./emails\";\r\nimport { previewFile } from \"./item-sources\";\r\nimport { refreshNotifyNumber, refreshNotifyPanel } from \"./notifications\";\r\nimport { GetBaseUrl, changeCurrentItem } from \"./page-navigation\";\r\nimport {\r\n\tcheckIfNeedsRequeryRecipients,\r\n\tcreateRecipientsList,\r\n\tgetRecipientsFromHub,\r\n} from \"./recipients\";\r\nimport {\r\n\tCloseBigDialog,\r\n\tCloseDialog,\r\n\tHideLoadingPanel,\r\n\tShowLoadingPanel,\r\n\tcalcMinPopup,\r\n\tcheckWhereIsUser,\r\n\tconvertDate,\r\n\tconvertToNonPolishLetters,\r\n\tdownloadFileFromLink,\r\n\tfixScrollInDx,\r\n\tfixStringToPreventJSErrors,\r\n\thexToRgb,\r\n\tisRunningOnMobile,\r\n\tpushNotification,\r\n\tsetContrast,\r\n\tshowDxToast,\r\n\tstringIsNullOrEmpty,\r\n\tsupportedContent,\r\n\turlify,\r\n\tuuidv4,\r\n\twaitForElm,\r\n} from \"./site\";\r\nimport { checkChatForPosition } from \"./vario-object\";\r\nimport { addFilePreview } from \"./vario-object-side-panel\";\r\n\r\nconst reactionsArr = {\r\n\t1: { emoji: \"\uD83D\uDC4D\", title: \"\u0141apka w g\u00F3r\u0119\" },\r\n\t2: { emoji: \"\u2764\uFE0F\", title: \"Serduszko\" },\r\n\t3: { emoji: \"\uD83D\uDE02\", title: \"\u015Amiech\" },\r\n\t4: { emoji: \"\uD83D\uDE2D\", title: \"P\u0142acz\" },\r\n\t5: { emoji: \"\uD83D\uDE2E\", title: \"Szok\" },\r\n};\r\n\r\n///AJAX\r\n//Pobranie listy wszystkich czat\u00F3w bie\u017C\u0105cego usera\r\nexport function retrieveChats(\r\n\tcallback: (response: ServiceResponse) => void\r\n) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/RetrieveChats`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(\"retrieveChats\", response);\r\n\r\n\t\t\tsessionStorage.setItem(\"chatList\", JSON.stringify(response.data));\r\n\t\t\tif (callback !== undefined) {\r\n\t\t\t\tcallback(response);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//Stworzenie wiadomo\u015Bci. Je\u017Celi jest to pierwsza wiadomo\u015B\u0107 (czat jeszcze nie istnieje) nale\u017Cy poda\u0107 msgBody, recipients i opcjonalnie itemID i itemType.\r\n//Je\u017Celi to kolejna wiadomo\u015B\u0107 to nale\u017Cy poda\u0107 chatID i msgBody\r\nexport function createMessage(\r\n\tchatID?: number,\r\n\titemID?: number,\r\n\titemType?: number,\r\n\tmsgBody?: string,\r\n\trecipients?: string,\r\n\tfiles?: Blob[],\r\n\tfilesFromVario?: FilesFromVario[],\r\n\tcallback?: (response: ServiceResponse) => void\r\n) {\r\n\tconst form_data = new FormData();\r\n\tform_data.append(\"chatID\", chatID?.toString() ?? \"\");\r\n\tform_data.append(\"itemID\", itemID?.toString() ?? \"\");\r\n\tform_data.append(\"itemType\", itemType?.toString() ?? \"\");\r\n\tform_data.append(\"msgBody\", msgBody ?? \"\");\r\n\tform_data.append(\"recipients\", recipients ?? \"\");\r\n\tform_data.append(\"attachmentID\", \"\");\r\n\r\n\tif ((filesFromVario?.length ?? 0) > 0) {\r\n\t\tform_data.append(\r\n\t\t\t\"attachmentIDs\",\r\n\t\t\tJSON.stringify(filesFromVario?.map((x) => (x as FilesFromVario).itemId))\r\n\t\t);\r\n\t}\r\n\r\n\tif (files)\r\n\t\tfor (const file of files) {\r\n\t\t\tform_data.append(\"files\", file);\r\n\t\t}\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/CreateMessage`,\r\n\t\tcache: false,\r\n\t\tcontentType: false,\r\n\t\tprocessData: false,\r\n\t\tdata: form_data,\r\n\t\ttype: \"post\",\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(\"createMessage\", response);\r\n\r\n\t\t\tif (callback !== undefined) {\r\n\t\t\t\tcallback(response);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t\tshowDxToast(\"Wiadomo\u015B\u0107 nie zosta\u0142a wys\u0142ana\", \"warning\");\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//Pobranie wiadomo\u015Bci z konkretnego czatu\r\nexport function retrieveMessages(\r\n\tchatID: number,\r\n\ttopCount,\r\n\tfromMessageID: number | null,\r\n\tcallback: (response: ServiceResponse) => void\r\n) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/RetrieveMessages?chatID=${chatID}&topCount=${topCount}&fromMessageID=${fromMessageID}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(\"retrieveMessages\", response);\r\n\r\n\t\t\tif (callback !== undefined) {\r\n\t\t\t\tcallback(response);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d pobierania wiadomo\u015Bci\", \"warning\");\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//Oznaczenie wiadomo\u015Bci jako przeczytanych z konkretnego czatu\r\nexport function markChatAsRead(\r\n\tchatID: number,\r\n\tcallback: (response: ServiceResponse) => void\r\n) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/MarkChatAsRead?chatID=${chatID}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(\"markChatAsRead\", response);\r\n\r\n\t\t\tif (callback !== undefined) {\r\n\t\t\t\tcallback(response);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//Usuni\u0119cie currentUsera z wybranego czatu(grupowego, zwi\u0105zanego z pozycj\u0105)\r\nexport function RemoveUserFromChat(\r\n\tchatID: number,\r\n\tcallback: (response: ServiceResponse) => void\r\n) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/RemoveUserFromChat?chatID=${chatID}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(\"RemoveUserFromChat\", response);\r\n\r\n\t\t\tif (callback !== undefined) {\r\n\t\t\t\tcallback(response);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d opuszczenia czatu\", \"warning\");\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//Dodanie usera do czatu. Stworzy nowy czat grupowy, a je\u015Bli to ju\u017C jest czat grupowy to doda nowego uczestnika\r\nexport function AddUserToChat(\r\n\tchatID: number,\r\n\tuserIDs: number[],\r\n\tcallback: (response: ServiceResponse) => void\r\n) {\r\n\tShowLoadingPanel(\"Dodawanie do czatu...\");\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/AddUserToChat?chatID=${chatID}`,\r\n\t\ttype: \"Post\",\r\n\t\tdataType: \"json\",\r\n\t\tdata: { userIDs: userIDs },\r\n\t\tcache: false,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(\"AddUserToChat\", response);\r\n\r\n\t\t\tif (callback !== undefined) {\r\n\t\t\t\tcallback(response);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d dodawania uczestnika do czatu\", \"warning\");\r\n\t\t},\r\n\t\tcomplete: () => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//Pobranie recipientow konkretnego czatu\r\nexport async function RetrieveChatRecipients(\r\n\tchatID: number,\r\n\tcallback: (response: ServiceResponse) => void\r\n) {\r\n\tconst res: ServiceResponse = await $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/RetrieveChatRecipients?chatID=${chatID}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(\"RetrieveChatRecipients\", response);\r\n\r\n\t\t\tif (callback !== undefined) {\r\n\t\t\t\tcallback(response);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t},\r\n\t});\r\n\r\n\tif (res?.success) {\r\n\t\tawait checkIfNeedsRequeryRecipients(res?.data);\r\n\t}\r\n}\r\n\r\n//Pobranie informacji o czacie konkretnej pozycji (czy isnieje)\r\nexport function RetrieveChatForPosition(\r\n\tfullItemID: string,\r\n\tcallback: (response: ServiceResponse) => void\r\n) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/RetrieveChatForPosition?fullItemID=${fullItemID}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(\"RetrieveChatForPosition\", response);\r\n\r\n\t\t\tif (callback !== undefined) {\r\n\t\t\t\tcallback(response);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//Do\u0142\u0105czenie do czatu zwi\u0105zanego z pozycj\u0105\r\nexport function JoinToChatForPosition(\r\n\tchatID: number | undefined,\r\n\tfullItemID: string,\r\n\tcallback: (response: ServiceResponse) => void\r\n) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/JoinToChatForPosition?chatID=${chatID}&fullItemID=${fullItemID}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(\"JoinToChatForPosition\", response);\r\n\r\n\t\t\tif (callback !== undefined) {\r\n\t\t\t\tcallback(response);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//Usuni\u0119ci\u0119 wiadomo\u015Bci z czatu\r\nexport function RemoveMessageFromChat(\r\n\tmessageID: number,\r\n\tcallback: (response: ServiceResponse) => void\r\n) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/RemoveMessageFromChat?messageID=${messageID}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(\"RemoveMessageFromChat\", response);\r\n\r\n\t\t\tif (callback !== undefined) {\r\n\t\t\t\tcallback(response);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//Dodanie/usuni\u0119cie reakcji z czatu\r\nexport function AddReactionToMessageChat(\r\n\tmessageID: number,\r\n\treaction: string,\r\n\tcallback: (response: ServiceResponse) => void\r\n) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/AddReactionToMessageChat?messageID=${messageID}&reaction=${reaction}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(\"AddReactionToMessageChat\", response);\r\n\r\n\t\t\tif (callback !== undefined) {\r\n\t\t\t\tcallback(response);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//Pobranie szczeg\u00F3\u0142ow wiadomo\u015Bci\r\nexport function RetrieveMessageDetails(\r\n\tmessageID: number,\r\n\tcallback: (response: ServiceResponse) => void\r\n) {\r\n\treturn $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/RetrieveMessageDetails?messageID=${messageID}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(\"RetrieveMessageDetails\", response);\r\n\r\n\t\t\tif (callback !== undefined) {\r\n\t\t\t\tcallback(response);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//Stworzenie nowego adresata email - Stworzenie nowego usera lub contact entry istniej\u0105cego usera w celu dodania go do listy adresowej\r\nexport function CreateUserOrAddContactEntry(\r\n\temailAddress: string,\r\n\tcallback: (response: ServiceResponse) => void\r\n) {\r\n\tconst form_data = new FormData();\r\n\tform_data.append(\"emailAddress\", emailAddress);\r\n\tform_data.append(\"appBaseUrl\", prepareLink(\"\"));\r\n\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\treturn $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/CreateUserOrAddContactEntry`,\r\n\t\tcache: false,\r\n\t\tcontentType: false,\r\n\t\tprocessData: false,\r\n\t\tdata: form_data,\r\n\t\ttype: \"post\",\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(\"CreateUserOrAddContactEntry\", response);\r\n\r\n\t\t\tif (callback !== undefined) {\r\n\t\t\t\tcallback(response);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t},\r\n\t\tcomplete: () => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\n///AJAX END\r\n\r\n//Pobranie ilo\u015Bci czat\u00F3w z nowymi wiadomo\u015Bciami\r\n\r\nlet chatPopupFirstOpen = true;\r\n\r\nexport function getUnreadChatsNumber() {\r\n\tretrieveChats((response) => {\r\n\t\tconst unreadChatsIDs: number[] = [];\r\n\r\n\t\tif (response?.success) {\r\n\t\t\tfor (const element of response.data) {\r\n\t\t\t\tif (element.lastMessageIsRead === false) {\r\n\t\t\t\t\tunreadChatsIDs.push(element.chatID);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tshowMessagesNotifySummary(response.data);\r\n\t\t}\r\n\r\n\t\tsessionStorage.setItem(\"unreadChats\", JSON.stringify(unreadChatsIDs));\r\n\t\tupdateUnreadChatsNumber(unreadChatsIDs.length);\r\n\t});\r\n}\r\n\r\n//Zaktualizowanie ikony dymka czatu\r\nexport function updateUnreadChatsNumber(number: number) {\r\n\t$(\"#unreadMessagesNumber\").text(number);\r\n\t$(\"#unreadMessagesNumberMobile\").text(number);\r\n\r\n\tif (number <= 0) {\r\n\t\t$(\"#unreadMessagesNumber\").addClass(\"hidden\");\r\n\t\t$(\"#unreadMessagesNumberMobile\").addClass(\"hidden\");\r\n\t} else {\r\n\t\t$(\"#unreadMessagesNumber\").removeClass(\"hidden\");\r\n\t\t$(\"#unreadMessagesNumberMobile\").removeClass(\"hidden\");\r\n\t}\r\n}\r\n\r\n//Wys\u0142anie powiadomienia przez hub do user\u00F3w o nowej wiadomo\u015Bci\r\nexport function sendHubNotifyAfterCreateMessage(\r\n\tchatID?: number,\r\n\titemID?: number,\r\n\titemType?: number,\r\n\tmsgBody?: string,\r\n\trecipients?: string,\r\n\tfiles?: File[],\r\n\tfilesFromVario?: FilesFromVario[]\r\n) {\r\n\tcreateMessage(\r\n\t\tchatID,\r\n\t\titemID,\r\n\t\titemType,\r\n\t\tmsgBody,\r\n\t\trecipients,\r\n\t\tfiles,\r\n\t\tfilesFromVario,\r\n\t\t(response) => {\r\n\t\t\tlet fileNames = \"\";\r\n\t\t\tlet varioFileNames = \"\";\r\n\t\t\tif (files?.length) {\r\n\t\t\t\tfileNames = fixStringToPreventJSErrors(\r\n\t\t\t\t\tfiles?.map((x) => x.name)?.join(\", \") ?? \"\"\r\n\t\t\t\t);\r\n\r\n\t\t\t\t$(`.attachmentSendingLoader[data-file-names=\"${fileNames}\"]`).remove();\r\n\t\t\t}\r\n\r\n\t\t\tif (filesFromVario?.length) {\r\n\t\t\t\tvarioFileNames = fixStringToPreventJSErrors(\r\n\t\t\t\t\tfilesFromVario?.map((x) => x.name)?.join(\", \") ?? \"\"\r\n\t\t\t\t);\r\n\r\n\t\t\t\t$(\r\n\t\t\t\t\t`.attachmentSendingLoader[data-file-names=\"${varioFileNames}\"]`\r\n\t\t\t\t).remove();\r\n\t\t\t}\r\n\r\n\t\t\tif (response?.success) {\r\n\t\t\t\t{\r\n\t\t\t\t\tlet _chatID = -1;\r\n\t\t\t\t\tif (chatID) {\r\n\t\t\t\t\t\t_chatID = chatID;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t_chatID = response.data.newCreatedChatID ?? -1;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tOnSendMessageChatHandler(_chatID, msgBody ?? \"\", recipients ?? \"\");\r\n\r\n\t\t\t\t\t//Wyslanie wiadomosci w czacie do samego siebie. Nie chcemy nic wysy\u0142a\u0107 w hubie\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tresponse.data.recipientsIDs == null ||\r\n\t\t\t\t\t\tresponse.data.recipientsIDs.length === 0\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tlet msg = \"Wys\u0142a\u0142 pliki: \";\r\n\t\t\t\t\tif (msgBody?.length === 0 && files?.length) {\r\n\t\t\t\t\t\tif (files.length === 1) msg = \"Wys\u0142a\u0142 plik: \";\r\n\t\t\t\t\t\tmsg += fileNames;\r\n\t\t\t\t\t} else if (msgBody?.length === 0 && filesFromVario?.length) {\r\n\t\t\t\t\t\tif (filesFromVario.length === 1) msg = \"Wys\u0142a\u0142 plik: \";\r\n\t\t\t\t\t\tmsg += varioFileNames;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (msgBody && msgBody?.length > 0) {\r\n\t\t\t\t\t\tmsg = \"\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst trimmedBody = (msgBody + msg).substring(0, 300);\r\n\r\n\t\t\t\t\tsendViaHub(\r\n\t\t\t\t\t\tresponse.data.messageID,\r\n\t\t\t\t\t\t_chatID,\r\n\t\t\t\t\t\tresponse.data.recipientsIDs,\r\n\t\t\t\t\t\ttrimmedBody,\r\n\t\t\t\t\t\t1\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"Wiadomo\u015B\u0107 nie zosta\u0142a wys\u0142ana\", \"warning\");\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n}\r\n\r\nexport async function sendViaHub(\r\n\tmessageID: number,\r\n\tchatID: number,\r\n\trecipientsIDs: number[] | null,\r\n\tbody: string,\r\n\tmessageType: VarioHubModels.MessageType\r\n) {\r\n\tif (!recipientsIDs || recipientsIDs?.length === 0) {\r\n\t\trecipientsIDs = JSON.parse(\r\n\t\t\t$(`.chatHeaderUser[data-chatId=\"${chatID}\"]`).attr(\"data-participants\") ??\r\n\t\t\t\t\"null\"\r\n\t\t);\r\n\r\n\t\tif (!recipientsIDs) {\r\n\t\t\tawait RetrieveChatRecipients(chatID, (response) => {\r\n\t\t\t\tif (response?.success) {\r\n\t\t\t\t\trecipientsIDs = response.data.map((obj) => obj.userID);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tconst messageRequestModel: VarioHubModels.RequestMessage = {\r\n\t\tmessageID: messageID,\r\n\t\tchatID: chatID,\r\n\t\trecipients: recipientsIDs ?? [],\r\n\t\tmessage: body,\r\n\t\ttopic: \"\",\r\n\t\tmessageLevel: 1,\r\n\t\ticon: \"\",\r\n\t\tmessageType: messageType,\r\n\t\tdelay: 0,\r\n\t\trequired: false,\r\n\t};\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/HubProxy/SendMessage`,\r\n\t\ttype: \"Post\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: { requestMessage: messageRequestModel },\r\n\t\tsuccess: (_: boolean) => {},\r\n\t\terror: (error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//Hub wys\u0142a\u0142 powiadomienie o otrzymaniu nowej wiadomo\u015Bci.\r\nexport function OnReceiveMessageChatHandler(\r\n\tResponseMessage: VarioHubModels.ResponseMessage\r\n) {\r\n\tif (debug) console.log(\"OnReceiveMessageChatHandler\", ResponseMessage);\r\n\r\n\tif (ResponseMessage.messageType === 2) {\r\n\t\tonMessageRemovedFromChatFromHub(ResponseMessage);\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (ResponseMessage.messageType === 3) {\r\n\t\tif (ResponseMessage.message?.length > 0) {\r\n\t\t\tShowToastMessage(ResponseMessage);\r\n\t\t}\r\n\t\tif (ResponseMessage.messageID)\r\n\t\t\tappendReactions(ResponseMessage.messageID, null, 0);\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\tif ($(\"#devex-dialog-chat\").dxPopup(\"instance\").option(\"visible\") === true) {\r\n\t\tif (ResponseMessage.chatID != null) {\r\n\t\t\t//Aktualizacja pojedynczego czatu w apnelu po lewej danymi kt\u00F3re przysz\u0142y\r\n\t\t\tupdateSingleChatLeft(\r\n\t\t\t\tResponseMessage.chatID,\r\n\t\t\t\tResponseMessage.message,\r\n\t\t\t\t\"other\"\r\n\t\t\t);\r\n\r\n\t\t\t//Od\u015Bwie\u017Cenie okna czatu (je\u017Celi ten czat jest aktualnie otwarty przez usera). Dla pewno\u015Bci pobierane s\u0105 3 ostatnie wiadomo\u015Bci i s\u0105 aapendowane (je\u017Celi jeszcze ich nie ma)\r\n\t\t\tif (\r\n\t\t\t\t$(`*[data-chat-id=${ResponseMessage.chatID}]`).hasClass(\"activeChat\")\r\n\t\t\t) {\r\n\t\t\t\tretrieveMessages(ResponseMessage.chatID, 3, null, (response) => {\r\n\t\t\t\t\tif (response?.success) {\r\n\t\t\t\t\t\tappendChatHistory(response.data);\r\n\r\n\t\t\t\t\t\t//Po dodaniu wiadomo\u015Bci robi si\u0119 scroll na sam d\u00F3\u0142. CO je\u015Bli kto\u015B scrolluje sobie na g\u00F3re w poszukiwniu wiadomo\u015Bci starej?\r\n\t\t\t\t\t\t//TODO scroll zrobi\u0107 tylko je\u015Bli user nie ma scrollbara wy\u017Cej ni\u017C jaka\u015B pozycja?\r\n\t\t\t\t\t\tscrollChatToBottom();\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\t//Wy\u015Bwietlenie tosta z wiadomo\u015Bci\u0105. Zostanie wy\u015Bwietlony tylko wtedy je\u015Bli nie mamy otwartego okna i nie jeste\u015Bmy w czacie z kt\u00F3rego przysz\u0142a wiadomo\u015B\u0107\r\n\tif (\r\n\t\t!(\r\n\t\t\t$(\"#devex-dialog-chat\").dxPopup(\"instance\").option(\"visible\") === true &&\r\n\t\t\t$(`*[data-chat-id=${ResponseMessage.chatID}]`).hasClass(\"activeChat\")\r\n\t\t)\r\n\t) {\r\n\t\tShowToastMessage(ResponseMessage);\r\n\t}\r\n\r\n\tconst lastActiveChat = Number(localStorage.getItem(\"lastActiveChat\"));\r\n\r\n\t//Od\u015Bwie\u017Cenie liczby nieprzeczytanych czat\u00F3w na dymku\r\n\tlet unreadChats = JSON.parse(sessionStorage.getItem(\"unreadChats\") ?? \"null\");\r\n\tif (ResponseMessage.chatID != null) {\r\n\t\tif (unreadChats != null && Array.isArray(unreadChats)) {\r\n\t\t\tconst index = unreadChats.indexOf(ResponseMessage.chatID);\r\n\t\t\tif (\r\n\t\t\t\tindex === -1 &&\r\n\t\t\t\t!(\r\n\t\t\t\t\tlastActiveChat === ResponseMessage.chatID &&\r\n\t\t\t\t\t$(\"#chatInput\").is(\":focus\")\r\n\t\t\t\t)\r\n\t\t\t) {\r\n\t\t\t\tunreadChats.push(ResponseMessage.chatID);\r\n\t\t\t\tupdateUnreadChatsNumber(unreadChats.length);\r\n\r\n\t\t\t\tsessionStorage.setItem(\"unreadChats\", JSON.stringify(unreadChats));\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tunreadChats = [];\r\n\t\t\tunreadChats.push(ResponseMessage.chatID);\r\n\t\t\tsessionStorage.setItem(\"unreadChats\", JSON.stringify(unreadChats));\r\n\t\t}\r\n\t}\r\n\r\n\tif (\r\n\t\tlastActiveChat === ResponseMessage.chatID &&\r\n\t\t$(\"#chatInput\").is(\":focus\")\r\n\t) {\r\n\t\tmarkChatAsReadFront(ResponseMessage.chatID);\r\n\t}\r\n\r\n\t//getUnreadChatsNumber();\r\n\r\n\t//Kroki do wykonania (Prawdopodobne)\r\n\t//Je\u017Celi nie mamy aktywne okienko czatu i kursor nie jest zfocusowany do pisania w tym czacie, zrobic dx toast z waidomo\u015Bci\u0105 (jeszcze jest w funkcji OnReceiveMessage)\r\n\t//Je\u017Celi mamy aktywne okienko tego czatu to pobra\u0107 z tego czatu ostatnie 5 wiadomosci. (Teoretycznie mozna uzyc tego co przyszlo z ResponseMessage. Pobranie z bazy bezpieczniejsze ale gorsza wydajnosc) Zaktualizowac okienko historii czatu. Wyslac request ktory zaktualizuje status przeczytania wiadomosci\r\n\t//Jezeli mamy aktywne glowy popup czatu zaktualizowac boczny panel z wszystkimi czatami. Uzyc retrieveChats czy samemu zbudowa\u0107 z tego co przyszlo?\r\n}\r\n\r\nexport function generateRandomColor(text: string) {\r\n\tif (stringIsNullOrEmpty(text)) return \"FFFFFF\";\r\n\r\n\ttext = convertToNonPolishLetters(text);\r\n\r\n\tlet randomColor = (\r\n\t\tNumber.parseInt(\r\n\t\t\tNumber.parseInt(text, 36).toExponential().slice(2, -5),\r\n\t\t\t10\r\n\t\t) & 0xffffff\r\n\t)\r\n\t\t.toString(16)\r\n\t\t.toUpperCase();\r\n\r\n\tfor (let i = 0; i < 6; i++) {\r\n\t\tif (randomColor.length === i) randomColor += \"0\".repeat(6 - i);\r\n\t}\r\n\r\n\treturn randomColor;\r\n}\r\n\r\nexport function createUserIcon(\r\n\telement?: Partial &\r\n\t\tPartial &\r\n\t\tPartial\r\n) {\r\n\ttry {\r\n\t\tlet chatType = \"\";\r\n\r\n\t\tlet letters = \"\";\r\n\r\n\t\tlet caption =\r\n\t\t\telement?.chatCaption ??\r\n\t\t\telement?.recipientName ??\r\n\t\t\telement?.operatorCaption ??\r\n\t\t\t\"\";\r\n\r\n\t\t//Chat wieloosobowy\r\n\t\tif (\r\n\t\t\tcaption.includes(\"(+\") ||\r\n\t\t\t(element?.groupChat && element?.relatedObjectDef == null)\r\n\t\t) {\r\n\t\t\tchatType = \"Multi\";\r\n\t\t\tletters = prepareLetters(caption, chatType);\r\n\t\t} else {\r\n\t\t\t//Chat 1:1\r\n\t\t\tchatType = \"Single\";\r\n\t\t\tletters = prepareLetters(caption, chatType);\r\n\t\t}\r\n\r\n\t\tconst randomColor = generateRandomColor(caption);\r\n\r\n\t\tconst textColor = setContrast(hexToRgb(`#${randomColor}`));\r\n\r\n\t\tif (\r\n\t\t\telement &&\r\n\t\t\t(typeof element?.relatedObjectDef === \"undefined\" ||\r\n\t\t\t\telement?.relatedObjectDef?.toString() === \"undefined\")\r\n\t\t)\r\n\t\t\telement.relatedObjectDef = null;\r\n\t\tlet isBaseImage = false;\r\n\r\n\t\t//Chat w kontek\u015Bcie pozycji\r\n\t\tlet chatIcon = ` ${letters}`;\r\n\t\tif (element?.itemID && element?.itemType && element?.relatedObjectDef) {\r\n\t\t\tchatType = \"Position\";\r\n\r\n\t\t\tif (element.relatedObjectDef !== -1) {\r\n\t\t\t\tlet defIconUrl = element.relatedObjectDef.toString();\r\n\t\t\t\tisBaseImage =\r\n\t\t\t\t\tdefIconUrl.toString().includes(\"base64\") ||\r\n\t\t\t\t\tdefIconUrl.toString().includes(\"GetIcon\");\r\n\t\t\t\tif (!isBaseImage)\r\n\t\t\t\t\tdefIconUrl = `${GetBaseUrl()}/Vario/GetImageForDefinition/?definitionVerID=${element.relatedObjectDef}&imageSize=large`;\r\n\r\n\t\t\t\tchatIcon = ``;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst statusCircle = prepareStatusCircle(caption, chatType);\r\n\r\n\t\tlet baseImageClass = \"\";\r\n\t\tif (isBaseImage) baseImageClass = \" baseImage\";\r\n\r\n\t\tif (element?.outsideRecipient) caption += ` (${element.siteCaption})`;\r\n\r\n\t\treturn `
\r\n ${chatIcon}\r\n ${statusCircle}\r\n
`;\r\n\t} catch (e) {\r\n\t\tconsole.warn(e);\r\n\t\treturn \"\";\r\n\t}\r\n}\r\n\r\n//Uda\u0142o si\u0119 poprawnie zapisa\u0107 wiadomo\u015B\u0107 do bazy. Od\u015Bwie\u017Cenie graficznych element\u00F3w.\r\nexport function OnSendMessageChatHandler(\r\n\tchatID: number | null,\r\n\tmsgBody: string,\r\n\trecipients: string\r\n) {\r\n\t//W\u0142a\u015Bnie poprawnie zosta\u0142a wys\u0142ana pierwsza wiadomo\u015B\u0107 w czacie tworz\u0105ca nowy czat. Pobra\u0107 aktualn\u0105 list\u0119 czat\u00F3w, zmieni\u0107 zak\u0142adk\u0119 na czaty i wybra\u0107 aktywny czat\r\n\tif (recipients) {\r\n\t\trepaintChats(chatID);\r\n\t\t$(\"#tabBtnChats\").trigger(\"click\");\r\n\t\t$(\"#tabBtnChats\").addClass(\"active\");\r\n\t\t$(\"#tabBtnContacts\").removeClass(\"active\");\r\n\t} else {\r\n\t\tupdateSingleChatLeft(chatID, msgBody, \"me\");\r\n\t}\r\n\r\n\tif (chatID) {\r\n\t\t//Od\u015Bwie\u017Cenie okna czatu. Dla pewno\u015Bci pobierane s\u0105 3 ostatnie wiadomo\u015Bci i s\u0105 aapendowane (je\u017Celi jeszcze ich nie ma)\r\n\t\tretrieveMessages(chatID, 3, null, (response) => {\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tappendChatHistory(response.data);\r\n\r\n\t\t\t\tscrollChatToBottom();\r\n\t\t\t\tfocusChatInput();\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n}\r\n\r\n//Otwarcie g\u0142\u00F3wnego popapu z chatem\r\nexport function OpenMainChatPopup() {\r\n\treturn new Promise((resolve, reject) => {\r\n\t\ttry {\r\n\t\t\tlet recipientsPromise: Promise = Promise.resolve(null);\r\n\r\n\t\t\tif (sessionStorage.getItem(\"Recipients\") == null) {\r\n\t\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\t\t\trecipientsPromise = getRecipientsFromHub();\r\n\t\t\t}\r\n\r\n\t\t\trecipientsPromise.then(() => {\r\n\t\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\t\t\tretrieveChats((response) => {\r\n\t\t\t\t\tconst unreadChatsIDs: number[] = [];\r\n\r\n\t\t\t\t\tif (response?.success) {\r\n\t\t\t\t\t\tfor (const element of response.data) {\r\n\t\t\t\t\t\t\tif (element.lastMessageIsRead === false) {\r\n\t\t\t\t\t\t\t\tunreadChatsIDs.push(element.chatID);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tsessionStorage.setItem(\"unreadChats\", JSON.stringify(unreadChatsIDs));\r\n\t\t\t\t\tupdateUnreadChatsNumber(unreadChatsIDs.length);\r\n\r\n\t\t\t\t\tconst popup = $(\"#devex-dialog-chat\").dxPopup(\"instance\");\r\n\t\t\t\t\tif (isRunningOnMobile()) {\r\n\t\t\t\t\t\tpopup.option(\"maxWidth\", \"100vw\");\r\n\t\t\t\t\t\tpopup.option(\"maxHeight\", \"95vh\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tpopup.option(\"maxWidth\", \"80vw\");\r\n\t\t\t\t\t\tpopup.option(\"maxHeight\", \"90vh\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpopup.option(\"minWidth\", 300);\r\n\t\t\t\t\tpopup.option(\"minHeight\", 500);\r\n\r\n\t\t\t\t\tpopup.option(\r\n\t\t\t\t\t\t\"titleTemplate\",\r\n\t\t\t\t\t\t`\r\n
\r\n \r\n
\r\n \r\n \r\n
\r\n
\r\n `\r\n\t\t\t\t\t);\r\n\t\t\t\t\tpopup.option(\"contentTemplate\", $(\"#Main-Dialog-Chat\"));\r\n\t\t\t\t\tpopup.option(\"onResize\", onChatPopupResize);\r\n\r\n\t\t\t\t\tif (isRunningOnMobile()) {\r\n\t\t\t\t\t\tpopup.option(\"dragEnabled\", false);\r\n\t\t\t\t\t\tpopup.option(\"resizeEnabled\", false);\r\n\t\t\t\t\t\tpopup.option(\"shading\", true);\r\n\t\t\t\t\t\tpopup.option(\"restorePosition\", true);\r\n\t\t\t\t\t\tpopup.option(\"position\", {\r\n\t\t\t\t\t\t\tmy: \"center\",\r\n\t\t\t\t\t\t\tat: \"center\",\r\n\t\t\t\t\t\t\tof: window,\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tpopup.option(\"dragEnabled\", true);\r\n\t\t\t\t\t\tpopup.option(\"resizeEnabled\", true);\r\n\t\t\t\t\t\tpopup.option(\"shading\", false);\r\n\t\t\t\t\t\tpopup.option(\"restorePosition\", false);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tpopup.show();\r\n\t\t\t\t\tpopup\r\n\t\t\t\t\t\t.content()\r\n\t\t\t\t\t\t?.parent()\r\n\t\t\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t\t\t\t$(\"#devex-dialog-chat\").dxPopup({\r\n\t\t\t\t\t\tonHidden: () => {\r\n\t\t\t\t\t\t\tchatPopupFirstOpen = true;\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t$(\"#MainDialogChat\").empty();\r\n\t\t\t\t\t$(\"#MainDialogChat\").append(`\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n \r\n \r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n `);\r\n\r\n\t\t\t\t\t$(\"#chatSearch\").on(\"keyup\", (event: JQuery.KeyUpEvent) => {\r\n\t\t\t\t\t\tfilterChat($(event.currentTarget).val()?.toString() ?? \"\");\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tif ($(\"#tabBtnContacts\").hasClass(\"active\")) {\r\n\t\t\t\t\t\t$(\"#chatSearch\").attr(\r\n\t\t\t\t\t\t\t\"placeholder\",\r\n\t\t\t\t\t\t\t\"Szukaj lub wprowad\u017A adres email\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$(\"#chatSearch\").attr(\"placeholder\", \"Szukaj\");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tcreateEmptyChatView();\r\n\t\t\t\t\tCreateChatPopupContent(response, null);\r\n\t\t\t\t\tfixScrollInDx(\"#chatList\");\r\n\t\t\t\t\tfixScrollInDx(\"#contactsList\");\r\n\r\n\t\t\t\t\tHideLoadingPanel();\r\n\r\n\t\t\t\t\tif ((Number(popup.option(\"width\")) ?? -1) < 800) hideChatNav();\r\n\r\n\t\t\t\t\tresolve(response);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t} catch (e) {\r\n\t\t\tconsole.log(e);\r\n\t\t\tHideLoadingPanel();\r\n\t\t\treject(e);\r\n\t\t}\r\n\t});\r\n}\r\n\r\n//Stworzenie kontentu do g\u0142\u00F3wnego popapu (lista czat\u00F3w)\r\nexport function CreateChatPopupContent(\r\n\tresponse: ServiceResponse,\r\n\tchatIDToSelect: number | null\r\n) {\r\n\trequestForMessagesId = undefined;\r\n\r\n\ttry {\r\n\t\t$(\"#chatList\").empty();\r\n\t\tif (response.data.length === 0) {\r\n\t\t\t$(\"#chatList\").append(`\r\n
\r\n Twoja lista czat\u00F3w jest pusta. Napisz do kogo\u015B wybieraj\u0105c go z listy kontakt\u00F3w!\r\n
\r\n `);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tfor (const element of response.data) {\r\n\t\t\tlet extraBold = \"\";\r\n\t\t\tconst unRead = !element.lastMessageIsRead;\r\n\t\t\tif (unRead) {\r\n\t\t\t\textraBold = \"extraBold\";\r\n\t\t\t}\r\n\r\n\t\t\tconst userIcon = createUserIcon(element);\r\n\r\n\t\t\tconst html = $.parseHTML(element.body);\r\n\t\t\tconst message =\r\n\t\t\t\thtml.find((x) => x.nodeName.toLowerCase().includes(\"text\"))\r\n\t\t\t\t\t?.textContent ?? \"\";\r\n\r\n\t\t\tconst extraTitle = stringIsNullOrEmpty(message)\r\n\t\t\t\t? \"\"\r\n\t\t\t\t: `title=\"${message}\"`;\r\n\r\n\t\t\tconst where = groupChats(\r\n\t\t\t\telement,\r\n\t\t\t\tJSON.parse(localStorage.getItem(\"groupChatContacts\") ?? \"null\")\r\n\t\t\t);\r\n\r\n\t\t\t$(where ?? \"\").append(`\r\n
\r\n ${userIcon}\r\n
\r\n
${element.chatCaption}
\r\n
${message}
\r\n
\r\n
${element.lastMessageCreationDate}
\r\n
\r\n `);\r\n\r\n\t\t\t$(`*[data-chat-id=${element.chatID}]`).on(\r\n\t\t\t\t\"click\",\r\n\t\t\t\tasync (event: JQuery.ClickEvent) => {\r\n\t\t\t\t\tawait createChatTextPanel($(event.currentTarget), element);\r\n\t\t\t\t\tlocalStorage.setItem(\"lastActiveChat\", element.chatID?.toString());\r\n\t\t\t\t\tsetActiveChatCSS(element.chatID, \"chat\");\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (chatIDToSelect == null) {\r\n\t\t\tconst lastActiveChat = localStorage.getItem(\"lastActiveChat\");\r\n\t\t\tif (lastActiveChat != null) {\r\n\t\t\t\t$(`*[data-chat-id=${lastActiveChat}]`).trigger(\"click\");\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t//Chcemy pownie zaznaczy\u0107, boldem aktualnie wybrany czat (otrzymalismy nowy czat, menu czat\u00F3w z lewej zosta\u0142o przebudowane)\r\n\t\t\tif (chatIDToSelect === -1) {\r\n\t\t\t\tconst lastActiveChat = localStorage.getItem(\"lastActiveChat\");\r\n\t\t\t\tif (lastActiveChat != null) {\r\n\t\t\t\t\t$(`*[data-chat-id=${lastActiveChat}]`).addClass(\"activeChat\");\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t$(`*[data-chat-id=${chatIDToSelect}]`).trigger(\"click\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfilterChat();\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t}\r\n}\r\n\r\nexport function groupChats(element?: RetrievedChat, group?: boolean | null) {\r\n\tconst isntGrouped = $(\"#singlePersonChatsHeader\").length === 0;\r\n\tif (group == null) group = isntGrouped;\r\n\r\n\tlocalStorage.setItem(\"groupChatContacts\", group.toString());\r\n\r\n\tlet where = \"#chatList\";\r\n\r\n\tlet list: JQuery | null = null;\r\n\tif (!element) {\r\n\t\tlist = $(\"#chatList .singleChat\").clone(true, true);\r\n\t\t$(\"#chatList\").empty();\r\n\t}\r\n\r\n\tif (group) {\r\n\t\t$(\"#groupChatContactsButton\").attr(\"title\", \"Wy\u0142\u0105cz grupowanie czat\u00F3w\");\r\n\t\t$(\"#groupChatContactsButton\").addClass(\"active\");\r\n\r\n\t\tif (isntGrouped) {\r\n\t\t\t$(\"#chatList\").empty();\r\n\r\n\t\t\t$(\"#chatList\").append(`\r\n
Czaty osobowe
\r\n
\r\n
Czaty grupowe
\r\n
\r\n
Czaty pozycji
\r\n
\r\n `);\r\n\r\n\t\t\t$(\"#singlePersonChatsHeader, #groupChatsHeader, #documentChatsHeader\").on(\r\n\t\t\t\t\"click\",\r\n\t\t\t\t(event: JQuery.ClickEvent) => {\r\n\t\t\t\t\tconst id = $(event.currentTarget).attr(\"id\")?.split(\"Header\")[0];\r\n\r\n\t\t\t\t\t$(event.currentTarget).toggleClass(\"collapsed\");\r\n\t\t\t\t\t$(`#${id}`).toggleClass(\"collapsed\");\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (!element && list) {\r\n\t\t\tfor (const item of list) {\r\n\t\t\t\tif ($(item).attr(\"data-related-object-def\") !== \"null\")\r\n\t\t\t\t\t$(\"#documentChats\").append($(item));\r\n\t\t\t\telse if ($(item).attr(\"data-group-chat\") === \"true\")\r\n\t\t\t\t\t$(\"#groupChats\").append($(item));\r\n\t\t\t\telse $(\"#singlePersonChats\").append($(item));\r\n\t\t\t}\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\twhere = \"#singlePersonChats\";\r\n\t\tif (element?.groupChat) where = \"#groupChats\";\r\n\t\tif (element?.relatedObjectDef) where = \"#documentChats\";\r\n\t} else {\r\n\t\t$(\"#groupChatContactsButton\").attr(\"title\", \"Grupuj czaty\");\r\n\t\t$(\"#groupChatContactsButton\").removeClass(\"active\");\r\n\r\n\t\tif (!element) {\r\n\t\t\ttry {\r\n\t\t\t\tlist?.toArray().sort((x, y) => {\r\n\t\t\t\t\tconst xDate = convertDate(\r\n\t\t\t\t\t\t$(x as HTMLElement).attr(\"data-date\") ?? \"\"\r\n\t\t\t\t\t);\r\n\t\t\t\t\tconst yDate = convertDate(\r\n\t\t\t\t\t\t$(y as HTMLElement).attr(\"data-date\") ?? \"\"\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tif (xDate > yDate) {\r\n\t\t\t\t\t\treturn -1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (xDate < yDate) {\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t});\r\n\t\t\t} catch (e) {\r\n\t\t\t\tconsole.log(e);\r\n\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (list)\r\n\t\t\t\tfor (const item of list) {\r\n\t\t\t\t\t$(\"#chatList\").append($(item));\r\n\t\t\t\t}\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!isntGrouped) {\r\n\t\t\t$(\"#chatList\").empty();\r\n\t\t}\r\n\t}\r\n\r\n\treturn where;\r\n}\r\n\r\nexport function groupContacts(element?: Recipient, group?: boolean | null) {\r\n\tconst isntGrouped = $(\"#myOrganizationContactsHeader\").length === 0;\r\n\tif (group == null) group = isntGrouped;\r\n\r\n\tlocalStorage.setItem(\"groupContacts\", group.toString());\r\n\r\n\tlet where = \"#contactsList\";\r\n\r\n\tlet list: JQuery | null = null;\r\n\tif (!element) {\r\n\t\tlist = $(\"#contactsList .singleChat\").clone(true, true);\r\n\t\t$(\"#contactsList\").empty();\r\n\t}\r\n\r\n\tif (group) {\r\n\t\t$(\"#groupContactsButton\").attr(\"title\", \"Wy\u0142\u0105cz grupowanie kontakt\u00F3w\");\r\n\t\t$(\"#groupContactsButton\").addClass(\"active\");\r\n\r\n\t\tif (isntGrouped) {\r\n\t\t\t$(\"#contactsList\").empty();\r\n\r\n\t\t\t$(\"#contactsList\").append(`\r\n
Moja organizacja
\r\n
\r\n
Zewn\u0119trzne organizacje
\r\n
\r\n `);\r\n\r\n\t\t\t$(\"#myOrganizationContactsHeader, #outsideContactsHeader\").on(\r\n\t\t\t\t\"click\",\r\n\t\t\t\t(event: JQuery.ClickEvent) => {\r\n\t\t\t\t\tconst id = $(event.currentTarget).attr(\"id\")?.split(\"Header\")[0];\r\n\r\n\t\t\t\t\t$(event.currentTarget).toggleClass(\"collapsed\");\r\n\t\t\t\t\t$(`#${id}`).toggleClass(\"collapsed\");\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (!element && list) {\r\n\t\t\tfor (const item of list) {\r\n\t\t\t\t$(\"#myOrganizationContacts\").append($(item));\r\n\t\t\t}\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\twhere = \"#myOrganizationContacts\";\r\n\t\tif (element?.outsideRecipient) where = \"#outsideContacts\";\r\n\t} else {\r\n\t\t$(\"#groupContactsButton\").attr(\"title\", \"Grupuj kontakty\");\r\n\t\t$(\"#groupContactsButton\").removeClass(\"active\");\r\n\r\n\t\tif (!element) {\r\n\t\t\ttry {\r\n\t\t\t\tlist?.toArray().sort((x, y) => {\r\n\t\t\t\t\tconst xDate = convertDate(\r\n\t\t\t\t\t\t$(x as HTMLElement).attr(\"data-date\") ?? \"\"\r\n\t\t\t\t\t);\r\n\t\t\t\t\tconst yDate = convertDate(\r\n\t\t\t\t\t\t$(y as HTMLElement).attr(\"data-date\") ?? \"\"\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tif (xDate > yDate) {\r\n\t\t\t\t\t\treturn -1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (xDate < yDate) {\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t});\r\n\t\t\t} catch (e) {\r\n\t\t\t\tconsole.log(e);\r\n\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (list)\r\n\t\t\t\tfor (const item of list) {\r\n\t\t\t\t\t$(\"#contactsList\").append($(item));\r\n\t\t\t\t}\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!isntGrouped) {\r\n\t\t\t$(\"#contactsList\").empty();\r\n\t\t}\r\n\t}\r\n\r\n\treturn where;\r\n}\r\n\r\n//Przygotowanie literek u\u017Cytych w k\u00F3\u0142kach\r\nexport function prepareLetters(caption: string, type: string) {\r\n\tlet letters = \"\";\r\n\r\n\tif (type === \"Multi\" && caption.includes(\"(+\")) {\r\n\t\tlet index = caption.indexOf(\"(+\") + 1;\r\n\t\tconst numberStr = caption.substring(index, caption.length - 1);\r\n\t\tlet number = Number.parseInt(numberStr);\r\n\t\tif (number > 9) number = 9;\r\n\r\n\t\tindex -= 1;\r\n\t\tconst newCaption = caption.substring(0, index).trim();\r\n\t\tconst dataLetters = newCaption.split(\",\");\r\n\t\tletters = dataLetters.map((lt) => lt[0]).join(\"\");\r\n\t\tletters += number;\r\n\t} else {\r\n\t\tlet dataLetters = caption.split(\" \");\r\n\t\tdataLetters = dataLetters.filter((x) => x !== \"\");\r\n\t\tif (dataLetters?.length) {\r\n\t\t\tletters = Array.from(dataLetters[0])?.[0]?.toString() ?? \"\";\r\n\t\t\tletters +=\r\n\t\t\t\tdataLetters[1] !== undefined ? Array.from(dataLetters[1])[0] : \"\";\r\n\t\t\tletters = letters.toUpperCase();\r\n\t\t}\r\n\t}\r\n\r\n\treturn letters;\r\n}\r\n\r\n//Przygotowanie k\u00F3\u0142ek z statusem online\r\nexport function prepareStatusCircle(caption: string, chatType: string) {\r\n\tlet statusCircle = \"\";\r\n\r\n\tif (\r\n\t\tsessionStorage.getItem(\"connectedWebClients\") != null &&\r\n\t\tchatType === \"Single\"\r\n\t) {\r\n\t\tconst connectedWebClients = JSON.parse(\r\n\t\t\tsessionStorage.getItem(\"connectedWebClients\") ?? \"null\"\r\n\t\t);\r\n\t\tstatusCircle = ``;\r\n\r\n\t\tif (\r\n\t\t\ttypeof connectedWebClients !== \"undefined\" &&\r\n\t\t\tconnectedWebClients != null\r\n\t\t) {\r\n\t\t\tconst clients = connectedWebClients.filter((cli) => {\r\n\t\t\t\treturn cli.userName === caption;\r\n\t\t\t});\r\n\r\n\t\t\tif (clients?.length > 0) {\r\n\t\t\t\tlet desktopUserOnline = false;\r\n\t\t\t\tlet webUserOnline = false;\r\n\r\n\t\t\t\tfor (let i = 0; i < clients.length; i++) {\r\n\t\t\t\t\tswitch (clients[i].applicationType) {\r\n\t\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\t\tdesktopUserOnline = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 3:\r\n\t\t\t\t\t\t\twebUserOnline = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (desktopUserOnline && webUserOnline) {\r\n\t\t\t\t\tstatusCircle = ``;\r\n\t\t\t\t} else if (desktopUserOnline) {\r\n\t\t\t\t\tstatusCircle = ``;\r\n\t\t\t\t} else if (webUserOnline) {\r\n\t\t\t\t\tstatusCircle = ``;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (chatType === \"Multi\") {\r\n\t\tstatusCircle = ``;\r\n\t}\r\n\r\n\treturn statusCircle;\r\n}\r\n\r\n//Zamiana aktywnej zak\u0142adki kontakty, czaty\r\nexport function swapContactsChats(e) {\r\n\tif (e.id === \"tabBtnContacts\") {\r\n\t\t$(\"#groupChatContactsButton\").addClass(\"hidden\");\r\n\t\t$(\"#groupContactsButton\").removeClass(\"hidden\");\r\n\t\t$(\"#chatList\").addClass(\"hidden\");\r\n\t\t$(\"#contactsList\").removeClass(\"hidden\");\r\n\t\t$(\"#chatSearch\").attr(\"placeholder\", \"Szukaj lub wprowad\u017A adres email\");\r\n\r\n\t\tif ($(\"#contactsList\").children().length === 0) {\r\n\t\t\tlet recipients: VarioEmployee[];\r\n\t\t\tif (sessionStorage.getItem(\"Recipients\") == null) {\r\n\t\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\t\t\t\tgetRecipientsFromHub().then((res) => {\r\n\t\t\t\t\trecipients = res;\r\n\t\t\t\t\tcreateContactsList(recipients);\r\n\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\trecipients = JSON.parse(sessionStorage.Recipients ?? \"null\");\r\n\t\t\t\tcreateContactsList(recipients);\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\t$(\"#groupChatContactsButton\").removeClass(\"hidden\");\r\n\t\t$(\"#groupContactsButton\").addClass(\"hidden\");\r\n\t\t$(\"#chatList\").removeClass(\"hidden\");\r\n\t\t$(\"#contactsList\").addClass(\"hidden\");\r\n\t\t$(\"#chatSearch\").attr(\"placeholder\", \"Szukaj\");\r\n\t}\r\n\r\n\tfilterChat();\r\n}\r\n\r\n//Stworzenie listy kontakt\u00F3w\r\nexport function createContactsList(recipients: VarioEmployee[]) {\r\n\tconst hasChatOpened = $(\"#chatHistoryContentContainer\").length;\r\n\r\n\tfor (const element of recipients) {\r\n\t\tconst uuid = uuidv4();\r\n\r\n\t\tconst chatIcon = createUserIcon(element);\r\n\r\n\t\tconst where = groupContacts(\r\n\t\t\telement,\r\n\t\t\tJSON.parse(localStorage.getItem(\"groupContacts\") ?? \"null\")\r\n\t\t);\r\n\r\n\t\t$(where ?? \"\").append(`\r\n
\r\n ${chatIcon}\r\n
${element.recipientName ?? \"Nieznany u\u017Cytkownik\"}
\r\n
`);\r\n\r\n\t\tif (hasChatOpened) {\r\n\t\t\tconst addToChatBtn = $(`\r\n \r\n `).insertAfter(\r\n\t\t\t\t$(`.singleChat[data-single-User-Contacts=${uuid}]`).find(\r\n\t\t\t\t\t\".contactCaption.chatSender\"\r\n\t\t\t\t)\r\n\t\t\t);\r\n\r\n\t\t\taddToChatBtn.on(\"click\", async (event) => {\r\n\t\t\t\tevent?.stopPropagation();\r\n\t\t\t\tevent?.stopImmediatePropagation();\r\n\r\n\t\t\t\tconst chatID = Number(\r\n\t\t\t\t\t$(\"#selectedChatHeader .chatHeaderUser\").attr(\"data-chatid\")\r\n\t\t\t\t);\r\n\r\n\t\t\t\tif (chatID < 0 || Number.isNaN(chatID)) {\r\n\t\t\t\t\tshowDxToast(\"Najpierw wybierz czat z listy czat\u00F3w.\", \"warning\");\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst userID = element.recipientKey.split(\";\")[1].substring(3);\r\n\r\n\t\t\t\tlet recipientsIDs = JSON.parse(\r\n\t\t\t\t\t$(`.chatHeaderUser[data-chatId=\"${chatID}\"]`).attr(\r\n\t\t\t\t\t\t\"data-participants\"\r\n\t\t\t\t\t) ?? \"null\"\r\n\t\t\t\t);\r\n\t\t\t\tif (!recipientsIDs) {\r\n\t\t\t\t\tawait RetrieveChatRecipients(chatID, (response) => {\r\n\t\t\t\t\t\tif (response?.success) {\r\n\t\t\t\t\t\t\trecipientsIDs = response.data.map((obj) => obj.userID);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (recipientsIDs?.find((x) => x === userID)) {\r\n\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\"U\u017Cytkownik jest uczestnikiem aktualnego czatu.\",\r\n\t\t\t\t\t\t\"warning\"\r\n\t\t\t\t\t);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tAddUserToChat(chatID, [Number(userID)], (response) => {\r\n\t\t\t\t\tif (response?.success) {\r\n\t\t\t\t\t\trepaintChats(response.data);\r\n\r\n\t\t\t\t\t\t//Po dodaniu user\u00F3w do czatu zostanie wys\u0142ana wiadomo\u015B\u0107 hubem do nich o tym\r\n\t\t\t\t\t\tsendViaHub(\r\n\t\t\t\t\t\t\t-1,\r\n\t\t\t\t\t\t\tresponse.data,\r\n\t\t\t\t\t\t\t[Number(userID)],\r\n\t\t\t\t\t\t\t`U\u017Cytkownik ${currentUserName} doda\u0142 Ci\u0119 do czatu grupowego`,\r\n\t\t\t\t\t\t\t1\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t$(\"#selectedChat\").empty();\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t$(`*[data-single-User-Contacts=${uuid}]`).on(\r\n\t\t\t\"click\",\r\n\t\t\tasync (event: JQuery.ClickEvent) => {\r\n\t\t\t\t//Je\u017Celi na li\u015Bcie czat\u00F3w znajduje si\u0119 ju\u017C czat z wybran\u0105 osob\u0105 przenie\u015B do niego, inaczej traktuj jak nowy czat\r\n\t\t\t\tconst currentChatList = JSON.parse(\r\n\t\t\t\t\tsessionStorage.getItem(\"chatList\") ?? \"null\"\r\n\t\t\t\t);\r\n\r\n\t\t\t\tif (currentChatList != null && Array.isArray(currentChatList)) {\r\n\t\t\t\t\tfor (let i = 0; i < currentChatList.length; i++) {\r\n\t\t\t\t\t\tconst chatDiv = $(`*[data-chat-id=${currentChatList[i].chatID}]`);\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tcurrentChatList[i].chatCaption === element.recipientName &&\r\n\t\t\t\t\t\t\tchatDiv.attr(\"data-group-chat\") === \"false\"\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tchatDiv.trigger(\"click\");\r\n\t\t\t\t\t\t\t$(\"#tabBtnChats\").trigger(\"click\");\r\n\t\t\t\t\t\t\t$(\"#tabBtnChats\").addClass(\"active\");\r\n\t\t\t\t\t\t\t$(\"#tabBtnContacts\").removeClass(\"active\");\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tawait createChatTextPanel($(event.currentTarget), element);\r\n\t\t\t\tsetActiveChatCSS(uuid, \"contacts\");\r\n\t\t\t}\r\n\t\t);\r\n\t}\r\n}\r\n\r\n//Pokazywanie/Ukrywanie listy kontakt\u00F3w/chat\u00F3w\r\nexport function toggleChatNav() {\r\n\tconst container = $(\".dialogChat\");\r\n\tif (container.hasClass(\"hiddenChatNav\")) {\r\n\t\tcontainer.removeClass(\"hiddenChatNav\");\r\n\t} else {\r\n\t\tcontainer.addClass(\"hiddenChatNav\");\r\n\t}\r\n}\r\n\r\nexport function hideChatNav() {\r\n\t$(\".dialogChat\").addClass(\"hiddenChatNav\");\r\n}\r\n\r\nexport function maximizeChatPopup() {\r\n\tconst popup = $(\"#devex-dialog-chat\").dxPopup(\"instance\");\r\n\r\n\tpopup.option(\"position\", { my: \"center\", at: \"center\", of: window });\r\n\tpopup.option(\"width\", \"80vw\");\r\n\tpopup.option(\"height\", \"90vh\");\r\n\r\n\t$(\"#chatExpandButton\").addClass(\"hidden\");\r\n\t$(\".dialogChat\").removeClass(\"hiddenChatNav\");\r\n}\r\n\r\nexport function onChatPopupResize(e) {\r\n\t$(\"#chatExpandButton\").removeClass(\"hidden\");\r\n\r\n\tconst container = $(\".dialogChat\");\r\n\tif (e.width >= 800) {\r\n\t\tcontainer.removeClass(\"hiddenChatNav\");\r\n\t} else {\r\n\t\tcontainer.addClass(\"hiddenChatNav\");\r\n\t}\r\n}\r\n\r\n//Zaktualizowanie statusu online user\u00F3w po pod\u0142\u0105czeniu/roz\u0142\u0105czeniu kogo\u015B\r\nexport function updateOnlineStatusCircle() {\r\n\tif ($(\"#devex-dialog-chat\").dxPopup(\"instance\").option(\"visible\") === false)\r\n\t\treturn;\r\n\r\n\tif (sessionStorage.getItem(\"connectedWebClients\") != null) {\r\n\t\tconst connectedWebClients = JSON.parse(\r\n\t\t\tsessionStorage.getItem(\"connectedWebClients\") ?? \"null\"\r\n\t\t);\r\n\t\tif (\r\n\t\t\ttypeof connectedWebClients !== \"undefined\" &&\r\n\t\t\tconnectedWebClients != null\r\n\t\t) {\r\n\t\t\t$(\".onlineStatusCircle\").each(function () {\r\n\t\t\t\tconst $this = $(this as HTMLElement);\r\n\t\t\t\tconst clients = connectedWebClients.filter((cli) => {\r\n\t\t\t\t\treturn cli.userName === $this.data(\"user-caption\");\r\n\t\t\t\t});\r\n\r\n\t\t\t\tif (clients) {\r\n\t\t\t\t\tlet desktopUserOnline = false;\r\n\t\t\t\t\tlet webUserOnline = false;\r\n\r\n\t\t\t\t\tfor (let i = 0; i < clients.length; i++) {\r\n\t\t\t\t\t\tswitch (clients[i].applicationType) {\r\n\t\t\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\t\t\tdesktopUserOnline = true;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 3:\r\n\t\t\t\t\t\t\t\twebUserOnline = true;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (desktopUserOnline && webUserOnline) {\r\n\t\t\t\t\t\t$this.css(\"background-color\", \"#00bf00\");\r\n\t\t\t\t\t\t$this.attr(\r\n\t\t\t\t\t\t\t\"title\",\r\n\t\t\t\t\t\t\t\"U\u017Cytkownik jest online w Vario Desktop i Vario Web\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else if (desktopUserOnline) {\r\n\t\t\t\t\t\t$this.css(\"background-color\", \"#00bf00\");\r\n\t\t\t\t\t\t$this.attr(\"title\", \"U\u017Cytkownik jest online w Vario Desktop\");\r\n\t\t\t\t\t} else if (webUserOnline) {\r\n\t\t\t\t\t\t$this.css(\"background-color\", \"#00bf00\");\r\n\t\t\t\t\t\t$this.attr(\"title\", \"U\u017Cytkownik jest online w Vario Web\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$this.css(\"background-color\", \"grey\");\r\n\t\t\t\t\t\t$this.attr(\"title\", \"U\u017Cytkownik jest offline\");\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\r\n//Dodanie podgl\u0105du wybranego czatu po prawej stronie. chatID, chatCaption, itemID, itemType gdy wybieramy konkretny czat. recipientID gdy tworzymy nowy wybieraj\u0105c osob\u0119 z kontakt\u00F3w.\r\nexport async function createChatTextPanel(\r\n\tDOMElem: JQuery | null,\r\n\telement: Partial & Partial\r\n) {\r\n\tmanualScroll = false;\r\n\r\n\tconst chatID = element.chatID;\r\n\tconst chatCaption = element.chatCaption ?? element.recipientName;\r\n\tconst itemID = element.itemID ?? undefined;\r\n\tconst itemType = element.itemType ?? undefined;\r\n\tconst groupChat = element.groupChat ?? false;\r\n\tlet recipientID = element.recipientKey;\r\n\r\n\tconst popup = $(\"#devex-dialog-chat\").dxPopup(\"instance\");\r\n\tif (\r\n\t\tNumber(popup.option(\"width\") ?? 0) < 800 ||\r\n\t\t(isRunningOnMobile() && !$(\".dialogChat\").hasClass(\"hiddenChatNav\"))\r\n\t)\r\n\t\thideChatNav();\r\n\r\n\tlet chatCaptionCtn = chatCaption;\r\n\tif (itemID && itemType) {\r\n\t\tconst fullItemId = `Type=${itemType};Id=${itemID}`;\r\n\t\tconst url = `${GetBaseUrl()}/Vario/VarioObject?id=${fullItemId}`;\r\n\t\tchatCaptionCtn = `${chatCaption}`;\r\n\t}\r\n\r\n\t$(\"#selectedChat\").empty();\r\n\t$(\"#selectedChat\").append(`\r\n
\r\n
\r\n
\r\n
${chatCaptionCtn}
\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n
\r\n \r\n \r\n
`);\r\n\r\n\tfixScrollInDx(\"#chatHistoryContentContainer\");\r\n\t($(\"#chatInput\") as any).autogrow();\r\n\r\n\t//przywracanie wiadomo\u015Bci je\u015Bli nie zosta\u0142a wys\u0142ana\r\n\tconst savedChatMessages =\r\n\t\tJSON.parse(sessionStorage.getItem(\"savedChatMessages\") ?? \"null\") ?? [];\r\n\tlet savedChatMessage = savedChatMessages?.find((x) => x.chatID === chatID);\r\n\tif (savedChatMessage && !stringIsNullOrEmpty(savedChatMessage?.message))\r\n\t\t$(\"#chatInput\").val(savedChatMessage.message);\r\n\r\n\t$(\"#chatInput\").on(\"keydown\", (e: JQuery.KeyDownEvent) => {\r\n\t\tsetTimeout(() => {\r\n\t\t\t//zapisywanie wiadomo\u015Bci na wypadek reloadu\r\n\t\t\tsavedChatMessage = {\r\n\t\t\t\tmessage: e.target.value,\r\n\t\t\t\tchatID: chatID,\r\n\t\t\t};\r\n\r\n\t\t\tconst index =\r\n\t\t\t\tsavedChatMessages?.findIndex((x) => x.chatID === chatID) ?? -1;\r\n\r\n\t\t\tif (index === -1) {\r\n\t\t\t\tsavedChatMessages.push(savedChatMessage);\r\n\t\t\t} else {\r\n\t\t\t\tsavedChatMessages[index] = savedChatMessage;\r\n\t\t\t}\r\n\r\n\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\"savedChatMessages\",\r\n\t\t\t\tJSON.stringify(savedChatMessages)\r\n\t\t\t);\r\n\t\t}, 0);\r\n\r\n\t\tif (e.key === \"Enter\" && !e.shiftKey) {\r\n\t\t\te.preventDefault();\r\n\t\t\t$(\"#createChatMsgButton\").trigger(\"click\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#chatInput\").on(\"paste\", pastedAttachment);\r\n\r\n\t$(\"#chatAttachInput\").on(\"change\", () => {\r\n\t\taddChatAttachments();\r\n\t});\r\n\r\n\t$(\"#createChatMsgButton\").on(\"click\", () => {\r\n\t\tconst files = Array.from(\r\n\t\t\t(document.getElementById(\"chatAttachmentsInput\") as HTMLInputElement)\r\n\t\t\t\t?.files ?? []\r\n\t\t);\r\n\t\tconst filesFromVarioDivs = $(\r\n\t\t\t\"#chatAttachments .chatFileAttachment[data-itemid]\"\r\n\t\t);\r\n\t\tconst filesFromVario: FilesFromVario[] = [];\r\n\r\n\t\tfilesFromVarioDivs.each((_, element) => {\r\n\t\t\tconst name =\r\n\t\t\t\t$(element as HTMLElement)\r\n\t\t\t\t\t.text()\r\n\t\t\t\t\t.trim() ?? \"\";\r\n\t\t\tconst itemId = $(element as HTMLElement).attr(\"data-itemid\") ?? \"\";\r\n\t\t\tfilesFromVario.push({ itemId: itemId, name: name });\r\n\t\t});\r\n\r\n\t\tif (\r\n\t\t\t($(\"#chatInput\").val()?.toString()?.trim()?.length ?? 0) < 1 &&\r\n\t\t\t!files?.length &&\r\n\t\t\t!filesFromVario?.length\r\n\t\t) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst index =\r\n\t\t\tsavedChatMessages?.findIndex((x) => x.chatID === chatID) ?? -1;\r\n\t\tif (index !== -1) {\r\n\t\t\tsavedChatMessages.splice(index, 1);\r\n\t\t}\r\n\r\n\t\tsessionStorage.setItem(\r\n\t\t\t\"savedChatMessages\",\r\n\t\t\tJSON.stringify(savedChatMessages)\r\n\t\t);\r\n\r\n\t\tif (($(\"#chatInput\")?.val()?.toString()?.length ?? 0) >= 4000) {\r\n\t\t\tshowDxToast(\"Twoja wiadomo\u015B\u0107 jest za d\u0142uga.\", \"warning\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (recipientID && !Array.isArray(recipientID)) {\r\n\t\t\tconst idIndex = recipientID.indexOf(\"Id=\");\r\n\t\t\trecipientID = recipientID.substring(idIndex + 3);\r\n\t\t}\r\n\r\n\t\t$(\"#chatAttachments .chatFileAttachment\").remove();\r\n\t\t$(\"#chatAttachments\").addClass(\"hidden\");\r\n\r\n\t\tif (files?.length > 0) {\r\n\t\t\tconst fileNames = files.map((x) => x.name).join(\", \");\r\n\t\t\t$(\"#chatHistoryContentContainer\").append(\r\n\t\t\t\t`
Wysy\u0142anie \"${fileNames}\"...
`\r\n\t\t\t);\r\n\t\t\tscrollChatToBottom();\r\n\t\t}\r\n\r\n\t\tif (filesFromVario?.length > 0) {\r\n\t\t\tconst fileNames = filesFromVario.map((x) => x.name).join(\", \");\r\n\t\t\t$(\"#chatHistoryContentContainer\").append(\r\n\t\t\t\t`
Dodawanie \"${fileNames}\"...
`\r\n\t\t\t);\r\n\t\t\tscrollChatToBottom();\r\n\t\t}\r\n\r\n\t\tsendHubNotifyAfterCreateMessage(\r\n\t\t\tchatID,\r\n\t\t\titemID,\r\n\t\t\titemType,\r\n\t\t\t$(\"#chatInput\").val()?.valueOf()?.toString() ?? \"\",\r\n\t\t\trecipientID,\r\n\t\t\tfiles,\r\n\t\t\tfilesFromVario\r\n\t\t);\r\n\t\t$(\"#chatInput\").val(\"\");\r\n\t\t$(\"#chatAttachmentsInput\").val(\"\");\r\n\t});\r\n\r\n\taddDragNDropToChat();\r\n\r\n\t//Appendowanie k\u00F3\u0142ka z czatu\r\n\tif (chatID) {\r\n\t\t$(`*[data-chat-id=${chatID}] .chatIcon`)\r\n\t\t\t.clone()\r\n\t\t\t.appendTo(\"#selectedChatHeader .circleContainer\");\r\n\t} else if (DOMElem) {\r\n\t\t//Appendowanie k\u00F3\u0142ka z kontakt\u00F3w\r\n\t\tconst atr = DOMElem[0].getAttribute(\"data-single-User-Contacts\");\r\n\t\t$(`*[data-single-User-Contacts=${atr}] .chatIcon`)\r\n\t\t\t.clone()\r\n\t\t\t.appendTo(\"#selectedChatHeader .circleContainer\");\r\n\t} else {\r\n\t\tconst chatIcon = createUserIcon(element);\r\n\t\t$(\"#selectedChatHeader .circleContainer\").append(chatIcon ?? \"\");\r\n\t}\r\n\r\n\tif (\r\n\t\t!element.isCurrentUserParticipantToChatPosition &&\r\n\t\tchatID &&\r\n\t\tchatCaption !== currentUserName\r\n\t) {\r\n\t\t//dodanie joinowania chatu\r\n\t\t$(\"#chatInputContainer\").remove();\r\n\r\n\t\t$(\"#selectedChatActions\").append(`\r\n \r\n `);\r\n\r\n\t\t$(\"#expandedChatButton\").on(\"click\", () => {\r\n\t\t\tJoinToChatForPosition(\r\n\t\t\t\tchatID,\r\n\t\t\t\t`Type=${element.itemType};Id=${element.itemID}`,\r\n\t\t\t\tasync (response) => {\r\n\t\t\t\t\tif (response?.success) {\r\n\t\t\t\t\t\trepaintChats(response.data);\r\n\t\t\t\t\t\t$(\"#tabBtnChats\").trigger(\"click\");\r\n\t\t\t\t\t\t$(\"#tabBtnChats\").addClass(\"active\");\r\n\t\t\t\t\t\t$(\"#tabBtnContacts\").removeClass(\"active\");\r\n\r\n\t\t\t\t\t\tawait openChat(element);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (!response?.success) {\r\n\t\t\t\t\t\tif (response?.message?.length) {\r\n\t\t\t\t\t\t\tshowDxToast(response.message, \"error\");\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tshowDxToast(\"Nie mo\u017Cna do\u0142\u0105czy\u0107 do tego czatu\", \"error\");\r\n\t\t\t\t\t\t}\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} else if (chatID && chatCaption !== currentUserName) {\r\n\t\t//Dodanie akcji do czatu\r\n\t\t$(\"#selectedChatActions\").append(`\r\n \r\n `);\r\n\r\n\t\t$(\"#expandedChatButton\").on(\"click\", () => {\r\n\t\t\tRetrieveChatRecipients(chatID, (response) => {\r\n\t\t\t\tif (response?.success) {\r\n\t\t\t\t\tcreateExpandedChatButton(\r\n\t\t\t\t\t\tresponse,\r\n\t\t\t\t\t\t(!!itemID && !!itemType) || groupChat\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\t//Pobranie wiadomo\u015Bci z czatu\r\n\tif (chatID) {\r\n\t\t$(\"#chatHistoryContentContainer\").append(`\r\n
\r\n
\r\n
\r\n
.
\r\n
.
\r\n
.
\r\n
\r\n
\r\n
`);\r\n\r\n\t\tawait RetrieveChatRecipients(chatID, (response) => {\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tconst userIds = response.data.map((obj) => obj.userID);\r\n\t\t\t\t$(\".chatHeaderUser\").attr(\"data-participants\", JSON.stringify(userIds));\r\n\t\t\t\t$(\".chatHeaderUser\").attr(\"data-chatId\", chatID);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tretrieveMessages(chatID, 20, null, async (response) => {\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tawait appendChatHistory(response.data);\r\n\r\n\t\t\t\t$(\"#mainChatLoader\").remove();\r\n\t\t\t\tscrollChatToBottom();\r\n\t\t\t\tfocusChatInput();\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\t//Czat sam ze sob\u0105\r\n\telse if (chatCaption === currentUserName) {\r\n\t\t$(\"#chatHistoryContentContainer\").append(\r\n\t\t\t`
To twoja prywatna przestrze\u0144
`\r\n\t\t);\r\n\t\t$(\"#chatHistoryContentContainer\").append(\r\n\t\t\t`
Napisz co\u015B aby rozpocz\u0105\u0107
`\r\n\t\t);\r\n\t}\r\n\t//Czat jeszcze nie jest w\u0142\u0105czony\r\n\telse {\r\n\t\t$(\"#chatHistoryContentContainer\").append(\r\n\t\t\t`
To pocz\u0105tek twojej konwersacji z ${chatCaption}
`\r\n\t\t);\r\n\t\t$(\"#chatHistoryContentContainer\").append(\r\n\t\t\t`
Napisz co\u015B aby rozpocz\u0105\u0107
`\r\n\t\t);\r\n\t}\r\n\r\n\t$(\"#chatInput\").on(\"focusin\", () => {\r\n\t\t//Oznaczenie czatu jako przeczytany\r\n\t\tif (chatID) {\r\n\t\t\tmarkChatAsReadFront(chatID);\r\n\t\t}\r\n\t});\r\n\r\n\tscrollChatToBottom();\r\n\tfocusChatInput();\r\n\r\n\t$(\"#chatHistoryContentContainer\").on(\r\n\t\t\"scroll wheel mousewheel touchmove\",\r\n\t\t() => {\r\n\t\t\tscrollChatDetection();\r\n\t\t}\r\n\t);\r\n}\r\n\r\n//Zbudowanie historii czatu z pobranych danych\r\nexport async function appendChatHistory(\r\n\tdata: RetrievedHubMessages[],\r\n\tappendToEnd = false\r\n) {\r\n\tlet recipients: VarioEmployee[] = JSON.parse(\r\n\t\tsessionStorage.getItem(\"Recipients\") ?? \"null\"\r\n\t);\r\n\tif (!recipients) recipients = await getRecipientsFromHub();\r\n\tif (appendToEnd) data = data.reverse();\r\n\tconst groupedMessages = groupMessagesByTime(data, 10);\r\n\tif (!groupedMessages?.size) return;\r\n\r\n\tfor (let [key, value] of groupedMessages.entries()) {\r\n\t\tif (appendToEnd) value = value.reverse();\r\n\t\tconst splitVal = key.split(\";\");\r\n\t\tconst groupDate = splitVal[0];\r\n\t\tconst groupDateParsed = value[value.length - 1].creationDateParsed;\r\n\t\tconst groupSender = splitVal[1];\r\n\t\tconst creator = recipients.find((x) =>\r\n\t\t\tx.recipientKey.includes(groupSender)\r\n\t\t);\r\n\t\tconst userClass = creator?.recipientKey?.includes(currentUserId)\r\n\t\t\t? \"currentUserInChat\"\r\n\t\t\t: \"\";\r\n\t\tconst uuid = uuidv4();\r\n\r\n\t\tlet userIcon = \"\";\r\n\r\n\t\t//grupowanie\r\n\t\t//jesli wiadomosc systemowa to nie grupujemy\r\n\t\tif (!groupSender.includes(\"System\")) {\r\n\t\t\tuserIcon = createUserIcon(creator);\r\n\r\n\t\t\tif (\r\n\t\t\t\t$(\r\n\t\t\t\t\t`#chatHistoryContentContainer .messageGroupContainer[data-key=\"${key}\"]`\r\n\t\t\t\t).length === 0\r\n\t\t\t) {\r\n\t\t\t\tconst toAppend = `
\r\n
\r\n
\r\n

${creator?.recipientName ?? \"Nieznany u\u017Cytkownik\"}

\r\n

${groupDateParsed}

\r\n
\r\n
\r\n
\r\n ${userIcon}\r\n
`;\r\n\r\n\t\t\t\tif (appendToEnd) $(\"#chatHistoryContentContainer\").prepend(toAppend);\r\n\t\t\t\telse $(\"#chatHistoryContentContainer\").append(toAppend);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//gdzie beda appendowane wiadomosci\r\n\t\tconst container = $(\r\n\t\t\t`#chatHistoryContentContainer .messageGroupContainer[data-key=\"${key}\"] .messageGroupMessageContainer`\r\n\t\t);\r\n\r\n\t\t//dodawanie wiadomosci\r\n\t\tfor (const element of value.reverse()) {\r\n\t\t\t//sprawdzanie duplikatu\r\n\t\t\tif (\r\n\t\t\t\t$(\"#chatHistoryContentContainer\").find(\r\n\t\t\t\t\t`.singleMessage[data-id=\"${element.id}\"]`\r\n\t\t\t\t).length > 0\r\n\t\t\t)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t//ustawienie czy jest nieprzeczytana wiadomosc\r\n\t\t\tlet boldClass = element.isRead === 1 ? \"\" : \"unreadMessageBold\";\r\n\r\n\t\t\t//przetwarzanie html\r\n\t\t\tconst html = $.parseHTML(element.body);\r\n\t\t\tlet message =\r\n\t\t\t\thtml.find((x) => x.nodeName.toLowerCase().includes(\"text\"))\r\n\t\t\t\t\t?.textContent ?? \"\";\r\n\t\t\tmessage = urlify(message);\r\n\t\t\tconst img = html.find((x) =>\r\n\t\t\t\tx.nodeName.toLowerCase().includes(\"img\")\r\n\t\t\t) as HTMLImageElement;\r\n\t\t\tif (img?.src) {\r\n\t\t\t\tmessage += ``;\r\n\t\t\t}\r\n\r\n\t\t\t//wiadomosci systemowe\r\n\t\t\tif (element.messageType !== 0 && element.messageType !== 5) {\r\n\t\t\t\tlet infoIcon = \"\";\r\n\r\n\t\t\t\tswitch (element.messageType) {\r\n\t\t\t\t\tcase 1:\r\n\t\t\t\t\t\tinfoIcon = ``;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\tinfoIcon = ``;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 3:\r\n\t\t\t\t\t\tinfoIcon = ``;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 4:\r\n\t\t\t\t\t\tinfoIcon = ``;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 5:\r\n\t\t\t\t\t\tinfoIcon = ``;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst toAppend = `\r\n
\r\n ${infoIcon}\r\n
${message}
\r\n
\r\n `;\r\n\r\n\t\t\t\tif (appendToEnd) $(\"#chatHistoryContentContainer\").prepend(toAppend);\r\n\t\t\t\telse $(\"#chatHistoryContentContainer\").append(toAppend);\r\n\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\t//opcje wiadomosci\r\n\t\t\tlet messageOptions = \"\";\r\n\t\t\tif (userClass !== \"\" && element.messageType !== 5) {\r\n\t\t\t\tmessageOptions = `\r\n
\r\n \r\n
\r\n `;\r\n\t\t\t} else if (userClass === \"\" && element.messageType !== 5) {\r\n\t\t\t\tlet emojiList = \"\";\r\n\r\n\t\t\t\tfor (const [key, value] of Object.entries(reactionsArr)) {\r\n\t\t\t\t\temojiList += ``;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tmessageOptions = `\r\n
\r\n ${emojiList}\r\n
\r\n `;\r\n\t\t\t} else if (element.messageType === 5) {\r\n\t\t\t\tmessage = ` ${message}`;\r\n\t\t\t\tboldClass += \" italicFont singleMessageSystem\";\r\n\t\t\t}\r\n\r\n\t\t\t//dodanie wiadomosci\r\n\t\t\tcontainer.append(`\r\n
\r\n ${messageOptions}\r\n
${message}
\r\n
\r\n `);\r\n\r\n\t\t\tif (element.messageType === 5) continue;\r\n\r\n\t\t\tconst messageDiv = $(`.singleMessage[data-id='${element.id}']`);\r\n\r\n\t\t\t//dodanie zalacznikow\r\n\t\t\tif (\r\n\t\t\t\telement?.sources?.length > 0 ||\r\n\t\t\t\telement?.varioObjectAttachment?.length > 0\r\n\t\t\t) {\r\n\t\t\t\tmessageDiv.append('
');\r\n\t\t\t\tappendAttachments(messageDiv, element.sources);\r\n\t\t\t\tappendVarioAttachments(messageDiv, element.varioObjectAttachment);\r\n\t\t\t}\r\n\r\n\t\t\t//dodanie reakcji\r\n\t\t\tif (element && \"Reactions\" in element) {\r\n\t\t\t\tappendReactions(element.id, element.Reactions, element.userReaction);\r\n\t\t\t}\r\n\r\n\t\t\tmessageDiv.find(\".deleteMessageButton\").on(\"click\", () => {\r\n\t\t\t\tshowPopupWarningDeletingMessage(\r\n\t\t\t\t\tNumber($(\".activeChat\").attr(\"data-chat-id\")),\r\n\t\t\t\t\telement.id\r\n\t\t\t\t);\r\n\t\t\t});\r\n\r\n\t\t\tmessageDiv\r\n\t\t\t\t.find(\".emojiButton\")\r\n\t\t\t\t.on(\"click\", (event: JQuery.ClickEvent) => {\r\n\t\t\t\t\tonAddReactionToMessageChat(\r\n\t\t\t\t\t\tNumber($(\".activeChat\").attr(\"data-chat-id\")),\r\n\t\t\t\t\t\telement.id,\r\n\t\t\t\t\t\tcreator?.recipientKey ?? \"\",\r\n\t\t\t\t\t\t$(event.currentTarget).text(),\r\n\t\t\t\t\t\tNumber($(event.currentTarget).attr(\"data-emoji-enum\"))\r\n\t\t\t\t\t);\r\n\t\t\t\t});\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function groupMessagesByTime(\r\n\tmessages: RetrievedHubMessages[],\r\n\tminutes: number\r\n) {\r\n\tconst grouped: Map = new Map();\r\n\r\n\tfor (const element of messages.reverse()) {\r\n\t\tconst lastValue = Array.from(grouped.keys()).pop();\r\n\t\tlet groupDate = \"\";\r\n\t\tlet sender = \"\";\r\n\t\tlet convertedGroupDate: Date;\r\n\t\tlet isInTimeRange = false;\r\n\t\tconst isSystemMessage =\r\n\t\t\telement.messageType !== 0 && element.messageType !== 5;\r\n\r\n\t\tif (isSystemMessage) {\r\n\t\t\tgrouped.set(`${element.creationDate};SystemMessage`, [element]);\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\t$(\"#chatHistoryContentContainer\").find(\r\n\t\t\t\t`.singleMessage[data-id=\"${element.id}\"]`\r\n\t\t\t).length > 0\r\n\t\t)\r\n\t\t\tcontinue;\r\n\r\n\t\tif (lastValue) {\r\n\t\t\tconst lastValueSplit = lastValue.split(\";\");\r\n\t\t\tgroupDate = lastValueSplit[0];\r\n\t\t\tsender = lastValueSplit[1];\r\n\t\t\tconvertedGroupDate = convertDate(groupDate);\r\n\t\t} else {\r\n\t\t\tconst newestGroup = $(\r\n\t\t\t\t\"#chatHistoryContentContainer .messageGroupContainer\"\r\n\t\t\t).last();\r\n\r\n\t\t\tif (newestGroup.length > 0) {\r\n\t\t\t\tconst newestGroupDate = newestGroup.attr(\"data-date\");\r\n\t\t\t\tconst newestGroupSender = newestGroup.attr(\"data-creatorId\");\r\n\r\n\t\t\t\tisInTimeRange = checkIfInTimeRange(\r\n\t\t\t\t\telement.creationDate,\r\n\t\t\t\t\tnewestGroupDate,\r\n\t\t\t\t\tminutes\r\n\t\t\t\t);\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tisInTimeRange &&\r\n\t\t\t\t\tnewestGroupSender?.includes(element.createdBy.toString())\r\n\t\t\t\t) {\r\n\t\t\t\t\tgrouped.set(`${newestGroupDate};${element.createdBy}`, [element]);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tgrouped.set(`${element.creationDate};${element.createdBy}`, [element]);\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tisInTimeRange = checkIfInTimeRange(\r\n\t\t\telement.creationDate,\r\n\t\t\tconvertedGroupDate,\r\n\t\t\tminutes\r\n\t\t);\r\n\r\n\t\tif (isInTimeRange && element.createdBy.toString() === sender) {\r\n\t\t\tgrouped.get(`${groupDate};${sender}`)?.unshift(element);\r\n\t\t} else {\r\n\t\t\tgrouped.set(`${element.creationDate};${element.createdBy}`, [element]);\r\n\t\t}\r\n\t}\r\n\r\n\treturn grouped;\r\n}\r\n\r\nexport function checkIfInTimeRange(date, dateToCompare, minutes: number) {\r\n\tif (typeof date !== \"object\") date = convertDate(date);\r\n\tif (typeof dateToCompare !== \"object\")\r\n\t\tdateToCompare = convertDate(dateToCompare);\r\n\r\n\tconst start = new Date(dateToCompare.getTime() + -(minutes * 60000));\r\n\tconst end = new Date(dateToCompare.getTime() + minutes * 60000);\r\n\r\n\treturn date > start && date < end;\r\n}\r\n\r\n// Ponowne pobranie listy wszystkich czat\u00F3w i ponowne dodanie ich do panelu po lewej\r\nexport function repaintChats(chatIDToSelect: number | null) {\r\n\tretrieveChats((response) => {\r\n\t\tCreateChatPopupContent(response, chatIDToSelect);\r\n\t});\r\n}\r\n\r\n//Od\u015Bwie\u017Cenie informacji na panelu z lewej strony. Who okresla czy nowa wiadomo\u015B\u0107 przysz\u0142a czy sami j\u0105 stworzyli\u015Bmy\r\nexport function updateSingleChatLeft(\r\n\tchatID: number | null,\r\n\tmsgBody = \"\",\r\n\twho = \"me\"\r\n) {\r\n\tconst chatLeftPanelJQuery = $(`*[data-chat-id=${chatID}]`);\r\n\tif (chatLeftPanelJQuery.length > 0) {\r\n\t\tconst chatLeftPanel = chatLeftPanelJQuery[0];\r\n\r\n\t\tconst prefix = who === \"other\" ? \"\" : \"Ty: \";\r\n\t\tconst currDate = new Date();\r\n\t\tlet currentHours = currDate.getHours().toString();\r\n\t\tcurrentHours = `0${currentHours}`.slice(-2);\r\n\t\tlet currentMinutes = currDate.getMinutes().toString();\r\n\t\tcurrentMinutes = `0${currentMinutes}`.slice(-2);\r\n\r\n\t\tconst dateToUpdate = `${currentHours}:${currentMinutes}`;\r\n\t\tconst datePanel = chatLeftPanel.querySelector(\".chatDate\");\r\n\t\tif (datePanel) datePanel.textContent = dateToUpdate;\r\n\r\n\t\tconst dateParam = currDate.toLocaleString(\"pl-PL\").replace(\",\", \"\");\r\n\r\n\t\tchatLeftPanelJQuery.attr(\"data-date\", dateParam);\r\n\r\n\t\tconst bodyPanel = chatLeftPanel.querySelector(\".chatBody\");\r\n\t\tif (bodyPanel) {\r\n\t\t\tconst html = $.parseHTML(msgBody);\r\n\t\t\tconst message =\r\n\t\t\t\thtml.find((x) => x.nodeName.toLowerCase().includes(\"text\"))\r\n\t\t\t\t\t?.textContent ?? \"\";\r\n\t\t\tconst trimmedBody = prefix + message?.substring(0, 300);\r\n\t\t\tbodyPanel.textContent = trimmedBody;\r\n\t\t}\r\n\r\n\t\tconst lastActiveChat = sessionStorage.getItem(\"lastActiveChat\");\r\n\t\t//Je\u017Celi wiadomo\u015B\u0107 przysz\u0142a od kogo\u015B a dodatkowo nie jest wybrany ten czat i nie mamy focusa na inpucie dodaj bolda\r\n\t\tif (\r\n\t\t\twho !== \"me\" &&\r\n\t\t\t!(lastActiveChat === chatID && $(\"#chatInput\").is(\":focus\"))\r\n\t\t) {\r\n\t\t\tchatLeftPanelJQuery.addClass(\"extraBold\");\r\n\t\t}\r\n\r\n\t\t//Przenosimy ten czat na sam\u0105 g\u00F3r\u0119 listy\r\n\t\tchatLeftPanelJQuery.parent().prepend(chatLeftPanelJQuery);\r\n\t}\r\n\t//W\u0142a\u015Bnie przysz\u0142a wiadomo\u015B\u0107 z czatu kt\u00F3rego jeszcze nie ma na li\u015Bcie. Trzeba przebudowa\u0107\r\n\telse {\r\n\t\trepaintChats(-1);\r\n\t}\r\n}\r\n\r\n//Ustawienie aktywnie wybranego czatu/kontaktu pod\u015Bwietleniem\r\nexport function setActiveChatCSS(chatID: number | string | null, tab: string) {\r\n\t$(\".activeChat\").removeClass(\"activeChat\");\r\n\r\n\tif (tab === \"chat\") {\r\n\t\t$(`*[data-chat-id=${chatID}]`).addClass(\"activeChat\");\r\n\t}\r\n\r\n\tif (tab === \"contacts\") {\r\n\t\t$(`*[data-single-User-Contacts=${chatID}]`).addClass(\"activeChat\");\r\n\t}\r\n}\r\n\r\n//Wy\u015Bwietlanie tosta z nowo otrzyman\u0105 wiadomo\u015Bci\u0105\r\nexport function ShowToastMessage(response: VarioHubModels.ResponseMessage) {\r\n\ttry {\r\n\t\tconst responseMessageExt: VarioHubModels.ResponseMessageExtra = response;\r\n\t\tlet messageLevel: DevExpress.ui.dxToast.ToastType = \"info\";\r\n\t\tlet duration = 0;\r\n\t\tduration = Number.parseInt(responseMessageExt.delay.toString());\r\n\t\tif (duration <= 0) {\r\n\t\t\tduration = 5000;\r\n\t\t}\r\n\r\n\t\tswitch (responseMessageExt.messageLevel) {\r\n\t\t\tcase 0:\r\n\t\t\tcase 1:\r\n\t\t\t\tmessageLevel = \"info\";\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tmessageLevel = \"warning\";\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\r\n\t\t\t\tmessageLevel = \"error\";\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tmessageLevel = \"info\";\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tlet messageTopic = responseMessageExt.topic;\r\n\t\tif (messageTopic == null || messageTopic === \"null\") {\r\n\t\t\tmessageTopic = \"\";\r\n\t\t}\r\n\r\n\t\tconst html = $.parseHTML(responseMessageExt.message);\r\n\t\tlet message =\r\n\t\t\thtml.find((x) => x.nodeName.toLowerCase().includes(\"text\"))\r\n\t\t\t\t?.textContent ?? \"\";\r\n\t\tconst img = html.find((x) =>\r\n\t\t\tx.nodeName.toLowerCase().includes(\"img\")\r\n\t\t) as HTMLImageElement;\r\n\t\tif (img?.src) {\r\n\t\t\tmessage += ``;\r\n\t\t}\r\n\r\n\t\tresponseMessageExt.message = message;\r\n\t\tresponseMessageExt.creationDate = new Date()\r\n\t\t\t.toLocaleString()\r\n\t\t\t.replace(\",\", \"\");\r\n\t\tresponseMessageExt.id = responseMessageExt.messageID\r\n\t\t\t? responseMessageExt.messageID.toString()\r\n\t\t\t: uuidv4();\r\n\r\n\t\tlet msg = `${responseMessageExt.messageSenderName}: ${messageTopic} - ${message}`;\r\n\t\tif (!messageTopic)\r\n\t\t\tmsg = `${responseMessageExt.messageSenderName}: ${message}`;\r\n\t\t$(\"#devex-toast-message\").dxToast(\"instance\").option({\r\n\t\t\ttype: messageLevel,\r\n\t\t\tmessage: msg,\r\n\t\t\tvisible: true,\r\n\t\t\tdisplayTime: 5000,\r\n\t\t});\r\n\r\n\t\t//poczekanie az pojawi sie toast dx i dodanie na niego clicka ktory wlacza okienko odpowiedz\r\n\t\twaitForElm(\r\n\t\t\t\".dx-toast-wrapper .dx-overlay-content.dx-toast-info.dx-toast-content\"\r\n\t\t).then((elm) => {\r\n\t\t\t$(elm).css(\"cursor\", \"pointer\");\r\n\t\t\t$(elm).one(\"click\", () => {\r\n\t\t\t\topenChatFromToast(responseMessageExt.chatID);\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\tconst notification: Partial & {\r\n\t\t\toptions: NotificationOptions;\r\n\t\t} = {\r\n\t\t\ttitle: `${responseMessageExt.messageSenderName}: ${messageTopic}`,\r\n\t\t\toptions: {\r\n\t\t\t\tbody: responseMessageExt.message,\r\n\t\t\t\ttag: responseMessageExt.id,\r\n\t\t\t\ticon: `${GetBaseUrl()}/images/bell-icon.png`,\r\n\t\t\t\tdata: {\r\n\t\t\t\t\tisDebug: debug,\r\n\t\t\t\t\twebsitePath: GetBaseUrl(),\r\n\t\t\t\t\ttype: \"hubNotification\",\r\n\t\t\t\t\tresponseMessage: responseMessageExt,\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t};\r\n\r\n\t\tpushNotification(notification);\r\n\r\n\t\t//Obs\u0142uga otrzymana wiadomo\u015Bci bez id chatu (np. z ddesktopa albo huba)\r\n\t\tif (responseMessageExt.chatID == null) {\r\n\t\t\tif (sessionStorage.getItem(\"notifyHub\")) {\r\n\t\t\t\tconst oldNotifications = JSON.parse(sessionStorage.notifyHub ?? \"null\");\r\n\t\t\t\toldNotifications.push(responseMessageExt);\r\n\t\t\t\tsessionStorage.setItem(\"notifyHub\", JSON.stringify(oldNotifications));\r\n\t\t\t} else {\r\n\t\t\t\tconst notifyArray = new Array();\r\n\t\t\t\tnotifyArray.push(responseMessageExt);\r\n\t\t\t\tsessionStorage.setItem(\"notifyHub\", JSON.stringify(notifyArray));\r\n\t\t\t}\r\n\r\n\t\t\trefreshNotifyPanel(\"NewMessageRecived\");\r\n\t\t\trefreshNotifyNumber(\"NewMessageRecived\");\r\n\t\t}\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t}\r\n}\r\n\r\n//Otwarcie konkretnego czatu po klikni\u0119ciu w tost\r\nexport function openChatFromToast(chatID: number | undefined) {\r\n\tif (!chatID) return;\r\n\tlocalStorage.setItem(\"lastActiveChat\", chatID.toString());\r\n\r\n\tif ($(\"#devex-dialog-chat\").dxPopup(\"instance\").option(\"visible\") === false) {\r\n\t\tOpenMainChatPopup();\r\n\t} else {\r\n\t\t$(`*[data-chat-id=${chatID}]`).trigger(\"click\");\r\n\t}\r\n}\r\n\r\n//Scroll na d\u00F3\u0142 czatu\r\nexport function scrollChatToBottom() {\r\n\tif (manualScroll) return;\r\n\r\n\tlet time = 200;\r\n\tif (chatPopupFirstOpen) {\r\n\t\ttime = 400;\r\n\t}\r\n\tsetTimeout(() => {\r\n\t\t$(\"#chatHistoryContentContainer\").scrollTop(\r\n\t\t\t$(\"#chatHistoryContentContainer\")[0].scrollHeight\r\n\t\t);\r\n\t}, time);\r\n}\r\n\r\nexport function scrollChatToMessage(messageId: number) {\r\n\tconst container = $(\"#chatHistoryContentContainer\");\r\n\tcontainer?.scrollTop(\r\n\t\t($(\r\n\t\t\t`#chatHistoryContentContainer .singleMessage[data-id=\"${messageId}\"]`\r\n\t\t)?.offset()?.top ?? 0) -\r\n\t\t\t(container?.offset()?.top ?? 0) +\r\n\t\t\t(container?.scrollTop() ?? 0)\r\n\t);\r\n}\r\n\r\n//Zfocusowanie inputa do pisania. Je\u017Celi popap si\u0119 jeszcze otwiera, potrzebny wi\u0119kszy delay (chatPopupFirstOpen)\r\nexport function focusChatInput() {\r\n\tif (isRunningOnMobile()) return;\r\n\r\n\tlet time = 200;\r\n\tif (chatPopupFirstOpen) {\r\n\t\tchatPopupFirstOpen = false;\r\n\t\ttime = 500;\r\n\t}\r\n\tsetTimeout(() => {\r\n\t\t$(\"#chatInput\").trigger(\"focus\");\r\n\t}, time);\r\n}\r\n\r\nexport function createExpandedChatButton(\r\n\tresponse: ServiceResponse,\r\n\tcanLeave: boolean\r\n) {\r\n\tconst expandedPanel = $(\".expandedChatUsers\");\r\n\tif (expandedPanel.length > 0) {\r\n\t\texpandedPanel.remove();\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst listOfRecipients = response?.data;\r\n\tif (!listOfRecipients || listOfRecipients.length === 0) return;\r\n\r\n\t$(\"#selectedChatActions\").append(`
\r\n
\r\n
`);\r\n\r\n\tif (canLeave) {\r\n\t\t$(\".expandedChatUsers\").append(\r\n\t\t\t``\r\n\t\t);\r\n\r\n\t\t$(\"#leaveChat\").on(\"click\", () => {\r\n\t\t\tTryLeaveChat(listOfRecipients[0].chatID);\r\n\t\t});\r\n\t}\r\n\r\n\tconst recipients: VarioEmployee[] = JSON.parse(\r\n\t\tsessionStorage.getItem(\"Recipients\") ?? \"null\"\r\n\t);\r\n\tlet filteredRecipients = recipients;\r\n\tif (!recipients) {\r\n\t\t$(\".expandedChatUsers\").remove();\r\n\t\treturn;\r\n\t}\r\n\r\n\tfor (const rec of listOfRecipients) {\r\n\t\tfilteredRecipients = filteredRecipients.filter(\r\n\t\t\t(val) => !val.recipientKey.includes(rec.userID.toString())\r\n\t\t);\r\n\t}\r\n\r\n\t$(\"#addToChat\").on(\"click\", () => {\r\n\t\taddUserToChat(listOfRecipients[0].chatID, filteredRecipients, canLeave);\r\n\t});\r\n\r\n\ttry {\r\n\t\tfor (const rec of listOfRecipients) {\r\n\t\t\tconst creator = recipients.find((x) =>\r\n\t\t\t\tx.recipientKey.includes(rec.userID.toString())\r\n\t\t\t);\r\n\r\n\t\t\tif (!creator) continue;\r\n\r\n\t\t\tconst userIcon = createUserIcon(creator);\r\n\r\n\t\t\t$(\r\n\t\t\t\t\".chatRecipientsList\"\r\n\t\t\t).append(`
\r\n ${userIcon}\r\n
${creator.recipientName}\r\n
\r\n
`);\r\n\t\t}\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t}\r\n\r\n\tfixScrollInDx(\".expandedChatUsers\");\r\n}\r\n\r\nexport function TryLeaveChat(chatID: number) {\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(250));\r\n\tpopup.option(\"minHeight\", calcMinPopup(100, true));\r\n\tpopup.option(\"showTitle\", false);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\tpopup.show();\r\n\r\n\t$(\"#Dialog\").empty();\r\n\t$(\"#Dialog\").append(`\r\n

Czy na pewno wyj\u015B\u0107 z czatu?

\r\n `);\r\n\r\n\tpopup.content().find(\".DialogFooter\").empty();\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.append(`\r\n\t\t
\r\n \r\n \r\n
\r\n\t`);\r\n\r\n\tpopup.repaint();\r\n\r\n\t$(\"#leaveChatBtn\").on(\"click\", () => {\r\n\t\tRemoveUserFromChat(chatID, () => {\r\n\t\t\t//Zrobi\u0107 reload czat\u00F3w po lewej i usun\u0105\u0107 ostatnio wybrany chat z sesji\r\n\t\t\tlocalStorage.setItem(\"lastActiveChat\", \"-1\");\r\n\t\t\trepaintChats(null);\r\n\t\t\t$(\"#selectedChat\").empty();\r\n\t\t\tcreateEmptyChatView();\r\n\t\t});\r\n\t\tCloseDialog();\r\n\t});\r\n\r\n\t$(document).one(\"keypress\", (event) => {\r\n\t\tif (\r\n\t\t\t$(\"#leaveChatBtn\").length > 0 &&\r\n\t\t\tevent?.originalEvent?.key === \"Enter\"\r\n\t\t) {\r\n\t\t\t$(\"#leaveChatBtn\").trigger(\"click\");\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function addUserToChat(\r\n\tchatID: number,\r\n\trecipients: VarioEmployee[],\r\n\tcanLeave: boolean\r\n) {\r\n\tconst popup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(500));\r\n\tpopup.option(\"minHeight\", calcMinPopup(425, true));\r\n\tpopup.option(\"title\", \"Dodaj u\u017Cytkownik\u00F3w do czatu\");\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t$(\"#BigDialog\").empty();\r\n\tpopup.content().find(\".DialogFooter\").empty();\r\n\r\n\tcreateRecipientsList(recipients, false, false, false);\r\n\r\n\tif (!canLeave) {\r\n\t\t$(\"#BigDialog\").append(\r\n\t\t\t`Dodanie u\u017Cytkownik\u00F3w spowoduje utworzenie nowej konwersacji.`\r\n\t\t);\r\n\t}\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.append(\r\n\t\t\t`
`\r\n\t\t);\r\n\r\n\tif (globalSelectedRecipients.length > 0) {\r\n\t\t$(\"#ExecuteButton\").attr(\"disabled\", null);\r\n\r\n\t\t$(\"#recipientCounter\").text(\r\n\t\t\t`Wybranych: ${globalSelectedRecipients.length}`\r\n\t\t);\r\n\t} else {\r\n\t\t$(\"#ExecuteButton\").attr(\"disabled\", \"disabled\");\r\n\t}\r\n\r\n\t$(\"#ExecuteButton\").on(\"click\", () => {\r\n\t\tconst list: number[] = [];\r\n\t\tfor (const user of globalSelectedRecipients) {\r\n\t\t\tlist.push(Number(user.id.split(\";\")[1].substring(3)));\r\n\t\t}\r\n\r\n\t\tAddUserToChat(chatID, list, (response) => {\r\n\t\t\tif (response?.success) {\r\n\t\t\t\t$(\"#ExecuteButton\").attr(\"disabled\", \"disabled\");\r\n\t\t\t\tCloseBigDialog();\r\n\r\n\t\t\t\trepaintChats(response.data);\r\n\r\n\t\t\t\t//Po dodaniu user\u00F3w do czatu zostanie wys\u0142ana wiadomo\u015B\u0107 hubem do nich o tym\r\n\t\t\t\tsendViaHub(\r\n\t\t\t\t\t-1,\r\n\t\t\t\t\tresponse.data,\r\n\t\t\t\t\tlist,\r\n\t\t\t\t\t`U\u017Cytkownik ${currentUserName} doda\u0142 Ci\u0119 do czatu grupowego`,\r\n\t\t\t\t\t1\r\n\t\t\t\t);\r\n\r\n\t\t\t\tglobalSelectedRecipients = [];\r\n\t\t\t\t$(\"#selectedChat\").empty();\r\n\t\t\t} else {\r\n\t\t\t\trepaintChats(null);\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n}\r\n\r\nexport async function openChatForPosition(\r\n\tfullItemID: string,\r\n\titemTitle: string,\r\n\tdefinitionVerID: number\r\n) {\r\n\tRetrieveChatForPosition(fullItemID, async (response) => {\r\n\t\tif (response?.success) {\r\n\t\t\tif (response.data?.chatID) {\r\n\t\t\t\tif (debug) console.log(\"jest czat\");\r\n\t\t\t\tlocalStorage.setItem(\r\n\t\t\t\t\t\"lastActiveChat\",\r\n\t\t\t\t\tresponse.data.chatID?.toString()\r\n\t\t\t\t);\r\n\t\t\t\tawait OpenMainChatPopup();\r\n\r\n\t\t\t\tresponse.data.chatCaption = itemTitle;\r\n\t\t\t\tresponse.data.relatedObjectDef = definitionVerID;\r\n\r\n\t\t\t\tawait openChat(response.data);\r\n\t\t\t} else {\r\n\t\t\t\tif (debug) console.log(\"brak czatu\");\r\n\t\t\t\tlocalStorage.setItem(\"lastActiveChat\", \"-1\");\r\n\t\t\t\tawait OpenMainChatPopup();\r\n\t\t\t\tOpenPreviewChatForPositionNoExist(fullItemID, itemTitle);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!response?.success) {\r\n\t\t\tif (response.message?.length) {\r\n\t\t\t\tshowDxToast(response.message, \"error\");\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"Nie mo\u017Cna otworzy\u0107 czatu tej pozycji\", \"error\");\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function OpenPreviewChatForPositionNoExist(\r\n\tfullItemID: string,\r\n\titemTitle: string\r\n) {\r\n\tJoinToChatForPosition(undefined, fullItemID, async (response) => {\r\n\t\tif (response?.success) {\r\n\t\t\trepaintChats(response.data);\r\n\t\t\t$(\"#tabBtnChats\").trigger(\"click\");\r\n\t\t\t$(\"#tabBtnChats\").addClass(\"active\");\r\n\t\t\t$(\"#tabBtnContacts\").removeClass(\"active\");\r\n\t\t\tconst itemID = Number(fullItemID.split(\";Id=\")[1]);\r\n\t\t\tawait openChat({\r\n\t\t\t\tchatID: response.data,\r\n\t\t\t\titemID: itemID,\r\n\t\t\t\tchatCaption: itemTitle,\r\n\t\t\t});\r\n\r\n\t\t\tif (checkWhereIsUser() === \"varioObject\" && hubUrl?.length > 0) {\r\n\t\t\t\tcheckChatForPosition(fullItemID, title, Number(modelDefinitionKey));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!response?.success) {\r\n\t\t\tif (response.message?.length) {\r\n\t\t\t\tshowDxToast(response.message, \"error\");\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"Nie mo\u017Cna do\u0142\u0105czy\u0107 do tego czatu\", \"error\");\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport async function openChat(\r\n\telement: Partial & Partial\r\n) {\r\n\tawait createChatTextPanel(null, element);\r\n\r\n\tconst iconContainer = $(\"#selectedChatHeader .circleContainer\");\r\n\tif (iconContainer.find(\".chatIcon\").length === 0) {\r\n\t\tconst chatIcon = createUserIcon(element);\r\n\t\ticonContainer.append(chatIcon);\r\n\t}\r\n\r\n\tlocalStorage.setItem(\"lastActiveChat\", element?.chatID?.toString() ?? \"\");\r\n\tsetActiveChatCSS(element?.chatID?.toString() ?? \"\", \"chat\");\r\n}\r\n\r\nlet requestForMessagesId: number | undefined;\r\nlet manualScroll = false;\r\nexport function scrollChatDetection() {\r\n\tconst scrollTop = $(\"#chatHistoryContentContainer\").scrollTop() ?? -1;\r\n\tif (scrollTop > 350) {\r\n\t\tmanualScroll = false;\r\n\t\treturn;\r\n\t}\r\n\tmanualScroll = true;\r\n\r\n\tconst preLastMessageId = Number(\r\n\t\t$(\"#chatHistoryContentContainer .singleMessage[data-id]\")\r\n\t\t\t.eq(1)\r\n\t\t\t.attr(\"data-id\")\r\n\t);\r\n\r\n\tif (requestForMessagesId === preLastMessageId) return;\r\n\trequestForMessagesId = preLastMessageId;\r\n\r\n\tconst chatId = Number($(\".singleChat.activeChat\").attr(\"data-chat-id\"));\r\n\r\n\t$(\"#chatHistoryContentContainer\").prepend(`
\r\n
\r\n
\r\n
.
\r\n
.
\r\n
.
\r\n
\r\n
\r\n
`);\r\n\r\n\tretrieveMessages(chatId, 20, preLastMessageId, async (response) => {\r\n\t\tif (response?.success) {\r\n\t\t\tawait appendChatHistory(response.data, true);\r\n\t\t\t$(\"#chatLoader\").remove();\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function filterChat(filter = $(\"#chatSearch\").val()?.toString() ?? \"\") {\r\n\tif (filter !== \"\") $(\"#clearSearchButton\").removeClass(\"hidden\");\r\n\r\n\tif (filter?.length > 0 && validateEmail(filter)) {\r\n\t\tif (registerEnabled === \"True\" || register4AllEnabled === \"True\") {\r\n\t\t\t$(\"#addNewEmailForChatButton\").removeClass(\"hidden\");\r\n\t\t}\r\n\t} else {\r\n\t\t$(\"#addNewEmailForChatButton\").addClass(\"hidden\");\r\n\t}\r\n\r\n\tlet userContainer: JQuery;\r\n\tlet txtValue: string;\r\n\t$(\"#leftPanelChat .singleChat\").each((_, item) => {\r\n\t\tconst itemElem = item as HTMLElement;\r\n\t\tuserContainer = $(itemElem).find(\".chatSender\");\r\n\r\n\t\tif (userContainer) {\r\n\t\t\ttxtValue = userContainer.text().trim();\r\n\t\t\tif (txtValue.toUpperCase().indexOf(filter.toUpperCase()) === -1) {\r\n\t\t\t\titemElem.style.display = \"none\";\r\n\t\t\t} else {\r\n\t\t\t\titemElem.style.display = \"\";\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function clearFilter() {\r\n\t$(\"#chatSearch\").val(\"\");\r\n\tfilterChat();\r\n\r\n\t$(\"#clearSearchButton\").addClass(\"hidden\");\r\n\t$(\"#addNewEmailForChatButton\").addClass(\"hidden\");\r\n}\r\n\r\nexport async function addNewEmailForChat() {\r\n\tconst emailAddress = $(\"#chatSearch\").val()?.toString()?.trim();\r\n\tif (!emailAddress?.length) return;\r\n\r\n\tawait CreateUserOrAddContactEntry(emailAddress, (response) => {\r\n\t\tif (response?.success) {\r\n\t\t\tconst recipients: VarioEmployee[] = JSON.parse(\r\n\t\t\t\tsessionStorage.getItem(\"Recipients\") ?? \"null\"\r\n\t\t\t);\r\n\t\t\tconst userFound = recipients.find((x) =>\r\n\t\t\t\tx.recipientName.includes(emailAddress)\r\n\t\t\t);\r\n\t\t\tif (!userFound) {\r\n\t\t\t\tconst newRec: VarioEmployee = {\r\n\t\t\t\t\trecipientKey: response.data.recipientKey,\r\n\t\t\t\t\trecipientName: emailAddress,\r\n\t\t\t\t\trecipientMembershipGroup: response.data?.recipientMembershipGroup,\r\n\t\t\t\t\trecipientPosition: response.data?.recipientPosition,\r\n\t\t\t\t\trecipientType: response.data?.recipientType,\r\n\t\t\t\t\trecipientIcon: response.data?.recipientIcon,\r\n\t\t\t\t\tsiteCaption: response.data?.siteCaption,\r\n\t\t\t\t\toutsideRecipient: response.data?.outsideRecipient,\r\n\t\t\t\t\trecipientRoles: [],\r\n\t\t\t\t};\r\n\r\n\t\t\t\trecipients.push(newRec);\r\n\t\t\t\tsessionStorage.setItem(\"Recipients\", JSON.stringify(recipients));\r\n\r\n\t\t\t\t//jak jestesmy na czatach to przejsc na kontakty\r\n\t\t\t\tif ($(\"#tabBtnChats\").hasClass(\"active\")) {\r\n\t\t\t\t\tconst e = { id: \"tabBtnContacts\" };\r\n\t\t\t\t\tswapContactsChats(e);\r\n\t\t\t\t\t$(\"#tabBtnChats\").removeClass(\"active\");\r\n\t\t\t\t\t$(\"#tabBtnContacts\").addClass(\"active\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$(\"#contactsList\").empty();\r\n\t\t\t\tcreateContactsList(recipients);\r\n\r\n\t\t\t\t$(`*[data-single-user-name=\"${emailAddress}\"]`)?.trigger(\"click\");\r\n\t\t\t\tclearFilter();\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"U\u017Cytkownik jest ju\u017C na li\u015Bcie kontakt\u00F3w\", \"info\");\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tshowDxToast(\"Wyst\u0105pi\u0142 b\u0142\u0105d\", \"error\");\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function createEmptyChatView() {\r\n\t$(\"#selectedChat\").append(`\r\n
\r\n
\r\n \"Vario\"\r\n
\r\n \r\n \r\n
\r\n
\r\n `);\r\n}\r\n\r\nexport function markChatAsReadFront(chatID: number) {\r\n\tmarkChatAsRead(chatID, (response) => {\r\n\t\tif (response?.success) {\r\n\t\t\t//Oznaczenie wiadomo\u015Bci w czacie jako przeczytane\r\n\t\t\t$(\".unreadMessageBold\").removeClass(\"unreadMessageBold\");\r\n\r\n\t\t\t//Oznaczenie czatu po lewej jako przeczytany\r\n\t\t\t$(`*[data-chat-id=${chatID}]`).removeClass(\"extraBold\");\r\n\r\n\t\t\t//Zaktualizowanie cyferki na dymku\r\n\t\t\tconst unreadChats = JSON.parse(\r\n\t\t\t\tsessionStorage.getItem(\"unreadChats\") ?? \"null\"\r\n\t\t\t);\r\n\t\t\tif (unreadChats && Array.isArray(unreadChats)) {\r\n\t\t\t\tconst index = unreadChats.indexOf(chatID);\r\n\t\t\t\tif (index !== -1) {\r\n\t\t\t\t\tunreadChats.splice(index, 1);\r\n\t\t\t\t\tupdateUnreadChatsNumber(unreadChats.length);\r\n\r\n\t\t\t\t\tsessionStorage.setItem(\"unreadChats\", JSON.stringify(unreadChats));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function showMessagesNotifySummary(data: RetrievedChat[]) {\r\n\tif (\r\n\t\tsessionStorage.getItem(\"showChatSummaryNotify\") != null &&\r\n\t\tsessionStorage.getItem(\"showChatSummaryNotify\") === \"true\"\r\n\t) {\r\n\t\tlet newCounter = 0;\r\n\t\tlet lastUnreadMessage: RetrievedChat | null = null;\r\n\t\tlet summaryMessage = \"\";\r\n\t\tlet lastChatID = -1;\r\n\t\tfor (const element of data) {\r\n\t\t\tif (element.lastMessageIsRead === false) {\r\n\t\t\t\tnewCounter++;\r\n\t\t\t\tlastUnreadMessage = element;\r\n\t\t\t\tlastChatID = lastUnreadMessage?.chatID;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (newCounter === 1) {\r\n\t\t\tsummaryMessage = `Masz nieprzeczytan\u0105 wiadomo\u015B\u0107 w czacie z \"${lastUnreadMessage?.chatCaption}\"`;\r\n\t\t} else if (newCounter > 1) {\r\n\t\t\tsummaryMessage = `Masz ${newCounter} nieprzeczytane wiadomo\u015Bci w czatach`;\r\n\t\t}\r\n\r\n\t\tif (summaryMessage.length > 0) {\r\n\t\t\t//showDxToast(summaryMessage, \"info\");\r\n\r\n\t\t\t$(\"#devex-toast-message\").dxToast(\"instance\").option({\r\n\t\t\t\ttype: \"info\",\r\n\t\t\t\tmessage: summaryMessage,\r\n\t\t\t\tvisible: true,\r\n\t\t\t\tdisplayTime: 5000,\r\n\t\t\t});\r\n\r\n\t\t\t//poczekanie az pojawi sie toast dx i dodanie na niego clicka ktory wlacza okienko odpowiedz\r\n\t\t\twaitForElm(\r\n\t\t\t\t\".dx-toast-wrapper .dx-overlay-content.dx-toast-info.dx-toast-content\"\r\n\t\t\t).then((elm) => {\r\n\t\t\t\t$(elm).css(\"cursor\", \"pointer\");\r\n\t\t\t\t$(elm).one(\"click\", () => {\r\n\t\t\t\t\topenChatFromToast(lastChatID);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tsessionStorage.setItem(\"showChatSummaryNotify\", \"false\");\r\n\t}\r\n}\r\n\r\nexport function showPopupWarningDeletingMessage(\r\n\tchatID: number,\r\n\tmessageID: number\r\n) {\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(250));\r\n\tpopup.option(\"minHeight\", calcMinPopup(120, true));\r\n\tpopup.option(\"showTitle\", false);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\tpopup.show();\r\n\r\n\t$(\"#Dialog\").empty();\r\n\t$(\"#Dialog\").append(\r\n\t\t`

Czy chcesz usun\u0105\u0107 wiadomo\u015B\u0107?

`\r\n\t);\r\n\r\n\tpopup.content().find(\".DialogFooter\").empty();\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.append(`\r\n
\r\n \r\n \r\n
\r\n `);\r\n\r\n\t$(document).one(\"keypress\", (event) => {\r\n\t\tif (\r\n\t\t\t$(\"#deleteMessageBtn\").length > 0 &&\r\n\t\t\tevent?.originalEvent?.key === \"Enter\"\r\n\t\t) {\r\n\t\t\t$(\"#deleteMessageBtn\").trigger(\"click\");\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function onMessageRemovedFromChat(chatID: number, messageID: number) {\r\n\tRemoveMessageFromChat(messageID, (response) => {\r\n\t\tif (response?.success) {\r\n\t\t\tremoveMessageFromChatPopup(messageID, chatID);\r\n\t\t\tsendViaHub(messageID, chatID, null, \"\", 2);\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function onMessageRemovedFromChatFromHub(\r\n\tresponse: VarioHubModels.ResponseMessage\r\n) {\r\n\tremoveMessageFromChatPopup(\r\n\t\tNumber(response?.messageID),\r\n\t\tNumber(response?.chatID)\r\n\t);\r\n}\r\n\r\nexport function removeMessageFromChatPopup(messageID: number, chatID: number) {\r\n\tif ($(\".activeChat\").attr(\"data-chat-id\") !== chatID.toString()) return;\r\n\r\n\tconst deletedMessage = $(`.singleMessage[data-id=${messageID}]`);\r\n\tif (!deletedMessage.length) return;\r\n\r\n\tlet userClass = \"otherUserInChat\";\r\n\tif (deletedMessage.parents(\".currentUserInChat\").length) {\r\n\t\tuserClass = \"currentUserInChat\";\r\n\t}\r\n\r\n\tdeletedMessage.replaceWith(`\r\n
\r\n \r\n
Wiadomo\u015B\u0107 usuni\u0119ta
\r\n
\r\n `);\r\n\r\n\tif (\r\n\t\t$(\"#chatHistoryContentContainer .singleMessage\").last().attr(\"data-id\") ===\r\n\t\tmessageID.toString()\r\n\t)\r\n\t\trepaintChats(-1);\r\n}\r\n\r\nexport function onAddReactionToMessageChat(\r\n\tchatID: number,\r\n\tmessageID: number,\r\n\tauthorID: string,\r\n\treaction: string,\r\n\treactionEnum: number\r\n) {\r\n\tconst selectedEmojiDiv = $(`.singleMessage[data-id='${messageID}']`).find(\r\n\t\t\".messageSettings .emojiButton.selected\"\r\n\t);\r\n\tconst unReact =\r\n\t\tselectedEmojiDiv.attr(\"data-emoji-enum\") === reactionEnum.toString();\r\n\r\n\tif (unReact) {\r\n\t\treaction = \"\";\r\n\t\tselectedEmojiDiv.removeClass(\"selected\");\r\n\t\treactionEnum = 0;\r\n\t}\r\n\r\n\tAddReactionToMessageChat(messageID, reaction, (response) => {\r\n\t\tif (response?.success) {\r\n\t\t\t//Wyslac hubem nowy rodzaj info - o dodaniu reakcji (Do autora z tostem i refreshem. Dla pozosta\u0142ych pusty tylko z refreshem)\r\n\r\n\t\t\t//wysy\u0142anie hubem tylko jak reakcja nie jest cofni\u0119ciem, np unlike\r\n\t\t\tconst arrAuthor = new Array();\r\n\t\t\tauthorID = authorID.split(\"Id=\")[1];\r\n\t\t\tarrAuthor.push(authorID);\r\n\r\n\t\t\tlet msg = `U\u017Cytkownik ${currentUserName} zareagowa\u0142 na wiadomo\u015B\u0107 ${reaction}`;\r\n\t\t\tif (unReact) {\r\n\t\t\t\tmsg = \"\";\r\n\t\t\t}\r\n\t\t\tsendViaHub(messageID, chatID, arrAuthor, msg, 3);\r\n\r\n\t\t\tlet participants = JSON.parse(\r\n\t\t\t\t$(\".chatHeaderUser\").attr(\"data-participants\") ?? \"null\"\r\n\t\t\t);\r\n\t\t\tparticipants = participants?.filter(\r\n\t\t\t\t(element) => element !== authorID && element !== currentUserId\r\n\t\t\t);\r\n\r\n\t\t\tif (participants.length > 0)\r\n\t\t\t\tsendViaHub(messageID, chatID, participants, \"\", 3);\r\n\r\n\t\t\tappendReactions(messageID, null, reactionEnum);\r\n\t\t\tif (\r\n\t\t\t\t$(\".messageGroupMessageContainer .singleMessage:last\").attr(\r\n\t\t\t\t\t\"data-id\"\r\n\t\t\t\t) === messageID.toString()\r\n\t\t\t) {\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tscrollChatToMessage(messageID);\r\n\t\t\t\t}, 300);\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function addChatAttachments(\r\n\tfiles: FileList | File[] = (\r\n\t\tdocument.getElementById(\"chatAttachInput\") as HTMLInputElement\r\n\t)?.files ?? []\r\n) {\r\n\tconst filesArray = Array.from(files);\r\n\r\n\tconst attDiv = $(\"#chatAttachments\");\r\n\tattDiv.removeClass(\"hidden\");\r\n\tattDiv.find(\".chatFileAttachment:not([data-itemid])\").remove();\r\n\tif (\r\n\t\tfilesArray.length > 0 &&\r\n\t\t\"itemId\" in filesArray[0] &&\r\n\t\tattDiv.find(`.chatFileAttachment[data-itemid=\"${filesArray[0].itemId}\"]`)\r\n\t\t\t.length > 0\r\n\t)\r\n\t\treturn;\r\n\r\n\tconst chatAttachmentsInput = document.getElementById(\r\n\t\t\"chatAttachmentsInput\"\r\n\t) as HTMLInputElement;\r\n\r\n\tconst mainFiles = Array.from(chatAttachmentsInput?.files ?? []);\r\n\r\n\t// Merge the arrays\r\n\tconst mergedArray = mainFiles.concat(filesArray);\r\n\r\n\tconst dt = new DataTransfer();\r\n\tAddFiles(mergedArray, (x, index) => AddAttachment(x, index, attDiv, dt));\r\n\r\n\t$(\".deleteChatAttachment\").on(\"click\", (event: JQuery.ClickEvent) => {\r\n\t\tevent.stopPropagation();\r\n\t\tevent.stopImmediatePropagation();\r\n\r\n\t\tconst attachDiv = $(event.currentTarget).parent();\r\n\t\tdeleteAttachmentDuringInput(attachDiv);\r\n\t});\r\n\r\n\t$(\"#chatAttachInput\").val(\"\");\r\n\tif (chatAttachmentsInput) chatAttachmentsInput.files = dt.files; // Assign the updates list\r\n\r\n\tif (attDiv.find(\".chatFileAttachment\").length === 0) {\r\n\t\tattDiv.addClass(\"hidden\");\r\n\t}\r\n}\r\n\r\nexport function AddAttachment(\r\n\tfile: Partial & Partial,\r\n\ti: number,\r\n\tattDiv: JQuery,\r\n\tdt: DataTransfer\r\n) {\r\n\tif (!file) return;\r\n\tif (!(\"fromGrid\" in file)) dt.items.add(file as File);\r\n\r\n\tconst extension =\r\n\t\tsupportedContent.checkWhichFileExtensions((file as File).type) ?? [];\r\n\tlet extensionIcon = \"\";\r\n\tif (extension.length > 0 || \"icon\" in file) {\r\n\t\tlet fileExtensionIconLink = `${GetBaseUrl()}/Vario/GetIconFromFileExtension/?fileExtension=.${extension[0]}`;\r\n\t\tif (\"icon\" in file) fileExtensionIconLink = file.icon ?? \"\";\r\n\r\n\t\textensionIcon = `\"\"`;\r\n\t}\r\n\r\n\tconst attachmentDiv = $(`\r\n
\r\n ${extensionIcon}\r\n

${file.name}

\r\n \r\n
\r\n `).appendTo(attDiv);\r\n\r\n\tif (\"itemId\" in file) attachmentDiv.attr(\"data-itemid\", file?.itemId ?? \"\");\r\n\telse {\r\n\t\tattachmentDiv.on(\"click\", () => {\r\n\t\t\tpreviewAttachment(file);\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function deleteAttachmentDuringInput(attachDiv: JQuery) {\r\n\tconst input = document.getElementById(\r\n\t\t\"chatAttachmentsInput\"\r\n\t) as HTMLInputElement;\r\n\tif (!input) return;\r\n\tconst { files } = input;\r\n\r\n\t//zalacznik z vario\r\n\tconst itemIdFromVario = attachDiv.attr(\"data-itemid\") ?? \"\";\r\n\tif (itemIdFromVario && itemIdFromVario !== \"\") {\r\n\t\tattachDiv.remove();\r\n\r\n\t\tconst attDiv = $(\"#chatAttachments\");\r\n\t\tif (attDiv.find(\".chatFileAttachment\").length === 0) {\r\n\t\t\tattDiv.addClass(\"hidden\");\r\n\t\t}\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (!files?.length) return;\r\n\r\n\tconst attachId = attachDiv.attr(\"data-attachment-id\");\r\n\r\n\tconst dt = new DataTransfer();\r\n\tfor (let i = 0; i < files.length; i++) {\r\n\t\tconst file = files[i];\r\n\t\tif (Number(attachId) !== i) dt.items.add(file); // here you exclude the file. thus removing it.\r\n\t}\r\n\r\n\tinput.files = dt.files; // Assign the updates list\r\n\taddChatAttachments();\r\n}\r\n\r\nexport function addDragNDropToChat() {\r\n\tconst dropArea = document.getElementById(\"selectedChat\");\r\n\r\n\tif (dropArea) {\r\n\t\tfor (const eventName of [\"dragenter\", \"dragover\", \"dragleave\", \"drop\"]) {\r\n\t\t\tdropArea.addEventListener(eventName, preventDefaults, false);\r\n\t\t}\r\n\r\n\t\tdropArea.addEventListener(\r\n\t\t\t\"dragenter\",\r\n\t\t\t(event) => {\r\n\t\t\t\tdragEnterFunc(event, dropArea);\r\n\t\t\t},\r\n\t\t\tfalse\r\n\t\t);\r\n\t\tdropArea.addEventListener(\r\n\t\t\t\"dragleave\",\r\n\t\t\t(event) => {\r\n\t\t\t\tdragLeaveFunc(event, dropArea);\r\n\t\t\t},\r\n\t\t\tfalse\r\n\t\t);\r\n\t\tdropArea.addEventListener(\"drop\", handleDropInChat, false);\r\n\t}\r\n}\r\n\r\nexport function handleDropInChat(e: DragEvent) {\r\n\tconst dropArea = document.getElementById(\"selectedChat\");\r\n\tif (dropArea) dragLeaveFunc(undefined, dropArea);\r\n\r\n\tconst dt: DataTransfer | null = e.dataTransfer;\r\n\tlet files = Array.from(dt?.files ?? []);\r\n\r\n\tconst filesFromVario = JSON.parse(\r\n\t\tdt?.getData(\"text/plain\") ? dt?.getData(\"text/plain\") : \"null\"\r\n\t);\r\n\r\n\tif (filesFromVario?.length) {\r\n\t\tif (filesFromVario.find((x) => x.isFromVarioChat)) {\r\n\t\t\tshowDxToast(\r\n\t\t\t\t\"Nie mo\u017Cna doda\u0107 za\u0142\u0105cznika do tego samego czatu.\",\r\n\t\t\t\t\"warning\"\r\n\t\t\t);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (filesFromVario.find((x) => x.baseUrl !== GetBaseUrl())) {\r\n\t\t\tshowDxToast(\"Nie mo\u017Cna skopiowa\u0107 pozycji.\", \"warning\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tfiles = filesFromVario.map((x) => ({\r\n\t\t\titemId: x.itemId,\r\n\t\t\ticon: x.icon,\r\n\t\t\tname: x.caption ?? x.name,\r\n\t\t\tfromGrid: true,\r\n\t\t}));\r\n\t}\r\n\r\n\taddChatAttachments(files);\r\n}\r\n\r\nexport function pastedAttachment(e) {\r\n\tconst files = e?.originalEvent?.clipboardData?.files;\r\n\tif (!files.length) return;\r\n\r\n\taddChatAttachments(files);\r\n}\r\n\r\nexport function previewAttachment(\r\n\tfile: Partial & Partial\r\n) {\r\n\tif (!supportedContent.checkIfSupported(file.type)) return;\r\n\tif (convertPDFToImagesOnMobile === \"True\" && file.type === \"application/pdf\")\r\n\t\treturn;\r\n\r\n\tconst popup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"height\", \"100%\");\r\n\tpopup.option(\"width\", \"100%\");\r\n\tif (isRunningOnMobile()) {\r\n\t\tpopup.option(\"maxWidth\", \"90vw\");\r\n\t\tpopup.option(\"maxHeight\", \"90vh\");\r\n\t} else {\r\n\t\tpopup.option(\"maxWidth\", \"80vw\");\r\n\t\tpopup.option(\"maxHeight\", \"80vh\");\r\n\t}\r\n\r\n\tpopup.option(\"title\", file.name);\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t$(\"#BigDialog\").empty();\r\n\tpopup.content().find(\".DialogFooter\").empty();\r\n\t$(\"#BigDialog\").append('
');\r\n\r\n\taddFilePreview(\r\n\t\t\"sourcePreview\",\r\n\t\tfile,\r\n\t\tsupportedContent.checkWhichTypeOfFile(file.type ?? \"\") ?? \"\",\r\n\t\ttrue,\r\n\t\tfile.name\r\n\t);\r\n}\r\n\r\nexport async function appendReactions(\r\n\tmessageId: number,\r\n\treactionsObject: MessageReactions | null,\r\n\tuserReaction: number\r\n) {\r\n\tconst messageDiv = $(`.singleMessage[data-id='${messageId}']`);\r\n\tif (!messageDiv.length) return;\r\n\r\n\tconst recipients: VarioEmployee[] = JSON.parse(\r\n\t\tsessionStorage.getItem(\"Recipients\") ?? \"null\"\r\n\t);\r\n\tlet needToDownloadUsers = true;\r\n\r\n\tlet reactions: Reactions[] = [];\r\n\tif (!reactionsObject) {\r\n\t\t//jesli dodalismy reakcje\r\n\t\tawait RetrieveMessageDetails(messageId, (response) => {\r\n\t\t\tif (response?.success && response?.data?.reactions) {\r\n\t\t\t\tneedToDownloadUsers = false;\r\n\t\t\t\tconst currReactionsObject = response.data.reactions;\r\n\r\n\t\t\t\tfor (const key in currReactionsObject) {\r\n\t\t\t\t\tif (Number(key) === 0) continue;\r\n\r\n\t\t\t\t\tconst emojiEnum = key;\r\n\t\t\t\t\tconst count = currReactionsObject[key].length;\r\n\t\t\t\t\tconst users = currReactionsObject[key];\r\n\r\n\t\t\t\t\tconst parsedUsers: any[] = [];\r\n\t\t\t\t\tfor (const user of users) {\r\n\t\t\t\t\t\tparsedUsers.push(\r\n\t\t\t\t\t\t\trecipients.find((x) => x.recipientKey.includes(user))\r\n\t\t\t\t\t\t\t\t?.recipientName\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treactions.push({\r\n\t\t\t\t\t\temoji: reactionsArr[emojiEnum].emoji,\r\n\t\t\t\t\t\tcount,\r\n\t\t\t\t\t\tusers: parsedUsers,\r\n\t\t\t\t\t\tenum: Number(emojiEnum),\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} else {\r\n\t\t//appendowanie reakcji przy pobraniu message\r\n\t\treactions = Object.entries(reactionsObject).reduce(\r\n\t\t\t(arr: Reactions[], [emojiEnum, count]) => {\r\n\t\t\t\tif (count !== 0) {\r\n\t\t\t\t\tarr.push({\r\n\t\t\t\t\t\temoji: reactionsArr[emojiEnum].emoji,\r\n\t\t\t\t\t\tcount: Number(count),\r\n\t\t\t\t\t\tusers: [],\r\n\t\t\t\t\t\tenum: Number(emojiEnum),\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\treturn arr;\r\n\t\t\t},\r\n\t\t\t[]\r\n\t\t);\r\n\t}\r\n\r\n\tmessageDiv.find(\".messageSettings .emojiButton\").removeClass(\"selected\");\r\n\r\n\tif (reactions.length > 0) {\r\n\t\tif (messageDiv.find(\".messageReactions\").length) {\r\n\t\t\tmessageDiv.find(\".messageReactions\").empty();\r\n\t\t} else {\r\n\t\t\tmessageDiv.append('
');\r\n\t\t}\r\n\r\n\t\tfor (const react of reactions) {\r\n\t\t\tmessageDiv.find(\".messageReactions\").append(`\r\n
\r\n ${react?.emoji}\r\n ${react?.count}\r\n ${react?.users?.join(\", \") ?? \"\"}\r\n
\r\n `);\r\n\t\t}\r\n\r\n\t\tif (needToDownloadUsers) {\r\n\t\t\t//dodawanie uzytkownikow ktorzy dodali reakcje\r\n\t\t\tRetrieveMessageDetails(messageId, (response) => {\r\n\t\t\t\tif (response?.success) {\r\n\t\t\t\t\tif (!response?.data?.reactions) return;\r\n\t\t\t\t\tconst reactionAuthors = response.data.reactions;\r\n\r\n\t\t\t\t\tfor (const [key, value] of Object.entries(reactionAuthors)) {\r\n\t\t\t\t\t\tconst users: any[] = [];\r\n\t\t\t\t\t\tfor (const user of value) {\r\n\t\t\t\t\t\t\tusers.push(\r\n\t\t\t\t\t\t\t\trecipients.find((x) => x.recipientKey.includes(user))\r\n\t\t\t\t\t\t\t\t\t?.recipientName\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tmessageDiv\r\n\t\t\t\t\t\t\t.find(\r\n\t\t\t\t\t\t\t\t`.messageReactionContainer[data-enum=\"${key}\"] .messageReactionNames`\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t.text(users?.join(\", \"));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (typeof userReaction === \"undefined\" || userReaction === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst userEmojiPicked = reactionsArr[userReaction].emoji;\r\n\t\tmessageDiv\r\n\t\t\t.find(`.messageSettings .emojiButton:contains('${userEmojiPicked}')`)\r\n\t\t\t.addClass(\"selected\");\r\n\t} else {\r\n\t\tmessageDiv.find(\".messageReactions\").remove();\r\n\t}\r\n}\r\n\r\nexport function appendAttachments(\r\n\tmessageDiv: JQuery,\r\n\tattachments: VarioObjectContent[]\r\n) {\r\n\tattachments?.forEach((file, index) => {\r\n\t\tconst type = supportedContent.checkWhichTypeOfFile(file.contentType ?? \"\");\r\n\t\tconst link = `${GetBaseUrl()}/Vario/DownloadContentFile?id=${file.sourceId}&download=true`;\r\n\r\n\t\tconst fileExtensionIconLink = `${GetBaseUrl()}/Vario/GetIconFromFileExtension/?fileExtension=.${file.extension}`;\r\n\r\n\t\tconst extensionIcon = `\"Ikona`;\r\n\r\n\t\tlet innerBody = ``;\r\n\r\n\t\tif (type === \"image\" || type === \"gif\") {\r\n\t\t\tinnerBody = `\"${file.contentFileName}\"`;\r\n\t\t}\r\n\r\n\t\tconst appendedDiv =\r\n\t\t\t$(`
\r\n
\r\n \r\n
\r\n ${innerBody}\r\n
`).appendTo(\r\n\t\t\t\tmessageDiv.find(\".messageAttachments\")\r\n\t\t\t);\r\n\r\n\t\tappendedDiv.find(\".attachmentOptions button\").on(\"click\", () => {\r\n\t\t\tdownloadFileFromLink(\r\n\t\t\t\tlink,\r\n\t\t\t\tundefined,\r\n\t\t\t\t(file.contentFileName ?? \"\") + (file.extension ?? \"\")\r\n\t\t\t);\r\n\t\t});\r\n\r\n\t\tappendedDiv.on(\"dragstart\", (evt) => {\r\n\t\t\tconst dragObject = new DragObject(\r\n\t\t\t\ttrue,\r\n\t\t\t\t(file.contentFileName ?? \"\") + (file.extension ?? \"\"),\r\n\t\t\t\tfile.sourceId ?? \"\",\r\n\t\t\t\tfalse\r\n\t\t\t);\r\n\t\t\tevt?.originalEvent?.dataTransfer?.setData(\r\n\t\t\t\t\"text/plain\",\r\n\t\t\t\tJSON.stringify(dragObject)\r\n\t\t\t);\r\n\t\t});\r\n\t});\r\n\r\n\tmessageDiv\r\n\t\t.find(\r\n\t\t\t\".messageAttachments .chatFileAttachment > img, .messageAttachments .chatFileAttachment > button\"\r\n\t\t)\r\n\t\t.on(\"click\", (event: JQuery.ClickEvent) => {\r\n\t\t\tconst extension = $(event.currentTarget)\r\n\t\t\t\t.attr(\"data-file-extension\")\r\n\t\t\t\t?.split(\".\")[1];\r\n\t\t\tif (!supportedContent.checkIfSupported(extension)) return;\r\n\r\n\t\t\tpreviewFile(\r\n\t\t\t\t$(event.currentTarget).attr(\"data-attachment-link\"),\r\n\t\t\t\t\"\",\r\n\t\t\t\t$(event.currentTarget).attr(\"title\")\r\n\t\t\t);\r\n\t\t});\r\n}\r\n\r\nexport function appendVarioAttachments(\r\n\tmessageDiv: JQuery,\r\n\tattachments: VarioObject[]\r\n) {\r\n\tattachments?.forEach((file, index) => {\r\n\t\tconst link = `${GetBaseUrl()}/Vario/VarioObject?id=${file.hashKey}&asPartialView=false&innerCall=false&browserTabGuid=${uuidv4()}`;\r\n\r\n\t\tconst definitionIconLink = `${GetBaseUrl()}/Vario/GetImageForDefinition/?definitionVerID=${file.definitionKey}&imageSize=small`;\r\n\r\n\t\tconst definitionIcon = `\"Ikona`;\r\n\r\n\t\tconst innerBody = ``;\r\n\r\n\t\tconst appendedDiv =\r\n\t\t\t$(``).appendTo(\r\n\t\t\t\tmessageDiv.find(\".messageAttachments\")\r\n\t\t\t);\r\n\r\n\t\tappendedDiv.on(\"dragstart\", (evt) => {\r\n\t\t\tconst dragObject = new DragObject(\r\n\t\t\t\ttrue,\r\n\t\t\t\tfile.title,\r\n\t\t\t\tfile.key,\r\n\t\t\t\ttrue,\r\n\t\t\t\tdefinitionIconLink\r\n\t\t\t);\r\n\t\t\tevt?.originalEvent?.dataTransfer?.setData(\r\n\t\t\t\t\"text/plain\",\r\n\t\t\t\tJSON.stringify(dragObject)\r\n\t\t\t);\r\n\t\t});\r\n\r\n\t\tappendedDiv.find(\"a\").on(\"click\", (event) => {\r\n\t\t\tevent.preventDefault();\r\n\t\t\tchangeCurrentItem({\r\n\t\t\t\titemId: file.key,\r\n\t\t\t\tinnerCall: false,\r\n\t\t\t});\r\n\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\t});\r\n\t});\r\n}\r\n", "import \"../types/dx.all.d.ts\";\r\nimport { LayoutControlWeb } from \"../types/models/Enums/layoutControlWeb\";\r\nimport {\r\n\ttype AddForWhat,\r\n\tAddressingScope,\r\n\ttype ChangedFields,\r\n\ttype DuplicatedFilesMode,\r\n\ttype FilesFromVario,\r\n\ttype ImportFileResponse,\r\n\tImportedFileStatus,\r\n\ttype LogonRequired,\r\n\ttype ParsedWorkflowFieldsModel,\r\n\tRequestStatus,\r\n\ttype ResponseObject,\r\n\ttype SelectOption,\r\n\ttype ServiceResponse,\r\n\ttype TryToChangeObjectProperitesResponse,\r\n\ttype VarioCategory,\r\n\ttype VarioEmployee,\r\n\ttype VarioMessageViewModel,\r\n\ttype VarioObject,\r\n\ttype VarioObjectField,\r\n\ttype VarioObjectInitModel,\r\n\ttype VarioObjectType,\r\n\ttype WorkflowRequiredFieldsModel,\r\n} from \"../types/models/vario-types\";\r\nimport { reloadGridPanel } from \"./data-grid-side-panel\";\r\nimport {\r\n\tUnselectAndUnfocusDxTable,\r\n\taddNewPosition,\r\n\tcheckIfGridInEditMode,\r\n\tprepareFloatingButtonForTableView,\r\n\trefreshDxGrid,\r\n\treloadDxGridDataSource,\r\n\trepaintDxGrid,\r\n\tselectNewlyAddedRow,\r\n} from \"./devextreme-table-functions\";\r\nimport {\r\n\tChangeCorrespondenceActionButtonsStatus,\r\n\tcreateRecipientTagInput,\r\n} from \"./emails\";\r\nimport { itemShowMoreOptions } from \"./floating-actions\";\r\nimport {\r\n\tclearDynamicWorkflowActionsForFloatingButton,\r\n\tclearFloatingButton,\r\n\tfloatingButtonBackToViewCardWithSubElements,\r\n\tfloatingButtonForNoSelection,\r\n\tfloatingButtonForOneSelection,\r\n} from \"./floating-buttons\";\r\nimport { syncTreeViewSelection } from \"./item-properties.ts\";\r\nimport {\r\n\tGetBaseUrl,\r\n\tchangeCurrentItem,\r\n\trefreshCurrentPage,\r\n\treloadDataToNavTab,\r\n} from \"./page-navigation\";\r\nimport { getAutoCompleteRecipientsData } from \"./recipients\";\r\nimport { refreshManager } from \"./refresh-manager\";\r\nimport { clearRichEditProps, isDirtyDoc, saveDoc } from \"./richedit\";\r\nimport {\r\n\tChangeSaveBtnsStatus,\r\n\tCloseDialog,\r\n\tContainMinusID,\r\n\tHideLoadingPanel,\r\n\tReloadScheduler,\r\n\tShowLoadingPanel,\r\n\tShowPopupWarningUnsaved,\r\n\taddItemInfoToPopup,\r\n\tcalcMinPopup,\r\n\tcheckWhereIsUser,\r\n\tclearDraggedFilesBuffer,\r\n\tcloseToast,\r\n\tfixScrollInDx,\r\n\tisRunningOnMobile,\r\n\tsaveNewPositionAfterAddingToGrid,\r\n\tshowDxToast,\r\n\tstringIsNullOrEmpty,\r\n\tuuidv4,\r\n} from \"./site\";\r\nimport { CloseVarioObjectButtonClick, appendSidePanel } from \"./vario-object\";\r\n\r\ndeclare global {\r\n\tvar allowedDefinitionsGlobal: VarioObjectType[] | null;\r\n\tvar allowedDefinitionsGlobal4SelectedItem: VarioObjectType[] | null;\r\n\r\n\tvar itemReadyToSubmit: boolean;\r\n\tvar varioObjectReadyToSubmit: boolean;\r\n\tvar SubmitAttempsVarioObject: number;\r\n\r\n\tvar SubmitAttemps: number;\r\n\r\n\tvar formSubmitting: boolean;\r\n\tvar ignoreIsDirty: boolean;\r\n\tvar inputIsDirty: boolean;\r\n\r\n\tvar specialFields: ParsedWorkflowFieldsModel[] | null;\r\n\r\n\tvar downloadingDefinitionsAjax: JQueryXHR | null;\r\n\r\n\tvar dropdownValuesDict: any;\r\n\r\n\tvar changedVarioObjectFields: any[];\r\n\r\n\tvar undoItemPromise: Promise | JQuery.jqXHR | null;\r\n}\r\n\r\nglobalThis.allowedDefinitionsGlobal = null;\r\nglobalThis.allowedDefinitionsGlobal4SelectedItem = null;\r\n\r\nglobalThis.itemReadyToSubmit = true;\r\nglobalThis.varioObjectReadyToSubmit = true;\r\nglobalThis.SubmitAttempsVarioObject = 0;\r\n\r\nglobalThis.SubmitAttemps = 0;\r\n\r\nglobalThis.formSubmitting = false;\r\nglobalThis.ignoreIsDirty = false;\r\nglobalThis.inputIsDirty = false;\r\n\r\nglobalThis.specialFields = null;\r\n\r\nglobalThis.downloadingDefinitionsAjax = null;\r\n\r\nglobalThis.dropdownValuesDict = {};\r\n\r\nglobalThis.changedVarioObjectFields = [];\r\n\r\nglobalThis.undoItemPromise = null;\r\n\r\nconst DUPLICATED_FILES_MODE = {\r\n\tNormal: 0,\r\n\tOmmit: 1,\r\n\tReplaceWithExisting: 2,\r\n\tImport: 3,\r\n\tNextTry: 4,\r\n};\r\n\r\nexport const isDirty = () => {\r\n\tif (ignoreIsDirty) {\r\n\t\tignoreIsDirty = false;\r\n\t\treturn false;\r\n\t}\r\n\r\n\tconst ViewCardOK = IsFormViewCardSaved();\r\n\tconst subViewFormOK = IsFormViewSubElementsSaved();\r\n\tif (inputIsDirty || !ViewCardOK || !subViewFormOK) {\r\n\t\treturn true;\r\n\t}\r\n\r\n\treturn false;\r\n};\r\n\r\nexport async function CloseEditor() {\r\n\tif (isDirty()) {\r\n\t\tconst res = await ShowPopupWarningUnsaved(true).catch(() => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\tconst allowedDefinitions = allowedDefinitionsGlobal;\r\n\tif (allowedDefinitions)\r\n\t\tfor (const item of allowedDefinitions) {\r\n\t\t\tjQuery(`#${item.key}`).addClass(\"hidden\");\r\n\t\t}\r\n\tjQuery(\"#Editor\").addClass(\"hidden\");\r\n\tResetRequiredFieldsClasses();\r\n\r\n\tif (checkIfGridInEditMode()) return;\r\n\r\n\t//fix na odswiezenie grida\r\n\trepaintDxGrid();\r\n}\r\n\r\nexport function saveChoice(dictionaryId: string) {\r\n\t//zapisywanie ostatnio wybranego slownika dropdown\u00F3w (np. dla mpk)\r\n\tlocalStorage.setItem(\"dictionary\", dictionaryId);\r\n}\r\n\r\n//sub elements\r\nexport function ChangeFieldValue(\r\n\titemKey: string,\r\n\tcontainerKey: string,\r\n\tdefinitionKey: string,\r\n\tfieldKey: string,\r\n\tvalue: string,\r\n\trealValueType = \"Text\",\r\n\tevent?: JQuery.ChangeEvent\r\n) {\r\n\tif (event?.namespace === \"select2\") return;\r\n\r\n\tconst fields: ChangedFields[] = [];\r\n\tconst valueType = realValueType;\r\n\tfields.push({\r\n\t\tFieldKey: fieldKey,\r\n\t\tValue: value,\r\n\t\tModified: true,\r\n\t\tValueType: valueType,\r\n\t});\r\n\tif (fields) {\r\n\t\titemReadyToSubmit = false;\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/TryToChangeObjectProperites`,\r\n\t\t\ttype: \"Post\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: {\r\n\t\t\t\titemKey: itemKey,\r\n\t\t\t\tfields: fields,\r\n\t\t\t\tdefinitionKey: definitionKey,\r\n\t\t\t\tcontainerKey: containerKey,\r\n\t\t\t\tmessageContainer: \".subElementsMessagePartial\",\r\n\t\t\t},\r\n\t\t\tsuccess: (data: TryToChangeObjectProperitesResponse) => {\r\n\t\t\t\tfor (const field of data.fields) {\r\n\t\t\t\t\tconst editor = document.querySelector(\r\n\t\t\t\t\t\t`#${definitionKey}-${field.fieldKey}`\r\n\t\t\t\t\t) as HTMLInputElement;\r\n\r\n\t\t\t\t\tif (editor) {\r\n\t\t\t\t\t\tif (field.fieldKey === \"Categories\") {\r\n\t\t\t\t\t\t\tconst list = document.querySelector(\r\n\t\t\t\t\t\t\t\t`:not(.hidden) #${definitionKey}-Categories`\r\n\t\t\t\t\t\t\t) as HTMLSelectElement;\r\n\t\t\t\t\t\t\tif (list != null) {\r\n\t\t\t\t\t\t\t\t$(list.options).remove();\r\n\t\t\t\t\t\t\t\t$(list).append(\r\n\t\t\t\t\t\t\t\t\t``\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif (editor.classList.contains(\"dx-numberbox\")) {\r\n\t\t\t\t\t\t\t\t$(editor).dxNumberBox({\r\n\t\t\t\t\t\t\t\t\tvalue: Number(field.value),\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t} else if (editor.value !== field.value) {\r\n\t\t\t\t\t\t\t\teditor.value = field.value;\r\n\t\t\t\t\t\t\t\tif (field.controlType === 3) {\r\n\t\t\t\t\t\t\t\t\teditor.checked = field.value.toLowerCase() === \"true\";\r\n\t\t\t\t\t\t\t\t} else if (\r\n\t\t\t\t\t\t\t\t\tfield.controlType === 2 ||\r\n\t\t\t\t\t\t\t\t\tfield.controlType === 4 ||\r\n\t\t\t\t\t\t\t\t\tfield.controlType === 5\r\n\t\t\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\t\t\tconst select2Id = `${definitionKey}-${field.fieldKey}`;\r\n\r\n\t\t\t\t\t\t\t\t\tsetSelectedInSelect2(select2Id, field.value);\r\n\t\t\t\t\t\t\t\t\tif ($(`#${select2Id}`).data(\"select2\")?.isOpen())\r\n\t\t\t\t\t\t\t\t\t\t$(`#${select2Id}`)\r\n\t\t\t\t\t\t\t\t\t\t\t.data(\"select2\")\r\n\t\t\t\t\t\t\t\t\t\t\t.dropdown.$search.trigger(\"input\");\r\n\t\t\t\t\t\t\t\t\trefreshDropDownText(editor, field);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if (field.fieldKey === \"ID\") {\r\n\t\t\t\t\t\tconst idType = itemKey.substring(0, itemKey.indexOf(\";\") + 4);\r\n\t\t\t\t\t\titemKey = idType + field.value;\r\n\t\t\t\t\t\t//Podmieniamy warto\u015Bc idka tym co przysz\u0142o (np. po update z triggera)\r\n\t\t\t\t\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId =\r\n\t\t\t\t\t\t\tidType + field.value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdownloadDropDownDataSubElements();\r\n\r\n\t\t\t\tif (data?.message?.message?.length) {\r\n\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\tdata.message.message,\r\n\t\t\t\t\t\tdata.message.status === RequestStatus.success ? \"success\" : \"error\"\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\t//$(\".subElementsMessagePartial\").each(function (index, item) {\r\n\t\t\t\t\t// let url = GetBaseUrl() + \"/Vario/VarioActionExecuted\";\r\n\t\t\t\t\t// if (url && url.length > 0) {\r\n\t\t\t\t\t// $(item).load(url, { result: data.message });\r\n\t\t\t\t\t// }\r\n\t\t\t\t\t//});\r\n\t\t\t\t}\r\n\t\t\t\titemReadyToSubmit = true;\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function refreshDropDownText(\r\n\tmainDropdown: HTMLInputElement,\r\n\tfield: VarioObjectField\r\n) {\r\n\t$(mainDropdown)\r\n\t\t.next(\".select2\")\r\n\t\t.find(\"span .select2-selection__rendered\")\r\n\t\t.text(field.displayText);\r\n\t$(`#displayTextElementId${field.fieldKey}`).val(field.displayText);\r\n}\r\n\r\nexport function getAllModifiedFields(\r\n\tristrictToElement = \"null\"\r\n): ChangedFields[] {\r\n\tconst fields: ChangedFields[] = [];\r\n\r\n\t$(\".varioFieldClass\").each((_, element) => {\r\n\t\tconst el = element as HTMLElement;\r\n\t\tconst modifiedEls = el.getElementsByClassName(\r\n\t\t\t\"fieldModifiedFlag\"\r\n\t\t) as HTMLCollectionOf;\r\n\r\n\t\tif (modifiedEls[0]?.value && modifiedEls[0].value === \"true\") {\r\n\t\t\tconst valueEls = el.getElementsByClassName(\r\n\t\t\t\t\"fieldValueElement\"\r\n\t\t\t) as HTMLCollectionOf;\r\n\r\n\t\t\tconst fieldKeys = el.getElementsByClassName(\r\n\t\t\t\t\"varioFieldKey\"\r\n\t\t\t) as HTMLCollectionOf;\r\n\r\n\t\t\tif (valueEls && fieldKeys) {\r\n\t\t\t\tlet fieldValue = \"\";\r\n\t\t\t\tif (valueEls.length > 1) {\r\n\t\t\t\t\tfieldValue =\r\n\t\t\t\t\t\tvalueEls[1].value ??\r\n\t\t\t\t\t\t$(valueEls[1])?.dxNumberBox(\"instance\")?.option(\"value\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tfieldValue =\r\n\t\t\t\t\t\tvalueEls[0].value ??\r\n\t\t\t\t\t\t$(valueEls[0])?.dxNumberBox(\"instance\")?.option(\"value\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst valueTypeElement = el.getElementsByClassName(\r\n\t\t\t\t\t\"fieldValueTypeElement\"\r\n\t\t\t\t) as HTMLCollectionOf;\r\n\r\n\t\t\t\tlet valueType = \"Text\";\r\n\t\t\t\tif (valueTypeElement) {\r\n\t\t\t\t\tvalueType = valueTypeElement[0].value;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tristrictToElement === \"null\" ||\r\n\t\t\t\t\tfieldKeys[0].value === ristrictToElement\r\n\t\t\t\t) {\r\n\t\t\t\t\tconst fieldKey = fieldKeys[0].value;\r\n\t\t\t\t\tlet dropdownText = fieldValue;\r\n\t\t\t\t\tif (recipientStorage && fieldKey in recipientStorage)\r\n\t\t\t\t\t\tdropdownText = recipientStorage[fieldKey]\r\n\t\t\t\t\t\t\t.map((x) => (x as VarioEmployee).recipientName)\r\n\t\t\t\t\t\t\t.join(\", \");\r\n\t\t\t\t\telse if ($(valueEls).is(\"select\"))\r\n\t\t\t\t\t\tdropdownText =\r\n\t\t\t\t\t\t\tdropdownValuesDict[fieldKeys[0].value]?.find(\r\n\t\t\t\t\t\t\t\t(x) => x.value === fieldValue\r\n\t\t\t\t\t\t\t)?.symbol ?? fieldValue;\r\n\r\n\t\t\t\t\tfields.push({\r\n\t\t\t\t\t\tFieldKey: fieldKey,\r\n\t\t\t\t\t\tValue: fieldValue,\r\n\t\t\t\t\t\tModified: true,\r\n\t\t\t\t\t\tValueType: valueType,\r\n\t\t\t\t\t\tdropdownText: dropdownText,\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\tif (htmlEditorChanges) {\r\n\t\tfields.push({\r\n\t\t\tFieldKey: \"Body\",\r\n\t\t\tValue: htmlEditorChanges,\r\n\t\t\tModified: true,\r\n\t\t\tValueType: \"text\",\r\n\t\t});\r\n\t}\r\n\r\n\treturn fields;\r\n}\r\n\r\nexport function hideBorderAnim() {\r\n\t//chowanie animacji podkreslenia pola zrodla w widoku karty po dodaniu zrodla\r\n\tlet childSource = document.getElementById(\"ChildSources\");\r\n\tif (childSource == null) {\r\n\t\tchildSource = document.getElementById(\"ChildSourcesNoEdit\");\r\n\t}\r\n\tchildSource?.classList.remove(\"borderAnim\");\r\n}\r\n\r\nexport function createInputForFile(itemId: string, text = \"Wgraj/zast\u0105p plik\") {\r\n\tif (!$(\"#inputUploadFiles\").length)\r\n\t\t$(\"#varioObjectForm\").append(\r\n\t\t\t``\r\n\t\t);\r\n\r\n\t$(\"#inputUploadFiles\").trigger(\"click\");\r\n}\r\n\r\nexport function AddFiles(\r\n\tfiles: File[],\r\n\tfileAppender: (file: File, index: number) => void\r\n) {\r\n\tif (files) {\r\n\t\tlet totalSize = 0;\r\n\t\tconst fileArray = Array.from(files);\r\n\r\n\t\tfor (const x of fileArray) {\r\n\t\t\ttotalSize += x.size;\r\n\t\t}\r\n\t\tif (totalSize > maxFileSize) {\r\n\t\t\tshowDxToast(\r\n\t\t\t\t`Rozmiar plik\u00F3w przekracza limit ${maxFileSize / 1024 / 1000}MB`,\r\n\t\t\t\t\"error\"\r\n\t\t\t);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tfileArray.forEach((file, index) => {\r\n\t\t\tfileAppender(file, index);\r\n\t\t});\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nexport function AttachmentAdded() {\r\n\tconst filesInput = $(\"#inputUploadFiles\")[0] as HTMLInputElement;\r\n\tconst numFiles = filesInput.files?.length ?? -1;\r\n\tconst updatedFilesList = new DataTransfer();\r\n\tif (\r\n\t\t!AddFiles(Array.from(filesInput.files ?? []), (x) =>\r\n\t\t\tupdatedFilesList.items.add(x)\r\n\t\t)\r\n\t)\r\n\t\treturn;\r\n\r\n\tChangeSaveBtnsStatus(true);\r\n\r\n\tif (numFiles > 0) {\r\n\t\tconst uploadCounter = document.getElementById(\"uploadFilesCounter\");\r\n\t\tif (uploadCounter) uploadCounter.innerHTML = numFiles.toString();\r\n\t\tif (uploadCounter?.classList?.contains(\"hidden\")) {\r\n\t\t\tuploadCounter.classList.remove(\"hidden\");\r\n\t\t}\r\n\t}\r\n\r\n\tif ($(\".imgSourceVarioObject\").length > 0) {\r\n\t\tconst textEdit = document.getElementById(\"ChildSourcesNoEdit\");\r\n\t\tconst imgSoursce = document.getElementsByClassName(\"imgSourceVarioObject\");\r\n\t\tif (imgSoursce.length > 0 && textEdit != null) {\r\n\t\t\timgSoursce[0].classList.add(\"hidden\");\r\n\t\t\ttextEdit.classList.remove(\"hidden\");\r\n\t\t}\r\n\t}\r\n\r\n\tlet childSource = document.getElementById(\"ChildSources\") as HTMLInputElement;\r\n\tif (childSource == null) {\r\n\t\tchildSource = document.getElementById(\r\n\t\t\t\"ChildSourcesNoEdit\"\r\n\t\t) as HTMLInputElement;\r\n\t}\r\n\r\n\tif (childSource != null && updatedFilesList.files.length === 1) {\r\n\t\tconst fileName = updatedFilesList.files[0].name;\r\n\t\tchildSource.value = fileName;\r\n\t\tchildSource.classList.toggle(\"borderAnim\");\r\n\t\tsetTimeout(hideBorderAnim, 3000);\r\n\t}\r\n\r\n\tsetInputAsDirty();\r\n\tclearRichEditProps();\r\n\tappendSidePanel();\r\n\r\n\tOnSubmitButtonClick();\r\n}\r\n\r\nexport function isHidden(el: HTMLElement) {\r\n\treturn el.offsetParent === null;\r\n}\r\n\r\n//funkcja do sprawdzania klasy requiredfield i disabled guzikow zapisu\r\nexport function afterChangingField(\r\n\telementId: string,\r\n\tvarioObjectKeylementId: string,\r\n\tvalueElementId: string,\r\n\topenButtonElementId: string\r\n) {\r\n\tconst btnGroup = document.getElementById(\"btnGroupOperations\");\r\n\tif (btnGroup) {\r\n\t\tconst show = $(btnGroup).data(\"show\");\r\n\t\tif (show === \"1\") {\r\n\t\t\titemShowMoreOptions(btnGroup);\r\n\t\t}\r\n\t}\r\n\r\n\tif (!stringIsNullOrEmpty(elementId)) {\r\n\t\tconst modifiedInput = document.getElementById(\r\n\t\t\telementId\r\n\t\t) as HTMLInputElement;\r\n\t\tmodifiedInput.value = \"true\";\r\n\t}\r\n\r\n\tif (\r\n\t\t(document.getElementById(varioObjectKeylementId) as HTMLInputElement)\r\n\t\t\t?.value != null &&\r\n\t\tdocument.getElementById(openButtonElementId) != null\r\n\t) {\r\n\t\t//document.getElementById(varioObjectKeylementId).value = document.getElementById(valueElementId).value;\r\n\t\tconst buttonElement = document.getElementById(\r\n\t\t\topenButtonElementId\r\n\t\t) as HTMLButtonElement;\r\n\t\tbuttonElement.innerHTML = ``;\r\n\t}\r\n\r\n\tsetRequiredFields(valueElementId);\r\n\r\n\tif ($(\".fieldRequired\").length === 0) {\r\n\t\tChangeSaveBtnsStatus(true);\r\n\t} else {\r\n\t\tChangeSaveBtnsStatus(false);\r\n\t}\r\n\r\n\tif (!valueElementId) return;\r\n\r\n\tif ($(`#${valueElementId}`).val()) {\r\n\t\t$(`#openDialog-${valueElementId}`).show();\r\n\t} else {\r\n\t\t$(`#openDialog-${valueElementId}`).hide();\r\n\t}\r\n}\r\n\r\n//wysylanie request do TryToChangeObjectProperites w vario object\r\nexport function FieldValueChanged(\r\n\telementId = \"\",\r\n\tvarioObjectKeylementId = \"\",\r\n\tvalueElementId = \"\",\r\n\topenButtonElementId = \"\"\r\n) {\r\n\tafterChangingField(\r\n\t\telementId,\r\n\t\tvarioObjectKeylementId,\r\n\t\tvalueElementId,\r\n\t\topenButtonElementId\r\n\t);\r\n\r\n\tconst fields = getAllModifiedFields(valueElementId);\r\n\r\n\tconsole.log(fields);\r\n\tif (fields?.length) {\r\n\t\tsetInputAsDirty();\r\n\r\n\t\tconst itemKey = (\r\n\t\t\tdocument.getElementById(\"VarioObjectKey\") as HTMLInputElement\r\n\t\t)?.value;\r\n\t\tlet containerKey = \"\";\r\n\t\tlet definitionKey = \"\";\r\n\t\tif (document.getElementById(\"ObjectType_key\"))\r\n\t\t\tdefinitionKey = (\r\n\t\t\t\tdocument.getElementById(\"ObjectType_key\") as HTMLInputElement\r\n\t\t\t).value;\r\n\t\tif (document.getElementById(\"ItemContainerKey\"))\r\n\t\t\tcontainerKey = (\r\n\t\t\t\tdocument.getElementById(\"ItemContainerKey\") as HTMLInputElement\r\n\t\t\t).value;\r\n\r\n\t\tvarioObjectReadyToSubmit = false;\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/TryToChangeObjectProperites`,\r\n\t\t\ttype: \"Post\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: {\r\n\t\t\t\titemKey: itemKey,\r\n\t\t\t\tfields: fields,\r\n\t\t\t\tdefinitionKey: definitionKey,\r\n\t\t\t\tcontainerKey: containerKey,\r\n\t\t\t\tmessageContainer: \".actionPartialMessage\",\r\n\t\t\t},\r\n\t\t\tsuccess: (data: TryToChangeObjectProperitesResponse) => {\r\n\t\t\t\tfor (const field of data.fields) {\r\n\t\t\t\t\tconst editor = document.querySelector(\r\n\t\t\t\t\t\t`#${field.fieldKey}`\r\n\t\t\t\t\t) as HTMLInputElement;\r\n\r\n\t\t\t\t\tif (editor) {\r\n\t\t\t\t\t\tif (editor.classList.contains(\"dx-numberbox\")) {\r\n\t\t\t\t\t\t\t$(editor).dxNumberBox({\r\n\t\t\t\t\t\t\t\tvalue: Number(field.value),\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\teditor.value = field.value;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (field.controlType === 3) {\r\n\t\t\t\t\t\t\teditor.checked = field.value.toLowerCase() === \"true\";\r\n\t\t\t\t\t\t} else if ($(editor).hasClass(\"ToSelect\")) {\r\n\t\t\t\t\t\t\t$(`#${$(editor).attr(\"data-valueelement\")}`).val(field.value);\r\n\t\t\t\t\t\t\trefreshDropDownText(editor, field);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\tdocument.getElementById(\r\n\t\t\t\t\t\t\t\t\t`varioObjectKeyElementId${field.fieldKey}`\r\n\t\t\t\t\t\t\t\t) as HTMLInputElement\r\n\t\t\t\t\t\t\t).value != null &&\r\n\t\t\t\t\t\t\tdocument.getElementById(`openButtonElementId${field.fieldKey}`) !=\r\n\t\t\t\t\t\t\t\tnull\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\tdocument.getElementById(\r\n\t\t\t\t\t\t\t\t\t`varioObjectKeyElementId${field.fieldKey}`\r\n\t\t\t\t\t\t\t\t) as HTMLInputElement\r\n\t\t\t\t\t\t\t).value = (\r\n\t\t\t\t\t\t\t\tdocument.getElementById(field.fieldKey) as HTMLInputElement\r\n\t\t\t\t\t\t\t).value;\r\n\r\n\t\t\t\t\t\t\tconst buttonElement = document.getElementById(\r\n\t\t\t\t\t\t\t\t`openButtonElementId${field.fieldKey}`\r\n\t\t\t\t\t\t\t) as HTMLButtonElement;\r\n\t\t\t\t\t\t\tbuttonElement.dataset.hashVarioObjectKey =\r\n\t\t\t\t\t\t\t\tfield.hashVarioObjectKey;\r\n\t\t\t\t\t\t\tbuttonElement.innerHTML = ``;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (data?.message?.message?.length) {\r\n\t\t\t\t\t$(\".actionPartialMessage\").each((_, item) => {\r\n\t\t\t\t\t\tconst url = `${GetBaseUrl()}/Vario/VarioActionExecuted`;\r\n\t\t\t\t\t\tif (url && url.length > 0) {\r\n\t\t\t\t\t\t\t$(item as HTMLElement).load(url, { result: data.message });\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//LoadDropDowns(valueElementId);\r\n\t\t\t\tProjectChanged();\r\n\t\t\t\tvarioObjectReadyToSubmit = true;\r\n\t\t\t},\r\n\t\t\terror: (err) => {\r\n\t\t\t\tconsole.log(err);\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function setFormSubmitting() {\r\n\tformSubmitting = true;\r\n}\r\n\r\nexport function IsFormViewCardSaved() {\r\n\tlet canExecute = true;\r\n\tconst btnSave = document.getElementById(\r\n\t\t\"BarbtnSaveItemFloating\"\r\n\t) as HTMLButtonElement;\r\n\tif (btnSave) {\r\n\t\tif (!btnSave.classList.contains(\"disabled\") && !btnSave?.disabled) {\r\n\t\t\tcanExecute = false;\r\n\t\t}\r\n\t}\r\n\treturn canExecute;\r\n}\r\n\r\nexport function IsFormViewSubElementsSaved() {\r\n\tlet canExecute = true;\r\n\r\n\tif (\r\n\t\ttypeof subElementsModel[modelSubElementsOnly].globalListOfEditables !==\r\n\t\t\t\"undefined\" &&\r\n\t\tsubElementsModel[modelSubElementsOnly].globalListOfEditables &&\r\n\t\tsubElementsModel[modelSubElementsOnly].globalListOfEditables.length > 0\r\n\t) {\r\n\t\t//console.log(\"listOfEditables\", listOfEditables)\r\n\t\tcanExecute = false;\r\n\t} else {\r\n\t\t//console.log(\"listOfEditables nie istnieje lub jest puste\")\r\n\t\tcanExecute = true;\r\n\t}\r\n\treturn canExecute;\r\n}\r\n\r\nexport function LoadSubElementsEditor(\r\n\tdefinitionKey: string,\r\n\tforEdit: boolean,\r\n\titemIdParam: string,\r\n\tactuallControlView: LayoutControlWeb\r\n) {\r\n\tconst editor = $(\"#SubElementsEditor\");\r\n\t$(editor).removeAttr(\"data-forComponentId\");\r\n\t$(editor).removeAttr(\"data-forcontainerId\");\r\n\r\n\tlet itemId = \"\";\r\n\tlet forComponent = false;\r\n\tconst container =\r\n\t\t$(\".AddDocumentsButtonMenu #okButton\").attr(\"data-forcontainerId\") ??\r\n\t\tcontainerId;\r\n\tif (editor?.length && definitionKey) {\r\n\t\tif (actuallControlView === LayoutControlWeb.ScheduleLayoutFile) {\r\n\t\t\titemId = containerId;\r\n\t\t} else if (\r\n\t\t\t!stringIsNullOrEmpty(\r\n\t\t\t\t$(\".AddDocumentsButtonMenu #okButton\").attr(\"data-forComponentID\")\r\n\t\t\t)\r\n\t\t) {\r\n\t\t\titemId =\r\n\t\t\t\t$(\".AddDocumentsButtonMenu #okButton\").attr(\"data-forComponentID\") ??\r\n\t\t\t\t\"\";\r\n\t\t\tallowedDefinitionsGlobal;\r\n\t\t\tforComponent = !!allowedDefinitionsGlobal4SelectedItem?.find(\r\n\t\t\t\t(x) =>\r\n\t\t\t\t\tx.key ===\r\n\t\t\t\t\tsubElementsModel[modelSubElementsOnly].globalBuforSelectedDefinitionId\r\n\t\t\t)?.forComponent;\r\n\t\t} else {\r\n\t\t\titemId = modelId;\r\n\t\t}\r\n\r\n\t\tlet fieldForceDisplay = \"\";\r\n\t\tconst filesInput = document.getElementById(\"files\") as HTMLInputElement;\r\n\t\tconst addedFiles = $(filesInput.files ?? []);\r\n\t\tif (addedFiles && addedFiles.length === 1) {\r\n\t\t\tfieldForceDisplay = \"ChildSources\";\r\n\t\t}\r\n\r\n\t\tlet templateDef = \"\";\r\n\t\tconst selectTemplate = document.getElementById(\r\n\t\t\t\"selectTemplate\"\r\n\t\t) as HTMLSelectElement;\r\n\t\tif (\r\n\t\t\t$(\"#useTemplate\").prop(\"checked\") &&\r\n\t\t\tselectTemplate?.value !== \"---Wybierz wzorzec---\"\r\n\t\t) {\r\n\t\t\ttemplateDef = selectTemplate.value;\r\n\t\t}\r\n\r\n\t\tif (!forEdit) {\r\n\t\t\tif (templateDef) {\r\n\t\t\t\tdeleteOnUndo = true;\r\n\t\t\t\tShowLoadingPanel(\"Pobieranie danych wzorca...\");\r\n\t\t\t}\r\n\r\n\t\t\t$.ajax({\r\n\t\t\t\turl: `${GetBaseUrl()}/Vario/GetVarioObjectBaseData`,\r\n\t\t\t\ttype: \"get\",\r\n\t\t\t\tcache: false,\r\n\t\t\t\tdata: {\r\n\t\t\t\t\tdefinitionKey:\r\n\t\t\t\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId,\r\n\t\t\t\t\tparentId: forComponent ? itemId : null,\r\n\t\t\t\t\tcontainerId: forComponent ? null : itemId,\r\n\t\t\t\t\ttemplateId: templateDef,\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: (data: VarioObjectInitModel) => {\r\n\t\t\t\t\tshowSubElementsEditor(\r\n\t\t\t\t\t\titemId,\r\n\t\t\t\t\t\tdefinitionKey,\r\n\t\t\t\t\t\tactuallControlView,\r\n\t\t\t\t\t\tfieldForceDisplay,\r\n\t\t\t\t\t\tforEdit,\r\n\t\t\t\t\t\tforComponent,\r\n\t\t\t\t\t\tdata.key,\r\n\t\t\t\t\t\tdata.initFields,\r\n\t\t\t\t\t\tcontainer\r\n\t\t\t\t\t);\r\n\t\t\t\t},\r\n\t\t\t\tcomplete: () => {\r\n\t\t\t\t\tHideLoadingPanel(true);\r\n\t\t\t\t},\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tshowSubElementsEditor(\r\n\t\t\t\titemId,\r\n\t\t\t\tdefinitionKey,\r\n\t\t\t\tactuallControlView,\r\n\t\t\t\tfieldForceDisplay,\r\n\t\t\t\tforEdit,\r\n\t\t\t\tforComponent,\r\n\t\t\t\titemIdParam,\r\n\t\t\t\tnull,\r\n\t\t\t\tcontainer\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function showSubElementsEditor(\r\n\titemId: string,\r\n\tdefinitionKey: string,\r\n\tactuallControlView: LayoutControlWeb,\r\n\tfieldForceDisplay: string,\r\n\tforEdit: boolean,\r\n\tforComponent: boolean,\r\n\titemIdParam: string,\r\n\tinitFields: VarioObjectField[] | null,\r\n\tcontainer: string\r\n) {\r\n\tconst editor = $(\"#SubElementsEditor\");\r\n\tconst url = `${GetBaseUrl()}/Vario/SubElementsEditor`;\r\n\t$.ajax({\r\n\t\turl: url,\r\n\t\ttype: \"get\",\r\n\t\tcache: false,\r\n\t\tdata: {\r\n\t\t\titemId: itemId,\r\n\t\t\tdefinitionKey: definitionKey,\r\n\t\t\tactuallControlView: actuallControlView,\r\n\t\t\tfieldForceDisplay: fieldForceDisplay,\r\n\t\t\teditItemId: itemIdParam,\r\n\t\t},\r\n\t\tsuccess: (data: string & LogonRequired) => {\r\n\t\t\tif (\r\n\t\t\t\tdata != null &&\r\n\t\t\t\tdata.logonRequired !== undefined &&\r\n\t\t\t\tdata.logonRequired === true\r\n\t\t\t) {\r\n\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t} else {\r\n\t\t\t\titemReadyToSubmit = true;\r\n\t\t\t\t$(editor).empty();\r\n\t\t\t\t$(editor).append(data);\r\n\t\t\t\tif (forEdit) {\r\n\t\t\t\t\tAfterEditorReadyForEdit(itemIdParam, definitionKey, false);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tAfterEditorReady(itemIdParam, initFields);\r\n\t\t\t\t}\r\n\t\t\t\tconst parentIdForComponent = forComponent ? itemId : null;\r\n\t\t\t\tif (parentIdForComponent)\r\n\t\t\t\t\t$(editor).attr(\"data-forComponentId\", parentIdForComponent);\r\n\t\t\t\t$(editor).attr(\"data-forcontainerId\", container);\r\n\t\t\t\taddRequiredWorkflowFields();\r\n\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tconsole.log(err);\r\n\t\t\tif (err?.status === 418) return;\r\n\r\n\t\t\tif (err?.responseText) {\r\n\t\t\t\tshowDxToast(err.responseText, \"error\");\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"Wyst\u0105pi\u0142 b\u0142\u0105d\", \"error\");\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function fileChanged(filename: string) {\r\n\t$(\"#upload-file-info\").html(filename);\r\n\tconst captionElement = document.getElementById(\"Caption\") as HTMLInputElement;\r\n\tif (\r\n\t\tfilename != null &&\r\n\t\tfilename !== \"\" &&\r\n\t\tfilename !== \"undefined\" &&\r\n\t\t$(captionElement)?.length &&\r\n\t\t(captionElement.value == null ||\r\n\t\t\tcaptionElement.value === \"\" ||\r\n\t\t\tcaptionElement.value === \" \")\r\n\t) {\r\n\t\tconst caption = filename.replace(/^.*[\\\\\\/]/, \"\");\r\n\t\t$(\"#Caption\").val(caption);\r\n\t\t$(\"#Modified_ElementId_Caption\").val(\"true\");\r\n\t}\r\n}\r\n\r\nexport function LoadDropDownDictionaries(\r\n\titemKeyElementId: string,\r\n\tfieldKey: string,\r\n\telementId: string,\r\n\tvalueElementId: string,\r\n\tdefinitionKeyElementId: string\r\n) {\r\n\t$(elementId).empty();\r\n\t$(elementId).append(\r\n\t\t'\"\r\n\t);\r\n\r\n\tconst valueElement = document.getElementById(\r\n\t\tvalueElementId\r\n\t) as HTMLInputElement;\r\n\tlet selectedValue = valueElement?.value;\r\n\tconst itemKey = (\r\n\t\tdocument.getElementById(itemKeyElementId) as HTMLInputElement\r\n\t)?.value;\r\n\r\n\tconst definitionKey = (\r\n\t\tdocument.getElementById(definitionKeyElementId) as HTMLInputElement\r\n\t)?.value;\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetDropDownDictionariesForField`,\r\n\t\ttype: \"GET\",\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdataType: \"JSON\",\r\n\t\tcache: false,\r\n\t\tdata: {\r\n\t\t\tfieldkey: fieldKey,\r\n\t\t\titemKey: itemKey,\r\n\t\t\tdefinitionKey: definitionKey,\r\n\t\t},\r\n\t\tsuccess: (data: SelectOption[]) => {\r\n\t\t\t$(elementId).empty();\r\n\r\n\t\t\t$.each(data, (_, dictValue) => {\r\n\t\t\t\tif (Array.isArray(dictValue)) {\r\n\t\t\t\t\tfor (let i = 0; i < dictValue.length; i++) {\r\n\t\t\t\t\t\tlet selected = \"\";\r\n\r\n\t\t\t\t\t\tif (selectedValue === \"\" && dictValue[i].value !== \"\") {\r\n\t\t\t\t\t\t\tselectedValue = dictValue[i].value;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (dictValue[i].value?.localeCompare(selectedValue) === 0) {\r\n\t\t\t\t\t\t\tselected = 'selected=\"selected\"';\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t$(elementId).append(\r\n\t\t\t\t\t\t\t``\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tlet selected = \"\";\r\n\r\n\t\t\t\t\tif (selectedValue === \"\" && dictValue.value !== \"\") {\r\n\t\t\t\t\t\tselectedValue = dictValue.value;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (dictValue.value?.localeCompare(selectedValue) === 0) {\r\n\t\t\t\t\t\tselected = 'selected=\"selected\"';\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t$(elementId).append(\r\n\t\t\t\t\t\t``\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\r\n//get dropdown varioobject\r\nexport function LoadDropDown(\r\n\titemKeyElementId: string,\r\n\tfieldKey: string,\r\n\tdictionaryKeyItemId: string,\r\n\telementId: string,\r\n\tvalueElementId: string,\r\n\tdisplayTextElementId: string,\r\n\tdefinitionKeyElementId: string\r\n) {\r\n\ttry {\r\n\t\tif (fieldKey !== undefined) {\r\n\t\t\tif (fieldKey === \"Leader\" || fieldKey === \"ParentCompany\") return;\r\n\r\n\t\t\tconst displayTextElement = document.getElementById(\r\n\t\t\t\tdisplayTextElementId\r\n\t\t\t) as HTMLInputElement;\r\n\r\n\t\t\tconst itemKey = (\r\n\t\t\t\tdocument.getElementById(itemKeyElementId) as HTMLInputElement\r\n\t\t\t).value;\r\n\t\t\tconst dictItem = document.getElementById(\r\n\t\t\t\tdictionaryKeyItemId\r\n\t\t\t) as HTMLInputElement;\r\n\t\t\tconst valueElement = document.getElementById(\r\n\t\t\t\tvalueElementId\r\n\t\t\t) as HTMLInputElement;\r\n\t\t\tconst definitionKey = (\r\n\t\t\t\tdocument.getElementById(definitionKeyElementId) as HTMLInputElement\r\n\t\t\t).value;\r\n\r\n\t\t\tlet selectedValue = $(`#${fieldKey} :selected`).val()?.toString() ?? \"\";\r\n\t\t\tlet displayText = $(`#${fieldKey} :selected`).text();\r\n\r\n\t\t\tif (valueElement?.value) {\r\n\t\t\t\tselectedValue = valueElement.value;\r\n\t\t\t}\r\n\r\n\t\t\tif (selectedValue === \"Trwa \u0142adowanie...\") selectedValue = \"\";\r\n\r\n\t\t\tif (displayTextElement?.value) {\r\n\t\t\t\tdisplayText = displayTextElement.value;\r\n\t\t\t}\r\n\r\n\t\t\tlet dictionaryKey = \"\";\r\n\t\t\tif (dictItem != null) {\r\n\t\t\t\tdictionaryKey = dictItem.value;\r\n\t\t\t}\r\n\r\n\t\t\tlet containerKey = \"\";\r\n\t\t\tif (document.getElementById(\"ItemContainerKey\"))\r\n\t\t\t\tcontainerKey = (\r\n\t\t\t\t\tdocument.getElementById(\"ItemContainerKey\") as HTMLInputElement\r\n\t\t\t\t).value;\r\n\r\n\t\t\t$(elementId)\r\n\t\t\t\t.find('option:not(:selected):not([data-select2-tag=\"true\"])')\r\n\t\t\t\t.remove();\r\n\t\t\tif ($(elementId).find(\"option:selected\").text() !== \"Trwa \u0142adowanie...\")\r\n\t\t\t\t$(elementId).append(``);\r\n\r\n\t\t\tdropdownValuesDict[fieldKey] = [\r\n\t\t\t\t{ text: \"Trwa \u0142adowanie...\", value: \"Trwa \u0142adowanie...\" },\r\n\t\t\t];\r\n\r\n\t\t\tif (selectedValue)\r\n\t\t\t\tdropdownValuesDict[fieldKey].push({\r\n\t\t\t\t\ttext: displayText ? displayText : selectedValue,\r\n\t\t\t\t\tvalue: selectedValue,\r\n\t\t\t\t\tselected: true,\r\n\t\t\t\t});\r\n\r\n\t\t\tconst fields = getAllModifiedFields();\r\n\t\t\t$.ajax({\r\n\t\t\t\turl: `${GetBaseUrl()}/Vario/GetDropDownList`,\r\n\t\t\t\ttype: \"Post\",\r\n\t\t\t\tdataType: \"json\",\r\n\t\t\t\tcache: false,\r\n\t\t\t\tdata: {\r\n\t\t\t\t\tfieldkey: fieldKey,\r\n\t\t\t\t\tfields: fields,\r\n\t\t\t\t\titemKey: itemKey,\r\n\t\t\t\t\tdictionaryKey: dictionaryKey,\r\n\t\t\t\t\tdefinitionKey: definitionKey,\r\n\t\t\t\t\tcontainerKey: containerKey,\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: (data) => {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\t//return przy szybkim zmienianiu slownikow zeby byly aktualne\r\n\t\t\t\t\t\tif (dictItem != null && dictionaryKey !== dictItem?.value) return;\r\n\r\n\t\t\t\t\t\t$(elementId).find('option:not([data-select2-tag=\"true\"])').remove();\r\n\r\n\t\t\t\t\t\tlet selectedValueExistsInDict = data.find(\r\n\t\t\t\t\t\t\t(x) => x.value === selectedValue\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t!selectedValueExistsInDict &&\r\n\t\t\t\t\t\t\tselectedValue &&\r\n\t\t\t\t\t\t\t$(`select${elementId}`).data(\"select2\")?.options?.options?.tags\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tselectedValueExistsInDict = {\r\n\t\t\t\t\t\t\t\ttext:\r\n\t\t\t\t\t\t\t\t\tdisplayText === \"Trwa \u0142adowanie...\"\r\n\t\t\t\t\t\t\t\t\t\t? \"\"\r\n\t\t\t\t\t\t\t\t\t\t: displayText\r\n\t\t\t\t\t\t\t\t\t\t\t? displayText\r\n\t\t\t\t\t\t\t\t\t\t\t: selectedValue,\r\n\t\t\t\t\t\t\t\tvalue: selectedValue,\r\n\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t\tdata.push(selectedValueExistsInDict);\r\n\t\t\t\t\t\t} else if (selectedValueExistsInDict) {\r\n\t\t\t\t\t\t\tselectedValueExistsInDict.selected = true;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tdropdownValuesDict[fieldKey] = data;\r\n\t\t\t\t\t\tsetSelectedInSelect2(fieldKey, selectedValueExistsInDict);\r\n\r\n\t\t\t\t\t\tconst el = document.getElementById(fieldKey) as HTMLInputElement;\r\n\t\t\t\t\t\tif (el && $(el).hasClass(\"required-field\")) {\r\n\t\t\t\t\t\t\tconst parentN = el.parentNode;\r\n\t\t\t\t\t\t\tif (parentN) {\r\n\t\t\t\t\t\t\t\tconst btns = (parentN as HTMLElement).getElementsByClassName(\r\n\t\t\t\t\t\t\t\t\t\"btn\"\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\tif (btns) {\r\n\t\t\t\t\t\t\t\t\t$(btns[0]).addClass(\"required-field\");\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ($(`select${elementId}`).data(\"select2\")?.isOpen())\r\n\t\t\t\t\t\t\t$(`select${elementId}`)\r\n\t\t\t\t\t\t\t\t.data(\"select2\")\r\n\t\t\t\t\t\t\t\t.dropdown.$search.trigger(\"input\");\r\n\r\n\t\t\t\t\t\tsetRequiredFields(fieldKey);\r\n\t\t\t\t\t} catch (exception) {\r\n\t\t\t\t\t\tconsole.log(exception);\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} catch (exception) {\r\n\t\tconsole.log(exception);\r\n\t}\r\n}\r\n\r\nexport function ProjectChanged() {\r\n\t$(\".dropDownLoadProject\").each((_, item) => {\r\n\t\tconst $item = $(item as HTMLElement);\r\n\t\tconst fieldKey = $item.data(\"id\");\r\n\t\tconst dictionaryKeyItemId = $item.data(\"val\");\r\n\t\tconst valueElementId = $item.data(\"valueelement\");\r\n\t\tconst displayTextElementId = $item.data(\"dtexteid\");\r\n\r\n\t\tLoadDropDown(\r\n\t\t\t\"VarioObjectKey\",\r\n\t\t\tfieldKey,\r\n\t\t\tdictionaryKeyItemId,\r\n\t\t\t`#${$item.attr(\"id\")}`,\r\n\t\t\tvalueElementId,\r\n\t\t\tdisplayTextElementId,\r\n\t\t\t\"ObjectType_key\"\r\n\t\t);\r\n\t});\r\n}\r\n\r\nexport function LoadDropDowns(excludeDropDownElementId?: string) {\r\n\t$(\".dropDownDictionariesLoadAsync\").each((_, item) => {\r\n\t\tconst $item = $(item as HTMLElement);\r\n\t\tconst fieldKey = $item.data(\"id\");\r\n\t\tconst valueElementId = $item.data(\"valueelement\");\r\n\t\tif ($item.attr(\"id\") !== \"\") {\r\n\t\t\tLoadDropDownDictionaries(\r\n\t\t\t\t\"VarioObjectKey\",\r\n\t\t\t\tfieldKey,\r\n\t\t\t\t`#${$item.attr(\"id\")}`,\r\n\t\t\t\tvalueElementId,\r\n\t\t\t\t\"ObjectType_key\"\r\n\t\t\t);\r\n\t\t}\r\n\t});\r\n\r\n\t$(\".dropDownLoadAsync\").each((_, item) => {\r\n\t\tconst $item = $(item as HTMLElement);\r\n\t\tif (\r\n\t\t\t!excludeDropDownElementId ||\r\n\t\t\texcludeDropDownElementId !== $item.data(\"id\")\r\n\t\t) {\r\n\t\t\tconst fieldKey = $item.data(\"id\");\r\n\t\t\tconst dictionaryKeyItemId = $item.data(\"val\");\r\n\t\t\tconst valueElementId = $item.data(\"valueelement\");\r\n\t\t\tconst displayTextElementId = $item.data(\"dtexteid\");\r\n\t\t\tif ((item as HTMLElement).nodeName === \"SELECT\")\r\n\t\t\t\tLoadDropDown(\r\n\t\t\t\t\t\"VarioObjectKey\",\r\n\t\t\t\t\tfieldKey,\r\n\t\t\t\t\tdictionaryKeyItemId,\r\n\t\t\t\t\t`#${$item.attr(\"id\")}`,\r\n\t\t\t\t\tvalueElementId,\r\n\t\t\t\t\tdisplayTextElementId,\r\n\t\t\t\t\t\"ObjectType_key\"\r\n\t\t\t\t);\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function UndoItem(\r\n\tclose: boolean,\r\n\tUndoFromRichEdit: boolean,\r\n\titemID?: string,\r\n\tparentId?: string\r\n) {\r\n\t//Wykryc czy viewCard czy subelemety i dac dobre id\r\n\tShowLoadingPanel(\"Cofanie zmian...\");\r\n\tlet forceDelete = false;\r\n\r\n\t//czyszczenie zrodla na undo\r\n\t$(\"#inputUploadFiles\").val(\"\");\r\n\r\n\ttry {\r\n\t\tif (deleteOnUndo) {\r\n\t\t\tforceDelete = true;\r\n\t\t}\r\n\r\n\t\tdeleteOnUndo = false;\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t}\r\n\r\n\tconst formCardView = $(\"#varioObjectForm\");\r\n\t//Znalesc forme z subView\r\n\tconst formSubView = $(\"#PositionEditor\");\r\n\tconst where = checkWhereIsUser();\r\n\r\n\tif (itemID) {\r\n\t\t//do nothing\r\n\t} else if (\r\n\t\tformSubView.length > 0 &&\r\n\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId\r\n\t) {\r\n\t\titemID =\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId ?? \"\";\r\n\t\tif (document.getElementById(\"scheduler\") != null) {\r\n\t\t\tparentId = containerId;\r\n\t\t} else {\r\n\t\t\tparentId = modelId;\r\n\t\t}\r\n\r\n\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId = null;\r\n\t} else if ((formCardView.length > 0 && isDirty()) || UndoFromRichEdit) {\r\n\t\t//Sprawdzamy czy istnieje forma z widoku i czy przycisk zapisu jest dostepny\r\n\t\titemID = where === \"subElements\" ? lastSelectedRow[0]?.ItemID : modelId;\r\n\t}\r\n\r\n\tconst isFromVarioObjectSubelements =\r\n\t\tcheckWhereIsUser(true) === \"varioObjectWithSubElements\" &&\r\n\t\titemID !== modelId;\r\n\r\n\tif ((!forceDelete && ContainMinusID(itemID)) || !itemID) {\r\n\t\tignoreIsDirty = true;\r\n\t\tinputIsDirty = false;\r\n\t\tsubElementsModel[modelSubElementsOnly].globalListOfEditables = [];\r\n\r\n\t\tif (!itemID) {\r\n\t\t\tshowDxToast(\"Cofni\u0119cie zmian si\u0119 nie powiod\u0142o\", \"error\");\r\n\t\t\tclose = false;\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\twhere === \"subElements\" ||\r\n\t\t\twhere === \"scheduler\" ||\r\n\t\t\tisFromVarioObjectSubelements\r\n\t\t) {\r\n\t\t\tif (close) CloseEditor();\r\n\t\t\tif (isFromVarioObjectSubelements)\r\n\t\t\t\tfloatingButtonBackToViewCardWithSubElements();\r\n\t\t\telse prepareFloatingButtonForTableView();\r\n\t\t} else if (!close) {\r\n\t\t\trefreshManager.needRefresh = new Set([\r\n\t\t\t\trefreshManager?.refreshArea?.varioObjectForm,\r\n\t\t\t]);\r\n\t\t\trefreshCurrentPage();\r\n\t\t}\r\n\t\tHideLoadingPanel();\r\n\r\n\t\tundoItemPromise = new Promise((resolve, reject) => {\r\n\t\t\t// Reject the promise with an error or reason\r\n\t\t\tif (!itemID) {\r\n\t\t\t\treject(new Error(\"Cofni\u0119cie zmian si\u0119 nie powiod\u0142o\"));\r\n\t\t\t} else {\r\n\t\t\t\tresolve(\"Minus ID\");\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\tundoItemPromise = $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/UndoItem`,\r\n\t\ttype: \"Post\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: { id: itemID, parentId: parentId, forceDelete: forceDelete },\r\n\t\tsuccess: () => {\r\n\t\t\tignoreIsDirty = true;\r\n\t\t\tinputIsDirty = false;\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalListOfEditables = [];\r\n\r\n\t\t\tif (where === \"subElements\" || where === \"scheduler\") {\r\n\t\t\t\tif (close) CloseEditor();\r\n\t\t\t\tif (!lastSelectedRow?.length) prepareFloatingButtonForTableView();\r\n\t\t\t\tif (UndoFromRichEdit) reloadGridPanel(lastSelectedRow);\r\n\t\t\t} else if (isFromVarioObjectSubelements)\r\n\t\t\t\tfloatingButtonBackToViewCardWithSubElements();\r\n\t\t\telse if (!close) {\r\n\t\t\t\trefreshManager.needRefresh = new Set([\r\n\t\t\t\t\trefreshManager?.refreshArea?.varioObjectForm,\r\n\t\t\t\t]);\r\n\t\t\t\trefreshCurrentPage();\r\n\t\t\t}\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function submitVarioObjectFormWithAjax(\r\n\tformName: string,\r\n\tclose: boolean\r\n) {\r\n\tChangeSaveBtnsStatus(false);\r\n\r\n\treturn new Promise(async (resolve, reject) => {\r\n\t\t// export function to periodically check the variable\r\n\t\tconst checkInterval = setInterval(async () => {\r\n\t\t\tinputIsDirty = false;\r\n\r\n\t\t\tif (varioObjectReadyToSubmit) {\r\n\t\t\t\tclearInterval(checkInterval); // Stop checking\r\n\r\n\t\t\t\tSubmitAttempsVarioObject = 0;\r\n\r\n\t\t\t\tawait ($(`#${formName}`) as any).ajaxSubmit({\r\n\t\t\t\t\tsuccess: async (res: VarioMessageViewModel) => {\r\n\t\t\t\t\t\tif (debug) {\r\n\t\t\t\t\t\t\tconsole.log(res);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t\t\t$(\"#inputUploadFiles\").val(\"\");\r\n\r\n\t\t\t\t\t\tif (res?.status === RequestStatus.success) {\r\n\t\t\t\t\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\t\t\t\t\t\tchangedVarioObjectFields = [\r\n\t\t\t\t\t\t\t\t...getAllModifiedFields(),\r\n\t\t\t\t\t\t\t\t...changedVarioObjectFields.filter((x) => x.fromGrid),\r\n\t\t\t\t\t\t\t];\r\n\t\t\t\t\t\t\tChangeSaveBtnsStatus(false);\r\n\t\t\t\t\t\t\tChangeCorrespondenceActionButtonsStatus(true);\r\n\t\t\t\t\t\t\thtmlEditorChanges = null;\r\n\t\t\t\t\t\t\tselectNewlyAddedRow(res.itemKey);\r\n\r\n\t\t\t\t\t\t\tconst changedOnlyCorrespondenceEditor =\r\n\t\t\t\t\t\t\t\tchangedVarioObjectFields.length === 1 &&\r\n\t\t\t\t\t\t\t\tchangedVarioObjectFields.find((x) => x.FieldKey === \"Body\");\r\n\r\n\t\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t\t!close &&\r\n\t\t\t\t\t\t\t\t!ContainMinusID(modelId) &&\r\n\t\t\t\t\t\t\t\t!changedOnlyCorrespondenceEditor\r\n\t\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\t\trefreshManager.needRefresh = new Set([\r\n\t\t\t\t\t\t\t\t\trefreshManager?.refreshArea?.varioObjectForm,\r\n\t\t\t\t\t\t\t\t\trefreshManager?.refreshArea?.filePreview,\r\n\t\t\t\t\t\t\t\t]);\r\n\t\t\t\t\t\t\t\tawait refreshCurrentPage();\r\n\t\t\t\t\t\t\t} else if (ContainMinusID(modelId)) {\r\n\t\t\t\t\t\t\t\tawait changeCurrentItem({\r\n\t\t\t\t\t\t\t\t\titemId: res.itemKey,\r\n\t\t\t\t\t\t\t\t\tcontainerKey: res.containerKey,\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tshowDxToast(res.message, \"success\");\r\n\t\t\t\t\t\t\tresolve(res); // Resolve the promise with the response\r\n\t\t\t\t\t\t} else if (res) {\r\n\t\t\t\t\t\t\tHideLoadingPanel(true);\r\n\t\t\t\t\t\t\tconst errorMessage = res?.message ?? \"B\u0142\u0105d zapisu pozycji\";\r\n\t\t\t\t\t\t\tshowDxToast(errorMessage, \"error\");\r\n\t\t\t\t\t\t\treject(new Error(errorMessage)); // Reject the promise with an error\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t},\r\n\t\t\t\t\terror: (err) => {\r\n\t\t\t\t\t\tHideLoadingPanel(true);\r\n\t\t\t\t\t\tconsole.log(err);\r\n\t\t\t\t\t\tconst errorMessage = err?.message ?? \"B\u0142\u0105d zapisu pozycji\";\r\n\t\t\t\t\t\tshowDxToast(errorMessage, \"error\");\r\n\t\t\t\t\t\treject(new Error(errorMessage)); // Reject the promise with an error\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: () => {\r\n\t\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t\t},\r\n\t\t\t\t});\r\n\t\t\t} else if (SubmitAttempsVarioObject > 25) {\r\n\t\t\t\tshowDxToast(\"Nie uda\u0142o si\u0119 zapisa\u0107 pozycji\", \"error\");\r\n\t\t\t\tvarioObjectReadyToSubmit = true;\r\n\t\t\t\tSubmitAttempsVarioObject = 0;\r\n\t\t\t\tHideLoadingPanel(true);\r\n\t\t\t\tinputIsDirty = true;\r\n\t\t\t\tChangeSaveBtnsStatus(true);\r\n\t\t\t\tclearInterval(checkInterval);\r\n\t\t\t\treject(false);\r\n\t\t\t} else {\r\n\t\t\t\tconst popupVisible = $(\"#devex-dialog-trigger\")\r\n\t\t\t\t\t.dxPopup(\"instance\")\r\n\t\t\t\t\t.option(\"visible\");\r\n\r\n\t\t\t\tif (popupVisible) {\r\n\t\t\t\t\tSubmitAttempsVarioObject = 0;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tSubmitAttempsVarioObject++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}, 500);\r\n\t});\r\n}\r\n\r\nexport async function SubmitForm(formName, close?: boolean, event?: Event) {\r\n\tif (!checkIfCanSave()) {\r\n\t\tshowDxToast(\r\n\t\t\t\"Pozycja nie mo\u017Ce by\u0107 zapisana. Wype\u0142nij wymagane pola.\",\r\n\t\t\t\"warning\"\r\n\t\t);\r\n\t\tHideLoadingPanel();\r\n\t\treturn new Promise((_, reject) => {\r\n\t\t\treject(false);\r\n\t\t});\r\n\t}\r\n\r\n\tShowLoadingPanel(\"Zapisywanie...\");\r\n\tsetFormSubmitting();\r\n\tconst formCardView = document.getElementById(\"varioObjectForm\");\r\n\tif (formCardView && !IsFormViewCardSaved()) {\r\n\t\tformName = \"varioObjectForm\";\r\n\t}\r\n\tif (formName) {\r\n\t\treturn submitVarioObjectFormWithAjax(formName, !!close);\r\n\t}\r\n\t//Znalesc forme z subView\r\n\tif (checkIfGridInEditMode()) {\r\n\t\t$(\".dx-row.dx-row-focused\")\r\n\t\t\t.find(\".dxGridIconsHoverInEdit.dx-icon-save\")\r\n\t\t\t.trigger(\"click\");\r\n\t\treturn saveDxGridChangePromise;\r\n\t}\r\n\tconst formSubView = document.getElementById(\"PositionEditor\");\r\n\tif (formSubView) {\r\n\t\tconst buttonSaveArr = document.querySelectorAll(\"[data-itemKey]\");\r\n\t\tlet promise: Promise = new Promise(() => {});\r\n\r\n\t\t$(buttonSaveArr).each((_, item) => {\r\n\t\t\tif (!isHidden(item as HTMLElement)) {\r\n\t\t\t\tconst itemDef =\r\n\t\t\t\t\t(item as HTMLElement).getAttribute(\"data-itemKey\") ?? \"\";\r\n\t\t\t\tevent?.preventDefault();\r\n\r\n\t\t\t\tpromise = SubmitTableEditor(itemDef, close);\r\n\t\t\t\tinputIsDirty = false;\r\n\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn promise;\r\n\t}\r\n}\r\n\r\nexport async function OnSubmitButtonClick(close?: boolean, event?: Event) {\r\n\tevent?.preventDefault();\r\n\r\n\tglobalThis.ignoreUnsavedDocFlag = false;\r\n\tif (isDirtyDoc()) {\r\n\t\tlet closeLocal = false;\r\n\t\tif (!inputIsDirty && close) {\r\n\t\t\tcloseLocal = true;\r\n\t\t}\r\n\t\tsaveDoc(closeLocal);\r\n\t}\r\n\r\n\t//Forma varioobject nie zosta\u0142a zmieniona wi\u0119c nie chcemy jej zapisa\u0107 i prze\u0142adowa\u0107 ca\u0142ej strony\r\n\tif (!inputIsDirty && !forceDirtyVarioObject && !ContainMinusID(modelId)) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tShowLoadingPanel(\"Zapisywanie zmian...\");\r\n\tCloseDialog();\r\n\r\n\tawait SubmitForm(\"varioObjectForm\", false, event);\r\n\r\n\tif (close) CloseVarioObjectButtonClick();\r\n}\r\n\r\n//Import files based on a specific definition in the grid or via the form\r\nexport async function selectThisDefinitionInEditor(\r\n\tactuallControlView: LayoutControlWeb,\r\n\tfromDrop: boolean,\r\n\tforSelectedItem = false,\r\n\tpopupVisible = true,\r\n\tparentId = \"\",\r\n\tcontainId = \"\"\r\n) {\r\n\tShowLoadingPanel(\"Wczytywanie...\");\r\n\r\n\tconst selectTemplate = document.getElementById(\r\n\t\t\"selectElementType\"\r\n\t) as HTMLSelectElement;\r\n\tif (popupVisible && selectTemplate) {\r\n\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId =\r\n\t\t\tselectTemplate.value;\r\n\t}\r\n\r\n\tconst filesInput = document.getElementById(\"files\") as HTMLInputElement;\r\n\r\n\tif (\r\n\t\ttypeof draggedFilesBuffer !== \"undefined\" &&\r\n\t\tdraggedFilesBuffer &&\r\n\t\tdraggedFilesBuffer.length > 0 &&\r\n\t\t!(\"fromChat\" in draggedFilesBuffer[0])\r\n\t) {\r\n\t\tfilesInput.files = draggedFilesBuffer as FileList;\r\n\t}\r\n\r\n\tconst filesCount = filesInput.files?.length ?? 0;\r\n\tconst draggedFilesCount = draggedFilesBuffer?.length ?? 0;\r\n\tlet hasRequiredFields = false;\r\n\tlet hasRequiredTemplate = false;\r\n\r\n\tif (downloadingDefinitionsAjax) await downloadingDefinitionsAjax;\r\n\r\n\tconst definitions = forSelectedItem\r\n\t\t? allowedDefinitionsGlobal4SelectedItem\r\n\t\t: allowedDefinitionsGlobal;\r\n\tconst selectedDefinition =\r\n\t\tdefinitions?.find(\r\n\t\t\t(item) =>\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId ===\r\n\t\t\t\titem.key\r\n\t\t) ?? definitions?.[0];\r\n\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId =\r\n\t\tselectedDefinition?.key ?? \"\";\r\n\r\n\thasRequiredFields = !!selectedDefinition?.fieldsFlags?.find(\r\n\t\t(x) => x.isRequired\r\n\t);\r\n\thasRequiredTemplate = !!selectedDefinition?.mustUseTemplate;\r\n\r\n\tif (hasRequiredFields && (filesCount > 1 || draggedFilesCount > 1)) {\r\n\t\t//cannot import multiple files with required fields\r\n\t\tshowDxToast(\r\n\t\t\t\"Importowane pozycje maj\u0105 wymagane pola!\\nImportuj je pojedynczo, aby m\u00F3c wprowadzi\u0107 odpowiednie warto\u015Bci w formularzu.\",\r\n\t\t\t\"warning\"\r\n\t\t);\r\n\t} else if (fromDrop && !hasRequiredFields) {\r\n\t\tif (hasRequiredTemplate) {\r\n\t\t\t//cannot import files for definition with required template\r\n\t\t\tshowDxToast(\r\n\t\t\t\t\"Pozycje mog\u0105 by\u0107 tworzone wy\u0142\u0105cznie z wzorca!\\nUtw\u00F3rz pozycj\u0119 w systemie, wybieraj\u0105c wymagany wzorzec.\",\r\n\t\t\t\t\"warning\"\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\t//import multiple files in grid\r\n\t\t\tsaveFiles();\r\n\t\t}\r\n\t} else {\r\n\t\t//import single file via form\r\n\t\tif (draggedFilesCount > 0 && !(\"fromChat\" in (draggedFilesBuffer ?? [])[0]))\r\n\t\t\tclearDraggedFilesBuffer();\r\n\t\tsubElementsModel[modelSubElementsOnly].globalListOfRequiredFields = [];\r\n\t\tsubElementsModel[modelSubElementsOnly].globalListOfEditables = [];\r\n\t\tinputIsDirty = false;\r\n\t\tdeleteOnUndo = false;\r\n\r\n\t\tShowLoadingPanel(\"Wczytywanie...\");\r\n\t\tif (\r\n\t\t\tactuallControlView === LayoutControlWeb.ScheduleLayoutFile ||\r\n\t\t\tisRunningOnMobile() ||\r\n\t\t\tgridInlineEditor === \"False\"\r\n\t\t) {\r\n\t\t\tLoadSubElementsEditor(\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId ?? \"\",\r\n\t\t\t\tfalse,\r\n\t\t\t\t\"\",\r\n\t\t\t\tactuallControlView\r\n\t\t\t);\r\n\t\t} else\r\n\t\t\taddNewPosition(\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId ?? \"\",\r\n\t\t\t\tforSelectedItem,\r\n\t\t\t\tparentId,\r\n\t\t\t\tcontainId\r\n\t\t\t);\r\n\t}\r\n}\r\n\r\nexport function getData(\r\n\tfieldKey: string,\r\n\titemKey?: string,\r\n\tdefinitionKey?: string\r\n) {\r\n\tconst list = $(`[id=DictionaryFor-${fieldKey}-${definitionKey}]`);\r\n\tlet selected: string | SelectOption = \"\";\r\n\tconst savedDictionary = localStorage.getItem(\"dictionary\");\r\n\tif (list?.length) {\r\n\t\tconst selectedOption = list.find(\"option:selected\").val()?.valueOf() ?? \"\";\r\n\t\tselected =\r\n\t\t\ttypeof selectedOption === \"object\"\r\n\t\t\t\t? (selectedOption as SelectOption)\r\n\t\t\t\t: selectedOption?.toString();\r\n\t\t$(list).attr(\"disabled\", \"disabled\");\r\n\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetDropDownDictionariesForField`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: {\r\n\t\t\t\tfieldkey: fieldKey,\r\n\t\t\t\titemKey: itemKey,\r\n\t\t\t\tdefinitionKey: definitionKey,\r\n\t\t\t},\r\n\t\t\tsuccess: (data: { list: SelectOption[] }) => {\r\n\t\t\t\t$(list).find(\"option\").remove();\r\n\t\t\t\tfor (let i = 0; i < data.list.length; i++) {\r\n\t\t\t\t\tif (data.list[i] != null) {\r\n\t\t\t\t\t\tif (data.list[i].value === selected) {\r\n\t\t\t\t\t\t\t$(list).append(\r\n\t\t\t\t\t\t\t\t``\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t} else if (data.list[i].value === savedDictionary) {\r\n\t\t\t\t\t\t\t$(list).append(\r\n\t\t\t\t\t\t\t\t``\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t$(list).append(\r\n\t\t\t\t\t\t\t\t``\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t$(list).attr(\"disabled\", null);\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function DisableSaveButtons(definition?: string) {\r\n\tif (!definition) return;\r\n\r\n\tconst saveBtn = document.getElementById(\r\n\t\t`${definition}-submitFormButton`\r\n\t) as HTMLButtonElement;\r\n\tconst saveLeaveBtn = document.getElementById(\r\n\t\t`${definition}-submitLeaveFormButton`\r\n\t) as HTMLButtonElement;\r\n\r\n\tif (\r\n\t\tsubElementsModel[modelSubElementsOnly].globalListOfRequiredFields.length > 0\r\n\t) {\r\n\t\t$(saveBtn).attr(\"disabled\", \"disabled\");\r\n\t\t$(saveLeaveBtn).attr(\"disabled\", \"disabled\");\r\n\t} else {\r\n\t\t$(saveBtn).removeAttr(\"disabled\");\r\n\t\t$(saveLeaveBtn).removeAttr(\"disabled\");\r\n\t}\r\n}\r\n\r\n// get dropdown subelements\r\nexport function getDropdownData(\r\n\tlistId: string,\r\n\tfieldkey: string,\r\n\titemKey?: string,\r\n\tdictionaryKey?: string,\r\n\tdefinitionKey?: string,\r\n\tcontainerKey?: string,\r\n\tvalue?: string | SelectOption,\r\n\tparentFieldKey?: string,\r\n\tedition?: boolean,\r\n\tselected?: string | SelectOption\r\n) {\r\n\tconst list = $(`[id=${listId}]`);\r\n\tlet displayName = \"\";\r\n\r\n\tif (!selected) {\r\n\t\tdisplayName = list.find(\"option:selected\").text();\r\n\t\tconst selectedOption = list.find(\"option:selected\").val()?.valueOf();\r\n\t\tselected =\r\n\t\t\ttypeof selectedOption === \"object\"\r\n\t\t\t\t? (selectedOption as SelectOption)\r\n\t\t\t\t: selectedOption?.toString();\r\n\t}\r\n\r\n\tif (typeof selected === \"string\")\r\n\t\tselected = {\r\n\t\t\ttext: displayName ?? selected,\r\n\t\t\tvalue: selected,\r\n\t\t\tselected: true,\r\n\t\t};\r\n\r\n\t$(list).find('option:not(:selected):not([data-select2-tag=\"true\"])').remove();\r\n\tif ($(list).find(\"option:selected\").text() !== \"Trwa \u0142adowanie...\")\r\n\t\t$(list).append(``);\r\n\r\n\tdropdownValuesDict[listId] = [\r\n\t\t{ text: \"Trwa \u0142adowanie...\", value: \"Trwa \u0142adowanie...\" },\r\n\t\tselected,\r\n\t];\r\n\r\n\tif (!$(list).next(\".select2\").length) createSelect2(listId, selected);\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetDropDownList`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tdata: {\r\n\t\t\tfieldkey: fieldkey,\r\n\t\t\titemKey: itemKey,\r\n\t\t\tdictionaryKey: dictionaryKey,\r\n\t\t\tdefinitionKey: definitionKey,\r\n\t\t\tcontainerKey: containerKey,\r\n\t\t\tvalue: value,\r\n\t\t\tparentFieldKey: parentFieldKey,\r\n\t\t},\r\n\t\tsuccess: (data: SelectOption[]) => {\r\n\t\t\tif (edition === true) {\r\n\t\t\t\t$(list).find('option:not([data-select2-tag=\"true\"])').remove();\r\n\t\t\t\tdropdownValuesDict[listId] = data;\r\n\r\n\t\t\t\tif (typeof selected !== \"undefined\") {\r\n\t\t\t\t\tif (fieldkey === \"Categories\") {\r\n\t\t\t\t\t\tif (typeof selected === \"string\")\r\n\t\t\t\t\t\t\tselected = {\r\n\t\t\t\t\t\t\t\tselected: true,\r\n\t\t\t\t\t\t\t\ttext: selected,\r\n\t\t\t\t\t\t\t\tid: selected,\r\n\t\t\t\t\t\t\t\tvalue: selected,\r\n\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\tdropdownValuesDict[listId].push(selected);\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\ttypeof selected === \"object\" &&\r\n\t\t\t\t\t\tdropdownValuesDict[listId].find(\r\n\t\t\t\t\t\t\t(x) => x.value === (selected as SelectOption)?.id\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tselected.text = dropdownValuesDict[listId].find(\r\n\t\t\t\t\t\t\t(x) => x.value === (selected as SelectOption).id\r\n\t\t\t\t\t\t)?.text;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsetSelectedInSelect2(listId, selected);\r\n\r\n\t\t\t\tif ($(`#${listId}`).data(\"select2\")?.isOpen()) {\r\n\t\t\t\t\t$(`#${listId}`).data(\"select2\").dropdown.$search.trigger(\"input\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function checkRequired(\r\n\tvalue: string | null,\r\n\telementID: string | JQuery,\r\n\tisDropDown: boolean,\r\n\tdocType: string | null,\r\n\tfieldKey: string\r\n) {\r\n\tif (value == null) return;\r\n\tif (!elementID.length) return;\r\n\r\n\tconst hasValue = value.length > 0;\r\n\tconst element =\r\n\t\ttypeof elementID === \"string\" ? $(`#${elementID}`) : elementID;\r\n\tconst parent = element.parents(\r\n\t\t\".requiredClassAtr,.requiredWorkflowClassAtr,.suggestedWorkflowClassAtr\"\r\n\t);\r\n\tconst isRequired = $(element).hasClass(\"requiredClassAtr\")\r\n\t\t? $(element).hasClass(\"requiredClassAtr\")\r\n\t\t: $(element).parents(\".requiredClassAtr\").length > 0;\r\n\tconst isWorkflowRequired = $(element).hasClass(\"requiredWorkflowClassAtr\")\r\n\t\t? $(element).hasClass(\"requiredWorkflowClassAtr\")\r\n\t\t: $(element).parents(\".requiredWorkflowClassAtr\").length > 0;\r\n\tconst isSuggested = $(element).hasClass(\"suggestedWorkflowClassAtr\")\r\n\t\t? $(element).hasClass(\"suggestedWorkflowClassAtr\")\r\n\t\t: $(element).parents(\".suggestedWorkflowClassAtr\").length > 0;\r\n\tlet requiredClass = isDropDown ? \"required-fieldForSelect\" : \"required-field\";\r\n\tif (isSuggested) requiredClass = `suggested${requiredClass}`;\r\n\tconst whereToAdd = parent.length > 0 ? parent : element;\r\n\r\n\tif (!isRequired && !isWorkflowRequired && !isSuggested) return;\r\n\r\n\twhereToAdd.toggleClass(requiredClass, !hasValue);\r\n\tif (isRequired) {\r\n\t\t$(\".dxGridIconsHoverInEdit.dx-icon-save\").toggleClass(\r\n\t\t\t\"disabled\",\r\n\t\t\t!hasValue\r\n\t\t);\r\n\t\t$(\".dxGridIconsHoverInEdit.dx-icon-save\").attr(\r\n\t\t\t\"disabled\",\r\n\t\t\thasValue ? null : \"disabled\"\r\n\t\t);\r\n\r\n\t\tif (hasValue) {\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalListOfRequiredFields =\r\n\t\t\t\tsubElementsModel[\r\n\t\t\t\t\tmodelSubElementsOnly\r\n\t\t\t\t].globalListOfRequiredFields.filter((item) => item !== fieldKey);\r\n\t\t} else if (fieldKey) {\r\n\t\t\tconst index = subElementsModel[\r\n\t\t\t\tmodelSubElementsOnly\r\n\t\t\t].globalListOfRequiredFields.findIndex((element) =>\r\n\t\t\t\telement.includes(fieldKey)\r\n\t\t\t);\r\n\t\t\tif (index === -1) {\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalListOfRequiredFields.push(\r\n\t\t\t\t\tfieldKey\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (docType) DisableSaveButtons(docType);\r\n}\r\n\r\nexport function OpenFilesUploadMenu(forWorkflow = false) {\r\n\tconst inputVal = (\r\n\t\tdocument.getElementById(\"selectElementType\") as HTMLSelectElement\r\n\t).value;\r\n\r\n\tif (forWorkflow) globalSelectedDefinitionIdWorkflow = inputVal;\r\n\telse\r\n\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId =\r\n\t\t\tinputVal;\r\n}\r\n\r\nexport function setInputAsDirty() {\r\n\tinputIsDirty = true;\r\n}\r\n\r\nexport function AddToGlobalListOfEditables(\r\n\tfieldKey: string,\r\n\tvalue: string,\r\n\tisNumeric: boolean,\r\n\tdropdownText?: string\r\n) {\r\n\tif (isNumeric === true) value = value.replace(\".\", \",\");\r\n\tsubElementsModel[modelSubElementsOnly].globalListOfEditables.push(\r\n\t\t`${fieldKey}:::${value}`\r\n\t);\r\n\t(document.getElementById(\"editorValues\") as HTMLInputElement).value =\r\n\t\tJSON.stringify(\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalListOfEditables\r\n\t\t);\r\n\r\n\tchangedVarioObjectFields?.push({\r\n\t\tFieldKey: fieldKey,\r\n\t\tModified: true,\r\n\t\tValue: value,\r\n\t\tValueType: typeof value,\r\n\t\tfromGrid: true,\r\n\t\tdropdownText: dropdownText,\r\n\t});\r\n}\r\n\r\nexport function EditCreatedItem(itemKey: string) {\r\n\tsubElementsModel[modelSubElementsOnly].globalOperationName = \"Put\";\r\n\t(document.getElementById(\"editorKey\") as HTMLInputElement).value = itemKey;\r\n\tconst rect = document.getElementById(\"Editor\")?.getBoundingClientRect() ?? {\r\n\t\ttop: 0,\r\n\t};\r\n\tconst scrollTop = window.scrollY || document.documentElement.scrollTop;\r\n\t$(\"html, body\").animate({ scrollTop: rect.top + scrollTop - 50 }, \"smooth\");\r\n}\r\n\r\nexport function ResetRequiredFieldsClasses() {\r\n\t(document.getElementById(\"PositionEditor\") as HTMLFormElement)?.reset();\r\n\tsubElementsModel[modelSubElementsOnly].globalListOfRequiredFields = [];\r\n\t$(\".required-field\").each((_, item) => {\r\n\t\t(item as HTMLElement).classList.remove(\"required-field\");\r\n\t});\r\n}\r\n\r\nexport function openPopupForTextarea(el: string, title: string) {\r\n\tconst text = $(`#${el}`).val();\r\n\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"height\", \"auto\");\r\n\tpopup.option(\"title\", title);\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t$(\"#Dialog\").empty();\r\n\t$(\"#Dialog\").append(\r\n\t\t`

`\r\n\t);\r\n\r\n\t$(\"#textAreaDialogParagraph\").text(text?.toString() ?? \"\");\r\n\r\n\tpopup.repaint();\r\n\tpopup.show();\r\n\r\n\tfixScrollInDx(\".textareaDialog\");\r\n}\r\n\r\n// Tylko dla widoku tabelarycznego\r\n//ukrycie floatingu po otwarciu edytora\r\nexport function hideFloatingButtonOnOpeningEditor() {\r\n\tif (\r\n\t\ttypeof modelSubElementsOnly !== \"undefined\" &&\r\n\t\tmodelSubElementsOnly === \"True\"\r\n\t) {\r\n\t\tclearFloatingButton();\r\n\t\tclearDynamicWorkflowActionsForFloatingButton();\r\n\t}\r\n}\r\n\r\nexport function appendFloatingButtonAfterEditorClose() {\r\n\tif (sessionStorage.getItem(\"selectedRow\") != null) {\r\n\t\tfloatingButtonForOneSelection();\r\n\t\treturn;\r\n\t}\r\n}\r\n\r\nexport function AfterEditorReady(\r\n\tkey: string,\r\n\tinitFields: VarioObjectField[] | null\r\n) {\r\n\t(\r\n\t\tdocument.getElementById(\r\n\t\t\t\"MultipleFilesEditorDefinitionKey\"\r\n\t\t) as HTMLInputElement\r\n\t).value =\r\n\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId ?? \"\";\r\n\r\n\tlet templateDef = \"\";\r\n\tconst selectTemplate = document.getElementById(\r\n\t\t\"selectTemplate\"\r\n\t) as HTMLSelectElement;\r\n\tconst editiorTemplateName = document.getElementById(\r\n\t\t\"editiorTemplateName\"\r\n\t) as HTMLInputElement;\r\n\tif (\r\n\t\t$(\"#useTemplate\").prop(\"checked\") &&\r\n\t\tselectTemplate?.value !== \"---Wybierz wzorzec---\"\r\n\t) {\r\n\t\teditiorTemplateName.value = selectTemplate?.value;\r\n\t\ttemplateDef = selectTemplate?.value ?? \"\";\r\n\t} else {\r\n\t\teditiorTemplateName.value = \"\";\r\n\t}\r\n\r\n\tif (subElementsModel[modelSubElementsOnly].globalSelectedDefinitionId) {\r\n\t\tconst btnSaveMain = document.querySelector(\r\n\t\t\t\".dx-datagrid-form-buttons-container .dx-button[aria-label='Save']\"\r\n\t\t) as HTMLButtonElement;\r\n\t\t$(btnSaveMain).removeClass(\"hidden\");\r\n\t}\r\n\r\n\tconst allowedDefinitions = allowedDefinitionsGlobal;\r\n\r\n\tif (allowedDefinitions)\r\n\t\tfor (const item of allowedDefinitions) {\r\n\t\t\tjQuery(`#${item.key}`).addClass(\"hidden\");\r\n\t\t}\r\n\r\n\tjQuery(\r\n\t\t`#${subElementsModel[modelSubElementsOnly].globalSelectedDefinitionId}`\r\n\t).removeClass(\"hidden\");\r\n\r\n\t$(\".subelementsDropDownDictionariesLoadAsync\").each(function () {\r\n\t\tconst fieldKey = $(this as HTMLElement).attr(\"data-id\");\r\n\t\tgetData(\r\n\t\t\tfieldKey ?? \"\",\r\n\t\t\t\"\",\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId ?? \"\"\r\n\t\t);\r\n\t});\r\n\r\n\tif (\r\n\t\t!stringIsNullOrEmpty(\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId\r\n\t\t)\r\n\t)\r\n\t\tgetWorkflowRequiredFields(key);\r\n\r\n\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId = key;\r\n\tlet tempCaptionFromData = \"Nowy\";\r\n\tif (initFields)\r\n\t\tfor (const item of initFields) {\r\n\t\t\tif (item.fieldKey === \"Caption\") {\r\n\t\t\t\ttempCaptionFromData = item.value;\r\n\t\t\t}\r\n\r\n\t\t\tconst editField = document.getElementById(\r\n\t\t\t\t`${subElementsModel[modelSubElementsOnly].globalSelectedDefinitionId}-${item.fieldKey}`\r\n\t\t\t) as HTMLInputElement;\r\n\r\n\t\t\tif (item.valueRequired) {\r\n\t\t\t\t$(editField).addClass(\"requiredClassAtr\");\r\n\t\t\t\tif (item.value === \"\" || item.value == null) {\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\t!subElementsModel[\r\n\t\t\t\t\t\t\tmodelSubElementsOnly\r\n\t\t\t\t\t\t].globalListOfRequiredFields.includes(item.fieldKey)\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tsubElementsModel[\r\n\t\t\t\t\t\t\tmodelSubElementsOnly\r\n\t\t\t\t\t\t].globalListOfRequiredFields.push(item.fieldKey);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$(editField).addClass(\"required-field\");\r\n\t\t\t\t\tjQuery(\r\n\t\t\t\t\t\t`#${subElementsModel[modelSubElementsOnly].globalSelectedDefinitionId}-submitFormButton`\r\n\t\t\t\t\t).attr(\"disabled\", \"disabled\");\r\n\t\t\t\t\tjQuery(\r\n\t\t\t\t\t\t`#${subElementsModel[modelSubElementsOnly].globalSelectedDefinitionId}-submitLeaveFormButton`\r\n\t\t\t\t\t).attr(\"disabled\", \"disabled\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (editField != null) {\r\n\t\t\t\tif (\r\n\t\t\t\t\titem.controlType === 2 ||\r\n\t\t\t\t\titem.controlType === 5 ||\r\n\t\t\t\t\titem.controlType === 4\r\n\t\t\t\t) {\r\n\t\t\t\t\tdownloadDropDownDataSubElements(item);\r\n\t\t\t\t} else if (item.valueType === 2) {\r\n\t\t\t\t\tif (!item.value || item.value === \"\") continue;\r\n\r\n\t\t\t\t\t// Date\r\n\t\t\t\t\tconst todayTime = item.value;\r\n\t\t\t\t\tconst month = todayTime.substring(0, 2);\r\n\t\t\t\t\tconst day = todayTime.substring(3, 5);\r\n\t\t\t\t\tconst year = todayTime.substring(6, 10);\r\n\t\t\t\t\teditField.value = `${year}-${month}-${day}`;\r\n\t\t\t\t} else if (item.valueType === 3) {\r\n\t\t\t\t\tif (!item.value || item.value === \"\") continue;\r\n\t\t\t\t\t// DateAndTime\r\n\t\t\t\t\tif (item.formatString === \"d\") {\r\n\t\t\t\t\t\t// Date\r\n\t\t\t\t\t\tconst todayTime = item.value;\r\n\t\t\t\t\t\tconst month = todayTime.substring(0, 2);\r\n\t\t\t\t\t\tconst day = todayTime.substring(3, 5);\r\n\t\t\t\t\t\tconst year = todayTime.substring(6, 10);\r\n\t\t\t\t\t\teditField.value = `${year}-${month}-${day}`;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// DateAndTime\r\n\t\t\t\t\t\tconst todayTime = item.value;\r\n\t\t\t\t\t\tconst month = todayTime.substring(0, 2);\r\n\t\t\t\t\t\tconst day = todayTime.substring(3, 5);\r\n\t\t\t\t\t\tconst year = todayTime.substring(6, 10);\r\n\t\t\t\t\t\tconst hour = todayTime.substring(11, 13);\r\n\t\t\t\t\t\tconst minute = todayTime.substring(14, 16);\r\n\t\t\t\t\t\tif (item.controlType !== 0)\r\n\t\t\t\t\t\t\teditField.value = `${year}-${month}-${day}T${hour}:${minute}`;\r\n\t\t\t\t\t\telse editField.value = `${year}-${month}-${day} ${hour}:${minute}`;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (item.value !== \"\") {\r\n\t\t\t\t\t\teditField.value = item.value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (item.fieldKey === \"Operators\") {\r\n\t\t\t\t\t//Jezeli pozycja nie zapisana nie chcemy da\u0107 mo\u017Cliwo\u015Bci ustawienia operator\u00F3w\r\n\t\t\t\t\t$(editField).addClass(\"disabled\");\r\n\t\t\t\t\t$(editField).attr(\"disabled\", \"disabled\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (item.valueType === 1) {\r\n\t\t\t\t\tcreateDxNumberBox(\r\n\t\t\t\t\t\t`${subElementsModel[modelSubElementsOnly].globalSelectedDefinitionId}-${item.fieldKey}`,\r\n\t\t\t\t\t\titem.value,\r\n\t\t\t\t\t\titem.formatString\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (item.fieldKey === \"Leader\" || item.fieldKey === \"ParentCompany\") {\r\n\t\t\t\t\tcreateListInput(editField);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (templateDef) {\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalListOfEditables.push(\r\n\t\t\t\t\t`Caption:::${tempCaptionFromData}`\r\n\t\t\t\t);\r\n\t\t\t\tconst editField = document.getElementById(\r\n\t\t\t\t\t`${subElementsModel[modelSubElementsOnly].globalSelectedDefinitionId}-ChildSources`\r\n\t\t\t\t) as HTMLInputElement;\r\n\r\n\t\t\t\tif (editField) editField.value = tempCaptionFromData;\r\n\t\t\t}\r\n\r\n\t\t\t//HideLoadingPanel(true);\r\n\t\t\t//}\r\n\t\t}\r\n\r\n\tconst filesInput = document.getElementById(\"files\") as HTMLInputElement;\r\n\tlet addedFiles: FileList | FilesFromVario[] | null = filesInput.files;\r\n\tif (\r\n\t\tdraggedFilesBuffer &&\r\n\t\t(draggedFilesBuffer?.length ?? 0) > 0 &&\r\n\t\t\"fromChat\" in draggedFilesBuffer[0]\r\n\t)\r\n\t\taddedFiles = draggedFilesBuffer;\r\n\r\n\tif (addedFiles && addedFiles.length === 1) {\r\n\t\tconst fileName = addedFiles[0].name;\r\n\t\tconst fileNameNoExt = fileName.replace(/\\.[^/.]+$/, \"\");\r\n\t\tconst editFieldCaption = document.getElementById(\r\n\t\t\t`${subElementsModel[modelSubElementsOnly].globalSelectedDefinitionId}-Caption`\r\n\t\t) as HTMLInputElement;\r\n\t\tif (editFieldCaption) {\r\n\t\t\teditFieldCaption.value = fileNameNoExt;\r\n\t\t\t$(editFieldCaption).trigger(\"keyup\");\r\n\t\t\t$(editFieldCaption).trigger(\"change\");\r\n\t\t}\r\n\r\n\t\tconst editFieldSource = document.getElementById(\r\n\t\t\t`${subElementsModel[modelSubElementsOnly].globalSelectedDefinitionId}-ChildSources`\r\n\t\t) as HTMLInputElement;\r\n\t\tif (editFieldSource) {\r\n\t\t\teditFieldSource.value = fileName;\r\n\t\t}\r\n\r\n\t\tclearDraggedFilesBuffer();\r\n\t}\r\n\r\n\tconst editorDiv = document.getElementById(\"Editor\");\r\n\tif (editorDiv != null) {\r\n\t\t$(editorDiv).removeClass(\"hidden\");\r\n\r\n\t\tif (containerId?.includes(\"Schedule\"))\r\n\t\t\t$(editorDiv).addClass(\"editorCalendar\");\r\n\r\n\t\tconst rect = editorDiv.getBoundingClientRect();\r\n\t\tconst scrollTop = window.scrollY || document.documentElement.scrollTop;\r\n\t\t$(\"html, body\").animate({ scrollTop: rect.top + scrollTop - 50 }, \"smooth\");\r\n\r\n\t\tDisableSaveButtons(\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId ?? \"\"\r\n\t\t);\r\n\t}\r\n}\r\n\r\nexport function AfterEditorReadyForEdit(\r\n\titemIdParam: string,\r\n\tdefinitionKeyParam: string,\r\n\trequery: boolean\r\n) {\r\n\tResetRequiredFieldsClasses();\r\n\r\n\tconst editorForm = document.getElementById(\r\n\t\t\"PositionEditor\"\r\n\t) as HTMLFormElement;\r\n\tif (editorForm != null) {\r\n\t\teditorForm.action = \"/Vario/PutObject\";\r\n\t}\r\n\r\n\tif (!requery) {\r\n\t\tignoreIsDirty = true;\r\n\t\tCloseEditor();\r\n\t}\r\n\r\n\tsubElementsModel[modelSubElementsOnly].globalOperationName = \"Put\";\r\n\r\n\tconst editorKeyInput = document.getElementById(\r\n\t\t\"editorKey\"\r\n\t) as HTMLInputElement;\r\n\tlet localItemId: string;\r\n\tif (itemIdParam) {\r\n\t\teditorKeyInput.value = itemIdParam;\r\n\t\tlocalItemId = itemIdParam;\r\n\t} else {\r\n\t\teditorKeyInput.value =\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalHoveredItem?.ItemID ?? \"\";\r\n\t\tlocalItemId =\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalHoveredItem?.ItemID ?? \"\";\r\n\t}\r\n\r\n\tlet definitionKey: string;\r\n\tif (definitionKeyParam) {\r\n\t\tdefinitionKey = definitionKeyParam;\r\n\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId =\r\n\t\t\tdefinitionKey;\r\n\t} else {\r\n\t\tdefinitionKey =\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalHoveredItem?.DefinitionKey ??\r\n\t\t\t\"\";\r\n\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId =\r\n\t\t\tdefinitionKey;\r\n\t}\r\n\r\n\tdeleteOnUndo = false;\r\n\tsubElementsModel[modelSubElementsOnly].globalListOfEditables = [];\r\n\tinputIsDirty = false;\r\n\r\n\t$(\".subelementsDropDownDictionariesLoadAsync\").each((_, item) => {\r\n\t\tconst fieldKey = $(item as HTMLElement).attr(\"data-id\");\r\n\t\tgetData(fieldKey ?? \"\", \"\", definitionKey);\r\n\t});\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetVarioObjectById`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tdata: { id: localItemId },\r\n\t\tsuccess: (data: VarioObject) => {\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId =\r\n\t\t\t\tdata?.key;\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalListOfRequiredFields = [];\r\n\t\t\tif (definitionKey) {\r\n\t\t\t\tfor (const field of data.fields) {\r\n\t\t\t\t\tconst editField = document.getElementById(\r\n\t\t\t\t\t\t`${definitionKey}-${field.fieldKey}`\r\n\t\t\t\t\t) as HTMLInputElement;\r\n\t\t\t\t\tif (field.valueRequired && field.value === \"\") {\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t!subElementsModel[\r\n\t\t\t\t\t\t\t\tmodelSubElementsOnly\r\n\t\t\t\t\t\t\t].globalListOfRequiredFields.includes(field.fieldKey)\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tsubElementsModel[\r\n\t\t\t\t\t\t\t\tmodelSubElementsOnly\r\n\t\t\t\t\t\t\t].globalListOfRequiredFields.push(field.fieldKey);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t$(editField).addClass(\"requiredClassAtr\");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (editField != null) {\r\n\t\t\t\t\t\t//checkbox\r\n\t\t\t\t\t\tif (field.controlType === 3) {\r\n\t\t\t\t\t\t\tif (field.value.toLowerCase() === \"true\") {\r\n\t\t\t\t\t\t\t\teditField.checked = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (!field.signatureIsConstrained) {\r\n\t\t\t\t\t\t\t$(editField).addClass(\"unconstrainedField\");\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tfield.controlType === 2 ||\r\n\t\t\t\t\t\t\tfield.controlType === 4 ||\r\n\t\t\t\t\t\t\tfield.controlType === 5\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tdownloadDropDownDataSubElements(field);\r\n\t\t\t\t\t\t} else if (field.valueType === 2) {\r\n\t\t\t\t\t\t\tif (!field.value || field.value === \"\") continue;\r\n\r\n\t\t\t\t\t\t\t// Date\r\n\t\t\t\t\t\t\tconst todayTime = field.value;\r\n\t\t\t\t\t\t\tconst month = todayTime.substring(0, 2);\r\n\t\t\t\t\t\t\tconst day = todayTime.substring(3, 5);\r\n\t\t\t\t\t\t\tconst year = todayTime.substring(6, 10);\r\n\t\t\t\t\t\t\teditField.value = `${year}-${month}-${day}`;\r\n\t\t\t\t\t\t} else if (field.valueType === 3) {\r\n\t\t\t\t\t\t\tif (!field.value || field.value === \"\") continue;\r\n\r\n\t\t\t\t\t\t\t// DateAndTime\r\n\t\t\t\t\t\t\tif (field.formatString === \"d\") {\r\n\t\t\t\t\t\t\t\t// Date\r\n\t\t\t\t\t\t\t\tconst todayTime = field.value;\r\n\t\t\t\t\t\t\t\tconst month = todayTime.substring(0, 2);\r\n\t\t\t\t\t\t\t\tconst day = todayTime.substring(3, 5);\r\n\t\t\t\t\t\t\t\tconst year = todayTime.substring(6, 10);\r\n\t\t\t\t\t\t\t\teditField.value = `${year}-${month}-${day}`;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// DateAndTime\r\n\t\t\t\t\t\t\t\tconst todayTime = field.value;\r\n\t\t\t\t\t\t\t\tconst month = todayTime.substring(0, 2);\r\n\t\t\t\t\t\t\t\tconst day = todayTime.substring(3, 5);\r\n\t\t\t\t\t\t\t\tconst year = todayTime.substring(6, 10);\r\n\t\t\t\t\t\t\t\tconst hour = todayTime.substring(11, 13);\r\n\t\t\t\t\t\t\t\tconst minute = todayTime.substring(14, 16);\r\n\t\t\t\t\t\t\t\tif (field.controlType !== 0)\r\n\t\t\t\t\t\t\t\t\teditField.value = `${year}-${month}-${day}T${hour}:${minute}`;\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\teditField.value = `${year}-${month}-${day} ${hour}:${minute}`;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else if (field.valueType === 5) {\r\n\t\t\t\t\t\t\t//zrodlo nie chcemy wyswietlac po zapisie bo zwraca base64\r\n\t\t\t\t\t\t\t$(editField).parent().parent().hide();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\teditField.value = field.value;\r\n\t\t\t\t\t\t\tconst o = new Option(\"\", \"\", true, true);\r\n\t\t\t\t\t\t\t$(o).html(field.displayText);\r\n\t\t\t\t\t\t\t$(editField).append(o);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (field.valueType === 1) {\r\n\t\t\t\t\t\t\tcreateDxNumberBox(\r\n\t\t\t\t\t\t\t\t`${definitionKey}-${field.fieldKey}`,\r\n\t\t\t\t\t\t\t\tfield.value,\r\n\t\t\t\t\t\t\t\tfield.formatString\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (field.fieldKey === \"Operators\") {\r\n\t\t\t\t\t\t\tcreateRecipientTagInput(\r\n\t\t\t\t\t\t\t\teditField,\r\n\t\t\t\t\t\t\t\tfield.valueRequired,\r\n\t\t\t\t\t\t\t\t[AddressingScope.InternalRecipients],\r\n\t\t\t\t\t\t\t\tfield.recipients\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tfield.fieldKey === \"Leader\" ||\r\n\t\t\t\t\t\t\tfield.fieldKey === \"ParentCompany\"\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tcreateListInput(editField);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tconst editorDiv = document.getElementById(\"Editor\");\r\n\t\t\tif (editorDiv != null) $(editorDiv).removeClass(\"hidden\");\r\n\r\n\t\t\t$(`#${definitionKey}`).removeClass(\"hidden\");\r\n\t\t\tDisableSaveButtons(definitionKey);\r\n\r\n\t\t\tconst rect = editorDiv?.getBoundingClientRect() ?? { top: 0 };\r\n\t\t\tconst scrollTop = window.scrollY || document.documentElement.scrollTop;\r\n\t\t\t$(\"html, body\").animate(\r\n\t\t\t\t{ scrollTop: rect.top + scrollTop - 50 },\r\n\t\t\t\t\"smooth\"\r\n\t\t\t);\r\n\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function EditSelectedItem(\r\n\titemIdParam: string,\r\n\tdefinitionKeyParam: string\r\n) {\r\n\tShowLoadingPanel(\"Wczytywanie...\");\r\n\t// TODO przekazac paramatr 1 - grid, 2 - kalendarz\r\n\tif (isRunningOnMobile()) {\r\n\t\tchangeCurrentItem({\r\n\t\t\titemId: itemIdParam,\r\n\t\t\tcontainerKey: containerId,\r\n\t\t});\r\n\t} else LoadSubElementsEditor(definitionKeyParam, true, itemIdParam, 1);\r\n}\r\n\r\nexport function ChangeSelectedTemplate() {\r\n\tconst tempSelect = document.getElementById(\r\n\t\t\"selectTemplate\"\r\n\t) as HTMLSelectElement;\r\n\tconst okButton = document.getElementById(\"okButton\") as HTMLButtonElement;\r\n\tif (tempSelect != null) {\r\n\t\tconst tempValue = tempSelect.value;\r\n\t\tif (tempValue === \"\") {\r\n\t\t\tokButton.disabled = true;\r\n\t\t} else {\r\n\t\t\tokButton.disabled = false;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function saveFiles() {\r\n\tShowLoadingPanel(\"Tworzenie pozycji...\");\r\n\r\n\tlet attachmentId = \"\";\r\n\tif (\r\n\t\tdraggedFilesBuffer &&\r\n\t\tdraggedFilesBuffer.length > 0 &&\r\n\t\t\"fromChat\" in draggedFilesBuffer[0] &&\r\n\t\t\"id\" in draggedFilesBuffer[0]\r\n\t) {\r\n\t\tattachmentId = (draggedFilesBuffer[0] as FilesFromVario).itemId;\r\n\t\tclearDraggedFilesBuffer();\r\n\t}\r\n\r\n\tconst filesInput = document.getElementById(\"files\") as HTMLInputElement;\r\n\tlet files = draggedFilesBuffer;\r\n\tif ((filesInput?.files?.length ?? 0) > 0) {\r\n\t\tfiles = filesInput.files;\r\n\t}\r\n\r\n\tconst dragedFiles: Partial[] | Partial[] = [];\r\n\tif (files) for (const x of files) dragedFiles.push(x);\r\n\r\n\tuploadFiles(\r\n\t\tcontainerId,\r\n\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId ?? \"\",\r\n\t\tctrlDown ? DUPLICATED_FILES_MODE.Import : DUPLICATED_FILES_MODE.Normal,\r\n\t\tattachmentId,\r\n\t\tdragedFiles\r\n\t);\r\n}\r\n\r\nexport async function uploadFiles(\r\n\tcontainerId: string,\r\n\tdefinitionId: string,\r\n\tduplicatedFilesMode: DuplicatedFilesMode,\r\n\tattachmentId: string,\r\n\tfiles: Partial[] | Partial[],\r\n\timportedFilesCount = 0,\r\n\t_replacedWithExistingFilesCount = 0,\r\n\t_ommitedFilesCount = 0,\r\n\ttotalFilesCount: number | null = null,\r\n\timportedFileNames: string[] = [],\r\n\treplacedWithExistingFileNames: string[] = [],\r\n\tommitedFileNames: string[] = []\r\n) {\r\n\tconst correctContainerId =\r\n\t\tawait saveNewPositionAfterAddingToGrid(containerId);\r\n\tif (correctContainerId === false) return;\r\n\tcontainerId = correctContainerId;\r\n\r\n\tconst form_data = new FormData();\r\n\tform_data.append(\"containerId\", containerId);\r\n\tform_data.append(\"definitionId\", definitionId);\r\n\tform_data.append(\"duplicatedFilesMode\", duplicatedFilesMode.toString());\r\n\r\n\tif (attachmentId) {\r\n\t\tform_data.append(\"attachmentId\", attachmentId);\r\n\t\ttotalFilesCount = 1;\r\n\t}\r\n\r\n\tif (files) for (const x of files) form_data.append(\"file\", x as File);\r\n\ttotalFilesCount = totalFilesCount == null ? files.length : totalFilesCount;\r\n\r\n\tconst text =\r\n\t\ttotalFilesCount > 1 ? \"Dodawanie plik\u00F3w...\" : \"Dodawanie pliku...\";\r\n\tshowDxToast(\r\n\t\ttext,\r\n\t\t\"info\",\r\n\t\tundefined,\r\n\t\t`
${text}
`,\r\n\t\t\"uploadProgress\"\r\n\t);\r\n\r\n\tconst interval = setInterval(() => {\r\n\t\tconst current = $(\"#FileDownloadingProgress\").attr(\"value\");\r\n\t\t$(\"#FileDownloadingProgress\").attr(\"value\", Number(current) + 5);\r\n\t}, 200);\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/PostNewFile`,\r\n\t\tcache: false,\r\n\t\tcontentType: false,\r\n\t\tprocessData: false,\r\n\t\tdata: form_data,\r\n\t\ttype: \"post\",\r\n\t\tsuccess: (data: ImportFileResponse) => {\r\n\t\t\tif (data?.status === ImportedFileStatus.DuplicatedFiles) {\r\n\t\t\t\tduplicateFileExistsPopup(\r\n\t\t\t\t\tcontainerId,\r\n\t\t\t\t\tdefinitionId,\r\n\t\t\t\t\tattachmentId,\r\n\t\t\t\t\tdata,\r\n\t\t\t\t\tdata.data?.length,\r\n\t\t\t\t\tdata.replacedWithExistingFilesCount,\r\n\t\t\t\t\tdata.ommitedFilesCount,\r\n\t\t\t\t\ttotalFilesCount,\r\n\t\t\t\t\timportedFileNames,\r\n\t\t\t\t\tdata.replacedWithExistingFileNames,\r\n\t\t\t\t\tdata.ommitedFileNames\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tconst filesDisplayed = 3;\r\n\r\n\t\t\t\tconst replaced = [\r\n\t\t\t\t\t...replacedWithExistingFileNames,\r\n\t\t\t\t\t...data.replacedWithExistingFileNames,\r\n\t\t\t\t];\r\n\t\t\t\tconst omitted = [...ommitedFileNames, ...data.ommitedFileNames];\r\n\t\t\t\tconst imported = [...importedFileNames, ...data.importedFileNames];\r\n\r\n\t\t\t\tlet importedFileMsg = \"\";\r\n\t\t\t\tlet replacedFilesCountMsg =\r\n\t\t\t\t\treplaced.length > 0\r\n\t\t\t\t\t\t? `

Zast\u0105piono pozycjami istniej\u0105cymi (${replaced.length}/${totalFilesCount})

`\r\n\t\t\t\t\t\t: \"\";\r\n\t\t\t\tlet ommitedFilesCountMsg =\r\n\t\t\t\t\tomitted.length > 0\r\n\t\t\t\t\t\t? `

Pomini\u0119to pozycje powielone w tym miejscu (${omitted.length}/${totalFilesCount})

`\r\n\t\t\t\t\t\t: \"\";\r\n\r\n\t\t\t\treplaced.forEach((file, index) => {\r\n\t\t\t\t\tif (index < filesDisplayed) {\r\n\t\t\t\t\t\treplacedFilesCountMsg += `
  • ${file}
  • `;\r\n\t\t\t\t\t} else if (index === filesDisplayed) {\r\n\t\t\t\t\t\treplacedFilesCountMsg += \"wi\u0119cej...\";\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\t\t\tomitted.forEach((file, index) => {\r\n\t\t\t\t\tif (index < filesDisplayed) {\r\n\t\t\t\t\t\tommitedFilesCountMsg += `
  • ${file}
  • `;\r\n\t\t\t\t\t} else if (index === filesDisplayed) {\r\n\t\t\t\t\t\tommitedFilesCountMsg += \"wi\u0119cej...\";\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\t\t\timported.forEach((file, index) => {\r\n\t\t\t\t\tif (index < filesDisplayed) {\r\n\t\t\t\t\t\timportedFileMsg += `
  • ${file}
  • `;\r\n\t\t\t\t\t} else if (index === filesDisplayed) {\r\n\t\t\t\t\t\timportedFileMsg += \"wi\u0119cej...\";\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\t\t\t// Check if there are any omitted files and add a message if there are\r\n\t\t\t\tif (omitted.length > 0) {\r\n\t\t\t\t\tommitedFilesCountMsg += `

    Wykryto zduplikowane pliki, kt\u00F3re zosta\u0142y pomini\u0119te.
    \r\n\t\t\t\t\t\tAby je zaimportowa\u0107, przytrzymaj klawisz Ctrl podczas wykonywania operacji.

    `;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Check if there are any data or replaced files\r\n\t\t\t\tif (data.data?.length > 0 || data.replacedWithExistingFilesCount > 0) {\r\n\t\t\t\t\tconst mainMsg =\r\n\t\t\t\t\t\ttotalFilesCount === data.data?.length\r\n\t\t\t\t\t\t\t? `
    Dodanych plik\u00F3w: ${data.data?.length}`\r\n\t\t\t\t\t\t\t: `
    ${\r\n\t\t\t\t\t\t\t\t\ttotalFilesCount ===\r\n\t\t\t\t\t\t\t\t\tdata.data?.length + data.replacedWithExistingFilesCount\r\n\t\t\t\t\t\t\t\t\t\t? \"Niekt\u00F3re pliki zosta\u0142y zast\u0105pione plikami z systemu!\"\r\n\t\t\t\t\t\t\t\t\t\t: \"Niekt\u00F3re pliki nie zosta\u0142y dodane!\"\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t
    Rozwi\u0144 szczeg\u00F3\u0142y operacji aby dowiedzie\u0107 si\u0119 wi\u0119cej.
    `;\r\n\r\n\t\t\t\t\timportFilesInfoPopup(\r\n\t\t\t\t\t\t`

    Zako\u0144czono import plik\u00F3w.${mainMsg}

    `,\r\n\t\t\t\t\t\t`

    Dodano pozycje (${\r\n\t\t\t\t\t\t\tdata.data?.length +\r\n\t\t\t\t\t\t\t(importedFilesCount != null ? importedFilesCount : 0)\r\n\t\t\t\t\t\t}/${totalFilesCount})

    \r\n\t\t\t\t\t\t
    ${importedFileMsg}${replacedFilesCountMsg}${ommitedFilesCountMsg}
    `\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\trefreshDxGrid();\r\n\t\t\t\t\tselectNewlyAddedRow(data.data);\r\n\t\t\t\t\tclearDraggedFilesBuffer();\r\n\r\n\t\t\t\t\tconst filesInput = document.getElementById(\r\n\t\t\t\t\t\t\"files\"\r\n\t\t\t\t\t) as HTMLInputElement;\r\n\t\t\t\t\tif (filesInput) filesInput.value = \"\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\timportFilesInfoPopup(\r\n\t\t\t\t\t\t\"

    Nie dodano plik\u00F3w!

    Rozwi\u0144 szczeg\u00F3\u0142y operacji aby dowiedzie\u0107 si\u0119 wi\u0119cej.
    \",\r\n\t\t\t\t\t\t`${ommitedFilesCountMsg}`,\r\n\t\t\t\t\t\ttrue\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tfloatingButtonForNoSelection();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t\terror: () => {\r\n\t\t\tconst filesInput = document.getElementById(\"files\") as HTMLInputElement;\r\n\t\t\tif (filesInput) filesInput.value = \"\";\r\n\t\t\tHideLoadingPanel();\r\n\t\t\trefreshDxGrid();\r\n\t\t\tshowDxToast(\"B\u0142\u0105d podczas tworzenia pozycji\", \"error\");\r\n\t\t},\r\n\t\tcomplete: () => {\r\n\t\t\tclearInterval(interval);\r\n\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tcloseToast(\"uploadProgress\");\r\n\t\t\t}, 1000);\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function importFilesInfoPopup(\r\n\tbodyTextInfo: string,\r\n\tfooterTextInfo = \"\",\r\n\terror = false\r\n) {\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(490));\r\n\tpopup.option(\"minHeight\", calcMinPopup(120, true));\r\n\tpopup.option(\"showTitle\", false);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\tpopup.show();\r\n\r\n\t$(\"#Dialog\").empty();\r\n\tpopup.content().find(\".DialogFooter\").empty();\r\n\r\n\t$(\"#Dialog\").append(bodyTextInfo);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.append(`\r\n
    \r\n \r\n
    \r\n `);\r\n\r\n\t$(\"#closeBtnPopup\").on(\"click\", () => {\r\n\t\tCloseDialog();\r\n\t});\r\n\t$(document).one(\"keypress\", (event) => {\r\n\t\tif (\r\n\t\t\t$(\"#closeBtnPopup\").length > 0 &&\r\n\t\t\tevent.originalEvent?.key === \"Enter\"\r\n\t\t) {\r\n\t\t\t$(\"#closeBtnPopup\").trigger(\"click\");\r\n\t\t}\r\n\t});\r\n\r\n\taddItemInfoToPopup(\"#Dialog-Main-Footer\", footerTextInfo, error);\r\n}\r\n\r\nexport function duplicateFileExistsPopup(\r\n\tcontainerId: string,\r\n\tdefinitionId: string,\r\n\tattachmentId: string,\r\n\tdata: ImportFileResponse,\r\n\timportedFilesCount: number,\r\n\treplacedWithExistingFilesCount: number,\r\n\tommitedFilesCount: number,\r\n\ttotalFilesCount: number,\r\n\timportedFileNames: string[],\r\n\treplacedWithExistingFileNames: string[],\r\n\tommitedFileNames: string[]\r\n) {\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(490));\r\n\tpopup.option(\"minHeight\", calcMinPopup(160, true));\r\n\tpopup.option(\"showTitle\", false);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\tpopup.show();\r\n\r\n\t$(\"#Dialog\").empty();\r\n\tpopup.content().find(\".DialogFooter\").empty();\r\n\r\n\tlet textInfo = \"\";\r\n\r\n\ttextInfo =\r\n\t\t\"

    Co najmniej jedna importowana pozycja ma tak\u0105 sam\u0105 tre\u015B\u0107 jak istniej\u0105cy plik w systemie!

    Czy chcesz, aby system u\u017Cy\u0142 istniej\u0105cych plik\u00F3w zamiast dodawa\u0107 duplikaty?

    \";\r\n\r\n\t$(\"#Dialog\").append(`${textInfo}`);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.append(`\r\n
    \r\n \r\n \r\n \r\n
    \r\n `);\r\n\r\n\t$(\"#ommitDuplicateFilesBtnPopup\").on(\"click\", () => {\r\n\t\tconst files = Array.from((draggedFilesBuffer as FileList) ?? []);\r\n\t\tconst dragedFiles: Partial[] | Partial[] = [];\r\n\r\n\t\tfiles\r\n\t\t\t.filter((item) => data.fileNamesForNextTry?.includes(item.name))\r\n\t\t\t.map((x) => dragedFiles.push(x));\r\n\r\n\t\tCloseDialog();\r\n\t\tShowLoadingPanel(\"Tworzenie pozycji...\");\r\n\t\tuploadFiles(\r\n\t\t\tcontainerId,\r\n\t\t\tdefinitionId,\r\n\t\t\tDUPLICATED_FILES_MODE.ReplaceWithExisting,\r\n\t\t\tattachmentId,\r\n\t\t\tdragedFiles,\r\n\t\t\timportedFilesCount,\r\n\t\t\treplacedWithExistingFilesCount,\r\n\t\t\tommitedFilesCount,\r\n\t\t\ttotalFilesCount,\r\n\t\t\timportedFileNames,\r\n\t\t\treplacedWithExistingFileNames,\r\n\t\t\tommitedFileNames\r\n\t\t);\r\n\r\n\t\tconst filesInput = document.getElementById(\"files\") as HTMLInputElement;\r\n\t\tfilesInput.value = \"\";\r\n\t});\r\n\r\n\t$(\"#replaceExistingFilesBtnPopup\").on(\"click\", () => {\r\n\t\tconst files = Array.from((draggedFilesBuffer as FileList) ?? []);\r\n\t\tconst dragedFiles: Partial[] | Partial[] = [];\r\n\r\n\t\tfiles\r\n\t\t\t.filter((item) => data.fileNamesForNextTry?.includes(item.name))\r\n\t\t\t.map((x) => dragedFiles.push(x));\r\n\r\n\t\tCloseDialog();\r\n\t\tShowLoadingPanel(\"Tworzenie pozycji...\");\r\n\t\tuploadFiles(\r\n\t\t\tcontainerId,\r\n\t\t\tdefinitionId,\r\n\t\t\tDUPLICATED_FILES_MODE.Ommit,\r\n\t\t\tattachmentId,\r\n\t\t\tdragedFiles,\r\n\t\t\timportedFilesCount,\r\n\t\t\treplacedWithExistingFilesCount,\r\n\t\t\tommitedFilesCount,\r\n\t\t\ttotalFilesCount,\r\n\t\t\timportedFileNames,\r\n\t\t\treplacedWithExistingFileNames,\r\n\t\t\tommitedFileNames\r\n\t\t);\r\n\r\n\t\tconst filesInput = document.getElementById(\"files\") as HTMLInputElement;\r\n\t\tfilesInput.value = \"\";\r\n\t});\r\n\t$(\"#cancelBtnPopup\").on(\"click\", () => {\r\n\t\tCloseDialog();\r\n\t});\r\n\t$(document).one(\"keypress\", (event) => {\r\n\t\tif (\r\n\t\t\t$(\"#replaceExistingFilesBtnPopup\").length > 0 &&\r\n\t\t\tevent.originalEvent?.key === \"Enter\"\r\n\t\t) {\r\n\t\t\t$(\"#replaceExistingFilesBtnPopup\").trigger(\"click\");\r\n\t\t}\r\n\t});\r\n\r\n\tconst error = data?.status === ImportedFileStatus.DuplicatedFiles;\r\n\taddItemInfoToPopup(\r\n\t\t\"#Dialog-Main-Footer\",\r\n\t\t`Pierwszy zduplikowany plik: ${data?.fileNamesForNextTry[0]}`,\r\n\t\terror\r\n\t);\r\n}\r\n\r\nexport function ChangeFileInputCount(useBuffer: boolean) {\r\n\tconst forWorkflow = JSON.parse(\r\n\t\t$(\"#selectElementType\").attr(\"data-forWorkflow\") ?? \"null\"\r\n\t);\r\n\r\n\tconst label = document.getElementById(\"filesLabel\");\r\n\tlet files: Partial | Partial[] | null = null;\r\n\tlet filesLength = 0;\r\n\r\n\tconst filesInput = document.getElementById(\"files\") as HTMLInputElement;\r\n\tconst filesWorkflowInput = document.getElementById(\r\n\t\t\"filesWorkflow\"\r\n\t) as HTMLInputElement;\r\n\tif (useBuffer) {\r\n\t\tfiles = draggedFilesBuffer as FileList;\r\n\t} else if (forWorkflow && filesWorkflowInput) {\r\n\t\tfiles = filesWorkflowInput.files;\r\n\t} else if (filesInput) {\r\n\t\tfiles = filesInput.files;\r\n\t}\r\n\r\n\tfilesLength = files?.length ?? 0;\r\n\r\n\tconst isFileFromChat =\r\n\t\tuseBuffer && filesLength > 0 && files?.[0] && \"fromChat\" in files[0];\r\n\r\n\tif (!isFileFromChat) {\r\n\t\tconst updatedFilesList = new DataTransfer();\r\n\t\tif (\r\n\t\t\t!AddFiles(Array.from((files as FileList) ?? []), (x) => {\r\n\t\t\t\tupdatedFilesList.items.add(x);\r\n\t\t\t})\r\n\t\t) {\r\n\t\t}\r\n\r\n\t\tconst filesInput = document.getElementById(\"files\") as HTMLInputElement;\r\n\t\tconst filesWorkflowInput = document.getElementById(\r\n\t\t\t\"filesWorkflow\"\r\n\t\t) as HTMLInputElement;\r\n\t\tif (useBuffer) {\r\n\t\t\tdraggedFilesBuffer = updatedFilesList.files;\r\n\t\t} else if (forWorkflow && filesWorkflowInput) {\r\n\t\t\tfilesWorkflowInput.files = updatedFilesList.files;\r\n\t\t} else if (filesInput) {\r\n\t\t\tfilesInput.files = updatedFilesList.files;\r\n\t\t}\r\n\r\n\t\tfilesLength = updatedFilesList.files.length;\r\n\t} else if (files) {\r\n\t\t//dodanie id attachment\r\n\t\t$(\"#PositionEditor #attachmentValue\").val(\r\n\t\t\t(files as FilesFromVario)[0].itemId\r\n\t\t);\r\n\t}\r\n\r\n\tif (!label) return;\r\n\r\n\tlabel.setAttribute(\"data-hasFiles\", (filesLength > 0).toString());\r\n\r\n\tswitch (filesLength) {\r\n\t\tcase 0:\r\n\t\t\tlabel.innerHTML = ` Wybierz pliki`;\r\n\t\t\tbreak;\r\n\t\tcase 1:\r\n\t\t\tlabel.innerHTML =\r\n\t\t\t\t' Wybrano 1 plik';\r\n\t\t\tbreak;\r\n\t\tcase 2:\r\n\t\tcase 3:\r\n\t\tcase 4:\r\n\t\t\tlabel.innerHTML = ` Wybrano ${filesLength} pliki`;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tlabel.innerHTML = ` Wybrano ${filesLength} plik\u00F3w`;\r\n\t}\r\n}\r\n\r\n//funkcja pobierajaca definicji ktore mozna uzyc do dodania pozycji\r\nexport function GetAllowedDefinitionsAjax(forWhat?: AddForWhat) {\r\n\t//forSelectedItem - dodawanie do wybranej pozycji np. do zawartosci lub jako skladnik\r\n\tconst forSelectedItem = forWhat === \"forSelectedItem\";\r\n\t//pobieranie id pozycji w ktorej chcemy dodac\r\n\tlet idParam =\r\n\t\tforSelectedItem && checkWhereIsUser() === \"subElements\"\r\n\t\t\t? lastSelectedRow[0]?.ItemID\r\n\t\t\t: containerId\r\n\t\t\t\t? containerId\r\n\t\t\t\t: modelId;\r\n\r\n\t//jesli nie znalazlo id to popsulo sie zaznaczenie rowa w gridzie\r\n\tif (!idParam) {\r\n\t\tif (\r\n\t\t\tforSelectedItem &&\r\n\t\t\tsubElementsModel[modelSubElementsOnly]?.currentFocusedRowIndex != null\r\n\t\t) {\r\n\t\t\t//reselect - dx bug\r\n\t\t\t$(\"#Tabela\")\r\n\t\t\t\t.dxDataGrid(\"instance\")\r\n\t\t\t\t.selectRows(\r\n\t\t\t\t\t[subElementsModel[modelSubElementsOnly].currentFocusedRowIndex],\r\n\t\t\t\t\tfalse\r\n\t\t\t\t);\r\n\t\t\t$(\"#Tabela\")\r\n\t\t\t\t.dxDataGrid(\"instance\")\r\n\t\t\t\t.selectRows(\r\n\t\t\t\t\t[subElementsModel[modelSubElementsOnly].currentFocusedRowIndex + 1],\r\n\t\t\t\t\tfalse\r\n\t\t\t\t);\r\n\t\t\tidParam = lastSelectedRow[0]?.ItemID;\r\n\t\t}\r\n\r\n\t\tif (!idParam) {\r\n\t\t\tshowDxToast(\"B\u0142\u0105d pobierania definicji\", \"error\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\t//definitionKey - uzywane do pobierania definicji dostepnych na poszczegolnych zakladkach zawartosci w widoku karty\r\n\tdownloadingDefinitionsAjax = $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetAllowedDefinitions`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tdata: {\r\n\t\t\tid: idParam,\r\n\t\t\tdefinitionKey:\r\n\t\t\t\tforSelectedItem && checkWhereIsUser() === \"subElements\"\r\n\t\t\t\t\t? null\r\n\t\t\t\t\t: subElementsModel[modelSubElementsOnly].globalSelectedDefinitionId,\r\n\t\t\tasComponent: forSelectedItem,\r\n\t\t},\r\n\t\tsuccess: (data: ServiceResponse) => {\r\n\t\t\tif (data?.success) {\r\n\t\t\t\tif (forSelectedItem) {\r\n\t\t\t\t\tallowedDefinitionsGlobal4SelectedItem = data.data ?? [];\r\n\t\t\t\t} else {\r\n\t\t\t\t\tallowedDefinitionsGlobal = data.data ?? [];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tdownloadingDefinitionsAjax = null;\r\n\t\t},\r\n\t\terror: (e) => {\r\n\t\t\tconsole.log(e);\r\n\t\t},\r\n\t});\r\n\r\n\treturn downloadingDefinitionsAjax;\r\n}\r\n\r\nexport function ChangeSelectedMPK(\r\n\tlistId: string,\r\n\tvalue: string,\r\n\tparentFieldKey: string\r\n) {\r\n\tconst split = listId?.split(\"-\");\r\n\t$(\".subelementsDropDownLoadProject\").each(function () {\r\n\t\tconst fieldKey = $(this as HTMLElement).attr(\"data-id\") ?? split[1];\r\n\t\tconst elementId = $(this as HTMLElement).attr(\"id\") ?? split[1];\r\n\t\tgetDropdownData(\r\n\t\t\telementId,\r\n\t\t\tfieldKey,\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalInitializedItemId ?? \"\",\r\n\t\t\tundefined,\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId ?? \"\",\r\n\t\t\tcontainerId,\r\n\t\t\tvalue,\r\n\t\t\tparentFieldKey,\r\n\t\t\ttrue\r\n\t\t);\r\n\t});\r\n}\r\n\r\nexport function addRequiredWorkflowFields(\r\n\tresults?: WorkflowRequiredFieldsModel\r\n) {\r\n\tif (!results && !specialFields) return;\r\n\r\n\tlet fields: ParsedWorkflowFieldsModel[] = [];\r\n\tif (results) {\r\n\t\tconst workflowRequiredFieldsObjects = results?.workflowRequiredFields?.map(\r\n\t\t\t(str) => {\r\n\t\t\t\treturn {\r\n\t\t\t\t\tkey: str,\r\n\t\t\t\t\ttype: \"required\",\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t);\r\n\r\n\t\tconst workflowSuggestedFieldsObjects =\r\n\t\t\tresults?.workflowSuggestedFields?.map((str) => {\r\n\t\t\t\treturn {\r\n\t\t\t\t\tkey: str,\r\n\t\t\t\t\ttype: \"suggested\",\r\n\t\t\t\t};\r\n\t\t\t});\r\n\r\n\t\tif (\r\n\t\t\t!workflowRequiredFieldsObjects?.length &&\r\n\t\t\t!workflowSuggestedFieldsObjects?.length\r\n\t\t)\r\n\t\t\treturn;\r\n\r\n\t\tfields = workflowRequiredFieldsObjects.concat(\r\n\t\t\tworkflowSuggestedFieldsObjects\r\n\t\t);\r\n\t}\r\n\r\n\tspecialFields = fields;\r\n\r\n\tfor (const field of fields) {\r\n\t\tconst id =\r\n\t\t\tfield.type === \"required\"\r\n\t\t\t\t? `valueRequiredWorkflowElementId${field.key}`\r\n\t\t\t\t: `valueSuggestedWorkflowElementId${field.key}`;\r\n\t\t$(`#${field.key}`)\r\n\t\t\t.parent()\r\n\t\t\t.append(`\r\n \r\n `);\r\n\r\n\t\tif (checkWhereIsUser() === \"varioObject\") setRequiredFields(field.key);\r\n\r\n\t\tif ($(\"#SubElementsEditor\").children().length) {\r\n\t\t\tif (field.type === \"required\")\r\n\t\t\t\t$(`#SubElementsEditor [data-Id=\"${field.key}\"]`).addClass(\r\n\t\t\t\t\t\"requiredWorkflowClassAtr\"\r\n\t\t\t\t);\r\n\t\t\telse if (field.type === \"suggested\")\r\n\t\t\t\t$(`#SubElementsEditor [data-Id=\"${field.key}\"]`).addClass(\r\n\t\t\t\t\t\"suggestedWorkflowClassAtr\"\r\n\t\t\t\t);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function setRequiredFields(valueElementId: string) {\r\n\tconst reqElement =\r\n\t\t(\r\n\t\t\tdocument.getElementById(\r\n\t\t\t\t`valueRequiredElementId${valueElementId}`\r\n\t\t\t) as HTMLInputElement\r\n\t\t)?.value === \"True\";\r\n\tconst reqWFElement =\r\n\t\t(\r\n\t\t\tdocument.getElementById(\r\n\t\t\t\t`valueRequiredWorkflowElementId${valueElementId}`\r\n\t\t\t) as HTMLInputElement\r\n\t\t)?.value === \"True\";\r\n\tconst sugWFElement =\r\n\t\t(\r\n\t\t\tdocument.getElementById(\r\n\t\t\t\t`valueSuggestedWorkflowElementId${valueElementId}`\r\n\t\t\t) as HTMLInputElement\r\n\t\t)?.value === \"True\";\r\n\r\n\tif (reqElement || reqWFElement || sugWFElement) {\r\n\t\tconst fieldElement = $(`#${valueElementId}`);\r\n\t\tconst parent = fieldElement.parent();\r\n\t\tconst children = parent?.children(\r\n\t\t\t`.btn, .select2-container, #${valueElementId}`\r\n\t\t);\r\n\r\n\t\tconst value = $(fieldElement).hasClass(\"dx-numberbox\")\r\n\t\t\t? $(fieldElement)?.dxNumberBox(\"instance\")?.option(\"value\")\r\n\t\t\t: fieldElement.val();\r\n\r\n\t\tif (\r\n\t\t\t!stringIsNullOrEmpty(value) ||\r\n\t\t\t(typeof value === \"number\" && value === 0)\r\n\t\t) {\r\n\t\t\tchildren.removeClass(\"fieldRequired requiredClassAtr required-field\");\r\n\t\t\tchildren.removeClass(\"fieldRequiredWF\");\r\n\t\t\tchildren.removeClass(\"fieldSuggestedWF\");\r\n\t\t} else {\r\n\t\t\tif (reqElement) children.addClass(\"fieldRequired\");\r\n\t\t\telse if (reqWFElement) children.addClass(\"fieldRequiredWF\");\r\n\t\t\telse if (sugWFElement) children.addClass(\"fieldSuggestedWF\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function downloadDropDownDataSubElements(fieldParam?: VarioObjectField) {\r\n\tconst definitionKey =\r\n\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId;\r\n\tconst itemID = subElementsModel[modelSubElementsOnly].globalInitializedItemId;\r\n\t$(\".subelementsDropDownLoadAsync\").each((_, item) => {\r\n\t\tconst $item = $(item as HTMLInputElement);\r\n\r\n\t\tconst val = stringIsNullOrEmpty($item.val())\r\n\t\t\t? $item.find(\"option:selected\").val()\r\n\t\t\t: $item[0].value;\r\n\t\tconst fieldKey = $item.attr(\"data-id\");\r\n\t\tconst field = fieldParam ?? {\r\n\t\t\tdisplayText: $item.find(\"option:selected\").text(),\r\n\t\t\tvalue: val,\r\n\t\t\tfieldKey: fieldKey,\r\n\t\t};\r\n\t\tif (fieldKey === field.fieldKey) {\r\n\t\t\tconst elementId = $item.attr(\"id\") ?? \"\";\r\n\t\t\tgetDropdownData(\r\n\t\t\t\telementId,\r\n\t\t\t\tfieldKey ?? \"\",\r\n\t\t\t\titemID ?? undefined,\r\n\t\t\t\tlocalStorage.getItem(\"dictionary\") ?? \"\",\r\n\t\t\t\tdefinitionKey ?? \"\",\r\n\t\t\t\tcontainerId,\r\n\t\t\t\tundefined,\r\n\t\t\t\tundefined,\r\n\t\t\t\ttrue,\r\n\t\t\t\t{\r\n\t\t\t\t\tselected: true,\r\n\t\t\t\t\ttext: field.displayText ?? field.value,\r\n\t\t\t\t\tid: field.value?.toString(),\r\n\t\t\t\t\tvalue: field.value?.toString() ?? \"\",\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t\tcheckRequired(\r\n\t\t\t\tfield.value?.toString() ?? \"\",\r\n\t\t\t\telementId,\r\n\t\t\t\ttrue,\r\n\t\t\t\tnull,\r\n\t\t\t\tfield.fieldKey ?? \"\"\r\n\t\t\t);\r\n\t\t}\r\n\t});\r\n\r\n\t$(\".subelementsDropDownLoadProject\").each((_, item) => {\r\n\t\tconst $item = $(item as HTMLInputElement);\r\n\r\n\t\tconst val = stringIsNullOrEmpty($item.val())\r\n\t\t\t? $item.find(\"option:selected\").val()\r\n\t\t\t: (item as HTMLInputElement).value;\r\n\t\tconst fieldKey = $item.attr(\"data-id\");\r\n\t\tconst field = fieldParam ?? {\r\n\t\t\tdisplayText: $item.find(\"option:selected\").text(),\r\n\t\t\tvalue: val,\r\n\t\t\tfieldKey: fieldKey,\r\n\t\t};\r\n\t\tif (fieldKey === field.fieldKey) {\r\n\t\t\tconst elementId = $item.attr(\"id\") ?? \"\";\r\n\t\t\tgetDropdownData(\r\n\t\t\t\telementId,\r\n\t\t\t\tfieldKey ?? \"\",\r\n\t\t\t\titemID ?? \"\",\r\n\t\t\t\tundefined,\r\n\t\t\t\tdefinitionKey ?? \"\",\r\n\t\t\t\tcontainerId,\r\n\t\t\t\tundefined,\r\n\t\t\t\tundefined,\r\n\t\t\t\ttrue,\r\n\t\t\t\t{\r\n\t\t\t\t\tselected: true,\r\n\t\t\t\t\ttext: field.displayText ?? field.value,\r\n\t\t\t\t\tid: field.value?.toString(),\r\n\t\t\t\t\tvalue: field.value?.toString() ?? \"\",\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t\tcheckRequired(\r\n\t\t\t\tfield.value?.toString() ?? \"\",\r\n\t\t\t\telementId,\r\n\t\t\t\ttrue,\r\n\t\t\t\tnull,\r\n\t\t\t\tfield.fieldKey ?? \"\"\r\n\t\t\t);\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function createListInput(editField: string | HTMLElement) {\r\n\teditField = editField as HTMLElement;\r\n\tconst id = $(editField).attr(\"id\");\r\n\r\n\tif (!id) return;\r\n\r\n\tconst attrs = {};\r\n\r\n\t$.each($(editField)[0]?.attributes, (_, attr) => {\r\n\t\tattrs[attr.nodeName] = attr.nodeValue;\r\n\t});\r\n\r\n\tlet val = $(editField).val()?.valueOf().toString();\r\n\tif (stringIsNullOrEmpty(val)) val = $(editField).find(\":selected\").text();\r\n\tif (stringIsNullOrEmpty(val))\r\n\t\tval = $(`#valueElementId${id}`).val()?.valueOf().toString();\r\n\r\n\t$(editField).replaceWith(() => $(\"\r\n \r\n
    \r\n
    `;\r\n\t} else if (shareLinkModel?.link) title = \"Edytuj zaproszenie\";\r\n\telse title = \"Do\u0142\u0105cz innych do twojej organizacji...\";\r\n\r\n\tpopup.option(\"title\", title);\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog-Additional\"));\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t//guziki wysylania i zapisywania\r\n\tconst saveButton = ``;\r\n\tconst sendButton = ``;\r\n\r\n\t//guziki usuwania linku\r\n\tconst deleteLinkBtn = ``;\r\n\r\n\t$(\"#Dialog-Additional\").empty();\r\n\t$(\"#Dialog-Additional\").append(`\r\n
    \r\n
    \r\n
    \r\n
    \r\n\r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n\r\n
    \r\n
    \r\n\r\n
    \r\n
    \r\n\r\n ${onlyFile}\r\n\r\n
    \r\n \r\n \r\n \r\n
    \r\n\r\n\t
    \r\n ${deleteLinkBtn}\r\n ${saveButton}\r\n ${sendButton}\r\n
    \r\n
    `);\r\n\r\n\tfixScrollInDx(\".tag-container\");\r\n\tfixScrollInDx(\"#Dialog-Additional\");\r\n\r\n\tprepareSendPopup(shareLinkModel);\r\n\tappendShareLinks(shareLinkModel);\r\n}\r\n\r\nexport function prepareSendPopup(\r\n\tshareLinkModel: Partial &\r\n\t\tPartial\r\n) {\r\n\trecipientsRO = [];\r\n\trecipientsRW = [];\r\n\trecipientsOS = [];\r\n\trecipientsInvite = [];\r\n\r\n\tlet labelInvite = \"\";\r\n\tlet recDivs = \"\";\r\n\tlet sendButtonsDisabledClass = \"disabled\";\r\n\tlet link = \"\";\r\n\tlet validOption = false;\r\n\tlet checkedValue = \"\";\r\n\tlet validTo: number | Date = new Date();\r\n\tlet mode = \"newInvite\";\r\n\r\n\t//dodanie divow z recipients\r\n\tif (shareLinkModel?.invite) {\r\n\t\tlabelInvite = ``;\r\n\t\tlet labelInvite2 = ``;\r\n\r\n\t\tif (shareLinkModel?.link) {\r\n\t\t\tmode = \"editInvite\";\r\n\t\t\tlabelInvite = \"\";\r\n\t\t\tlabelInvite2 = \"Zaproszony u\u017Cytkownik: \";\r\n\t\t}\r\n\r\n\t\trecDivs = `
    \r\n ${labelInvite2}\r\n
    \r\n \r\n
    \r\n
    `;\r\n\t} else if (shareLinkModel.invite === false) {\r\n\t\tlabelInvite = ``;\r\n\r\n\t\tif (shareLinkModel.supportGlobalShareLink)\r\n\t\t\trecDivs = `
    \r\n
    \r\n \r\n \r\n
    \r\n
    `;\r\n\r\n\t\trecDivs += `\r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n\r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n\r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    `;\r\n\t}\r\n\r\n\t$(\"#shareItemContainer\").prepend(`\r\n \r\n \r\n \r\n \r\n \r\n\r\n ${labelInvite}\r\n\r\n ${recDivs}\r\n `);\r\n\r\n\tconst hasPdf = shareLinkModel?.hasFile\r\n\t\t?.toString()\r\n\t\t?.toLowerCase()\r\n\t\t?.includes(\"pdf\");\r\n\r\n\tif (hasPdf) {\r\n\t\t$(\"#shareForOSContainer\").append(`\r\n
    \r\n \r\n \r\n
    \r\n `);\r\n\t\tconst signAcceptanceRequireChecked =\r\n\t\t\t(shareLinkModel?.recipients?.[0]?.flags ?? -1) > 0;\r\n\t\t$(\"#SignAcceptanceRequireCheckbox\").prop(\r\n\t\t\t\"checked\",\r\n\t\t\tsignAcceptanceRequireChecked\r\n\t\t);\r\n\t}\r\n\r\n\tif (!hasPdf) {\r\n\t\t$(\"#shareEmailsOS\").parent().addClass(\"disabled\");\r\n\t}\r\n\r\n\tif (shareLinkModel.invite === false) {\r\n\t\tcreateDxAutocomplete($(\"#shareEmailsRO\"), \"tag-container-RO\");\r\n\t\tcreateDxAutocomplete($(\"#shareEmailsRW\"), \"tag-container-RW\");\r\n\t\tcreateDxAutocomplete($(\"#shareEmailsOS\"), \"tag-container-OS\");\r\n\t}\r\n\t//\r\n\r\n\tif (!shareLinkModel?.hasFile) {\r\n\t\t$(\"#shareForAll\").parent().remove();\r\n\t\t$(\"#shareOnlyFile\").parent().remove();\r\n\t}\r\n\r\n\tconst shareGuidLink = document.getElementById(\r\n\t\t\"shareGuidLink\"\r\n\t) as HTMLInputElement;\r\n\tconst shareItemId = document.getElementById(\r\n\t\t\"shareItemId\"\r\n\t) as HTMLInputElement;\r\n\tconst documentIdForShare = document.getElementById(\r\n\t\t\"documentIdForShare\"\r\n\t) as HTMLInputElement;\r\n\r\n\tif (shareLinkModel?.invite) {\r\n\t\tif (shareLinkEmailTitle?.length <= 0) {\r\n\t\t\tgetEmailConfigInfo();\r\n\t\t}\r\n\r\n\t\t$(\"#shareItemContainer .userManageContainer\").append(`\r\n \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n `);\r\n\r\n\t\tif (mode === \"editInvite\") {\r\n\t\t\tconst rec = shareLinkModel?.recipients?.[0].recipient;\r\n\t\t\tif (rec) recipientsInvite.push(rec);\r\n\t\t\t$(\"#shareEmailsInvite\").addClass(\"disabled\");\r\n\t\t\t$(\"#shareEmailsInvite\").attr(\"disabled\", \"disabled\");\r\n\t\t\taddTags(\"tag-container-Invite\");\r\n\r\n\t\t\tconst removeTagBtn = document.querySelector(\r\n\t\t\t\t\".tag > i.dx-icon.dx-icon-close\"\r\n\t\t\t);\r\n\t\t\tremoveTagBtn?.remove();\r\n\r\n\t\t\tif (shareGuidLink) shareGuidLink.value = shareLinkModel.link ?? \"\";\r\n\t\t\tif (shareItemId) shareItemId.value = shareLinkModel.id?.toString() ?? \"\";\r\n\t\t}\r\n\t} else if (shareLinkModel.invite === false) {\r\n\t\tif (shareItemId && (shareLinkModel.id ?? 0) > 0)\r\n\t\t\tshareItemId.value = shareLinkModel.id?.toString() ?? \"\";\r\n\r\n\t\tif (shareLinkModel?.link && shareGuidLink)\r\n\t\t\tshareGuidLink.value = shareLinkModel.link;\r\n\r\n\t\tif (shareLinkModel?.itemID?.length && documentIdForShare) {\r\n\t\t\tdocumentIdForShare.value = shareLinkModel.itemID;\r\n\t\t} else if (documentIdForShare) {\r\n\t\t\tdocumentIdForShare.value = shareLinkModel.id?.toString() ?? \"\";\r\n\t\t}\r\n\r\n\t\tconst documentForShareTitle = document.getElementById(\r\n\t\t\t\"documentForShareTitle\"\r\n\t\t) as HTMLInputElement;\r\n\t\tconst documentForShareHasFile = document.getElementById(\r\n\t\t\t\"documentForShareHasFile\"\r\n\t\t) as HTMLInputElement;\r\n\r\n\t\tif (documentForShareTitle)\r\n\t\t\tdocumentForShareTitle.value = shareLinkModel.titleParam ?? \"\";\r\n\t\tif (documentForShareHasFile)\r\n\t\t\tdocumentForShareHasFile.value = shareLinkModel.hasFile?.toString() ?? \"\";\r\n\r\n\t\tshareLinkEmailTitle = shareLinkModel.sendEmailTitle ?? \"\";\r\n\t\tshareLinkEmailBody = shareLinkModel.sendEmailBody ?? \"\";\r\n\r\n\t\tif (shareLinkModel.recipients) {\r\n\t\t\tfor (let i = 0; i < shareLinkModel.recipients.length; i++) {\r\n\t\t\t\tif (\r\n\t\t\t\t\tshareLinkModel.recipients[i].shareRecipientMode ===\r\n\t\t\t\t\tShareRecipientMode.permissionsReadOnly\r\n\t\t\t\t) {\r\n\t\t\t\t\trecipientsRO.push(shareLinkModel.recipients[i].recipient);\r\n\t\t\t\t} else if (\r\n\t\t\t\t\tshareLinkModel.recipients[i].shareRecipientMode ===\r\n\t\t\t\t\tShareRecipientMode.permissionsWrite\r\n\t\t\t\t) {\r\n\t\t\t\t\trecipientsRW.push(shareLinkModel.recipients[i].recipient);\r\n\t\t\t\t} else if (\r\n\t\t\t\t\tshareLinkModel.recipients[i].shareRecipientMode ===\r\n\t\t\t\t\tShareRecipientMode.linkForSigning\r\n\t\t\t\t) {\r\n\t\t\t\t\trecipientsOS.push(shareLinkModel.recipients[i]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\taddTags(\"tag-container-RO\");\r\n\t\t\taddTags(\"tag-container-RW\");\r\n\t\t\taddTags(\"tag-container-OS\");\r\n\t\t}\r\n\t}\r\n\r\n\t//funkcje guzik\u00F3w\r\n\t$(\"#btnDeleteShareLink\").on(\"click\", () => {\r\n\t\tdeleteShareLinkPopup(shareLinkModel);\r\n\t});\r\n\r\n\t$(\"#btnCreateCancelShareLink\").on(\"click\", () => {\r\n\t\tcreateShareLink(shareLinkModel);\r\n\t});\r\n\r\n\t$(\"#sendEmailShareLink\").on(\"click\", () => {\r\n\t\tif (shareLinkModel.invite === false)\r\n\t\t\tprepareMessage(shareLinkModel, \"shareLink\");\r\n\t\telse if (shareLinkModel.invite)\r\n\t\t\tprepareMessage(shareLinkModel, \"inviteToVario\");\r\n\t});\r\n\t//\r\n\r\n\t//jesli jest juz stworzony link\r\n\tlet checkedAdmin = \"checked\";\r\n\tlet checkedUser = \"\";\r\n\r\n\tif (shareLinkModel?.link) {\r\n\t\tlink = prepareLink(shareLinkModel.link);\r\n\t\tsendButtonsDisabledClass = \"\";\r\n\r\n\t\tif (\r\n\t\t\tshareLinkModel.recipients?.[0]?.shareRecipientMode ===\r\n\t\t\tShareRecipientMode.invitationUser\r\n\t\t) {\r\n\t\t\tcheckedAdmin = \"\";\r\n\t\t\tcheckedUser = \"checked\";\r\n\t\t}\r\n\r\n\t\t$(\"#sendEmailShareLink\").removeClass(\"disabled\");\r\n\t\t$(\"#btnDeleteShareLink\").removeClass(\"hidden\");\r\n\t}\r\n\r\n\tif (checkedAdmin === \"checked\") $(\"#radioAdmin\").prop(\"checked\", true);\r\n\tif (checkedUser === \"checked\") $(\"#radioUser\").prop(\"checked\", true);\r\n\r\n\t$(\"#shareLinkInput\").val(link);\r\n\tif (sendButtonsDisabledClass === \"\")\r\n\t\t$(\"#copyShareLink\").attr(\"disabled\", \"\").removeClass(\"disabled\");\r\n\t//\r\n\r\n\t//jesli mamy mailbridge to dodajemy sekcje z komentarzem i tworzymy carbonCopy\r\n\tif (sendMailViaMailBridge === \"True\") {\r\n\t\t$(\"#userMessage\").append(`
    \r\n \r\n \r\n
    `);\r\n\r\n\t\t$(\"#carbonCopy\").append(`
    \r\n \r\n \r\n \r\n
    `);\r\n\r\n\t\tif (currentUserEmail?.length) {\r\n\t\t\t$(\"#emailInputShare\").val(currentUserEmail);\r\n\t\t}\r\n\t}\r\n\t//\r\n\r\n\t//ustawianie checkboxow ShareItemMode\r\n\tconst shareForAll = $(\"#shareForAllCheck\");\r\n\tconst shareOnlyFile = $(\"#shareOnlyFileCheck\");\r\n\tconst shareItemMode = shareLinkModel.shareItemMode;\r\n\r\n\tif (\r\n\t\tshareItemMode === ShareItemMode.forAllWithLink ||\r\n\t\tshareItemMode === (ShareItemMode.forAllWithLink | ShareItemMode.onlyFile)\r\n\t) {\r\n\t\tshareForAll.parent().removeClass(\"hidden\");\r\n\t\tshareForAll?.prop(\"checked\", true);\r\n\t\tshareForAllCheckChanged();\r\n\t} else if (shareItemMode === 4) {\r\n\t\tshareOnlyFile?.prop(\"checked\", true);\r\n\t}\r\n\r\n\t//ustawienie terminu jesli jest\r\n\tif (\r\n\t\tshareLinkModel.validTo &&\r\n\t\tshareLinkModel.validTo !== \"0001-01-01T00:00:00\"\r\n\t) {\r\n\t\tvalidOption = true;\r\n\t\tcheckedValue = \"checked\";\r\n\t\tvalidTo = Date.parse(shareLinkModel.validTo);\r\n\t}\r\n\r\n\t$(\"#shareDatePicker\").dxDateBox({\r\n\t\ttype: \"date\",\r\n\t\tvalue: validTo,\r\n\t\tdisabled: !validOption,\r\n\t\tonValueChanged: () => {\r\n\t\t\tsharePopupChanged();\r\n\t\t},\r\n\t});\r\n\r\n\tif (checkedValue === \"checked\") $(\"#shareValidTo\").prop(\"checked\", true);\r\n\t//\r\n\r\n\t//rejestrowanie zmian\r\n\t$(\"#shareItemContainer input, #shareItemContainer textarea\").on(\r\n\t\t\"change keyup paste\",\r\n\t\tfunction (event) {\r\n\t\t\tsharePopupChanged(event, $(this as HTMLElement));\r\n\t\t}\r\n\t);\r\n\t//\r\n}\r\n\r\nexport function appendShareLinks(\r\n\tshareLinkModel: Partial\r\n) {\r\n\tif (!shareLinkModel?.shareLinks?.length) return;\r\n\t$(\"#shareLinksDropdown\").remove();\r\n\r\n\t$(\r\n\t\t\"#Dialog-Additional\"\r\n\t).append(`
    \r\n
    \r\n
    \r\n Udost\u0119pnienia\r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    `);\r\n\r\n\tif (shareLinkModel?.shareLinks)\r\n\t\tfor (const link of shareLinkModel.shareLinks) {\r\n\t\t\tconst additionalLink: ShareLinkBasicInfoExtended = link;\r\n\t\t\tadditionalLink.itemID = shareLinkModel.itemID;\r\n\t\t\tadditionalLink.titleParam = shareLinkModel.titleParam;\r\n\t\t\tadditionalLink.hasFile = shareLinkModel.hasFile;\r\n\t\t\taddUserWithProfileIcon(additionalLink, \"shareLinks\", shareLinkModel);\r\n\t\t\tif (additionalLink.id === $(\"#shareItemId\").val())\r\n\t\t\t\t$(`#user-${additionalLink.guidLink}`).addClass(\"focusInPopup\");\r\n\t\t}\r\n\r\n\tfixScrollInDx(\"#shareLinks\");\r\n}\r\n\r\nexport function getEmailConfigInfo() {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetConfiguarionValue`,\r\n\t\ttype: \"GET\",\r\n\t\tdata: {\r\n\t\t\tkey: \"ShareLinkEmailTitle\",\r\n\t\t},\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tshareLinkEmailTitle = response.data;\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t},\r\n\t});\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetConfiguarionValue`,\r\n\t\ttype: \"GET\",\r\n\t\tdata: {\r\n\t\t\tkey: \"ShareLinkEmailBody\",\r\n\t\t},\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tshareLinkEmailBody = response.data;\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function sharePopupChanged(\r\n\tevent?: JQuery.TriggeredEvent,\r\n\telement?: JQuery\r\n) {\r\n\tconst checkboxTarget = event?.currentTarget as HTMLInputElement;\r\n\tif (checkboxTarget?.checked && element?.[0].id === \"carboncopyShare\") {\r\n\t\t$(\"#emailInputShare\").removeClass(\"disabled\");\r\n\t\t$(\"#emailInputShare\").removeClass(\"cursorDisabled\");\r\n\t\t$(\"#emailInputShare\").attr(\"disabled\", null);\r\n\t} else if (\r\n\t\t!checkboxTarget?.checked &&\r\n\t\telement?.[0].id === \"carboncopyShare\"\r\n\t) {\r\n\t\t$(\"#emailInputShare\").addClass(\"disabled\");\r\n\t\t$(\"#emailInputShare\").addClass(\"cursorDisabled\");\r\n\t\t$(\"#emailInputShare\").attr(\"disabled\", \"disabled\");\r\n\t}\r\n\r\n\t$(\"#btnCreateCancelShareLink\").removeClass(\"disabled\");\r\n\t$(\"#btnCreateCancelShareLink\").removeClass(\"cursorDisabled\");\r\n\t$(\"#btnCreateCancelShareLink\").attr(\"disabled\", null);\r\n\t$(\"#sendEmailShareLink\").removeClass(\"disabled\");\r\n\t$(\"#sendEmailShareLink\").removeClass(\"cursorDisabled\");\r\n\t$(\"#sendEmailShareLink\").attr(\"disabled\", null);\r\n}\r\n\r\nexport function shareValidToCheckChanged() {\r\n\tconst checked = (document.getElementById(\"shareValidTo\") as HTMLInputElement)\r\n\t\t.checked;\r\n\t$(\"#shareDatePicker\").dxDateBox(\"instance\").option(\"disabled\", !checked);\r\n\tsharePopupChanged();\r\n}\r\n\r\nexport function createShareLink(\r\n\tshareLinkModel: Partial &\r\n\t\tPartial\r\n): JQuery.jqXHR> | undefined {\r\n\ttry {\r\n\t\tconst itemsToShare = shareLinkModel.itemID ?? [\"\"];\r\n\t\tlet action = \"create\";\r\n\t\tif (\r\n\t\t\tshareLinkModel?.link ||\r\n\t\t\t!stringIsNullOrEmpty($(\"#shareLinkInput\").val())\r\n\t\t) {\r\n\t\t\taction = \"update\";\r\n\t\t}\r\n\r\n\t\tconst validToCheck = (\r\n\t\t\tdocument.getElementById(\"shareValidTo\") as HTMLInputElement\r\n\t\t).checked;\r\n\t\tlet validToDate: Date | string = \"\";\r\n\r\n\t\tconst shareForAll =\r\n\t\t\t$(\"#shareForAllCheck\").length > 0\r\n\t\t\t\t? $(\"#shareForAllCheck\").prop(\"checked\")\r\n\t\t\t\t: false;\r\n\t\tconst shareOnlyFile =\r\n\t\t\t$(\"#shareOnlyFileCheck\").length > 0\r\n\t\t\t\t? $(\"#shareOnlyFileCheck\").prop(\"checked\")\r\n\t\t\t\t: false;\r\n\r\n\t\tif (\r\n\t\t\t!shareForAll &&\r\n\t\t\trecipientsRO.length <= 0 &&\r\n\t\t\trecipientsRW.length <= 0 &&\r\n\t\t\trecipientsInvite.length <= 0 &&\r\n\t\t\trecipientsOS.length <= 0\r\n\t\t) {\r\n\t\t\tshowDxToast(\"Podaj przynajmniej jednego adresata!\", \"warning\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet recipientsROString = \"\";\r\n\t\tlet recipientsRWString = \"\";\r\n\t\tlet recipientsInviteString = \"\";\r\n\t\tlet recipientsOSString = \"\";\r\n\r\n\t\tif (!$(\"#shareForAllCheck\").prop(\"checked\")) {\r\n\t\t\trecipientsROString = recipientsToString(recipientsRO, \",\");\r\n\t\t\trecipientsRWString = recipientsToString(recipientsRW, \",\");\r\n\t\t\trecipientsInviteString = recipientsToString(recipientsInvite, \",\");\r\n\t\t\trecipientsOSString = recipientsToString(recipientsOS, \",\");\r\n\r\n\t\t\t//Okeinko zapraszania a nie sherowania\r\n\t\t\tif (recipientsInviteString.length > 0) {\r\n\t\t\t\trecipientsROString = recipientsInviteString;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t$(\"#btnCreateCancelShareLink\").attr(\"disabled\", \"disabled\");\r\n\t\t$(\"#btnCreateCancelShareLink\").addClass(\"disabled\");\r\n\r\n\t\tif (validToCheck) {\r\n\t\t\tconst dateBox = $(\"#shareDatePicker\").dxDateBox(\"instance\");\r\n\t\t\tvalidToDate = new Date(dateBox.option(\"value\") ?? \"\");\r\n\r\n\t\t\tvalidToDate = validToDate.toISOString();\r\n\t\t}\r\n\r\n\t\tlet guidLink = \"\";\r\n\t\tlet Id = \"\";\r\n\r\n\t\tif (action === \"update\") {\r\n\t\t\tguidLink = (document.getElementById(\"shareGuidLink\") as HTMLInputElement)\r\n\t\t\t\t.value;\r\n\t\t\tId = (document.getElementById(\"shareItemId\") as HTMLInputElement).value;\r\n\t\t\tShowLoadingPanel(\"Aktualizacja linku...\");\r\n\t\t} else {\r\n\t\t\tShowLoadingPanel(\"Tworzenie linku...\");\r\n\t\t}\r\n\r\n\t\tlet shareRecipientModeRadio = \"-1\";\r\n\t\tif (document.querySelector('input[name=\"inviteRole\"]') != null) {\r\n\t\t\tshareRecipientModeRadio = (\r\n\t\t\t\tdocument.querySelector(\r\n\t\t\t\t\t'input[name=\"inviteRole\"]:checked'\r\n\t\t\t\t) as HTMLInputElement\r\n\t\t\t).value;\r\n\t\t}\r\n\r\n\t\tconst comment = $(\"#usrMsgShareItem\").val();\r\n\t\tconst sendCopy = (\r\n\t\t\tdocument.querySelector(\"#carboncopyShare\") as HTMLInputElement\r\n\t\t)?.checked;\r\n\t\tconst sendCopyEmailAddress = $(\"#emailInputShare\").val();\r\n\r\n\t\tconst signAcceptanceRequire =\r\n\t\t\t$(\"#SignAcceptanceRequireCheckbox\").length > 0\r\n\t\t\t\t? $(\"#SignAcceptanceRequireCheckbox\").prop(\"checked\")\r\n\t\t\t\t: false;\r\n\r\n\t\treturn $.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/PrepareShareLink`,\r\n\t\t\ttype: \"Post\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: {\r\n\t\t\t\titemsToShare: itemsToShare,\r\n\t\t\t\trecipientsRO: recipientsROString,\r\n\t\t\t\trecipientsRW: recipientsRWString,\r\n\t\t\t\trecipientsOS: recipientsOSString,\r\n\t\t\t\tvalidTo: validToDate,\r\n\t\t\t\tguidLink: guidLink,\r\n\t\t\t\tId: Id,\r\n\t\t\t\tshareRecipientMode: shareRecipientModeRadio,\r\n\t\t\t\tshareForAll: shareForAll,\r\n\t\t\t\tshareOnlyFile: shareOnlyFile,\r\n\t\t\t\tsignAcceptanceRequire: signAcceptanceRequire,\r\n\t\t\t\tcomment: comment,\r\n\t\t\t\tsendCopyToEmailAddress: sendCopyEmailAddress,\r\n\t\t\t\tsendCopyToEmail: sendCopy,\r\n\t\t\t},\r\n\t\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tif (response == null || response.success === false) {\r\n\t\t\t\t\tif (response?.message?.length) {\r\n\t\t\t\t\t\tshowDxToast(response.message, \"error\");\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tshowDxToast(\"Wyst\u0105pi\u0142 problem przy tworzeniu linku\", \"error\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\trecipientsOS = response?.data?.recipients?.filter(\r\n\t\t\t\t\t\t(x) => x.shareRecipientMode === ShareRecipientMode.linkForSigning\r\n\t\t\t\t\t);\r\n\t\t\t\t\tconst result = prepareLink(response.data.link);\r\n\r\n\t\t\t\t\tconst shareGuidLink = document.getElementById(\r\n\t\t\t\t\t\t\"shareGuidLink\"\r\n\t\t\t\t\t) as HTMLInputElement;\r\n\t\t\t\t\tconst shareItemId = document.getElementById(\r\n\t\t\t\t\t\t\"shareItemId\"\r\n\t\t\t\t\t) as HTMLInputElement;\r\n\t\t\t\t\tconst shareLinkInput = document.getElementById(\r\n\t\t\t\t\t\t\"shareLinkInput\"\r\n\t\t\t\t\t) as HTMLInputElement;\r\n\r\n\t\t\t\t\tshareItemId.value = response.data.id.toString();\r\n\t\t\t\t\tshareLinkInput.value = result;\r\n\t\t\t\t\tshareGuidLink.value = response.data.link;\r\n\t\t\t\t\t$(\"#copyShareLink\").attr(\"disabled\", null);\r\n\t\t\t\t\t$(\"#copyShareLink\").removeClass(\"disabled\");\r\n\t\t\t\t\t$(\"#sendEmailShareLink\").attr(\"disabled\", null);\r\n\t\t\t\t\t$(\"#sendEmailShareLink\").removeClass(\"disabled\");\r\n\t\t\t\t\t$(\"#btnUpdateChangesShareLink\").attr(\"disabled\", \"disabled\");\r\n\t\t\t\t\t$(\"#btnUpdateChangesShareLink\").addClass(\"disabled\");\r\n\r\n\t\t\t\t\t$(\"#btnCreateCancelShareLink\").attr(\"disabled\", \"disabled\");\r\n\t\t\t\t\t$(\"#btnCreateCancelShareLink\").addClass(\"disabled\");\r\n\r\n\t\t\t\t\t$(\"#btnDeleteShareLink\").removeClass(\"hidden\");\r\n\t\t\t\t\tconst popup = $(\"#devex-dialog-additional\").dxPopup(\"instance\");\r\n\t\t\t\t\tif (shareLinkModel?.titleParam)\r\n\t\t\t\t\t\tpopup.option(\r\n\t\t\t\t\t\t\t\"title\",\r\n\t\t\t\t\t\t\t`Edycja udost\u0119pnienia: ${shareLinkModel?.titleParam}`\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\tpopup\r\n\t\t\t\t\t\t.content()\r\n\t\t\t\t\t\t?.parent()\r\n\t\t\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t\t\t\tprocessAllShareLinks(shareLinkModel);\r\n\r\n\t\t\t\t\tif (response.success && response.message) {\r\n\t\t\t\t\t\tshowDxToast(response.message, \"warning\");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t//Mamy okienko zarz\u0105dzaj u\u017Cytkownikami\r\n\t\t\t\t\tif (document.getElementById(\"manageUsersPopupExist\") !== null) {\r\n\t\t\t\t\t\tmanageUsersGetData(true);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t/*return response.data;*/\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: (error) => {\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t\tshowDxToast(\"Wyst\u0105pi\u0142 problem przy tworzeniu linku\", \"error\");\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t},\r\n\t\t});\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t\tHideLoadingPanel();\r\n\t}\r\n}\r\n\r\nexport function deleteShareLinkPopup(\r\n\tshareLinkModel: Partial &\r\n\t\tPartial\r\n) {\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(350));\r\n\tpopup.option(\"minHeight\", calcMinPopup(120, true));\r\n\tpopup.option(\"showTitle\", false);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\tpopup.show();\r\n\r\n\t$(\"#Dialog\").empty();\r\n\t$(\"#Dialog\").append(\r\n\t\t`

    Usuni\u0119cie linku spowoduje wycofanie udost\u0119pnienia.
    Czy chcesz kontynowa\u0107?

    `\r\n\t);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(`\r\n\t
    \r\n\t\t\r\n\t\t\r\n\t
    `);\r\n\r\n\t$(\"#deleteShareLinkBtnPopup\").on(\"click\", () => {\r\n\t\tdeleteShareLink(shareLinkModel);\r\n\t\tCloseDialog();\r\n\t});\r\n}\r\n\r\nexport function deleteShareLink(\r\n\tshareLinkModel: Partial &\r\n\t\tPartial\r\n) {\r\n\t$(\"#btnCreateCancelShareLink\").addClass(\"disabled\");\r\n\t$(\"#btnCreateCancelShareLink\").attr(\"disabled\", \"disabled\");\r\n\r\n\tconst shareGuidLink = document.getElementById(\r\n\t\t\"shareGuidLink\"\r\n\t) as HTMLInputElement;\r\n\tconst shareItemId = document.getElementById(\r\n\t\t\"shareItemId\"\r\n\t) as HTMLInputElement;\r\n\tconst documentIdForShare = document.getElementById(\r\n\t\t\"documentIdForShare\"\r\n\t) as HTMLInputElement;\r\n\r\n\tconst shareId = shareLinkModel?.id ?? shareItemId?.value;\r\n\tconst documentId = shareLinkModel?.itemID ?? documentIdForShare?.value;\r\n\tconst shareGuid =\r\n\t\t(shareLinkModel as any)?.guidLink ??\r\n\t\tshareLinkModel?.link ??\r\n\t\tshareGuidLink?.value;\r\n\tShowLoadingPanel(\"Usuwanie linku...\");\r\n\r\n\ttry {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/DeleteShareLink`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: { itemId: shareId, documentId: documentId, shareGuid: shareGuid },\r\n\t\t\tsuccess: (data: boolean) => {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tif (data) {\r\n\t\t\t\t\t//Mamy okienko zarz\u0105dzaj u\u017Cytkownikami\r\n\t\t\t\t\tif (document.getElementById(\"manageUsersPopupExist\") !== null) {\r\n\t\t\t\t\t\tmanageUsersGetData(true);\r\n\t\t\t\t\t\tCloseAdditionalDialog();\r\n\t\t\t\t\t\tshowDxToast(\"Link zosta\u0142 usuni\u0119ty.\", \"success\");\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t//Usuwamy link z udost\u0119pnionych pozycji\r\n\t\t\t\t\tif (shareId.toString().length > 0 && documentId.length > 0) {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Link zosta\u0142 usuni\u0119ty. Uprawnienia personalne zosta\u0142y wycofane.\",\r\n\t\t\t\t\t\t\t\"success\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\tconst id = (\r\n\t\t\t\t\t\t\tdocument.getElementById(\"documentIdForShare\") as HTMLInputElement\r\n\t\t\t\t\t\t).value;\r\n\t\t\t\t\t\tconst titleParam = (\r\n\t\t\t\t\t\t\tdocument.getElementById(\r\n\t\t\t\t\t\t\t\t\"documentForShareTitle\"\r\n\t\t\t\t\t\t\t) as HTMLInputElement\r\n\t\t\t\t\t\t).value;\r\n\r\n\t\t\t\t\t\tconst hasFileInput = (\r\n\t\t\t\t\t\t\tdocument.getElementById(\r\n\t\t\t\t\t\t\t\t\"documentForShareHasFile\"\r\n\t\t\t\t\t\t\t) as HTMLInputElement\r\n\t\t\t\t\t\t).value;\r\n\r\n\t\t\t\t\t\tconst hasFile =\r\n\t\t\t\t\t\t\thasFileInput === \"true\" || hasFileInput === \"false\"\r\n\t\t\t\t\t\t\t\t? JSON.parse(hasFileInput)\r\n\t\t\t\t\t\t\t\t: hasFileInput;\r\n\r\n\t\t\t\t\t\tretrieveAllShareLinks(id, titleParam, hasFile)?.then((response) => {\r\n\t\t\t\t\t\t\tif (!response?.success) return;\r\n\t\t\t\t\t\t\tcreateSendPopup(response.data);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//Usuwamy link do zaprosze\u0144\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tshowDxToast(\"Link zosta\u0142 usuni\u0119ty.\", \"success\");\r\n\t\t\t\t\t\tcreateSendPopup({ invite: true });\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshowDxToast(\"B\u0142\u0105d usuwania linku.\", \"error\");\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: (error) => {\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t},\r\n\t\t});\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t\tHideLoadingPanel();\r\n\t}\r\n}\r\n\r\nexport function prepareLink(result: string) {\r\n\tconst baseUrl = GetBaseUrl();\r\n\tconst controllerHref = \"/Vario/VarioObject/\";\r\n\tlet link = \"\";\r\n\tlink += baseUrl + controllerHref + result;\r\n\r\n\treturn link;\r\n}\r\n\r\nexport async function prepareMessage(\r\n\tshareLinkModel: Partial &\r\n\t\tPartial,\r\n\treason: string\r\n) {\r\n\tlet title = shareLinkModel?.titleParam ?? \"\";\r\n\tif (shareLinkModel?.invite) title = \"\";\r\n\r\n\tconst shareLink = await createShareLink(shareLinkModel);\r\n\tif (!shareLink?.success) return;\r\n\tif (shareLink?.data?.recipients) {\r\n\t\trecipientsOS = [];\r\n\t\tfor (let i = 0; i < shareLink.data.recipients.length; i++) {\r\n\t\t\tif (\r\n\t\t\t\tshareLink.data.recipients[i].shareRecipientMode ===\r\n\t\t\t\tShareRecipientMode.linkForSigning\r\n\t\t\t) {\r\n\t\t\t\trecipientsOS.push(shareLink.data.recipients[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tconst txtArea = document.getElementById(\"shareLinkInput\") as HTMLInputElement;\r\n\tconst link = txtArea.value;\r\n\tlet recipient = \"\";\r\n\tlet AllRecArray = recipientsRO.concat(recipientsRW);\r\n\tif (document.getElementById(\"usrMsgShareItem\") != null) {\r\n\t\tAllRecArray = AllRecArray.concat(recipientsInvite);\r\n\t}\r\n\trecipient = recipientsToString(AllRecArray, \",\");\r\n\r\n\tconst recipientsOSLocal = recipientsToDict(recipientsOS);\r\n\r\n\tlet subject = shareLinkEmailTitle ?? \"\";\r\n\tsubject = subject.replaceAll(\"${caption}\", title);\r\n\tlet body = shareLinkEmailBody ?? \"\";\r\n\tbody = body.replaceAll(\"${caption}\", title);\r\n\tbody = body.replaceAll(\"${link}\", link);\r\n\r\n\tbody = \"\";\r\n\tif (document.getElementById(\"usrMsgShareItem\") != null) {\r\n\t\tconst inputUserValue = (\r\n\t\t\tdocument.getElementById(\"usrMsgShareItem\") as HTMLInputElement\r\n\t\t).value;\r\n\t\tif (inputUserValue?.length) {\r\n\t\t\tbody = inputUserValue;\r\n\t\t}\r\n\t}\r\n\r\n\tconst sendCopy = (\r\n\t\tdocument.querySelector(\"#carboncopyShare\") as HTMLInputElement\r\n\t)?.checked;\r\n\r\n\tconst emailInputShare = document.getElementById(\r\n\t\t\"emailInputShare\"\r\n\t) as HTMLInputElement;\r\n\tif (sendCopy && emailInputShare?.value.length > 0) {\r\n\t\tif (!stringIsNullOrEmpty(recipient)) recipient += \",\";\r\n\t\trecipient += `${emailInputShare.value}`;\r\n\t}\r\n\r\n\t$(\"#sendEmailShareLink\").attr(\"disabled\", \"disabled\");\r\n\t$(\"#sendEmailShareLink\").addClass(\"disabled\");\r\n\tShowLoadingPanel(\"Wysy\u0142anie wiadomo\u015Bci...\");\r\n\ttry {\r\n\t\tlet descItemId = \"\";\r\n\t\tif (document.getElementById(\"documentIdForShare\") != null) {\r\n\t\t\tdescItemId = (\r\n\t\t\t\tdocument.getElementById(\"documentIdForShare\") as HTMLInputElement\r\n\t\t\t).value;\r\n\t\t}\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/SendMailViaMailBridge`,\r\n\t\t\ttype: \"Post\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: {\r\n\t\t\t\trecipients: recipient,\r\n\t\t\t\trecipientsOS: recipientsOSLocal,\r\n\t\t\t\temailReason: reason,\r\n\t\t\t\tshareLink: link,\r\n\t\t\t\tbody: body,\r\n\t\t\t\tdescItem: descItemId,\r\n\t\t\t},\r\n\t\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\t\tif (response.success === true) {\r\n\t\t\t\t\tCloseAdditionalDialog();\r\n\t\t\t\t\tshowDxToast(\"Zlecono wys\u0142anie wiadomo\u015Bci.\", \"success\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (response.message) {\r\n\t\t\t\t\t\tshowDxToast(response.message, \"warning\", 15000);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t$(\"#sendEmailShareLink\").attr(\"disabled\", null);\r\n\t\t\t\t$(\"#sendEmailShareLink\").removeClass(\"disabled\");\r\n\t\t\t},\r\n\t\t\terror: (error) => {\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t$(\"#sendEmailShareLink\").attr(\"disabled\", null);\r\n\t\t\t\t$(\"#sendEmailShareLink\").removeClass(\"disabled\");\r\n\t\t\t},\r\n\t\t});\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t\tHideLoadingPanel();\r\n\t\t$(\"#sendEmailShareLink\").attr(\"disabled\", null);\r\n\t\t$(\"#sendEmailShareLink\").removeClass(\"disabled\");\r\n\t}\r\n}\r\n\r\nexport function copyLinkToClipboard() {\r\n\tif (!navigator.clipboard?.writeText) {\r\n\t\tconsole.log(\"Clipboard API is not available\");\r\n\t\tshowDxToast(\r\n\t\t\t\"Obecna konfiguracja systemu nie pozwala na kopiowanie tre\u015Bci.\",\r\n\t\t\t\"warning\"\r\n\t\t);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst linkToCopy = document.getElementById(\r\n\t\t\"shareLinkInput\"\r\n\t) as HTMLInputElement;\r\n\tnavigator.clipboard\r\n\t\t.writeText(linkToCopy?.value)\r\n\t\t.then(() => {\r\n\t\t\tshowDxToast(\"Link zosta\u0142 skopiowany.\", \"success\");\r\n\t\t})\r\n\t\t.catch((error) => {\r\n\t\t\tconsole.log(`Copy failed! ${error}`);\r\n\t\t});\r\n}\r\n\r\nexport function retrieveAllShareLinks(\r\n\titemId: string,\r\n\ttitleParam?: string,\r\n\thasFile?: boolean | string\r\n): JQuery.jqXHR> | undefined {\r\n\ttry {\r\n\t\treturn $.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/RetrieveAllShareLinks`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: { itemId: itemId },\r\n\t\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tif (response?.success) {\r\n\t\t\t\t\tif (!response?.data.canReadVarioObject) {\r\n\t\t\t\t\t\tshowDxToast(\"Brak uprawnie\u0144 do odczytu!\", \"error\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tconst withAdditionalData: ShareLinksCollectionAdditional =\r\n\t\t\t\t\t\t\tresponse.data;\r\n\t\t\t\t\t\twithAdditionalData.itemID = itemId;\r\n\t\t\t\t\t\twithAdditionalData.titleParam = titleParam ?? \"\";\r\n\t\t\t\t\t\twithAdditionalData.invite = false;\r\n\t\t\t\t\t\twithAdditionalData.hasFile = hasFile ?? false;\r\n\r\n\t\t\t\t\t\treturn withAdditionalData;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: (error) => {\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t},\r\n\t\t});\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t\tHideLoadingPanel();\r\n\t}\r\n}\r\n\r\nexport function processAllShareLinks(\r\n\tshareLinkModel: Partial &\r\n\t\tPartial\r\n) {\r\n\tif (!shareLinkModel?.itemID) return;\r\n\r\n\tretrieveAllShareLinks(shareLinkModel.itemID)?.then((response) => {\r\n\t\tif (!response?.success) return;\r\n\r\n\t\tshareLinkModel.shareLinks = response?.data?.shareLinks;\r\n\t\tappendShareLinks(shareLinkModel);\r\n\t});\r\n}\r\n\r\nexport function retrieveShareLink(\r\n\titemId: string,\r\n\ttitleParam: string,\r\n\thasFile: string,\r\n\tguidLink: string\r\n) {\r\n\ttry {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/RetrieveShareLink`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: { itemId: itemId, guidLink: guidLink },\r\n\t\t\tsuccess: (data: RetrieveShareLink) => {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tif (!data?.canReadVarioObject) {\r\n\t\t\t\t\tshowDxToast(\"Brak uprawnie\u0144 do odczytu!\", \"error\");\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst withAdditionalData: Partial &\r\n\t\t\t\t\tRetrieveShareLink = data;\r\n\t\t\t\twithAdditionalData.itemID = itemId;\r\n\t\t\t\twithAdditionalData.titleParam = titleParam;\r\n\t\t\t\twithAdditionalData.invite = false;\r\n\t\t\t\twithAdditionalData.hasFile = hasFile;\r\n\t\t\t\tprocessAllShareLinks(withAdditionalData);\r\n\r\n\t\t\t\tcreateSendPopup(withAdditionalData);\r\n\t\t\t},\r\n\t\t\terror: (error) => {\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t},\r\n\t\t});\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t\tHideLoadingPanel();\r\n\t}\r\n}\r\n\r\nexport function FinallyExecuteDecree(\r\n\trecipients: string | null,\r\n\telementId: string,\r\n\tnote: string,\r\n\taddComment: boolean\r\n) {\r\n\tShowLoadingPanel(\"Dekretacja...\");\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/DecreeTo`,\r\n\t\ttype: \"Post\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: {\r\n\t\t\trecipientsId: recipients,\r\n\t\t\tid: elementId,\r\n\t\t\tnote: note,\r\n\t\t\taddComments: addComment,\r\n\t\t},\r\n\t\tsuccess: (data: ResponseObject & LogonRequired) => {\r\n\t\t\tif (\r\n\t\t\t\tdata != null &&\r\n\t\t\t\tdata.logonRequired !== undefined &&\r\n\t\t\t\tdata.logonRequired === true\r\n\t\t\t) {\r\n\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t} else {\r\n\t\t\t\tglobalSelectedRecipients = [];\r\n\r\n\t\t\t\tif (data?.status === RequestStatus.error) {\r\n\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\tdata?.message ? data.message : \"Nie uda\u0142o si\u0119 wykona\u0107 operacji\",\r\n\t\t\t\t\t\t\"error\"\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$(\"#ExecuteDecreeButton\").addClass(\"disabled\");\r\n\t\t\t\t\tCloseBigDialog();\r\n\t\t\t\t\tshowDxToast(\"Wykonano dekretacj\u0119\", \"success\");\r\n\t\t\t\t\tconst row = getRowFromGrid(elementId);\r\n\r\n\t\t\t\t\tconst cell = (row as any)?.cells?.find(\r\n\t\t\t\t\t\t(cell) => cell.column?.command === \"edit\"\r\n\t\t\t\t\t)?.cellElement;\r\n\t\t\t\t\tif (!$(cell).find(\"#decreeIconCorrespondence\").length)\r\n\t\t\t\t\t\t$(cell).prepend(\r\n\t\t\t\t\t\t\t``\r\n\t\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\tcomplete: () => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function ExecuteDecree(itemId: string) {\r\n\tconst message = (\r\n\t\tdocument.getElementById(\"MessageTextArea\") as HTMLTextAreaElement\r\n\t).value;\r\n\tconst addMessage = message.length > 0;\r\n\tconst recipients: string[] = [];\r\n\r\n\tfor (const item of globalSelectedRecipients) {\r\n\t\trecipients.push(item.id);\r\n\t}\r\n\r\n\tconst recipientsAsJson = JSON.stringify(recipients);\r\n\tFinallyExecuteDecree(recipientsAsJson, itemId, message, addMessage);\r\n}\r\n\r\nexport function TryExecuteDecree(\r\n\titemKey: string,\r\n\trecipients: VarioEmployee[],\r\n\tmessageDescription: string,\r\n\titemName: string\r\n) {\r\n\tglobalSelectedRecipients = [];\r\n\tif (recipients?.length > 0) {\r\n\t\tconst popup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\t\tpopup.option(\"minWidth\", calcMinPopup(500));\r\n\t\tpopup.option(\"minHeight\", calcMinPopup(525, true));\r\n\t\tpopup.option(\"title\", `Dekretacja korespondencji: ${itemName}`);\r\n\t\tpopup.option(\"showTitle\", true);\r\n\t\tpopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\t\tpopup.show();\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t?.parent()\r\n\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t$(\"#BigDialog\").empty();\r\n\t\t$(\"#DialogFooter\").empty();\r\n\r\n\t\tcreateRecipientsList(recipients, false, false, false);\r\n\r\n\t\t$(\"#BigDialog\").append(`
    ${messageDescription}
    `);\r\n\t\t$(\"#BigDialog\").append(\r\n\t\t\t'
    '\r\n\t\t);\r\n\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t.find(\".DialogFooter\")\r\n\t\t\t.empty()\r\n\t\t\t.append(\r\n\t\t\t\t`
    `\r\n\t\t\t);\r\n\t} else {\r\n\t\t// TYPESCRIPT DILEMMA\r\n\t\t// pusty recipients??\r\n\t\t// FinallyExecuteDecree(recipients, itemKey, \"\", false);\r\n\t\tshowDxToast(\"B\u0142\u0105d pobierania odbiorc\u00F3w dekretu\", \"error\");\r\n\t}\r\n}\r\n\r\nexport function shareForAllCheckChanged() {\r\n\tconst checked = (\r\n\t\tdocument.getElementById(\"shareForAllCheck\") as HTMLInputElement\r\n\t).checked;\r\n\t(document.getElementById(\"shareOnlyFileCheck\") as HTMLInputElement).checked =\r\n\t\tchecked;\r\n\r\n\tconst tagContainers = $(\"#shareItemContainer .tag-container\");\r\n\ttagContainers.toggleClass(\"disabled-by-configuration\");\r\n\ttagContainers.find(\".tag\").toggleClass(\"hidden\");\r\n\r\n\t$(\r\n\t\t'#shareItemContainer input, #shareItemContainer textarea, #shareItemContainer button:not(\"#btnDeleteShareLink\"):not(\"#copyShareLink\")'\r\n\t).attr(\"disabled\", checked ? \"disabled\" : null);\r\n\t$(\"#shareItemContainer input, #shareItemContainer textarea\").toggleClass(\r\n\t\t\"disabled-by-configuration\"\r\n\t);\r\n}\r\n\r\nexport function createRecipientTagInput(\r\n\teditField: string | JQuery | HTMLElement,\r\n\tisRequired: boolean,\r\n\taddressingScope: AddressingScope | AddressingScope[],\r\n\trecipients?: VarioEmployee[] | string\r\n) {\r\n\teditField = editField as HTMLElement;\r\n\tconst id = $(editField).attr(\"id\");\r\n\tif (!id) return;\r\n\tif ($(`#${id}-Input`).length) return;\r\n\trecipientStorage[id] = [];\r\n\r\n\t$(editField).after(\r\n\t\t`
    `\r\n\t);\r\n\tconst tagInput = $(`#${id}-Input`) as JQuery;\r\n\r\n\tcreateDxAutocomplete(tagInput, undefined, addressingScope);\r\n\r\n\ttagInput.after(\r\n\t\t`
    `\r\n\t);\r\n\t$(editField as HTMLElement).addClass(\"hidden\");\r\n\r\n\ttagInput\r\n\t\t.parent()\r\n\t\t.find(\".tag-container\")\r\n\t\t.on(\"click\", () => {\r\n\t\t\ttagInput.find(\"input\").trigger(\"focus\");\r\n\t\t});\r\n\tif (isRequired || $(editField).hasClass(\"requiredClassAtr\")) {\r\n\t\ttagInput.addClass(\"requiredClassAtr\");\r\n\t}\r\n\r\n\tif (recipients === undefined) {\r\n\t\tconst model = prepareVarioObjectModel();\r\n\t\trecipients = model?.fields?.find((x) => x.fieldKey === id)?.recipients;\r\n\t}\r\n\r\n\tif (!recipients?.length)\r\n\t\trecipients = $(editField).val()?.valueOf().toString() ?? \"\";\r\n\tif (recipients?.length) onRecipientsForEmailChanged(recipients, id, true);\r\n}\r\n\r\nexport function createDxAutocomplete(\r\n\ttagInput: JQuery,\r\n\tdivId?: string,\r\n\tscope?: AddressingScope | AddressingScope[]\r\n) {\r\n\tconst isOperators = !divId && scope === AddressingScope.InternalRecipients;\r\n\tlet dataRequest: JQueryPromise | undefined;\r\n\r\n\tconst dataSource = new DevExpress.data.CustomStore({\r\n\t\tkey: \"recipientKey\",\r\n\t\tload: (loadOptions) => {\r\n\t\t\tif (debug) console.log(loadOptions);\r\n\t\t\tconst searchVal = loadOptions?.searchValue ?? \"\";\r\n\t\t\tif (stringIsNullOrEmpty(searchVal)) return;\r\n\r\n\t\t\tif (!(scope as AddressingScope[])?.length) {\r\n\t\t\t\tscope =\r\n\t\t\t\t\tdivId == null\r\n\t\t\t\t\t\t? AddressingScope.InternalRecipientsCompaniesPersons\r\n\t\t\t\t\t\t: AddressingScope.Users;\r\n\t\t\t\tif (searchVal?.includes(\"@\"))\r\n\t\t\t\t\tscope = [\r\n\t\t\t\t\t\tAddressingScope.InternalRecipientsCompaniesPersons,\r\n\t\t\t\t\t\tAddressingScope.ContactEntriesEmails,\r\n\t\t\t\t\t];\r\n\t\t\t}\r\n\r\n\t\t\tdataRequest = getAutoCompleteRecipientsData(\r\n\t\t\t\tscope,\r\n\t\t\t\tsearchVal,\r\n\t\t\t\tloadOptions?.skip,\r\n\t\t\t\tloadOptions?.take\r\n\t\t\t)?.then((res) => {\r\n\t\t\t\tif (res?.length || Array.isArray(scope)) return res;\r\n\r\n\t\t\t\treturn getAutoCompleteRecipientsData(\r\n\t\t\t\t\t[\r\n\t\t\t\t\t\tAddressingScope.InternalRecipientsCompaniesPersons,\r\n\t\t\t\t\t\tAddressingScope.ContactEntriesEmails,\r\n\t\t\t\t\t],\r\n\t\t\t\t\tsearchVal,\r\n\t\t\t\t\tloadOptions?.skip,\r\n\t\t\t\t\tloadOptions?.take\r\n\t\t\t\t);\r\n\t\t\t});\r\n\r\n\t\t\treturn (dataRequest as any)?.done((res: VarioEmployee[]) => res);\r\n\t\t},\r\n\t});\r\n\r\n\ttagInput.dxSelectBox({\r\n\t\tdataSource: dataSource,\r\n\t\tvalueExpr: \"recipientKey\",\r\n\t\tdisplayExpr: (item) =>\r\n\t\t\titem?.recipientName ? item?.recipientName : item?.recipient,\r\n\t\tsearchEnabled: true,\r\n\t\tplaceholder: \"\",\r\n\t\tshowDropDownButton: false,\r\n\t\topenOnFieldClick: false,\r\n\t\tnoDataText: (() => {\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\ttagInput.dxSelectBox(\"instance\").close();\r\n\t\t\t}, 0);\r\n\t\t}) as any,\r\n\t\tonValueChanged() {\r\n\t\t\tif (typeof dataRequest?.fail === \"function\") dataRequest?.fail(() => {});\r\n\t\t\tdataRequest = undefined;\r\n\t\t},\r\n\t\tonEnterKey(data) {\r\n\t\t\tif (isOperators) return;\r\n\r\n\t\t\tdata?.event?.preventDefault();\r\n\r\n\t\t\tconst val =\r\n\t\t\t\t(data as any)?.value ??\r\n\t\t\t\t(data?.event?.target as HTMLInputElement)?.value ??\r\n\t\t\t\t\"\";\r\n\t\t\tif (stringIsNullOrEmpty(val)) return;\r\n\t\t\tif (!validateEmail(val)) {\r\n\t\t\t\tshowDxToast(\"Z\u0142y email\", \"error\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (tagInput.attr(\"id\")?.includes(\"-Input\"))\r\n\t\t\t\tonRecipientsForEmailChanged(val, tagInput.attr(\"id\"));\r\n\t\t\telse onRecipientsChanged(val, divId ?? \"\", tagInput);\r\n\t\t},\r\n\t\tonItemClick(data) {\r\n\t\t\tif (tagInput.attr(\"id\")?.includes(\"-Input\"))\r\n\t\t\t\tonRecipientsForEmailChanged(data?.itemData ?? \"\", tagInput.attr(\"id\"));\r\n\t\t\telse onRecipientsChanged(data?.itemData ?? \"\", divId ?? \"\", tagInput);\r\n\t\t},\r\n\t\titemTemplate(data) {\r\n\t\t\treturn ` ${data?.recipientName}`;\r\n\t\t},\r\n\t});\r\n\r\n\ttagInput.find(\".dx-texteditor-input\").on(\"keypress\", (event) => {\r\n\t\tif (event.key === \"Enter\") event.preventDefault();\r\n\t});\r\n\r\n\ttagInput.find(\".dx-texteditor-input\").on(\"focusout\", () => {\r\n\t\tif (isOperators) return;\r\n\r\n\t\tconst val =\r\n\t\t\ttagInput.dxSelectBox(\"instance\").option(\"selectedItem\") ??\r\n\t\t\ttagInput.find(\".dx-texteditor-input-container input\").val();\r\n\t\tif (stringIsNullOrEmpty(val)) return;\r\n\r\n\t\tif (typeof val !== \"object\") {\r\n\t\t\tif (!validateEmail(val)) {\r\n\t\t\t\tshowDxToast(\"Z\u0142y email\", \"error\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (tagInput.attr(\"id\")?.includes(\"-Input\"))\r\n\t\t\tonRecipientsForEmailChanged(val, tagInput.attr(\"id\"));\r\n\t\telse onRecipientsChanged(val, divId ?? \"\", tagInput);\r\n\t});\r\n}\r\n\r\nexport async function appendEmailEditor(sourceFile?: string) {\r\n\tif (checkWhereIsUser() !== \"varioObject\") return;\r\n\r\n\tif (!sourceFile) {\r\n\t\taddPreviewPanel();\r\n\r\n\t\t$(\"#varioObjectDocumentPreview\").append(`\r\n
    \r\n
    \r\n
    \r\n
    `);\r\n\r\n\t\tchooseOptionInSidePanel();\r\n\r\n\t\tsourceFile = `${GetBaseUrl()}/Vario/DownloadContentFile?id=${modelId}&download=false`;\r\n\t}\r\n\r\n\tif (sourceFile?.includes(\"/Vario/DownloadContentFile\")) {\r\n\t\ttry {\r\n\t\t\tawait $.ajax({\r\n\t\t\t\turl: sourceFile,\r\n\t\t\t\ttype: \"GET\",\r\n\t\t\t\tcache: true,\r\n\t\t\t\tsuccess: (res: string) => {\r\n\t\t\t\t\tsourceFile = res;\r\n\t\t\t\t},\r\n\t\t\t\terror: () => {\r\n\t\t\t\t\tsourceFile = undefined;\r\n\t\t\t\t},\r\n\t\t\t});\r\n\t\t} catch (e) {\r\n\t\t\tconsole.log(e);\r\n\r\n\t\t\tsourceFile = undefined;\r\n\t\t}\r\n\t}\r\n\r\n\t$(\"#varioObjectDiagram-button\").addClass(\"disabled\");\r\n\t$(\"#varioObjectProgDiagram-button\").addClass(\"disabled\");\r\n\r\n\t$(() => {\r\n\t\tconst editor = $(\"#emailEmbed\")\r\n\t\t\t.dxHtmlEditor({\r\n\t\t\t\tvalue: sourceFile,\r\n\t\t\t\timageUpload: {\r\n\t\t\t\t\ttabs: [\"file\", \"url\"],\r\n\t\t\t\t\tfileUploadMode: \"base64\",\r\n\t\t\t\t},\r\n\t\t\t\ttoolbar: {\r\n\t\t\t\t\titems: [\r\n\t\t\t\t\t\t\"undo\",\r\n\t\t\t\t\t\t\"redo\",\r\n\t\t\t\t\t\t\"separator\",\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tname: \"size\",\r\n\t\t\t\t\t\t\tacceptedValues: [\r\n\t\t\t\t\t\t\t\t\"8pt\",\r\n\t\t\t\t\t\t\t\t\"10pt\",\r\n\t\t\t\t\t\t\t\t\"12pt\",\r\n\t\t\t\t\t\t\t\t\"14pt\",\r\n\t\t\t\t\t\t\t\t\"18pt\",\r\n\t\t\t\t\t\t\t\t\"24pt\",\r\n\t\t\t\t\t\t\t\t\"36pt\",\r\n\t\t\t\t\t\t\t],\r\n\t\t\t\t\t\t\toptions: { inputAttr: { \"aria-label\": \"Font size\" } },\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tname: \"font\",\r\n\t\t\t\t\t\t\tacceptedValues: [\r\n\t\t\t\t\t\t\t\t\"Arial\",\r\n\t\t\t\t\t\t\t\t\"Courier New\",\r\n\t\t\t\t\t\t\t\t\"Georgia\",\r\n\t\t\t\t\t\t\t\t\"Impact\",\r\n\t\t\t\t\t\t\t\t\"Lucida Console\",\r\n\t\t\t\t\t\t\t\t\"Tahoma\",\r\n\t\t\t\t\t\t\t\t\"Times New Roman\",\r\n\t\t\t\t\t\t\t\t\"Verdana\",\r\n\t\t\t\t\t\t\t],\r\n\t\t\t\t\t\t\toptions: { inputAttr: { \"aria-label\": \"Font family\" } },\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\"separator\",\r\n\t\t\t\t\t\t\"bold\",\r\n\t\t\t\t\t\t\"italic\",\r\n\t\t\t\t\t\t\"strike\",\r\n\t\t\t\t\t\t\"underline\",\r\n\t\t\t\t\t\t\"separator\",\r\n\t\t\t\t\t\t\"alignLeft\",\r\n\t\t\t\t\t\t\"alignCenter\",\r\n\t\t\t\t\t\t\"alignRight\",\r\n\t\t\t\t\t\t\"alignJustify\",\r\n\t\t\t\t\t\t\"separator\",\r\n\t\t\t\t\t\t\"orderedList\",\r\n\t\t\t\t\t\t\"bulletList\",\r\n\t\t\t\t\t\t\"separator\",\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tname: \"header\",\r\n\t\t\t\t\t\t\tacceptedValues: [false, 1, 2, 3, 4, 5],\r\n\t\t\t\t\t\t\toptions: { inputAttr: { \"aria-label\": \"Header\" } },\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\"separator\",\r\n\t\t\t\t\t\t\"color\",\r\n\t\t\t\t\t\t\"background\",\r\n\t\t\t\t\t\t\"separator\",\r\n\t\t\t\t\t\t\"link\",\r\n\t\t\t\t\t\t\"image\",\r\n\t\t\t\t\t\t\"separator\",\r\n\t\t\t\t\t\t\"clear\",\r\n\t\t\t\t\t\t\"codeBlock\",\r\n\t\t\t\t\t\t\"blockquote\",\r\n\t\t\t\t\t\t\"separator\",\r\n\t\t\t\t\t\t\"insertTable\",\r\n\t\t\t\t\t\t\"deleteTable\",\r\n\t\t\t\t\t\t\"insertRowAbove\",\r\n\t\t\t\t\t\t\"insertRowBelow\",\r\n\t\t\t\t\t\t\"deleteRow\",\r\n\t\t\t\t\t\t\"insertColumnLeft\",\r\n\t\t\t\t\t\t\"insertColumnRight\",\r\n\t\t\t\t\t\t\"deleteColumn\",\r\n\t\t\t\t\t],\r\n\t\t\t\t},\r\n\t\t\t\tmediaResizing: {\r\n\t\t\t\t\tenabled: true,\r\n\t\t\t\t},\r\n\t\t\t\tonValueChanged: (e) => {\r\n\t\t\t\t\tconst value = `HTML\\v${e.value}`;\r\n\t\t\t\t\thtmlEditorChanges = value;\r\n\t\t\t\t\tsetInputAsDirty();\r\n\t\t\t\t\tChangeSaveBtnsStatus(true);\r\n\t\t\t\t},\r\n\t\t\t\tonFocusOut: () => {\r\n\t\t\t\t\tFieldValueChanged();\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t\t.dxHtmlEditor(\"instance\");\r\n\r\n\t\t$(\"#multiline\").dxCheckBox({\r\n\t\t\ttext: \"Multiline toolbar\",\r\n\t\t\tvalue: true,\r\n\t\t\tonValueChanged(e) {\r\n\t\t\t\teditor.option(\"toolbar.multiline\", e.value);\r\n\t\t\t},\r\n\t\t});\r\n\r\n\t\tconst tabs = [\r\n\t\t\t{ name: \"From This Device\", value: [\"file\"] },\r\n\t\t\t{\r\n\t\t\t\tname: \"From the Web\",\r\n\t\t\t\tvalue: [\"url\"],\r\n\t\t\t},\r\n\t\t\t{ name: \"Both\", value: [\"file\", \"url\"] },\r\n\t\t];\r\n\r\n\t\t$(\"#image-uploader-tabs\").dxSelectBox({\r\n\t\t\titems: tabs,\r\n\t\t\tvalue: tabs[2].value,\r\n\t\t\tinputAttr: { \"aria-label\": \"Tab\" },\r\n\t\t\tvalueExpr: \"value\",\r\n\t\t\tdisplayExpr: \"name\",\r\n\t\t\tonValueChanged: (e) => {\r\n\t\t\t\teditor.option(\"imageUpload.tabs\", e.value);\r\n\t\t\t},\r\n\t\t});\r\n\t});\r\n}\r\nexport function ChangeCorrespondenceActionButtonsStatus(enable: boolean) {\r\n\tconst disabled = enable ? null : \"disabled\";\r\n\r\n\t$(\"#sendCorrespondenceBtn, #replyCorrespondenceBtn\").attr(\r\n\t\t\"disabled\",\r\n\t\tdisabled\r\n\t);\r\n\t$(\"#sendCorrespondenceBtn, #replyCorrespondenceBtn\").toggleClass(\r\n\t\t\"disabled\",\r\n\t\t!enable\r\n\t);\r\n}\r\n\r\nexport async function sendCorrespondence() {\r\n\tif (isDirty()) {\r\n\t\tconst res = await ShowPopupWarningUnsaved(false, true).catch(() => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\r\n\tChangeCorrespondenceActionButtonsStatus(false);\r\n\r\n\tShowLoadingPanel(\"Wysy\u0142anie korespondencji...\");\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/SendCorrespondence?itemKey=${modelId}`,\r\n\t\ttype: \"GET\",\r\n\t\tcache: true,\r\n\t\tsuccess: (data: VarioMessageViewModel) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tif (data?.status === RequestStatus.success) {\r\n\t\t\t\tshowDxToast(\"Korespondencja zosta\u0142a wys\u0142ana\", \"success\");\r\n\t\t\t\tsessionStorage.removeItem(\"selectedRow\");\r\n\t\t\t\tCloseVarioObjectButtonClick();\r\n\t\t\t} else {\r\n\t\t\t\tChangeCorrespondenceActionButtonsStatus(true);\r\n\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\t`Wyst\u0105pi\u0142 b\u0142\u0105d podczas wysy\u0142ania korespondecji! \\n ${data.message}`,\r\n\t\t\t\t\t\"warning\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport async function replyToCorrespondence(\r\n\titemId: string,\r\n\tmode: ObjectCreationMode,\r\n\tdefKey: string\r\n) {\r\n\tif (isDirty()) {\r\n\t\tconst res = await ShowPopupWarningUnsaved(false, true).catch(() => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\r\n\tCreateVarioObjectFromDialog(containerId, undefined, itemId, mode, defKey);\r\n}\r\n\r\nexport function prepareLinkForOS(result: string) {\r\n\tconst baseUrl = GetBaseUrl();\r\n\tconst controllerHref = \"/Vario/SignDocumentUniversal/\";\r\n\tlet link = \"\";\r\n\r\n\tlink += baseUrl + controllerHref + result;\r\n\r\n\treturn link;\r\n}\r\n", "\uFEFF//------------------------------------funkcje do tworzenia nowej pozycji poprzez URUCHOM---------------------------------------\r\nimport \"../types/dx.all.d.ts\";\r\nimport {\r\n\ttype AddForWhat,\r\n\tObjectCreationMode,\r\n\ttype VarioObjectInitModel,\r\n\ttype VarioObjectType,\r\n\tinputsWithRecipients,\r\n} from \"../types/models/vario-types\";\r\nimport {\r\n\tDisableSaveButtons,\r\n\tcheckRequired,\r\n\tgetData,\r\n\tgetDropdownData,\r\n} from \"./editor\";\r\nimport { appendEmailEditor, onRecipientsForEmailChanged } from \"./emails\";\r\nimport { newDocument } from \"./floating-buttons\";\r\nimport { GetBaseUrl } from \"./page-navigation\";\r\nimport {\r\n\tCreateVarioObject,\r\n\tHideLoadingPanel,\r\n\tShowLoadingPanel,\r\n\tshowDxToast,\r\n\tstringIsNullOrEmpty,\r\n} from \"./site\";\r\nimport { appendSidePanel } from \"./vario-object\";\r\n\r\ndeclare global {\r\n\tvar allowedDefinitionsGlobalWorkflow: VarioObjectType[] | null;\r\n\tvar globalUseTemplateGlobalWorkflow: boolean;\r\n\tvar globalSelectedDefinitionIdWorkflow: string;\r\n}\r\n\r\nglobalThis.allowedDefinitionsGlobalWorkflow = null;\r\nglobalThis.globalUseTemplateGlobalWorkflow = false;\r\nglobalThis.globalSelectedDefinitionIdWorkflow = \"\";\r\n\r\n//funkcja wywolujaca popup tworzenia nowej pozycji dla guzika 'tworzenie nowej pozycji w ramachu obiegu pracy'\r\nexport function GetAllCreatableObjectTypesAsSubElements() {\r\n\tnewDocument({ forWhat: \"forWorkflow\" });\r\n}\r\n\r\n//funkcja tworzaca widok karty z dialogu tworzenia nowej pozycji\r\nexport function CreateVarioObjectFromDialog(\r\n\tcontainerId?: string,\r\n\tparentId?: string,\r\n\tcontextItemId?: string,\r\n\tmode: ObjectCreationMode = ObjectCreationMode.Undefined,\r\n\tdefKey?: string,\r\n\tforWhat: AddForWhat = \"forGrid\"\r\n) {\r\n\t//contextItemId jest uzywane do korespondencji, mode to tryb korespondencji,\r\n\t//parentId jest uzywany do tworzenia skladnikow\r\n\r\n\tif (!stringIsNullOrEmpty(defKey)) {\r\n\t\tglobalThis.globalSelectedDefinitionIdWorkflow = defKey ?? \"\";\r\n\t} else\r\n\t\tglobalSelectedDefinitionIdWorkflow =\r\n\t\t\t(document.getElementById(\"selectElementType\") as HTMLInputElement)\r\n\t\t\t\t?.value ?? globalSelectedDefinitionIdWorkflow;\r\n\r\n\tif (stringIsNullOrEmpty(globalSelectedDefinitionIdWorkflow)) {\r\n\t\tshowDxToast(\"Brak wybranej definicji\", \"warning\");\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst filesLabel = document.getElementById(\"filesLabel\");\r\n\tif (filesLabel) {\r\n\t\tconst filesWorkflow = document.getElementById(\r\n\t\t\t\"filesWorkflow\"\r\n\t\t) as HTMLInputElement;\r\n\t\tif (\r\n\t\t\tfilesWorkflow &&\r\n\t\t\t(!filesLabel.innerHTML.includes(\"Wybrano\") || forWhat !== \"forWorkflow\")\r\n\t\t) {\r\n\t\t\tfilesWorkflow.value = \"\";\r\n\t\t}\r\n\r\n\t\tconst files = document.getElementById(\"files\") as HTMLInputElement;\r\n\t\tif (\r\n\t\t\tfiles &&\r\n\t\t\t(!filesLabel.innerHTML.includes(\"Wybrano\") || forWhat === \"forWorkflow\")\r\n\t\t) {\r\n\t\t\tfiles.value = \"\";\r\n\t\t}\r\n\t}\r\n\r\n\tCreateVarioObject(\r\n\t\tglobalSelectedDefinitionIdWorkflow,\r\n\t\tcontainerId ?? \"\",\r\n\t\tparentId ?? \"\",\r\n\t\tcontextItemId ?? \"\",\r\n\t\tmode\r\n\t);\r\n}\r\n\r\nexport function AfterEditorReadyWorkflow(\r\n\tcorrespondenceMode: ObjectCreationMode,\r\n\tcontainerIdParam: string,\r\n\tparentId = \"\"\r\n) {\r\n\tlet templateDef: string | null = null;\r\n\r\n\tconst isEmail =\r\n\t\tcorrespondenceMode &&\r\n\t\tcorrespondenceMode !== ObjectCreationMode.Undefined &&\r\n\t\tcorrespondenceMode !== ObjectCreationMode.CreatedFromInitWorkflow;\r\n\r\n\tconst selectTemplate = document.getElementById(\r\n\t\t\"selectTemplate\"\r\n\t) as HTMLInputElement;\r\n\tif (\r\n\t\t$(\"#useTemplate\").prop(\"checked\") &&\r\n\t\tselectTemplate?.value !== \"---Wybierz wzorzec---\"\r\n\t) {\r\n\t\ttemplateDef = selectTemplate.value ?? \"\";\r\n\t}\r\n\r\n\tif (!templateDef && isEmail) {\r\n\t\tappendEmailEditor();\r\n\t}\r\n\r\n\tif (!templateDef) {\r\n\t\t//Np uruchamiamy karte pracy. Poszukac fieldRequired. Jak nie ma, to mozna odblokowac kalwisze zapisu?\r\n\r\n\t\tconst BarbtnSaveItemFloatingWithClose = document.getElementById(\r\n\t\t\t\"BarbtnSaveItemFloatingWithClose\"\r\n\t\t) as HTMLButtonElement;\r\n\r\n\t\tconst BarbtnSaveItemFloating = document.getElementById(\r\n\t\t\t\"BarbtnSaveItemFloating\"\r\n\t\t) as HTMLButtonElement;\r\n\r\n\t\tconst sendCorrespondenceBtn = document.getElementById(\r\n\t\t\t\"sendCorrespondenceBtn\"\r\n\t\t) as HTMLButtonElement;\r\n\r\n\t\tif ($(\".fieldRequired\").length === 0) {\r\n\t\t\tif (BarbtnSaveItemFloatingWithClose)\r\n\t\t\t\tBarbtnSaveItemFloatingWithClose.disabled = false;\r\n\t\t\tif (BarbtnSaveItemFloating) BarbtnSaveItemFloating.disabled = false;\r\n\t\t} else if (sendCorrespondenceBtn) {\r\n\t\t\tsendCorrespondenceBtn.disabled = true;\r\n\t\t}\r\n\t\treturn;\r\n\t}\r\n\r\n\t$(\".subelementsDropDownDictionariesLoadAsync\").each(function () {\r\n\t\tconst fieldKey = $(this).attr(\"data-id\") ?? \"\";\r\n\t\tgetData(fieldKey, undefined, globalSelectedDefinitionIdWorkflow);\r\n\t});\r\n\r\n\tif (templateDef) {\r\n\t\tdeleteOnUndo = true;\r\n\t\tShowLoadingPanel(\"Pobieranie danych wzorca...\");\r\n\t}\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetVarioObjectBaseData`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tdata: {\r\n\t\t\tdefinitionKey: globalSelectedDefinitionIdWorkflow,\r\n\t\t\tcontainerId: containerIdParam,\r\n\t\t\tparentId: parentId,\r\n\t\t\ttemplateId: templateDef,\r\n\t\t},\r\n\t\tsuccess: (data: VarioObjectInitModel) => {\r\n\t\t\tconst VarioObjectKey = document.getElementById(\r\n\t\t\t\t\"VarioObjectKey\"\r\n\t\t\t) as HTMLInputElement;\r\n\t\t\tif (VarioObjectKey) VarioObjectKey.value = data.key;\r\n\r\n\t\t\tlet tempCaptionFromData = \"Nowy\";\r\n\t\t\tlet fileExt = \"\";\r\n\t\t\tfor (const item of data.initFields) {\r\n\t\t\t\tif (item.fieldKey === \"Caption\") {\r\n\t\t\t\t\ttempCaptionFromData = item.value;\r\n\t\t\t\t\tconst editFieldCaption = document.getElementById(\r\n\t\t\t\t\t\t\"Caption\"\r\n\t\t\t\t\t) as HTMLInputElement;\r\n\t\t\t\t\tif (editFieldCaption) {\r\n\t\t\t\t\t\teditFieldCaption.value = tempCaptionFromData;\r\n\t\t\t\t\t\t$(editFieldCaption).trigger(\"keyup\");\r\n\t\t\t\t\t\t$(editFieldCaption).trigger(\"change\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (const fieldKeyRec of inputsWithRecipients) {\r\n\t\t\t\t\tif (item.fieldKey === fieldKeyRec) {\r\n\t\t\t\t\t\tif (item.recipients?.length && $(`#${fieldKeyRec}-Input`).length)\r\n\t\t\t\t\t\t\tonRecipientsForEmailChanged(\r\n\t\t\t\t\t\t\t\titem.recipients,\r\n\t\t\t\t\t\t\t\t`${fieldKeyRec}-Input`,\r\n\t\t\t\t\t\t\t\ttrue\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (item.fieldKey === \"FileExtension\") {\r\n\t\t\t\t\tfileExt = item.value;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst editField = document.getElementById(\r\n\t\t\t\t\titem.fieldKey\r\n\t\t\t\t) as HTMLInputElement;\r\n\r\n\t\t\t\tif (item.valueRequired) {\r\n\t\t\t\t\t$(editField).addClass(\"requiredClassAtr\");\r\n\t\t\t\t\tif (!item.value) {\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t!subElementsModel[\r\n\t\t\t\t\t\t\t\tmodelSubElementsOnly\r\n\t\t\t\t\t\t\t].globalListOfRequiredFields.includes(item.fieldKey)\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tsubElementsModel[\r\n\t\t\t\t\t\t\t\tmodelSubElementsOnly\r\n\t\t\t\t\t\t\t].globalListOfRequiredFields.push(item.fieldKey);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t$(editField).addClass(\"required-field\");\r\n\t\t\t\t\t\tjQuery(\"#-submitFormButton\").attr(\"disabled\", \"disabled\");\r\n\t\t\t\t\t\tjQuery(\"#-submitLeaveFormButton\").attr(\"disabled\", \"disabled\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (editField) {\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\titem.controlType === 5 ||\r\n\t\t\t\t\t\titem.controlType === 0 ||\r\n\t\t\t\t\t\titem.controlType === 4\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\t$(\".subelementsDropDownLoadAsync\").each((_, newItem) => {\r\n\t\t\t\t\t\t\tif ($(newItem).attr(\"data-id\") === item.fieldKey) {\r\n\t\t\t\t\t\t\t\tconst elementId = $(newItem).attr(\"id\") ?? \"\";\r\n\t\t\t\t\t\t\t\tgetDropdownData(\r\n\t\t\t\t\t\t\t\t\telementId,\r\n\t\t\t\t\t\t\t\t\titem.fieldKey,\r\n\t\t\t\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\t\t\t\tlocalStorage.getItem(\"dictionary\") ?? \"\",\r\n\t\t\t\t\t\t\t\t\tglobalSelectedDefinitionIdWorkflow,\r\n\t\t\t\t\t\t\t\t\t\"\",\r\n\t\t\t\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\t\t\titem.value\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\tcheckRequired(item.value, elementId, true, null, item.fieldKey);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t$(\".subelementsDropDownLoadProject\").each((_, newItem) => {\r\n\t\t\t\t\t\t\tif ($(newItem).attr(\"data-id\") === item.fieldKey) {\r\n\t\t\t\t\t\t\t\tconst elementId = $(newItem).attr(\"id\") ?? \"\";\r\n\t\t\t\t\t\t\t\tgetDropdownData(\r\n\t\t\t\t\t\t\t\t\telementId,\r\n\t\t\t\t\t\t\t\t\titem.fieldKey,\r\n\t\t\t\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\t\t\t\tglobalSelectedDefinitionIdWorkflow,\r\n\t\t\t\t\t\t\t\t\t\"\",\r\n\t\t\t\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\t\t\titem.value\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\tcheckRequired(item.value, elementId, true, null, item.fieldKey);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t} else if (item.valueType === 2) {\r\n\t\t\t\t\t\t// Date\r\n\t\t\t\t\t\tconst todayTime = item.value;\r\n\t\t\t\t\t\tconst month = todayTime.substring(0, 2);\r\n\t\t\t\t\t\tconst day = todayTime.substring(3, 5);\r\n\t\t\t\t\t\tconst year = todayTime.substring(6, 10);\r\n\t\t\t\t\t\teditField.value = `${year}-${month}-${day}`;\r\n\t\t\t\t\t} else if (item.valueType === 3) {\r\n\t\t\t\t\t\t// DateAndTime\r\n\t\t\t\t\t\tif (item.formatString === \"d\") {\r\n\t\t\t\t\t\t\t// Date\r\n\t\t\t\t\t\t\tconst todayTime = item.value;\r\n\t\t\t\t\t\t\tconst month = todayTime.substring(0, 2);\r\n\t\t\t\t\t\t\tconst day = todayTime.substring(3, 5);\r\n\t\t\t\t\t\t\tconst year = todayTime.substring(6, 10);\r\n\t\t\t\t\t\t\teditField.value = `${year}-${month}-${day}`;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// DateAndTime\r\n\t\t\t\t\t\t\tconst todayTime = item.value;\r\n\t\t\t\t\t\t\tconst month = todayTime.substring(0, 2);\r\n\t\t\t\t\t\t\tconst day = todayTime.substring(3, 5);\r\n\t\t\t\t\t\t\tconst year = todayTime.substring(6, 10);\r\n\t\t\t\t\t\t\tconst hour = todayTime.substring(11, 13);\r\n\t\t\t\t\t\t\tconst minute = todayTime.substring(14, 16);\r\n\t\t\t\t\t\t\teditField.value = `${year}-${month}-${day}T${hour}:${minute}`;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (item.value !== \"\") {\r\n\t\t\t\t\t\t\teditField.value = item.value;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tconst childSource = document.getElementById(\r\n\t\t\t\t\"ChildSources\"\r\n\t\t\t) as HTMLInputElement;\r\n\t\t\tif (childSource && tempCaptionFromData && fileExt) {\r\n\t\t\t\tconst captionWithExt = tempCaptionFromData + fileExt;\r\n\t\t\t\tchildSource.value = captionWithExt;\r\n\t\t\t}\r\n\r\n\t\t\tif (templateDef) {\r\n\t\t\t\tHideLoadingPanel(true);\r\n\r\n\t\t\t\tif (data.key) {\r\n\t\t\t\t\tappendSidePanel(data.key, fileExt);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n\r\n\tconst editorDiv = document.getElementById(\"Editor\");\r\n\tif (editorDiv) {\r\n\t\t$(editorDiv).removeClass(\"hidden\");\r\n\t\tconst rect = editorDiv.getBoundingClientRect();\r\n\t\tconst scrollTop = window.scrollY || document.documentElement.scrollTop;\r\n\t\t$(\"html, body\").animate({ scrollTop: rect.top + scrollTop - 50 }, \"smooth\");\r\n\r\n\t\tDisableSaveButtons(globalSelectedDefinitionIdWorkflow);\r\n\t}\r\n}\r\n", "\uFEFFimport \"../types/dx.all.d.ts\";\r\nimport { CustomOperationType } from \"../types/models/Enums/customOperationType\";\r\nimport { LayoutControlWeb } from \"../types/models/Enums/layoutControlWeb\";\r\nimport type { PossibleControlsToUse } from \"../types/models/Enums/possibleControlsToUse\";\r\nimport {\r\n\ttype ActionsViewModel,\r\n\ttype AddForWhat,\r\n\ttype CustomOperation,\r\n\ttype DocParams,\r\n\ttype FloatingButtonData,\r\n\ttype FloatingButtonItem,\r\n\ttype GlobalRecipient,\r\n\ttype NewVersionParams,\r\n\tObjectCreationMode,\r\n\ttype ResponseTemplate,\r\n\ttype SelectedRow,\r\n\ttype SimpleDxRowDataStructure,\r\n\ttype VarioEmployee,\r\n\ttype VarioObjectType,\r\n\ttype VarioWorkflowStateDescription,\r\n} from \"../types/models/vario-types\";\r\nimport {\r\n\tAcceptParticipationFromCallendar,\r\n\tAddNewScheduler,\r\n\tCopyToClipboard,\r\n\tCreateShareCalendar,\r\n\tDeleteShareCalendars,\r\n\tRejectParticipationFromCallendar,\r\n} from \"./calendar\";\r\nimport { openChatForPosition } from \"./chat\";\r\nimport { toggleSubelementsSidePanel } from \"./data-grid-side-panel\";\r\nimport {\r\n\tUnselectAndUnfocusDxTable,\r\n\taddColumnAdditionalPropertiesPopup,\r\n\tcancelFloatingButtonRequests,\r\n\tgetSelectedRows,\r\n\tonEditRowClick,\r\n\tparseDxGridItems,\r\n\tprepareSubViewModel,\r\n} from \"./devextreme-table-functions\";\r\nimport { workflowDiagram, workflowDiagramProgressive, workflowReport } from \"./diagrams\";\r\nimport {\r\n\teditCopy,\r\n\teditCut,\r\n\teditPaste,\r\n\teditPasteAsCopy,\r\n\teditPasteAsLink,\r\n} from \"./edit-operations\";\r\nimport {\r\n\tAddFiles,\r\n\tChangeFileInputCount,\r\n\tEditSelectedItem,\r\n\tGetAllowedDefinitionsAjax,\r\n\tOpenFilesUploadMenu,\r\n\taddRequiredWorkflowFields,\r\n\thideFloatingButtonOnOpeningEditor,\r\n\tselectThisDefinitionInEditor,\r\n} from \"./editor\";\r\nimport { decree, replyToCorrespondence, showLinkOptions } from \"./emails\";\r\nimport {\r\n\tChooseWorkflowActionIcon,\r\n\tExecuteCustomOperation,\r\n\tGenerateNewVersion,\r\n\tOpenInSelectedControll,\r\n\tRefreshWorkflowMessageContainer,\r\n\tTryDeleteVarioObjects,\r\n\tTryExecuteVarioAction,\r\n\tTryUnlinkVarioObjects,\r\n\tcopyVarioObjectLink,\r\n\tcreatePanel,\r\n\tgetDocVersionHistory,\r\n\tgetOperationsHistory,\r\n\tgetSourceHistory,\r\n\tmarkAsRead,\r\n\tmarkAsUnread,\r\n\topenInNewTab,\r\n\topenListOfProgressStatuses,\r\n\topenListOfStatuses,\r\n\topenPermissionPopup,\r\n\tpublishPDF,\r\n\tworkflowHistory,\r\n\tworkflowMessage,\r\n} from \"./floating-actions\";\r\nimport { CreateVarioObjectFromDialog } from \"./initiate-workflow\";\r\nimport { GetItemProperties } from \"./item-properties\";\r\nimport { previewFile } from \"./item-sources\";\r\nimport { getAvailableLayouts } from \"./layouts\";\r\nimport { WriteNote } from \"./notes\";\r\nimport {\r\n\tGetBaseUrl,\r\n\tLoadCreateNewMenu,\r\n\tchangeCurrentItem,\r\n} from \"./page-navigation\";\r\nimport { PrintCorrespondence, TryPrintElem } from \"./print\";\r\nimport { isDirtyDoc } from \"./richedit\";\r\nimport { ChooseSignature } from \"./signature\";\r\nimport {\r\n\tCloseBigDialog,\r\n\tCloseDialogOperations,\r\n\tContainMinusID,\r\n\tHideLoadingPanel,\r\n\tShowLoadingPanel,\r\n\tShowPopupWarningUnsavedRichEditDoc,\r\n\taddOperation,\r\n\tcalcMinPopup,\r\n\tcheckWhereIsUser,\r\n\tclearDraggedFilesBuffer,\r\n\tdownloadFileFromLink,\r\n\tdownloadMultipleFiles,\r\n\tfixStringToPreventJSErrors,\r\n\tisRunningOnMobile,\r\n\tmousePosition,\r\n\tresetPopup,\r\n\tshowDxToast,\r\n\tstringIsNullOrEmpty,\r\n\tsupportedContent,\r\n\ttranslator,\r\n\twaitForElm,\r\n} from \"./site\";\r\nimport { evalValuePopup } from \"./trigger\";\r\nimport {\r\n\tTryDeleteVarioObject,\r\n\tgetWorkFlowButtonsForVarioObject,\r\n\tprepareVarioObjectModel,\r\n} from \"./vario-object\";\r\nimport { openConvertedPDFsInNewTab } from \"./vario-object-side-panel\";\r\n\r\nexport class WorkflowButton {\r\n\titemKey: string | string[];\r\n\tactionKey: string;\r\n\tdisplayName: string;\r\n\ttooltip: string;\r\n\trecipients: VarioEmployee[] | string | null;\r\n\tmessageTitle: string | null;\r\n\tmessageDescription: string | null;\r\n\tselRecipientsTitle: string | null;\r\n\tcloseOnSuccess: boolean | string;\r\n\titemName: string | string[];\r\n\tcounter: number;\r\n\tactionIcon: string;\r\n\tduration: number | string;\r\n\tignoreEmptyMessage: boolean;\r\n\tselectRecipientsAsComplex: boolean;\r\n\tisCustomButton: boolean;\r\n\tremoveFromList: boolean;\r\n\tconstructor(\r\n\t\titemKey: string | string[],\r\n\t\tactionKey: string,\r\n\t\tdisplayName: string,\r\n\t\ttooltip: string,\r\n\t\trecipients: VarioEmployee[] | string | null,\r\n\t\tmessageTitle: string | null,\r\n\t\tmessageDescription: string | null,\r\n\t\tselRecipientsTitle: string | null,\r\n\t\tcloseOnSuccess: boolean | string,\r\n\t\titemName: string | string[],\r\n\t\tcounter: number,\r\n\t\tactionIcon: string,\r\n\t\tduration: string | number,\r\n\t\tignoreEmptyMessage: boolean,\r\n\t\tselectRecipientsAsComplex: boolean,\r\n\t\tisCustomButton: boolean,\r\n\t\tremoveFromList: boolean\r\n\t) {\r\n\t\tthis.itemKey = itemKey;\r\n\t\tthis.actionKey = actionKey;\r\n\t\tthis.displayName = displayName;\r\n\t\tthis.tooltip = tooltip;\r\n\t\tthis.recipients = recipients;\r\n\t\tthis.messageTitle = messageTitle;\r\n\t\tthis.messageDescription = messageDescription;\r\n\t\tthis.selRecipientsTitle = selRecipientsTitle;\r\n\t\tthis.closeOnSuccess = closeOnSuccess;\r\n\t\tthis.itemName = itemName;\r\n\t\tthis.counter = counter;\r\n\t\tthis.actionIcon = actionIcon;\r\n\t\tthis.duration = duration;\r\n\t\tthis.ignoreEmptyMessage = ignoreEmptyMessage;\r\n\t\tthis.selectRecipientsAsComplex = selectRecipientsAsComplex;\r\n\t\tthis.isCustomButton = isCustomButton;\r\n\t\tthis.removeFromList = removeFromList;\r\n\t}\r\n}\r\n\r\ndeclare global {\r\n\tvar buttonsPanelMiddleResizer: ResizeObserver | null;\r\n\tvar workflowState: string;\r\n\tvar workflowStateForVarioObject: string;\r\n\tvar othersWorkflowState: string;\r\n\tvar canShowWorkflowMessageParam: boolean | string | null;\r\n\tvar workflowActionsButtons: WorkflowButton[] | null;\r\n\tvar workflowActionsButtonsForVarioObject: WorkflowButton[] | null;\r\n\tvar customActionsButtons: WorkflowButton[] | null;\r\n\r\n\t//globalne zmienne pobranej tre\u015Bci polecenia obiegu\r\n\tvar workflowActionId: string;\r\n\tvar workflowActionTitle: string;\r\n\tvar workflowActionDescription: string;\r\n\tvar workflowActionCaption: string;\r\n\tvar workflowActionCreatedBy: string;\r\n\tvar workflowActionCreationdDate: string;\r\n\r\n\t//globalne zmienne do odswie\u017Cania opcji obiegu i polece\u0144 obiegu\r\n\tvar lastSelectedRow: SelectedRow[];\r\n\r\n\tvar globalSelectedRecipients: GlobalRecipient[];\r\n\r\n\tvar checkBufor: boolean;\r\n\r\n\tvar floatingButtons: FloatingButtonItem[];\r\n}\r\n\r\nglobalThis.buttonsPanelMiddleResizer = null;\r\nglobalThis.workflowState = \"loading\";\r\nglobalThis.workflowStateForVarioObject = \"loading\";\r\nglobalThis.othersWorkflowState = \"loading\";\r\nglobalThis.canShowWorkflowMessageParam = null;\r\nglobalThis.workflowActionsButtons = null;\r\nglobalThis.workflowActionsButtonsForVarioObject = null;\r\nglobalThis.customActionsButtons = null;\r\n\r\n//globalne zmienne pobranej tre\u015Bci polecenia obiegu\r\nglobalThis.workflowActionId = \"\";\r\nglobalThis.workflowActionTitle = \"\";\r\nglobalThis.workflowActionDescription = \"\";\r\nglobalThis.workflowActionCaption = \"\";\r\nglobalThis.workflowActionCreatedBy = \"\";\r\nglobalThis.workflowActionCreationdDate = \"\";\r\n\r\n//globalne zmienne do odswie\u017Cania opcji obiegu i polece\u0144 obiegu\r\nglobalThis.lastSelectedRow = [];\r\n\r\nglobalThis.globalSelectedRecipients = [];\r\n\r\nglobalThis.checkBufor = false;\r\n\r\nglobalThis.floatingButtons = [];\r\n\r\n//Tworzenie floating buttona na start\r\nexport function createFloatingButton() {\r\n\t$(\"#mockupFAB\").remove();\r\n\t$(\"#bodyElement\").append(\r\n\t\t'
    '\r\n\t);\r\n\r\n\t$(\"#mockupFAB\").on(\"click\", function () {\r\n\t\tif ($(this).find(\"i\").hasClass(\"dx-icon-close\")) {\r\n\t\t\t$(this)\r\n\t\t\t\t.find(\"i\")\r\n\t\t\t\t.addClass(\"dx-icon-hierarchy\")\r\n\t\t\t\t.removeClass(\"dx-icon-close\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t$(this)\r\n\t\t\t.find(\"i\")\r\n\t\t\t.removeClass(\"dx-icon-hierarchy\")\r\n\t\t\t.addClass(\"dx-icon-close\");\r\n\r\n\t\tconst where = checkWhereIsUser();\r\n\r\n\t\tlet data: FloatingButtonData = {};\r\n\t\tswitch (where) {\r\n\t\t\tcase \"scheduler\":\r\n\t\t\t\tdata.canAdd = CanAdd() && lastClickedCell;\r\n\t\t\t\tdata.visibleShare = exist === \"True\";\r\n\t\t\t\tdata.id = lastAppointmentData?.Identity;\r\n\t\t\t\tdata.canAccept = lastAppointmentData?.CanAccept && !lastClickedCell;\r\n\t\t\t\tdata.canReject = lastAppointmentData?.CanReject && !lastClickedCell;\r\n\t\t\t\tdata.rejectWithInfo = lastAppointmentData?.RejectWithInfo;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"varioObject\":\r\n\t\t\t\tdata.canAdd =\r\n\t\t\t\t\tcardViewWithSubElements === \"True\" &&\r\n\t\t\t\t\t!ContainMinusID(data.key ?? modelId) &&\r\n\t\t\t\t\t$(\"#Tabela\").length > 0;\r\n\t\t\t\tdata = { ...data, ...prepareVarioObjectModel() };\r\n\t\t\t\tdata.ItemID = data.key;\r\n\t\t\t\tdata.HashID = data.hashKey;\r\n\t\t\t\tdata.Caption = data.title;\r\n\t\t\t\tdata.DefinitionKey = data.definitionKey;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"subElements\": {\r\n\t\t\t\tdata.canAdd =\r\n\t\t\t\t\tmodelSubElementsOnly === \"True\" && !modelId?.includes(\"COperations\");\r\n\t\t\t\tconst selectedRow =\r\n\t\t\t\t\tlastSelectedRow[0]?.containerId === modelId ? lastSelectedRow[0] : {};\r\n\t\t\t\tdata = { ...data, ...selectedRow };\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\topenContextMenu({\r\n\t\t\ttargetElement: this,\r\n\t\t\trow: {\r\n\t\t\t\tdata: data as SelectedRow,\r\n\t\t\t},\r\n\t\t});\r\n\t});\r\n}\r\n\r\n//Wy\u0142\u0105czenie wszystkich statycznych przycisk\u00F3w floating buttona\r\nexport function clearFloatingButton() {\r\n\t$(\"#mockupFAB\").remove();\r\n}\r\n\r\nexport async function openContextMenu(\r\n\te:\r\n\t\t| DevExpress.ui.dxDataGrid.ContextMenuPreparingEvent\r\n\t\t| SimpleDxRowDataStructure,\r\n\ttype?: \"varioObject\" | \"subView\" | \"subViewMultiSelect\" | \"scheduler\"\r\n) {\r\n\tglobalThis.floatingButtons = getButtonsContextMenu(e, type);\r\n\tif (!globalThis.floatingButtons?.length)\r\n\t\tglobalThis.floatingButtons = [{ order: 1, icon: \"\", text: \"Brak opcji\" }];\r\n\r\n\tcreateFloatingPopup();\r\n\r\n\tappendFloatingButtons(undefined, \"#phoneActionButtonPanel\");\r\n\r\n\tcancelFloatingButtonRequests();\r\n\r\n\t//workflowe guziki\r\n\t//timeout bo cancelrequest z floating buttona psuje czasami\r\n\tsetTimeout(async () => {\r\n\t\ttry {\r\n\t\t\tglobalThis.floatingButtons = await getAsyncButtonsContextMenu(\r\n\t\t\t\te,\r\n\t\t\t\tglobalThis.floatingButtons,\r\n\t\t\t\ttype\r\n\t\t\t);\r\n\t\t\tconst workflowBtns = globalThis.floatingButtons\r\n\t\t\t\t.find((x) => x.text === \"Wi\u0119cej\")\r\n\t\t\t\t?.items?.find((x) => x.text === \"Polecenia obiegu\")?.items;\r\n\t\t\tif (!globalThis.floatingButtons?.length)\r\n\t\t\t\tglobalThis.floatingButtons = [\r\n\t\t\t\t\t{ order: 1, icon: \"\", text: \"Brak opcji\" },\r\n\t\t\t\t];\r\n\r\n\t\t\t//jesli kliknelismy na inny row to nie pokazujemy znowu context menu bo sie pojawi w innym miejscu\r\n\t\t\tif (!workflowBtns || workflowBtns?.find((x) => x.text === \"Loading\"))\r\n\t\t\t\treturn;\r\n\t\t} catch (ex) {\r\n\t\t\tconsole.log(ex);\r\n\t\t}\r\n\t}, 5);\r\n}\r\n\r\n//funkcja tworzaca popup na floating buttony operacji\r\nexport function createFloatingPopup() {\r\n\tconst popup = $(\"#devex-dialog-operations\")\r\n\t\t.dxPopup({\r\n\t\t\twrapperAttr: {\r\n\t\t\t\tid: \"operationsPopup\",\r\n\t\t\t},\r\n\t\t\tmaxWidth: 240,\r\n\t\t\tmaxHeight: \"100%\",\r\n\t\t\tshowTitle: false,\r\n\t\t\tcontentTemplate: $(\"#MainDevDialog-Operations\"),\r\n\t\t\tonShowing: () => {\r\n\t\t\t\t$(\"#devex-dialog-operations\").data(\"actionsForButtons\", false);\r\n\t\t\t},\r\n\t\t\tonHiding: (e) => {\r\n\t\t\t\tconst forceHide = $(\"#devex-dialog-operations\").data(\"forceHide\");\r\n\r\n\t\t\t\tconst location = document.elementFromPoint(\r\n\t\t\t\t\tmousePosition.x,\r\n\t\t\t\t\tmousePosition.y\r\n\t\t\t\t) as HTMLElement;\r\n\t\t\t\tif (\r\n\t\t\t\t\t($(\"#mockupFAB\").has(location).length ||\r\n\t\t\t\t\t\t$(\"#mockupFAB\").is(location)) &&\r\n\t\t\t\t\t!forceHide\r\n\t\t\t\t) {\r\n\t\t\t\t\te.cancel = true;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$(\"#mockupFAB\")\r\n\t\t\t\t\t\t.find(\"i\")\r\n\t\t\t\t\t\t.addClass(\"dx-icon-hierarchy\")\r\n\t\t\t\t\t\t.removeClass(\"dx-icon-close\");\r\n\t\t\t\t\tcreateFloatingButton();\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$(\"#devex-dialog-operations\").data(\"forceHide\", \"\");\r\n\t\t\t},\r\n\t\t})\r\n\t\t.dxPopup(\"instance\") as any;\r\n\r\n\tpopup.show();\r\n\r\n\t$(\"#Dialog-Operations\").empty();\r\n\t$(\r\n\t\t\"#Dialog-Operations\"\r\n\t).append(`
    \r\n
    \r\n
    \r\n
    `);\r\n\r\n\tif (!popup._$content[0].className.includes(\"operationsPopup\")) {\r\n\t\tpopup._$content[0].className += \" operationsPopup\";\r\n\t}\r\n}\r\n\r\nexport function getButtonsContextMenu(\r\n\te:\r\n\t\t| DevExpress.ui.dxDataGrid.ContextMenuPreparingEvent\r\n\t\t| SimpleDxRowDataStructure,\r\n\ttype?: \"varioObject\" | \"subView\" | \"subViewMultiSelect\" | \"scheduler\"\r\n): FloatingButtonItem[] {\r\n\t(e as any).items = [];\r\n\tif (!e.row || !(\"data\" in e.row)) return [];\r\n\r\n\tlet itemId: string | string[] = e.row.data.ItemID;\r\n\tlet caption = e.row.data.Caption;\r\n\tlet canAdd = \"canAdd\" in e.row.data;\r\n\r\n\tif (\r\n\t\t(!caption || !itemId || caption.includes(\"Brak uprawnie\u0144 do odczytu\")) &&\r\n\t\t!canAdd\r\n\t)\r\n\t\treturn [];\r\n\r\n\tcanAdd = e.row.data.canAdd;\r\n\r\n\tconst isReport = e.row.data.FileExtension?.toLowerCase() === \".repx\";\r\n\r\n\tlet customItems: FloatingButtonItem[] = [];\r\n\r\n\tlet data: SelectedRow | null = e.row.data;\r\n\tlet model: FloatingButtonData | null = data;\r\n\tconst multiselect = (globalItemsSelectedByUser?.length ?? 0) > 1;\r\n\tif (!type)\r\n\t\ttype =\r\n\t\t\tcheckWhereIsUser() === \"subElements\"\r\n\t\t\t\t? \"subView\"\r\n\t\t\t\t: checkWhereIsUser() === \"varioObject\"\r\n\t\t\t\t\t? \"varioObject\"\r\n\t\t\t\t\t: \"scheduler\";\r\n\r\n\tif (multiselect) {\r\n\t\ttype = \"subViewMultiSelect\";\r\n\t\titemId = globalItemsSelectedByUser ?? [];\r\n\t\tcaption = \"\";\r\n\t\tdata = null;\r\n\t\tmodel = null;\r\n\t} else if (type === \"subView\") {\r\n\t\tmodel = prepareSubViewModel(data, LayoutControlWeb.Loading);\r\n\r\n\t\tif (data.ItemID)\r\n\t\t\tcustomItems.unshift({\r\n\t\t\t\torder: 0,\r\n\t\t\t\ttext: \"Dodaj do wybranej pozycji\",\r\n\t\t\t\ticon: \"fas fa-folder-plus\",\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tnewDocument({ forWhat: \"forSelectedItem\" });\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\t} else if (type === \"scheduler\") {\r\n\t\tcustomItems = getCalendarOperations(data);\r\n\t}\r\n\r\n\tif (canAdd) {\r\n\t\tcustomItems.unshift({\r\n\t\t\torder: 1,\r\n\t\t\ttext: \"Dodaj\",\r\n\t\t\ticon: \"fas fa-plus\",\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tif (typeof clearDraggedFilesBuffer === \"function\") {\r\n\t\t\t\t\t\tclearDraggedFilesBuffer();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (type === \"scheduler\") AddNewScheduler();\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tnewDocument({\r\n\t\t\t\t\t\t\tforWhat:\r\n\t\t\t\t\t\t\t\tcheckWhereIsUser() === \"varioObject\"\r\n\t\t\t\t\t\t\t\t\t? \"forSelectedItem\"\r\n\t\t\t\t\t\t\t\t\t: \"forGrid\",\r\n\t\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\tif (type === \"scheduler\") return orderFloatingButtons(customItems);\r\n\r\n\tconst operationsBtns = getOperations(model, type);\r\n\tconst moreOperationsBtns = getMoreOperations(model, type);\r\n\tconst openAsBtns = getOpenAsButtons(model);\r\n\tconst editOperationBtns = getEditOperations(\r\n\t\titemId,\r\n\t\tcontainerId,\r\n\t\tcaption,\r\n\t\tdata?.DefinitionKey ?? \"\",\r\n\t\ttype === \"subViewMultiSelect\" ? \"\" : e.row.data.HashID,\r\n\t\ttype === \"varioObject\",\r\n\t\tisReport\r\n\t);\r\n\r\n\tconst openAsItems = moreOperationsBtns.find(\r\n\t\t(x) => x.text === \"Otw\u00F3rz plik jako...\"\r\n\t);\r\n\tif (openAsItems) openAsItems.items = openAsBtns;\r\n\r\n\tconst moreBtns = customItems.find(\r\n\t\t(x) => x.text === \"Poka\u017C wi\u0119cej opcji...\"\r\n\t)?.items;\r\n\tif (type !== \"varioObject\") {\r\n\t\tconst loadingPossibleControls = `
    \r\n
    \r\n
    .
    \r\n
    .
    \r\n
    .
    \r\n
    \r\n
    `;\r\n\t\tmoreBtns?.push({\r\n\t\t\torder: 1,\r\n\t\t\ttext: \"Loading\",\r\n\t\t\tcustomHTML: loadingPossibleControls,\r\n\t\t\ticon: \"\",\r\n\t\t});\r\n\t}\r\n\r\n\tcustomItems = [\r\n\t\t...customItems,\r\n\t\t...operationsBtns,\r\n\t\t...moreOperationsBtns,\r\n\t\t...editOperationBtns,\r\n\t\t{\r\n\t\t\torder: 2,\r\n\t\t\ttext: \"Poka\u017C wi\u0119cej opcji...\",\r\n\t\t\ticon: \"fas fa-ellipsis-h\",\r\n\t\t\titems: [],\r\n\t\t},\r\n\t\t{\r\n\t\t\torder: 2,\r\n\t\t\ttext: \"Edycja\",\r\n\t\t\ticon: \"fas fa-chevron-circle-left\",\r\n\t\t\titems: [],\r\n\t\t},\r\n\t\t{\r\n\t\t\torder: 3,\r\n\t\t\ttext: \"Operacje\",\r\n\t\t\ticon: \"fas fa-chevron-circle-left\",\r\n\t\t\titems: [],\r\n\t\t},\r\n\t];\r\n\r\n\tif (workflowIsAvailable) {\r\n\t\tcustomItems?.push({\r\n\t\t\torder: 4,\r\n\t\t\ttext: \"Polecenia obiegu\",\r\n\t\t\ticon: \"fas fa-chevron-circle-left\",\r\n\t\t\titems: [\r\n\t\t\t\t{\r\n\t\t\t\t\torder: 1,\r\n\t\t\t\t\ttext: \"Loading\",\r\n\t\t\t\t\tcustomHTML: `
    \r\n\t\t\t\t\t\t\t
    \r\n\t\t\t\t\t\t\t\t
    .
    \r\n\t\t\t\t\t\t\t\t
    .
    \r\n\t\t\t\t\t\t\t\t
    .
    \r\n\t\t\t\t\t\t\t
    \r\n\t\t\t\t\t\t
    `,\r\n\t\t\t\t\ticon: \"\",\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t}\r\n\r\n\tcustomItems = orderFloatingButtons(customItems);\r\n\r\n\t//guziki dla zaznaczonej pozycji w zawartosci\r\n\tif (\r\n\t\ttype === \"varioObject\" &&\r\n\t\tcheckWhereIsUser(true) === \"varioObjectWithSubElements\" &&\r\n\t\t$(\"#Tabela\").length > 0 &&\r\n\t\tgetSelectedRows().length\r\n\t) {\r\n\t\tconst selectedType =\r\n\t\t\tlastSelectedRow.length > 1 ? \"subViewMultiSelect\" : \"subView\";\r\n\t\tconst selectedData: SimpleDxRowDataStructure = {\r\n\t\t\trow: {\r\n\t\t\t\tdata: lastSelectedRow[0],\r\n\t\t\t},\r\n\t\t};\r\n\t\tlet selectedCustomItems = getButtonsContextMenu(selectedData, selectedType);\r\n\r\n\t\tconst textForInner =\r\n\t\t\tlastSelectedRow.length > 1\r\n\t\t\t\t? `Dla: ${caption.length} pozycji zawarto\u015Bci`\r\n\t\t\t\t: `Dla: ${lastSelectedRow[0].Caption.length > 30 ? lastSelectedRow[0].Caption.substring(0, 30).trim()+'...' : lastSelectedRow[0].Caption}`;\r\n\r\n\t\tcustomItems.splice(customItems.length - 1, 0, {\r\n\t\t\torder: 6,\r\n\t\t\ttext: textForInner,\r\n\t\t\ticon: \"fas fa-chevron-circle-left\",\r\n\t\t\titems: selectedCustomItems,\r\n\t\t});\r\n\r\n\t\t//workflowe guziki\r\n\t\t//timeout bo cancelrequest z floating buttona psuje czasami\r\n\t\tsetTimeout(async () => {\r\n\t\t\tselectedCustomItems = await getAsyncButtonsContextMenu(\r\n\t\t\t\tselectedData,\r\n\t\t\t\tselectedCustomItems,\r\n\t\t\t\tselectedType\r\n\t\t\t);\r\n\r\n\t\t\tconst innerBtns = customItems.find((x) => x.text === textForInner);\r\n\r\n\t\t\tif (innerBtns) innerBtns.items = selectedCustomItems;\r\n\t\t}, 10);\r\n\t}\r\n\r\n\treturn customItems;\r\n}\r\n\r\nexport async function getAsyncButtonsContextMenu(\r\n\te:\r\n\t\t| DevExpress.ui.dxDataGrid.ContextMenuPreparingEvent\r\n\t\t| SimpleDxRowDataStructure,\r\n\tcustomItems: FloatingButtonItem[],\r\n\ttype?: string\r\n) {\r\n\tif (checkWhereIsUser() === \"scheduler\") return customItems;\r\n\tconst itemId = e.row?.data.ItemID;\r\n\tconst caption = e.row?.data.Caption;\r\n\tconst operationBtns = customItems\r\n\t\t.find((x) => x.text === \"Poka\u017C wi\u0119cej opcji...\")\r\n\t\t?.items?.find((x) => x.text === \"Operacje\");\r\n\tconst workflowBtns = customItems\r\n\t\t.find((x) => x.text === \"Poka\u017C wi\u0119cej opcji...\")\r\n\t\t?.items?.find((x) => x.text === \"Polecenia obiegu\");\r\n\tif (!type) {\r\n\t\ttype = \"subView\";\r\n\t\tif (checkWhereIsUser() === \"varioObject\") type = \"varioObject\";\r\n\t}\r\n\r\n\tfunction hideLoading(array?: any[]) {\r\n\t\t//usuniecie ladowania (referencyjne)\r\n\t\tarray?.splice(\r\n\t\t\t0,\r\n\t\t\tarray.length,\r\n\t\t\t...array.filter((x) => x.text !== \"Loading\")\r\n\t\t);\r\n\t}\r\n\r\n\tlet workflowActionBtns =\r\n\t\ttype === \"varioObject\"\r\n\t\t\t? workflowActionsButtonsForVarioObject\r\n\t\t\t: workflowActionsButtons;\r\n\r\n\tif (workflowActionBtns == null) {\r\n\t\tawait getWorkflowButtons(\r\n\t\t\titemId,\r\n\t\t\tgetContainer(containerId, containerKey),\r\n\t\t\tcaption,\r\n\t\t\tundefined,\r\n\t\t\ttype\r\n\t\t);\r\n\t\thideLoading(workflowBtns?.items);\r\n\t\tworkflowActionBtns =\r\n\t\t\ttype === \"varioObject\"\r\n\t\t\t\t? workflowActionsButtonsForVarioObject\r\n\t\t\t\t: workflowActionsButtons;\r\n\t} else {\r\n\t\t//usuniecie ladowania\r\n\t\thideLoading(workflowBtns?.items);\r\n\t}\r\n\r\n\tif (workflowActionBtns?.filter((x) => !x.isCustomButton)?.length) {\r\n\t\tfor (const element of workflowActionBtns.filter((x) => !x.isCustomButton)) {\r\n\t\t\tworkflowBtns?.items?.push({\r\n\t\t\t\torder: element.counter,\r\n\t\t\t\ttext: element.displayName,\r\n\t\t\t\ticon: element.actionIcon,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tTryExecuteVarioAction(element);\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\tif (type !== \"varioObject\") {\r\n\t\tlet controlBtns: FloatingButtonItem[] = [];\r\n\t\tif (!getPossibleControlsToUseRequest?.readyState)\r\n\t\t\tgetPossibleControlsToUse();\r\n\r\n\t\tawait getPossibleControlsToUseRequest\r\n\t\t\t?.then((res) => {\r\n\t\t\t\tsendPossibleControlsToUse(e.row?.data, res);\r\n\t\t\t\tcontrolBtns = sendPossibleControlsToUseButtons(e.row?.data, res);\r\n\t\t\t\t//usuniecie ladowania\r\n\t\t\t\thideLoading(operationBtns?.items);\r\n\r\n\t\t\t\tfor (const btn of controlBtns) {\r\n\t\t\t\t\toperationBtns?.items?.push(btn);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (!operationBtns?.items?.length)\r\n\t\t\t\t\toperationBtns?.items?.push({\r\n\t\t\t\t\t\ticon: \"\",\r\n\t\t\t\t\t\ttext: \"\",\r\n\t\t\t\t\t\torder: 1,\r\n\t\t\t\t\t\tcustomHTML: `

    Brak dost\u0119pnych opcji

    `,\r\n\t\t\t\t\t});\r\n\t\t\t})\r\n\t\t\t.catch(() => {\r\n\t\t\t\t//usuniecie ladowania\r\n\t\t\t\thideLoading(operationBtns?.items);\r\n\r\n\t\t\t\tif (!operationBtns?.items?.length)\r\n\t\t\t\t\toperationBtns?.items?.push({\r\n\t\t\t\t\t\ticon: \"\",\r\n\t\t\t\t\t\ttext: \"\",\r\n\t\t\t\t\t\torder: 1,\r\n\t\t\t\t\t\tcustomHTML: `

    Brak dost\u0119pnych opcji

    `,\r\n\t\t\t\t\t});\r\n\t\t\t});\r\n\t}\r\n\r\n\t//customowe guziki\r\n\tconst whereToAdd = operationBtns;\r\n\tif (customActionsButtons)\r\n\t\tfor (const element of customActionsButtons) {\r\n\t\t\twhereToAdd?.items?.push({\r\n\t\t\t\torder: element.counter,\r\n\t\t\t\ttext: element.displayName,\r\n\t\t\t\ticon: element.actionIcon,\r\n\t\t\t\tisCustomButton: true,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tTryExecuteVarioAction(element);\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\t\t}\r\n\r\n\tconst otherWorkflowOperations = getOtherWorkflowOperations(\r\n\t\titemId,\r\n\t\t\"True\",\r\n\t\tcanShowWorkflowMessageParam ?? \"\",\r\n\t\tothersWorkflowState\r\n\t);\r\n\r\n\tif (otherWorkflowOperations?.length > 0 && workflowBtns?.items) {\r\n\t\tworkflowBtns.items = [...workflowBtns.items, ...otherWorkflowOperations];\r\n\t}\r\n\r\n\tif (workflowBtns?.items && workflowBtns?.items?.length === 0) {\r\n\t\tworkflowBtns.items = [\r\n\t\t\t{\r\n\t\t\t\ticon: \"\",\r\n\t\t\t\ttext: \"\",\r\n\t\t\t\torder: 1,\r\n\t\t\t\tcustomHTML: `

    Brak dost\u0119pnych opcji

    `,\r\n\t\t\t},\r\n\t\t];\r\n\t}\r\n\r\n\treturn customItems;\r\n}\r\n\r\nfunction orderFloatingButtons(buttons: FloatingButtonItem[]) {\r\n\tif (!buttons) return [];\r\n\r\n\tconst parsed: Record = [...buttons].reduce(\r\n\t\t(map, button) => {\r\n\t\t\tmap[button.text] = button;\r\n\t\t\treturn map;\r\n\t\t},\r\n\t\t{}\r\n\t);\r\n\r\n\tconst ordered: FloatingButtonItem[] = [\r\n\t\tparsed.Dodaj,\r\n\t\tparsed[\"Dodaj do wybranej pozycji\"],\r\n\t\tparsed[\"Otw\u00F3rz w nowej karcie\"],\r\n\t\tparsed[\"Akceptuj uczestnictwo\"],\r\n\t\tparsed[\"Skopiuj link do terminarza\"],\r\n\t\tparsed[\"Udost\u0119pnij terminarz\"],\r\n\t\tparsed[\"Zako\u0144cz udost\u0119pnianie terminarza\"],\r\n\t\tparsed[\"Drukuj korespondencj\u0119\"],\r\n\t\tparsed[\"Przeka\u017C dalej\"],\r\n\t\tparsed.Odpowiedz,\r\n\t\tparsed[\"Odpowiedz wszystkim\"],\r\n\t\tparsed.Dekretuj,\r\n\t\tparsed[\"Oznacz jako przeczytane\"],\r\n\t\tparsed[\"Oznacz jako nieprzeczytane\"],\r\n\t\tparsed[\"Zmie\u0144 status realizacji\"],\r\n\t\tparsed[\"Otw\u00F3rz plik\"],\r\n\t\tparsed[\"Otw\u00F3rz plik jako...\"],\r\n\t\tparsed[\"Zast\u0105p plik\"],\r\n\t\tparsed[\"Wgraj plik\"],\r\n\t\tparsed[\"Podpisz/Parafuj\"],\r\n\t\tparsed[\"Publikuj do pdf\"],\r\n\t\tparsed[\"Wersje dokumentu\"],\r\n\t\t{\r\n\t\t\t...parsed[\"Poka\u017C wi\u0119cej opcji...\"],\r\n\t\t\titems: [\r\n\t\t\t\tparsed.Kopiuj,\r\n\t\t\t\tparsed.Wklej,\r\n\t\t\t\tparsed[\"Kopiuj link\"],\r\n\t\t\t\tparsed[\"Dodaj notatk\u0119\"],\r\n\t\t\t\tparsed.Drukuj,\r\n\t\t\t\tparsed.Widoki,\r\n\t\t\t\tparsed[\"Otw\u00F3rz czat pozycji\"],\r\n\t\t\t\tparsed.Uprawnienia,\r\n\t\t\t\t{\r\n\t\t\t\t\t...parsed.Edycja,\r\n\t\t\t\t\titems: [\r\n\t\t\t\t\t\tparsed.Wytnij,\r\n\t\t\t\t\t\tparsed[\"Wklej kopi\u0119\"],\r\n\t\t\t\t\t\tparsed.Edytuj,\r\n\t\t\t\t\t\tparsed.Wypnij,\r\n\t\t\t\t\t\tparsed.Usu\u0144,\r\n\t\t\t\t\t].filter((x) => x != null),\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t...parsed.Operacje,\r\n\t\t\t\t\titems: [\r\n\t\t\t\t\t\t...Object.values(parsed).filter((x) => x.isCustomButton),\r\n\t\t\t\t\t\tparsed[\"Sprawd\u017A wyra\u017Cenie wyliczane\"],\r\n\t\t\t\t\t\tparsed[\"Utw\u00F3rz panel\"],\r\n\t\t\t\t\t\tparsed[\"Zmie\u0144 status\"],\r\n\t\t\t\t\t\tparsed[\"Dodaj kolumn\u0119\"],\r\n\t\t\t\t\t\tparsed[\"Projektuj raport\"],\r\n\t\t\t\t\t\tparsed.Udost\u0119pnij,\r\n\t\t\t\t\t\tparsed[\"Historia zmian pliku\"],\r\n\t\t\t\t\t\tparsed[\"Historia operacji\"],\r\n\t\t\t\t\t\tparsed.W\u0142a\u015Bciwo\u015Bci,\r\n\t\t\t\t\t].filter((x) => x != null),\r\n\t\t\t\t},\r\n\t\t\t\tparsed[\"Polecenia obiegu\"],\r\n\t\t\t].filter((x) => x != null),\r\n\t\t},\r\n\t].filter((x) => x != null);\r\n\r\n\treturn ordered;\r\n}\r\n\r\nexport function floatingButtonForNoSelection() {\r\n\t//return if position is getting changed so it doesnt cancel the request\r\n\tif (\r\n\t\tcurrentItemChangePromise?.state() === \"pending\" ||\r\n\t\tsubElementsRequest?.state() === \"pending\"\r\n\t)\r\n\t\treturn;\r\n\r\n\t//Wylaczenie dynamicznie stworzonych akcji workflow po odklikaniu\r\n\tcancelFloatingButtonRequests();\r\n\r\n\tcreateFloatingButton();\r\n\r\n\ttoggleSubelementsSidePanel(null);\r\n\r\n\tif (modelSubElementsOnly === \"False\") {\r\n\t\t//wracanie do widoku karty\r\n\r\n\t\tfloatingButtonBackToViewCardWithSubElements();\r\n\t\treturn;\r\n\t}\r\n\r\n\tclearDynamicWorkflowActionsForFloatingButton();\r\n\r\n\tif (modelSubElementsOnly !== \"True\") {\r\n\t\tfloatingButtonBackToViewCardWithSubElements();\r\n\t}\r\n}\r\n\r\nexport function floatingButtonForOneSelection() {\r\n\t//return if position is getting changed so it doesnt cancel the request\r\n\tif (\r\n\t\tcurrentItemChangePromise?.state() === \"pending\" ||\r\n\t\tsubElementsRequest?.state() === \"pending\"\r\n\t)\r\n\t\treturn;\r\n\r\n\tcancelFloatingButtonRequests();\r\n\r\n\tif (!lastSelectedRow?.length) {\r\n\t\tconsole.error(\"No lastSelectedRow found.\");\r\n\t\treturn;\r\n\t}\r\n\r\n\tcreateFloatingButton();\r\n\r\n\ttoggleSubelementsSidePanel(lastSelectedRow[0]);\r\n\r\n\tothersWorkflowState = \"loading\";\r\n\tcanShowWorkflowMessageParam = false;\r\n\tclearDynamicWorkflowActionsForFloatingButton();\r\n\tglobalThis.allowedDefinitionsGlobal4SelectedItem = null;\r\n\r\n\tGetAllowedDefinitionsAjax(\"forSelectedItem\");\r\n\tgetPossibleControlsToUse();\r\n\r\n\tgetWorkflowButtons(\r\n\t\tlastSelectedRow[0]?.ItemID,\r\n\t\tgetContainer(containerId, containerKey),\r\n\t\tlastSelectedRow[0]?.Caption\r\n\t);\r\n}\r\n\r\nexport function floatingButtonForMultiSelect(selectedItems: SelectedRow[]) {\r\n\t//return if position is getting changed so it doesnt cancel the request\r\n\tif (\r\n\t\tcurrentItemChangePromise?.state() === \"pending\" ||\r\n\t\tsubElementsRequest?.state() === \"pending\"\r\n\t)\r\n\t\treturn;\r\n\r\n\t//Obsluga floating buttona dla kilku zaznacze\u0144\r\n\tcancelFloatingButtonRequests();\r\n\r\n\tcreateFloatingButton();\r\n\r\n\ttoggleSubelementsSidePanel(selectedItems);\r\n\r\n\tclearDynamicWorkflowActionsForFloatingButton();\r\n\tconst ids = selectedItems.map((x) => x.ItemID);\r\n\r\n\tconst captions = selectedItems.map((x) => x.Caption);\r\n\tgetWorkflowButtons(ids, getContainer(containerId, containerKey), captions);\r\n}\r\n\r\n//Przywrocenie floating button do defaultu w widoku karta + tabela subelementy\r\nexport function floatingButtonBackToViewCardWithSubElements() {\r\n\tgetWorkFlowButtonsForVarioObject(true);\r\n}\r\n\r\n//--------------------------------------guziki g\u0142\u00F3wne-----------------------------------------------\r\n\r\n//dodawanie\r\nexport function selectDocumentDefinitions(forWhat: AddForWhat) {\r\n\tlet selectedDefinitions: VarioObjectType[] | null = [];\r\n\r\n\tswitch (forWhat) {\r\n\t\tcase \"forWorkflow\":\r\n\t\t\tselectedDefinitions = allowedDefinitionsGlobalWorkflow;\r\n\t\t\tbreak;\r\n\t\tcase \"forSelectedItem\":\r\n\t\t\tselectedDefinitions = allowedDefinitionsGlobal4SelectedItem;\r\n\t\t\tbreak;\r\n\t\tcase \"forGrid\":\r\n\t\tcase \"forScheduler\":\r\n\t\tcase \"forNewVersion\":\r\n\t\t\tselectedDefinitions = allowedDefinitionsGlobal;\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\treturn selectedDefinitions;\r\n}\r\n\r\nexport async function getDocumentDefinitions(forWhat: AddForWhat = \"forGrid\") {\r\n\tconst forWorkflow = forWhat === \"forWorkflow\";\r\n\r\n\tif (forWorkflow) await LoadCreateNewMenu();\r\n\telse await GetAllowedDefinitionsAjax(forWhat);\r\n\r\n\treturn selectDocumentDefinitions(forWhat);\r\n}\r\n\r\nexport async function newDocument(\r\n\tdocParams: DocParams = { forWhat: \"forGrid\" }\r\n) {\r\n\tif (isDirtyDoc()) {\r\n\t\tconst res = await ShowPopupWarningUnsavedRichEditDoc().catch(() => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\tdocParams.forWorkflow = docParams.forWhat === \"forWorkflow\";\r\n\r\n\tif (downloadingDefinitionsAjax?.state() === \"pending\")\r\n\t\tawait downloadingDefinitionsAjax;\r\n\tdocParams.allowedDefinitions = selectDocumentDefinitions(docParams.forWhat);\r\n\tif (!docParams.allowedDefinitions)\r\n\t\tdocParams.allowedDefinitions = await getDocumentDefinitions(\r\n\t\t\tdocParams.forWhat\r\n\t\t);\r\n\r\n\tif (docParams.definition && docParams.forWhat === \"forNewVersion\") {\r\n\t\t//jesli tworzymy nowa wersje to tylko jest jedna definicja dokumentu\r\n\t\tdocParams.allowedDefinitions = [docParams.definition as VarioObjectType];\r\n\t}\r\n\r\n\tsubElementsModel[modelSubElementsOnly].globalBuforSelectedDefinitionId = \"\";\r\n\tglobalSelectedDefinitionIdWorkflow = \"\";\r\n\tsubElementsModel[modelSubElementsOnly].globalOperationName = \"Post\";\r\n\r\n\tconst filesInput = document.getElementById(\"files\") as HTMLInputElement;\r\n\tconst PositionEditor = document.getElementById(\r\n\t\t\"PositionEditor\"\r\n\t) as HTMLFormElement;\r\n\tif (filesInput) filesInput.value = \"\";\r\n\tif (PositionEditor) {\r\n\t\tPositionEditor.action = \"/Vario/PostNewObject\";\r\n\t}\r\n\r\n\tHideLoadingPanel();\r\n\r\n\tif (CanAdd(docParams) === false) {\r\n\t\tshowDxToast(\"Brak mo\u017Cliwo\u015Bci dodania pozycji\", \"warning\");\r\n\t\treturn;\r\n\t}\r\n\tif (AddFiles(Array.from((draggedFilesBuffer as FileList) ?? []), () => {}))\r\n\t\tcreateNewDocumentPopup(docParams);\r\n\r\n\tappendAddButtonsFunctions(docParams);\r\n}\r\n\r\nexport function CanAdd(docParams: DocParams = { forWhat: \"forGrid\" }) {\r\n\tif (!docParams.allowedDefinitions) {\r\n\t\tdocParams.allowedDefinitions = selectDocumentDefinitions(docParams.forWhat);\r\n\t}\r\n\tif (\r\n\t\tArray.isArray(docParams.allowedDefinitions) &&\r\n\t\tdocParams.allowedDefinitions?.length > 0\r\n\t)\r\n\t\treturn true;\r\n\r\n\treturn false;\r\n}\r\n\r\nexport function createNewDocumentPopup(docParams: DocParams) {\r\n\t//funkcja tworzaca okienko dodawania nowej pozycji\r\n\tconst popup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\tresetPopup(\"devex-big-dialog\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(500));\r\n\tpopup.option(\"minHeight\", calcMinPopup(150, true));\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\tpopup?.option(\r\n\t\t\"title\",\r\n\t\tdocParams.forWhat === \"forWorkflow\"\r\n\t\t\t? \"Inicjuj obieg dla elementu typu:\"\r\n\t\t\t: docParams.forWhat === \"forNewVersion\"\r\n\t\t\t\t? \"Stw\u00F3rz wersj\u0119 z:\"\r\n\t\t\t\t: \"Dodaj pozycj\u0119\"\r\n\t);\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\t$(\"#BigDialog, #DialogFooter\").empty();\r\n\r\n\t$(\"#BigDialog\").append(`\r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n\t\t\t\t\r\n
    \r\n
    \r\n `);\r\n\r\n\tif (\r\n\t\t!isRunningOnMobile() &&\r\n\t\t!docParams.fromDrop &&\r\n\t\tdocParams.forWhat !== \"forNewVersion\"\r\n\t) {\r\n\t\t$(\"#BigDialog\").append(`\r\n\t\t\t
    \r\n\t\t\t\t
    \r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t
    \r\n\t\t\t
    `);\r\n\r\n\t\t$(\"#useNewCardEditor\").on(\"change\", function () {\r\n\t\t\tconst isChecked = $(this).is(\":checked\");\r\n\t\t\tdocParams.dontRestoreCardEditor = isChecked;\r\n\t\t});\r\n\t}\r\n\r\n\t$(\"#selectElementType\").attr(\r\n\t\t\"data-forWorkflow\",\r\n\t\tdocParams.forWorkflow?.toString() ?? \"false\"\r\n\t);\r\n\t$(\"#selectElementType\").attr(\"data-forWhat\", docParams.forWhat);\r\n\t$(\"#selectElementType\").attr(\r\n\t\t\"data-fromDrop\",\r\n\t\tdocParams.fromDrop?.toString() ?? \"false\"\r\n\t);\r\n\r\n\t$(\"#selectElementType\").on(\"change\", () => {\r\n\t\taddTemplates();\r\n\t\tif (!docParams.dontRestoreCardEditor)\r\n\t\t\trestoreNewCardEditorCheckState(docParams);\r\n\t});\r\n\r\n\t$(\"#DialogFooter\").append(`\r\n
    \r\n \r\n\r\n OK\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n Wybierz plik\r\n \r\n
    \r\n
    `);\r\n\r\n\taddDefinitions(docParams);\r\n\taddTemplates();\r\n\trestoreNewCardEditorCheckState(docParams);\r\n}\r\n\r\nexport function appendAddButtonsFunctions(docParams: DocParams) {\r\n\t//usuniecie guzikow dla tworzenia nowej wersji\r\n\tif (docParams.forWhat === \"forNewVersion\") {\r\n\t\t$(\"#selectElementType\").attr(\"disabled\", \"disabled\");\r\n\r\n\t\t//TODO obsluga plikow przy tworzeniu nowej wersji\r\n\t\t$(\".AddDocumentsButtonMenu #addFilesButton\").remove();\r\n\t} else if (docParams.forWhat === \"forSelectedItem\") {\r\n\t\t$(\".AddDocumentsButtonMenu #okButton\").attr(\r\n\t\t\t\"data-forComponentID\",\r\n\t\t\tlastSelectedRow[0]?.ItemID\r\n\t\t);\r\n\t\t$(\".AddDocumentsButtonMenu #okButton\").attr(\r\n\t\t\t\"data-forcontainerId\",\r\n\t\t\tlastSelectedRow[0]?.ItemID\r\n\t\t);\r\n\t} else {\r\n\t\t$(\".AddDocumentsButtonMenu #okButton\").attr(\r\n\t\t\t\"data-forcontainerId\",\r\n\t\t\tcontainerId\r\n\t\t);\r\n\t}\r\n\r\n\t$(\".AddDocumentsButtonMenu #okButton\").on(\"click\", () => {\r\n\t\tsetNewCardEditorCheckState();\r\n\t\tconst currentDefinition = $(\"#selectElementType\").val();\r\n\t\tconst currentDefinitionText = $(\"#selectElementType :selected\").text();\r\n\r\n\t\tconst isBasedOnCorrespondence = docParams?.allowedDefinitions?.find(\r\n\t\t\t(item) =>\r\n\t\t\t\tcurrentDefinition === item.key &&\r\n\t\t\t\titem.displayName === currentDefinitionText\r\n\t\t)?.isBasedOnCorrespondence;\r\n\t\tconst isComponent = allowedDefinitionsGlobal4SelectedItem?.find(\r\n\t\t\t(item) =>\r\n\t\t\t\tcurrentDefinition === item.key &&\r\n\t\t\t\titem.displayName === currentDefinitionText\r\n\t\t)?.forComponent;\r\n\r\n\t\t//wzorzec nie moze miec pliku\r\n\t\tconst useTemplate = globalUseTemplate || globalUseTemplateGlobalWorkflow;\r\n\t\tif (useTemplate) {\r\n\t\t\tif (docParams.forWhat === \"forWorkflow\")\r\n\t\t\t\t(document.getElementById(\"filesWorkflow\") as HTMLInputElement).value =\r\n\t\t\t\t\t\"\";\r\n\t\t\telse (document.getElementById(\"files\") as HTMLInputElement).value = \"\";\r\n\t\t\tclearDraggedFilesBuffer();\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tdocParams.forWhat === \"forWorkflow\" ||\r\n\t\t\tisBasedOnCorrespondence ||\r\n\t\t\tisRunningOnMobile() ||\r\n\t\t\tgetPreferredEditor(currentDefinition?.toString() ?? \"\") === \"card\"\r\n\t\t) {\r\n\t\t\t//pobieranie id pozycji do ktorej dodajemy\r\n\t\t\tconst itemId =\r\n\t\t\t\tcheckWhereIsUser() === \"varioObject\"\r\n\t\t\t\t\t? modelId\r\n\t\t\t\t\t: lastSelectedRow[0]?.ItemID;\r\n\r\n\t\t\t//pobieranie id kontenera pozycji do ktorej dodajemy\r\n\t\t\tlet container = \"\";\r\n\t\t\tif (docParams.forWhat === \"forSelectedItem\") {\r\n\t\t\t\t//asComponent - to ma byc skladnik, skladnik nie powinien miec przekazywanego containerId\r\n\t\t\t\t//za to pozycja zawartosci ma miec containerId\r\n\t\t\t\t//edit: trzeba przekazac bo sesja przegladania sie psuje, obsluzone pominiencie container w updatevarioobject w varioitemproxy\r\n\t\t\t\tcontainer = itemId;\r\n\t\t\t} else if (docParams.forWhat !== \"forWorkflow\") {\r\n\t\t\t\t//jesli workflow to chodzi o guzik 'tworzenie nowej pozycji w ramachu obiegu pracy' ktory nie ma kontenera\r\n\t\t\t\tcontainer = containerId;\r\n\t\t\t}\r\n\r\n\t\t\t//contextItemId jest uzywane do korespondencji aby wiedziec do ktorej odpowiadamy - teraz tworzymy nowa wiec nie potrzebne\r\n\t\t\t//mode to tryb korespondencji\r\n\t\t\t//parentId jest uzywany do tworzenia skladnikow\r\n\t\t\tconst parentId =\r\n\t\t\t\t!isBasedOnCorrespondence &&\r\n\t\t\t\tdocParams.forWhat === \"forSelectedItem\" &&\r\n\t\t\t\tisComponent\r\n\t\t\t\t\t? itemId\r\n\t\t\t\t\t: null;\r\n\r\n\t\t\tconst isInitWorkflow =\r\n\t\t\t\tdocParams.forWhat === \"forWorkflow\"\r\n\t\t\t\t\t? ObjectCreationMode.CreatedFromInitWorkflow\r\n\t\t\t\t\t: ObjectCreationMode.Undefined;\r\n\t\t\tconst creationModeCorr = isBasedOnCorrespondence\r\n\t\t\t\t? ObjectCreationMode.Send\r\n\t\t\t\t: ObjectCreationMode.Undefined;\r\n\r\n\t\t\tconst creationMode = creationModeCorr | isInitWorkflow;\r\n\r\n\t\t\tCreateVarioObjectFromDialog(\r\n\t\t\t\tcontainer,\r\n\t\t\t\tparentId ?? \"\",\r\n\t\t\t\tundefined,\r\n\t\t\t\tcreationMode,\r\n\t\t\t\tundefined,\r\n\t\t\t\tdocParams.forWhat\r\n\t\t\t);\r\n\t\t\tCloseBigDialog();\r\n\t\t} else if (docParams.forWhat === \"forNewVersion\") {\r\n\t\t\tGenerateNewVersion(docParams as NewVersionParams, false);\r\n\t\t} else {\r\n\t\t\tlet definition = 2;\r\n\t\t\tif (!containerId?.includes(\"Schedule\")) {\r\n\t\t\t\thideFloatingButtonOnOpeningEditor();\r\n\t\t\t\tUnselectAndUnfocusDxTable();\r\n\t\t\t\tdefinition = 1;\r\n\t\t\t\tsessionStorage.removeItem(\"selectedRow\");\r\n\t\t\t}\r\n\r\n\t\t\tif (docParams.forWhat === \"forSelectedItem\") {\r\n\t\t\t\tif (isComponent)\r\n\t\t\t\t\t$(\".AddDocumentsButtonMenu #okButton\").removeAttr(\r\n\t\t\t\t\t\t\"data-forcontainerId\"\r\n\t\t\t\t\t);\r\n\t\t\t\telse\r\n\t\t\t\t\t$(\".AddDocumentsButtonMenu #okButton\").removeAttr(\r\n\t\t\t\t\t\t\"data-forComponentID\"\r\n\t\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tconst parentId =\r\n\t\t\t\t$(\".AddDocumentsButtonMenu #okButton\").attr(\"data-forComponentID\") ||\r\n\t\t\t\t\"\";\r\n\t\t\tconst containId =\r\n\t\t\t\t$(\".AddDocumentsButtonMenu #okButton\").attr(\"data-forcontainerId\") ||\r\n\t\t\t\t\"\";\r\n\r\n\t\t\tselectThisDefinitionInEditor(\r\n\t\t\t\tdefinition,\r\n\t\t\t\tdocParams.fromDrop ?? false,\r\n\t\t\t\tdocParams.forWhat === \"forSelectedItem\",\r\n\t\t\t\ttrue,\r\n\t\t\t\tparentId,\r\n\t\t\t\tcontainId\r\n\t\t\t);\r\n\t\t\tCloseBigDialog();\r\n\t\t}\r\n\t});\r\n\r\n\t$(\".AddDocumentsButtonMenu #filesLabel\").on(\"click\", () => {\r\n\t\tOpenFilesUploadMenu(docParams.forWorkflow);\r\n\t});\r\n}\r\n\r\nexport function setNewCardEditorCheckState() {\r\n\tif (!$(\"#selectElementType\").val()) return;\r\n\r\n\tlet userPreferences = localStorage.getItem(\"editorTypeForDefinition\");\r\n\tif (!userPreferences) {\r\n\t\tuserPreferences = \"{}\";\r\n\t}\r\n\r\n\tconst currentDefinition =\r\n\t\t$(\"#selectElementType\").val()?.valueOf()?.toString() ?? \"\";\r\n\tconst userPreferencesJson = JSON.parse(userPreferences);\r\n\tuserPreferencesJson[currentDefinition] = $(\"#useNewCardEditor\").is(\":checked\")\r\n\t\t? \"card\"\r\n\t\t: \"inline\";\r\n\tlocalStorage.setItem(\r\n\t\t\"editorTypeForDefinition\",\r\n\t\tJSON.stringify(userPreferencesJson)\r\n\t);\r\n}\r\n\r\nexport function restoreNewCardEditorCheckState(docParams: DocParams) {\r\n\tconst currentDefinition =\r\n\t\t$(\"#selectElementType\").val()?.valueOf().toString() ?? \"\";\r\n\tconst currentDefinitionText = $(\"#selectElementType :selected\").text();\r\n\tconst currentDefObj = docParams?.allowedDefinitions?.find(\r\n\t\t(x) =>\r\n\t\t\tx.key === currentDefinition && x.displayName === currentDefinitionText\r\n\t);\r\n\t//dodawanie na podstawie definicji korespondencji\r\n\tconst isBasedOnCorrespondence = currentDefObj?.isBasedOnCorrespondence;\r\n\t//dodawanie skladnika w widoku karty moze byc tylko w nowym widoku karty a nie w gridzie\r\n\tconst componentItemVarioObject =\r\n\t\tdocParams?.forWhat === \"forSelectedItem\" &&\r\n\t\tcurrentDefObj?.forComponent &&\r\n\t\tcheckWhereIsUser() === \"varioObject\";\r\n\r\n\tif (\r\n\t\tisRunningOnMobile() ||\r\n\t\tdocParams?.forWhat === \"forWorkflow\" ||\r\n\t\tisBasedOnCorrespondence ||\r\n\t\tcomponentItemVarioObject\r\n\t) {\r\n\t\tsetUseNewCardEditorCheckbox(true, true);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst userPreferences = localStorage.getItem(\"editorTypeForDefinition\");\r\n\tif (!userPreferences) {\r\n\t\tsetUseNewCardEditorCheckbox(false, false);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst userPreferencesJson = JSON.parse(userPreferences);\r\n\r\n\tif (currentDefinition in userPreferencesJson) {\r\n\t\tsetUseNewCardEditorCheckbox(\r\n\t\t\tuserPreferencesJson[currentDefinition] === \"card\",\r\n\t\t\tfalse\r\n\t\t);\r\n\t\treturn;\r\n\t}\r\n\tsetUseNewCardEditorCheckbox(false, false);\r\n\treturn;\r\n}\r\n\r\nexport function getPreferredEditor(definition: string) {\r\n\tconst userPreferences = localStorage.getItem(\"editorTypeForDefinition\");\r\n\tif (!userPreferences) {\r\n\t\treturn \"inline\";\r\n\t}\r\n\r\n\tconst userPreferencesJson = JSON.parse(userPreferences);\r\n\tif (definition in userPreferencesJson) {\r\n\t\treturn userPreferencesJson[definition];\r\n\t}\r\n\r\n\treturn \"inline\";\r\n}\r\n\r\nexport function setUseNewCardEditorCheckbox(\r\n\tchecked: boolean,\r\n\tdisabled: boolean\r\n) {\r\n\t$(\"#useNewCardEditor\").prop(\"checked\", checked);\r\n\t$(\"#useNewCardEditor\").attr(\"disabled\", disabled ? \"disabled\" : null);\r\n}\r\n\r\nexport function addDefinitions(docParams: DocParams) {\r\n\tdocParams.forWorkflow = JSON.parse(\r\n\t\t$(\"#selectElementType\").attr(\"data-forWorkflow\") ?? \"null\"\r\n\t);\r\n\tif (!docParams.allowedDefinitions)\r\n\t\tdocParams.allowedDefinitions = docParams.forWorkflow\r\n\t\t\t? allowedDefinitionsGlobalWorkflow\r\n\t\t\t: allowedDefinitionsGlobal;\r\n\r\n\tlet selectOptions = \"\";\r\n\tif (docParams.allowedDefinitions)\r\n\t\tfor (const item of docParams.allowedDefinitions) {\r\n\t\t\tconst selected =\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly]\r\n\t\t\t\t\t.globalBuforSelectedDefinitionId === item.key ||\r\n\t\t\t\t(item.isDefault &&\r\n\t\t\t\t\tsubElementsModel[modelSubElementsOnly]\r\n\t\t\t\t\t\t.globalBuforSelectedDefinitionId === \"\")\r\n\t\t\t\t\t? `selected=\"selected\"`\r\n\t\t\t\t\t: \"\";\r\n\t\t\tconst disabled = item.key === \"NULL\" ? \"disabled\" : \"\";\r\n\r\n\t\t\tselectOptions += ``;\r\n\t\t}\r\n\r\n\t$(\"#selectElementType\").append(selectOptions);\r\n}\r\n\r\nexport function addTemplates() {\r\n\tconst forWorkflow = JSON.parse(\r\n\t\t$(\"#selectElementType\").attr(\"data-forWorkflow\") ?? \"null\"\r\n\t);\r\n\tconst forWhat = $(\"#selectElementType\").attr(\"data-forWhat\") ?? \"\";\r\n\tconst fromDrop = $(\"#selectElementType\").attr(\"data-fromDrop\");\r\n\r\n\tconst currentDefinition =\r\n\t\t$(\"#selectElementType\").val()?.valueOf()?.toString() ?? \"\";\r\n\tconst currentDefinitionText = $(\"#selectElementType :selected\").text();\r\n\r\n\t$(\"#templateSelectorDiv\").remove();\r\n\t$(\"#checkerContainer\").addClass(\"hidden\");\r\n\r\n\tif (!$(\"#template-loading\").length && fromDrop === \"false\") {\r\n\t\t$(\r\n\t\t\t\"#templateDiv\"\r\n\t\t).append(`
    Sprawdzanie dost\u0119pno\u015Bci wzorca\r\n\t\t\t
    \r\n\t\t\t
    \r\n\t\t\t
    .
    \r\n\t\t\t
    .
    \r\n\t\t\t
    .
    \r\n\t\t
    \r\n\t
    `);\r\n\t}\r\n\r\n\tsubElementsModel[modelSubElementsOnly].globalBuforSelectedDefinitionId =\r\n\t\tcurrentDefinition;\r\n\tsubElementsModel[modelSubElementsOnly].globalBuforSelectedDefinitionTitle =\r\n\t\tcurrentDefinitionText;\r\n\r\n\tif (\r\n\t\t!stringIsNullOrEmpty(\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalBuforSelectedDefinitionId\r\n\t\t)\r\n\t) {\r\n\t\tconst selectedInput = selectDocumentDefinitions(forWhat as AddForWhat);\r\n\t\tconst selectedDef = selectedInput?.find(\r\n\t\t\t(x) =>\r\n\t\t\t\tx.key ===\r\n\t\t\t\t\tsubElementsModel[modelSubElementsOnly]\r\n\t\t\t\t\t\t.globalBuforSelectedDefinitionId &&\r\n\t\t\t\tx.displayName === currentDefinitionText\r\n\t\t);\r\n\t\tconst canUploadFiles = selectedDef?.canUploadFile ?? true;\r\n\t\tconst mustUseTemplate = selectedDef?.mustUseTemplate ?? false;\r\n\r\n\t\t$(\".AddDocumentsButtonMenu #addFilesButton #filesLabel\").attr(\r\n\t\t\t\"disabled\",\r\n\t\t\tcanUploadFiles ? null : \"disabled\"\r\n\t\t);\r\n\t\t$(\".AddDocumentsButtonMenu #okButton\").attr(\r\n\t\t\t\"disabled\",\r\n\t\t\tmustUseTemplate ? \"disabled\" : null\r\n\t\t);\r\n\r\n\t\tif (document.getElementById(\"useTemplate\") != null) {\r\n\t\t\tconst useTemplate = (\r\n\t\t\t\tdocument.getElementById(\"useTemplate\") as HTMLInputElement\r\n\t\t\t)?.checked;\r\n\t\t\tif (forWorkflow) globalUseTemplateGlobalWorkflow = useTemplate;\r\n\t\t\telse globalUseTemplate = useTemplate;\r\n\t\t}\r\n\r\n\t\tif (fromDrop === \"false\") {\r\n\t\t\tconst def =\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalBuforSelectedDefinitionId;\r\n\t\t\tif (!def?.toLowerCase().startsWith(\"generictype:\")) {\r\n\t\t\t\t$.ajax({\r\n\t\t\t\t\turl: `${GetBaseUrl()}/Vario/GetTemplates`,\r\n\t\t\t\t\ttype: \"Get\",\r\n\t\t\t\t\tcache: false,\r\n\t\t\t\t\tdata: {\r\n\t\t\t\t\t\tdefinitionId: def,\r\n\t\t\t\t\t},\r\n\t\t\t\t\tsuccess: (data: ResponseTemplate) => {\r\n\t\t\t\t\t\t//timeout zeby nie znikalo info o ladowaniu wzorcow\r\n\t\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t\tdef ===\r\n\t\t\t\t\t\t\t\tsubElementsModel[modelSubElementsOnly]\r\n\t\t\t\t\t\t\t\t\t.globalBuforSelectedDefinitionId\r\n\t\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\t\tglobalAvailableTemplates = data.templates;\r\n\t\t\t\t\t\t\t\taddTemplatesSelector();\r\n\t\t\t\t\t\t\t\taddButtonsControl(\r\n\t\t\t\t\t\t\t\t\tJSON.parse(data?.message?.toLowerCase()),\r\n\t\t\t\t\t\t\t\t\tcanUploadFiles\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}, 350);\r\n\t\t\t\t\t},\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\tglobalAvailableTemplates = null;\r\n\t\t\t\taddTemplatesSelector();\r\n\t\t\t\taddButtonsControl(false, canUploadFiles);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\taddButtonsControl(false, canUploadFiles);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function addTemplatesSelector() {\r\n\t$(\"#template-loading\").remove();\r\n\t$(\"#templateSelectorDiv\").remove();\r\n\r\n\tif (!globalAvailableTemplates?.length) return;\r\n\r\n\t$(\"#checkerContainer\").removeClass(\"hidden\");\r\n\r\n\tlet selectOptions = \"\";\r\n\r\n\tglobalAvailableTemplates?.forEach((item, index) => {\r\n\t\tconst selected = index === 0 ? `selected=\"selected\"` : \"\";\r\n\r\n\t\tselectOptions += ``;\r\n\t});\r\n\r\n\t$(\"#templateDiv\").append(`\r\n
    \r\n
    Wybierz wzorzec:
    \r\n \r\n
    \r\n `);\r\n}\r\n\r\nexport function addButtonsControl(\r\n\ttemplateIsRequired: boolean,\r\n\tcanUploadFile: boolean,\r\n\tisChecker = false\r\n) {\r\n\tconst selectInput = $(\"#selectElementType\");\r\n\r\n\tif (templateIsRequired == null)\r\n\t\ttemplateIsRequired = JSON.parse(\r\n\t\t\tselectInput.attr(\"data-templateIsRequired\") ?? \"null\"\r\n\t\t);\r\n\tif (canUploadFile == null)\r\n\t\tcanUploadFile = JSON.parse(\r\n\t\t\tselectInput.attr(\"data-canUploadFile\") ?? \"null\"\r\n\t\t);\r\n\r\n\tselectInput.attr(\"data-templateIsRequired\", templateIsRequired.toString());\r\n\tselectInput.attr(\"data-canUploadFile\", canUploadFile.toString());\r\n\r\n\t$(\".AddDocumentsButtonMenu #okButton\").attr(\"disabled\", null);\r\n\t$(\".AddDocumentsButtonMenu #addFilesButton #filesLabel\").attr(\r\n\t\t\"disabled\",\r\n\t\tnull\r\n\t);\r\n\r\n\t//wymagany szablon\r\n\tif (templateIsRequired) {\r\n\t\t$(\"#useTemplate\").prop(\"checked\", true);\r\n\t\t$(\"#useTemplate\").attr(\"disabled\", \"disabled\");\r\n\t\t$(\"#useTemplateLabel\").addClass(\"disabled\");\r\n\t\t$(\".AddDocumentsButtonMenu #addFilesButton #filesLabel\").attr(\r\n\t\t\t\"disabled\",\r\n\t\t\t\"disabled\"\r\n\t\t);\r\n\t} else {\r\n\t\tif (!isChecker) $(\"#useTemplate\").prop(\"checked\", false);\r\n\t\t$(\"#useTemplate\").attr(\"disabled\", null);\r\n\t}\r\n\r\n\t//nie mozna dodac pliku\r\n\tif ($(\"#useTemplate\").prop(\"checked\") || !canUploadFile) {\r\n\t\t$(\".AddDocumentsButtonMenu #addFilesButton #filesLabel\").attr(\r\n\t\t\t\"disabled\",\r\n\t\t\t\"disabled\"\r\n\t\t);\r\n\t}\r\n\r\n\t$(\"#changeDefBecauseFiles\").remove();\r\n\t//definicja nie pozwala na dodanie plikow ale ma juz pliki\r\n\tif (\r\n\t\t!canUploadFile &&\r\n\t\tJSON.parse($(\"#addFilesButton label\").attr(\"data-hasFiles\") ?? \"null\")\r\n\t) {\r\n\t\t$(\".AddDocumentsButtonMenu #okButton\").attr(\"disabled\", \"disabled\");\r\n\t\t$(\"#templateDiv\").append(\r\n\t\t\t'
    Wybierz definicj\u0119 pozwalaj\u0105c\u0105 na dodanie \u017Ar\u00F3d\u0142a pliku!
    '\r\n\t\t);\r\n\t}\r\n\r\n\t//jesli useTemplate check\r\n\tif ($(\"#useTemplate\").prop(\"checked\")) {\r\n\t\t$(\"#templateSelectorDiv\").removeClass(\"hidden\");\r\n\t} else {\r\n\t\t$(\"#templateSelectorDiv\").addClass(\"hidden\");\r\n\t}\r\n\r\n\t//jesli zostal klikniety useTemplate check\r\n\tif (isChecker) {\r\n\t\tconst forWorkflow = JSON.parse(\r\n\t\t\t$(\"#selectElementType\").attr(\"data-forWorkflow\") ?? \"null\"\r\n\t\t);\r\n\t\tif (forWorkflow) {\r\n\t\t\tglobalUseTemplateGlobalWorkflow = !globalUseTemplateGlobalWorkflow;\r\n\t\t} else {\r\n\t\t\tglobalUseTemplate = !globalUseTemplate;\r\n\t\t\tclearDraggedFilesBuffer();\r\n\t\t}\r\n\t}\r\n\r\n\t//jesli plik z drag n drop\r\n\tif (JSON.parse(selectInput?.attr(\"data-fromDrop\") ?? \"null\")) {\r\n\t\t$(\".AddDocumentsButtonMenu #addFilesButton #filesLabel\").attr(\r\n\t\t\t\"disabled\",\r\n\t\t\t\"disabled\"\r\n\t\t);\r\n\t\t$(\"#useTemplate\").attr(\"disabled\", \"disabled\");\r\n\t\t$(\"#useTemplateLabel\").addClass(\"disabled\");\r\n\t}\r\n\r\n\tChangeFileInputCount(\r\n\t\t!!(typeof draggedFilesBuffer !== \"undefined\" && draggedFilesBuffer)\r\n\t);\r\n}\r\n//------guziki do popupow----------\r\n\r\nexport function getPossibleControlsToUse() {\r\n\tgetPossibleControlsToUseRequest = $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetPossibleControlsToUse`,\r\n\t\ttype: \"GET\",\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdataType: \"JSON\",\r\n\t\tcache: false,\r\n\t\tdata: { id: lastSelectedRow[0]?.ItemID },\r\n\t\tsuccess: (data: PossibleControlsToUse) => {\r\n\t\t\tif (data) {\r\n\t\t\t\tconst possibleControlsToUse = data;\r\n\t\t\t\tconst possibleControlsToUsediv = document.getElementById(\r\n\t\t\t\t\t\"possibleControlsToUse\"\r\n\t\t\t\t);\r\n\t\t\t\tif (possibleControlsToUsediv) {\r\n\t\t\t\t\tsendPossibleControlsToUse(\r\n\t\t\t\t\t\tlastSelectedRow[0],\r\n\t\t\t\t\t\tpossibleControlsToUse as unknown as LayoutControlWeb\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn possibleControlsToUse;\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function sendPossibleControlsToUseButtons(\r\n\tdataParam: FloatingButtonData | null,\r\n\tpossibleControlsToUse: LayoutControlWeb\r\n): FloatingButtonItem[] {\r\n\tconst openInButtons: FloatingButtonItem[] = [];\r\n\tif (!dataParam?.ItemID) return openInButtons;\r\n\r\n\tswitch (possibleControlsToUse) {\r\n\t\tcase -1:\r\n\t\t\t//Loading\r\n\t\t\tbreak;\r\n\t\tcase 1:\r\n\t\t\t//GridEXView\r\n\t\t\tbreak;\r\n\t\tcase 2:\r\n\t\t\t//ScheduleDxView\r\n\t\t\tbreak;\r\n\t\tcase 3:\r\n\t\t\t//GridEXView i ScheduleDxView\r\n\t\t\topenInButtons.push({\r\n\t\t\t\ttext: \"Widok harmonogramu\",\r\n\t\t\t\ticon: \"fas fa-calendar\",\r\n\t\t\t\torder: 1,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tOpenInSelectedControll(\r\n\t\t\t\t\t\t\tdataParam?.ItemID ?? \"\",\r\n\t\t\t\t\t\t\tLayoutControlWeb.ScheduleLayoutFile\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(\r\n\t\t\t\t\t\t\tdataParam?.ItemID ?? \"\",\r\n\t\t\t\t\t\t\t\"Operacje.Widok harmonogramu\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\r\n\t\t\topenInButtons.push({\r\n\t\t\t\ttext: \"Widok standardowy\",\r\n\t\t\t\ticon: \"fas fa-table\",\r\n\t\t\t\torder: 2,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tOpenInSelectedControll(\r\n\t\t\t\t\t\t\tdataParam?.ItemID ?? \"\",\r\n\t\t\t\t\t\t\tLayoutControlWeb.GridEXLayoutFile\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(dataParam?.ItemID ?? \"\", \"Operacje.Widok standardowy\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\t//Do GridEXView\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\treturn openInButtons;\r\n}\r\n\r\nexport function sendPossibleControlsToUse(\r\n\tdataParam: FloatingButtonData | null,\r\n\tpossibleControlsToUse: LayoutControlWeb\r\n) {\r\n\tconst possibleControlsToUsediv = $(\"#possibleControlsToUse\");\r\n\tpossibleControlsToUsediv.empty();\r\n\r\n\tif (possibleControlsToUse === -1) {\r\n\t\tpossibleControlsToUsediv.append(\r\n\t\t\t`

    \u0141adowanie opcji otwarcia...

    `\r\n\t\t);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst openInButtons = sendPossibleControlsToUseButtons(\r\n\t\tdataParam,\r\n\t\tpossibleControlsToUse\r\n\t);\r\n\r\n\tappendFloatingButtons(openInButtons, \"#possibleControlsToUse\");\r\n}\r\n\r\nexport function getOperations(\r\n\tmodel: FloatingButtonData | null,\r\n\ttype: string\r\n): FloatingButtonItem[] {\r\n\tconst itemId = model?.key ?? model?.ItemID ?? globalItemsSelectedByUser;\r\n\tconst caption = fixStringToPreventJSErrors(\r\n\t\tmodel?.Caption ?? model?.title ?? \"\"\r\n\t);\r\n\tlet defVerId =\r\n\t\tmodel?.definitionKey ?? model?.RefDefinitionVerID ?? model?.DefinitionVerID;\r\n\tconst hasFile = model?.FileExtension || model?.contentFileType;\r\n\r\n\tconst operationButtons: FloatingButtonItem[] = [];\r\n\r\n\tlet isPDFMultiSelect = false;\r\n\tlet isWordMultiSelect = false;\r\n\tlet canDownloadFiles = false;\r\n\tlet isCorrespondenceMultiSelect = false;\r\n\tif (type === \"subViewMultiSelect\") {\r\n\t\tlet havePermissions = true;\r\n\t\tlet isPDF = true;\r\n\t\tlet isWord = true;\r\n\t\tlet isCorrespondence = false;\r\n\t\tconst dsDataSource = $(\"#Tabela\")\r\n\t\t\t?.dxDataGrid(\"instance\")\r\n\t\t\t?.getDataSource() as any;\r\n\r\n\t\tfunction checkParamsForMultiSelect(item) {\r\n\t\t\tif (item.Caption.includes(\"Brak uprawnie\u0144 do odczytu\")) {\r\n\t\t\t\thavePermissions = false;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (!item.FileExtension?.includes(\"pdf\")) {\r\n\t\t\t\tisPDF = false;\r\n\t\t\t}\r\n\t\t\tif (!item.FileExtension?.includes(\"docx\")) {\r\n\t\t\t\tisWord = false;\r\n\t\t\t}\r\n\t\t\tif (item.ItemID?.includes(\"Correspondence\")) {\r\n\t\t\t\tisCorrespondence = true;\r\n\t\t\t}\r\n\t\t\tif (!stringIsNullOrEmpty(item.FileExtension)) {\r\n\t\t\t\tcanDownloadFiles = true;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (globalItemsSelectedByUser?.length && dsDataSource?._items?.length) {\r\n\t\t\tconst matchingItems = parseDxGridItems(dsDataSource);\r\n\r\n\t\t\tif (matchingItems)\r\n\t\t\t\tfor (const item of matchingItems) {\r\n\t\t\t\t\tif (globalItemsSelectedByUser.includes(item.ItemID)) {\r\n\t\t\t\t\t\tcheckParamsForMultiSelect(item);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t}\r\n\r\n\t\tisPDFMultiSelect = havePermissions && isPDF;\r\n\t\tisWordMultiSelect = havePermissions && isWord;\r\n\t\tisCorrespondenceMultiSelect = isCorrespondence;\r\n\t}\r\n\r\n\toperationButtons.push({\r\n\t\ttext: \"Poka\u017C wi\u0119cej opcji...\",\r\n\t\ticon: \"fas fa-ellipsis-h\",\r\n\t\torder: -2,\r\n\t\tfunctions: [],\r\n\t});\r\n\r\n\tif (type === \"subView\")\r\n\t\tsendPossibleControlsToUse(\r\n\t\t\tmodel,\r\n\t\t\tmodel?.possibleControlsToUse ?? LayoutControlWeb.Loading\r\n\t\t);\r\n\r\n\tif (model?.canUploadFile === true) {\r\n\t\tconst emptyDivForAppendingInput = document.getElementById(\r\n\t\t\t\"emptyDivForAppendingInput\"\r\n\t\t);\r\n\t\tif (emptyDivForAppendingInput?.innerHTML === \"\") {\r\n\t\t\tconst text = model?.childSources?.length ? \"Zast\u0105p plik\" : \"Wgraj plik\";\r\n\t\t\toperationButtons.push({\r\n\t\t\t\ttext: text,\r\n\t\t\t\timportant: true,\r\n\t\t\t\ticon: \"fas fa-file-upload\",\r\n\t\t\t\torder: 2,\r\n\t\t\t\tcustomHTML: `
    \r\n
    ${text}
    \r\n
    \r\n \r\n \r\n
    \r\n
    `,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tif (itemId?.length) {\r\n\t\tif (type === \"subView\" && !Array.isArray(itemId) && model?.HashID) {\r\n\t\t\toperationButtons.push({\r\n\t\t\t\timportant: true,\r\n\t\t\t\ttext: \"Otw\u00F3rz w nowej karcie\",\r\n\t\t\t\ticon: \"fas fa-external-link-alt\",\r\n\t\t\t\torder: -1,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\topenInNewTab(model?.HashID ?? \"\", hashId);\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tisPDFMultiSelect ||\r\n\t\t\tmodel?.FileExtension === \".pdf\" ||\r\n\t\t\t(type === \"varioObject\" &&\r\n\t\t\t\tmodel?.canWrite === true &&\r\n\t\t\t\tcontainPDF === \"True\")\r\n\t\t) {\r\n\t\t\toperationButtons.push({\r\n\t\t\t\timportant: true,\r\n\t\t\t\ttext: \"Podpisz/Parafuj\",\r\n\t\t\t\ticon: \"fas fa-signature\",\r\n\t\t\t\torder: 0,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tChooseSignature(itemId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(itemId, \"Operacje.Podpisz/Parafuj\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tisWordMultiSelect ||\r\n\t\t\tmodel?.FileExtension === \".docx\" ||\r\n\t\t\t(type === \"varioObject\" &&\r\n\t\t\t\tcontainWord === \"True\" &&\r\n\t\t\t\tmodel?.canWrite === true)\r\n\t\t) {\r\n\t\t\toperationButtons.push({\r\n\t\t\t\timportant: true,\r\n\t\t\t\ttext: \"Publikuj do pdf\",\r\n\t\t\t\ticon: \"fas fa-file-pdf\",\r\n\t\t\t\torder: 3,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tif (Array.isArray(itemId)) {\r\n\t\t\t\t\t\t\titemId.map((id) => publishPDF(id));\r\n\t\t\t\t\t\t} else publishPDF(itemId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(itemId, \"Operacje.Publikuj do pdf\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (isCorrespondenceMultiSelect || itemId?.includes(\"Correspondence\")) {\r\n\t\t\tif (!Array.isArray(itemId)) {\r\n\t\t\t\tif (type === \"varioObject\" && !ContainMinusID(itemId)) {\r\n\t\t\t\t\toperationButtons.push({\r\n\t\t\t\t\t\ttext: \"Drukuj korespondencj\u0119\",\r\n\t\t\t\t\t\ticon: \"fas fa-print\",\r\n\t\t\t\t\t\torder: 5,\r\n\t\t\t\t\t\tfunctions: [\r\n\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\tPrintCorrespondence(itemId);\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\taddOperation(itemId, \"Operacje.Drukuj korespondencj\u0119\");\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t],\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//TODO - dodac z API sprawdzanie canDecree i canForward\r\n\t\t\t\tconst canForward =\r\n\t\t\t\t\ttype === \"subView\"\r\n\t\t\t\t\t\t? modelId.includes(\"Inbox\") || modelId.includes(\"SentItems\")\r\n\t\t\t\t\t\t: model?.containerKey == null ||\r\n\t\t\t\t\t\t\tmodel?.containerKey?.includes(\"Inbox\") ||\r\n\t\t\t\t\t\t\tmodel?.containerKey?.includes(\"SentItems\");\r\n\t\t\t\tconst canDecree =\r\n\t\t\t\t\tcanDecreeVarioObject === \"True\" ||\r\n\t\t\t\t\tsubElementsModel[modelSubElementsOnly]?.canDecreeSubElements ===\r\n\t\t\t\t\t\t\"True\";\r\n\r\n\t\t\t\tif (!stringIsNullOrEmpty(defVerId) && (canDecree || canForward)) {\r\n\t\t\t\t\tconst varioObjectStatus =\r\n\t\t\t\t\t\tmodel?.Fields?.find((x) => x.fieldKey === \"Status\")?.value ??\r\n\t\t\t\t\t\t\"Zatwierdzony\";\r\n\t\t\t\t\tconst subElementsStatus = model?.Status ?? \"Zatwierdzony\";\r\n\t\t\t\t\tconst isApproved =\r\n\t\t\t\t\t\tsubElementsStatus === \"Zatwierdzony\" ||\r\n\t\t\t\t\t\tvarioObjectStatus === \"30\" ||\r\n\t\t\t\t\t\tvarioObjectStatus === \"Zatwierdzony\";\r\n\t\t\t\t\tconst isEdited =\r\n\t\t\t\t\t\tsubElementsStatus === \"Edytowalny\" ||\r\n\t\t\t\t\t\tsubElementsStatus === \"10\" ||\r\n\t\t\t\t\t\tvarioObjectStatus === \"10\" ||\r\n\t\t\t\t\t\tvarioObjectStatus === \"Edytowalny\";\r\n\r\n\t\t\t\t\tif (!ContainMinusID(itemId) && isApproved && !isEdited) {\r\n\t\t\t\t\t\tif (canForward) {\r\n\t\t\t\t\t\t\toperationButtons.push({\r\n\t\t\t\t\t\t\t\timportant: true,\r\n\t\t\t\t\t\t\t\ttext: \"Przeka\u017C dalej\",\r\n\t\t\t\t\t\t\t\ticon: \"fas fa-arrow-right\",\r\n\t\t\t\t\t\t\t\torder: 5.7,\r\n\t\t\t\t\t\t\t\tfunctions: [\r\n\t\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\t\treplyToCorrespondence(\r\n\t\t\t\t\t\t\t\t\t\t\titemId,\r\n\t\t\t\t\t\t\t\t\t\t\tObjectCreationMode.Forward,\r\n\t\t\t\t\t\t\t\t\t\t\tdefVerId\r\n\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\t\taddOperation(itemId, \"Operacje.Przeka\u017C dalej\");\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t],\r\n\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\toperationButtons.push({\r\n\t\t\t\t\t\t\t\timportant: true,\r\n\t\t\t\t\t\t\t\ttext: \"Odpowiedz\",\r\n\t\t\t\t\t\t\t\ticon: \"fas fa-reply\",\r\n\t\t\t\t\t\t\t\torder: 5.8,\r\n\t\t\t\t\t\t\t\tfunctions: [\r\n\t\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\t\treplyToCorrespondence(\r\n\t\t\t\t\t\t\t\t\t\t\titemId,\r\n\t\t\t\t\t\t\t\t\t\t\tObjectCreationMode.ReplyToSender,\r\n\t\t\t\t\t\t\t\t\t\t\tdefVerId\r\n\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\t\taddOperation(itemId, \"Operacje.Odpowiedz\");\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t],\r\n\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\toperationButtons.push({\r\n\t\t\t\t\t\t\t\timportant: true,\r\n\t\t\t\t\t\t\t\ttext: \"Odpowiedz wszystkim\",\r\n\t\t\t\t\t\t\t\ticon: \"fas fa-reply-all\",\r\n\t\t\t\t\t\t\t\torder: 5.9,\r\n\t\t\t\t\t\t\t\tfunctions: [\r\n\t\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\t\treplyToCorrespondence(\r\n\t\t\t\t\t\t\t\t\t\t\titemId,\r\n\t\t\t\t\t\t\t\t\t\t\tObjectCreationMode.ReplyToAll,\r\n\t\t\t\t\t\t\t\t\t\t\tdefVerId\r\n\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\t\taddOperation(itemId, \"Operacje.Odpowiedz wszystkim\");\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t],\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (canDecree) {\r\n\t\t\t\t\t\t\toperationButtons.push({\r\n\t\t\t\t\t\t\t\timportant: true,\r\n\t\t\t\t\t\t\t\ttext: \"Dekretuj\",\r\n\t\t\t\t\t\t\t\ticon: ``,\r\n\t\t\t\t\t\t\t\torder: 6,\r\n\t\t\t\t\t\t\t\tfunctions: [\r\n\t\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\t\tdecree(itemId, caption);\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\t\taddOperation(itemId, \"Operacje.Dekretuj\");\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t],\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (type !== \"varioObject\") {\r\n\t\t\t\tconst itemsToMark: string[] = Array.isArray(itemId) ? itemId : [itemId];\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\ttype === \"subViewMultiSelect\" ||\r\n\t\t\t\t\t(model?.IsNew && type !== \"subViewMultiSelect\")\r\n\t\t\t\t) {\r\n\t\t\t\t\toperationButtons.push({\r\n\t\t\t\t\t\timportant: true,\r\n\t\t\t\t\t\ttext: \"Oznacz jako przeczytane\",\r\n\t\t\t\t\t\ticon: \"far fa-envelope-open\",\r\n\t\t\t\t\t\torder: 6.1,\r\n\t\t\t\t\t\tfunctions: [\r\n\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\tmarkAsRead(itemsToMark);\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\taddOperation(itemsToMark, \"Operacje.Oznacz jako przeczytane\");\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t],\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\ttype === \"subViewMultiSelect\" ||\r\n\t\t\t\t\t(!model?.IsNew && type !== \"subViewMultiSelect\")\r\n\t\t\t\t) {\r\n\t\t\t\t\toperationButtons.push({\r\n\t\t\t\t\t\timportant: true,\r\n\t\t\t\t\t\ttext: \"Oznacz jako nieprzeczytane\",\r\n\t\t\t\t\t\ticon: \"fas fa-envelope\",\r\n\t\t\t\t\t\torder: 6.2,\r\n\t\t\t\t\t\tfunctions: [\r\n\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\tmarkAsUnread(itemsToMark);\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\taddOperation(\r\n\t\t\t\t\t\t\t\t\titemsToMark,\r\n\t\t\t\t\t\t\t\t\t\"Operacje.Oznacz jako nieprzeczytane\"\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t],\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (type !== \"subViewMultiSelect\" && !Array.isArray(itemId))\r\n\t\t\toperationButtons.push({\r\n\t\t\t\timportant: true,\r\n\t\t\t\ttext: \"Uprawnienia\",\r\n\t\t\t\ticon: \"fas fa-trophy\",\r\n\t\t\t\torder: 6.3,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\topenPermissionPopup(itemId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(itemId, \"Operacje.Uprawnienia\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\t}\r\n\r\n\tif (canDownloadFiles || hasFile) {\r\n\t\tconst text = Array.isArray(itemId) ? \"Pobierz pliki\" : \"Pobierz plik\";\r\n\t\toperationButtons.push({\r\n\t\t\timportant: true,\r\n\t\t\ttext: text,\r\n\t\t\ticon: \"fas fa-file-download\",\r\n\t\t\torder: 1,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tif (Array.isArray(itemId)) downloadMultipleFiles(itemId);\r\n\t\t\t\t\telse downloadFileFromLink(model?.linkToDownload, undefined, caption);\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddOperation(itemId ?? \"\", `Operacje.${text}`);\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t}\r\n\r\n\tif (\r\n\t\titemId &&\r\n\t\t!Array.isArray(itemId) &&\r\n\t\t!ContainMinusID(itemId ?? \"\") &&\r\n\t\t!caption?.includes(\"Brak uprawnie\u0144 do odczytu\")\r\n\t) {\r\n\t\toperationButtons.push({\r\n\t\t\timportant: true,\r\n\t\t\ttext: \"Udost\u0119pnij link\",\r\n\t\t\ticon: \"fas fa-share-alt\",\r\n\t\t\torder: 2.1,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tshowLinkOptions(itemId, caption, hasFile ?? false);\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddOperation(itemId, \"Operacje.Udost\u0119pnij link\");\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\r\n\t\tif (\r\n\t\t\tmodel?.contentFileExists === true &&\r\n\t\t\t!itemId?.includes(\"Correspondence\")\r\n\t\t) {\r\n\t\t\tconst openLinkFuncs = getOpenLinkFunctions(model, itemId, caption);\r\n\t\t\topenLinkFuncs.push(() => {\r\n\t\t\t\taddOperation(itemId, \"Operacje.Otw\u00F3rz plik\");\r\n\t\t\t});\r\n\r\n\t\t\toperationButtons.push({\r\n\t\t\t\ttext: \"Otw\u00F3rz plik\",\r\n\t\t\t\ticon: \"fas fa-eye\",\r\n\t\t\t\torder: 1.1,\r\n\t\t\t\tfunctions: openLinkFuncs,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (type !== \"subViewMultiSelect\" && hubUrl?.length > 0) {\r\n\t\t\tif (\r\n\t\t\t\t!defVerId ||\r\n\t\t\t\tdefVerId === \"undefined\" ||\r\n\t\t\t\ttypeof defVerId === \"undefined\"\r\n\t\t\t)\r\n\t\t\t\tdefVerId = model?.SmallImage;\r\n\r\n\t\t\toperationButtons.push({\r\n\t\t\t\timportant: true,\r\n\t\t\t\ttext: \"Otw\u00F3rz czat pozycji\",\r\n\t\t\t\ticon: \"fas fa-comments\",\r\n\t\t\t\torder: 9,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\topenChatForPosition(itemId, caption, defVerId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(itemId, \"Operacje.Otw\u00F3rz czat pozycji\");\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\toperationButtons.sort((a, b) => a.order - b.order);\r\n\r\n\tif (type === \"varioObject\") {\r\n\t\tlet lastOrder = operationButtons[operationButtons.length - 1].order;\r\n\r\n\t\tif (model?.operations) {\r\n\t\t\tconst modelOperationsLocal: CustomOperation[] = JSON.parse(\r\n\t\t\t\ttranslator(modelOperations.replace(/"/g, '\"'))\r\n\t\t\t);\r\n\r\n\t\t\t//bo liczy od 0\r\n\t\t\tlastOrder = lastOrder + 1;\r\n\r\n\t\t\tfor (let i = 0; i < modelOperationsLocal.length; i++) {\r\n\t\t\t\tif (\r\n\t\t\t\t\tmodelOperationsLocal[i].definitionKey &&\r\n\t\t\t\t\tmodelOperationsLocal[i].definitionKey === \"null\"\r\n\t\t\t\t) {\r\n\t\t\t\t\tmodelOperationsLocal[i].definitionKey = \"\";\r\n\t\t\t\t}\r\n\t\t\t\tif (modelOperationsLocal[i].operationType) {\r\n\t\t\t\t\tif (modelOperationsLocal[i].operationType === 2)\r\n\t\t\t\t\t\tmodelOperationsLocal[i].operationType =\r\n\t\t\t\t\t\t\tCustomOperationType.ReplyToSender;\r\n\t\t\t\t\telse if (modelOperationsLocal[i].operationType === 6)\r\n\t\t\t\t\t\tmodelOperationsLocal[i].operationType =\r\n\t\t\t\t\t\t\tCustomOperationType.ReplyToAll;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlastOrder = lastOrder + i;\r\n\r\n\t\t\t\toperationButtons.push({\r\n\t\t\t\t\ttext: modelOperationsLocal[i].name,\r\n\t\t\t\t\ticon: ``,\r\n\t\t\t\t\torder: lastOrder,\r\n\t\t\t\t\tfunctions: [\r\n\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\tExecuteCustomOperation(\r\n\t\t\t\t\t\t\t\tmodelOperationsLocal[i].itemKey,\r\n\t\t\t\t\t\t\t\tmodelOperationsLocal[i].definitionKey,\r\n\t\t\t\t\t\t\t\tmodelOperationsLocal[i].operationType\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\taddOperation(\r\n\t\t\t\t\t\t\t\titemId ?? \"\",\r\n\t\t\t\t\t\t\t\t`Operacje.${modelOperationsLocal[i].name}`\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t},\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\toperationButtons.sort((a, b) => a.order - b.order);\r\n\treturn operationButtons;\r\n}\r\n\r\n//dodatkowy floating button juz w wybranej kategorii floating buttona\r\nexport function getMoreOperations(\r\n\tmodel: FloatingButtonData | null,\r\n\ttype: string\r\n): FloatingButtonItem[] {\r\n\tconst moreOperationButtons: FloatingButtonItem[] = [];\r\n\tconst id = model?.key ?? model?.ItemID;\r\n\tconst containerId =\r\n\t\ttype !== \"varioObject\"\r\n\t\t\t? modelId\r\n\t\t\t: !stringIsNullOrEmpty(globalThis.containerId)\r\n\t\t\t\t? globalThis.containerId\r\n\t\t\t\t: \"\";\r\n\tconst modelTitle = fixStringToPreventJSErrors(\r\n\t\tmodel?.Caption ?? model?.title ?? \"\"\r\n\t);\r\n\r\n\tif (id && !ContainMinusID(id)) {\r\n\t\tif (type === \"varioObject\") {\r\n\t\t\tmoreOperationButtons.push({\r\n\t\t\t\texpanded: true,\r\n\t\t\t\ttext: \"Drukuj\",\r\n\t\t\t\ticon: \"dx-button-has-icon glyphicon glyphicon-print\",\r\n\t\t\t\tstyle: \"margin-top: 3px;\",\r\n\t\t\t\torder: 2.2,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tTryPrintElem(true, id);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(id, \"Operacje.Wi\u0119cej.Drukuj\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\r\n\t\t\tmoreOperationButtons.push({\r\n\t\t\t\texpanded: true,\r\n\t\t\t\ttext: \"Widoki\",\r\n\t\t\t\ticon: \"dx-button-has-icon fas fa-columns\",\r\n\t\t\t\tstyle: \"margin-top: 3px;\",\r\n\t\t\t\torder: 3,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tgetAvailableLayouts(\"Inner\");\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(id, \"Operacje.Wi\u0119cej.Widoki\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (!modelTitle.includes(\"Brak uprawnie\u0144 do odczytu\")) {\r\n\t\t\tmoreOperationButtons.push({\r\n\t\t\t\timportant: true,\r\n\t\t\t\texpanded: true,\r\n\t\t\t\ttext: \"Dodaj notatk\u0119\",\r\n\t\t\t\ticon: \"fas fa-notes-medical\",\r\n\t\t\t\torder: 4,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tWriteNote(id, modelTitle);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(id, \"Operacje.Wi\u0119cej.Dodaj notatk\u0119\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\r\n\t\t\tif (modelSubElementsOnly === \"True\") {\r\n\t\t\t\tmoreOperationButtons.push({\r\n\t\t\t\t\texpanded: true,\r\n\t\t\t\t\ttext: \"Utw\u00F3rz panel\",\r\n\t\t\t\t\ticon: \"fas fa-grip-lines\",\r\n\t\t\t\t\torder: 4.1,\r\n\t\t\t\t\tfunctions: [\r\n\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\tcreatePanel(id);\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\taddOperation(id, \"Operacje.Wi\u0119cej.Utw\u00F3rz panel\");\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t],\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (model?.contentFileExists === true) {\r\n\t\t\tif ((model.childSources?.length ?? 0) > 1 && type === \"varioObject\") {\r\n\t\t\t\tmoreOperationButtons.push({\r\n\t\t\t\t\texpanded: true,\r\n\t\t\t\t\ttext: \"Otw\u00F3rz plik jako...\",\r\n\t\t\t\t\ticon: ``,\r\n\t\t\t\t\torder: 5,\r\n\t\t\t\t\tfunctions: [],\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tif (type === \"varioObject\") {\r\n\t\t\t\tmoreOperationButtons.push({\r\n\t\t\t\t\texpanded: true,\r\n\t\t\t\t\timportant: true,\r\n\t\t\t\t\ttext: \"Historia zmian pliku\",\r\n\t\t\t\t\ticon: ``,\r\n\t\t\t\t\torder: 6,\r\n\t\t\t\t\tfunctions: [\r\n\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\tgetSourceHistory(id);\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\taddOperation(id, \"Operacje.Wi\u0119cej.Historia zmian pliku\");\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t],\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst definition = model?.objectType?.key ?? model?.DefinitionKey;\r\n\t\tif (!stringIsNullOrEmpty(definition) && id?.includes(\"DocumentVer\")) {\r\n\t\t\tmoreOperationButtons.push({\r\n\t\t\t\texpanded: true,\r\n\t\t\t\ttext: \"Wersje dokumentu\",\r\n\t\t\t\ticon: \"fas fa-code-branch\",\r\n\t\t\t\torder: 6.1,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tgetDocVersionHistory(id, modelTitle, containerId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(id, \"Operacje.Wi\u0119cej.Wersje dokumentu\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tmoreOperationButtons.push({\r\n\t\t\timportant: true,\r\n\t\t\texpanded: true,\r\n\t\t\ttext: \"Historia operacji\",\r\n\t\t\ticon: \"fas fa-history\",\r\n\t\t\torder: 5.2,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tgetOperationsHistory(id);\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddOperation(id, \"Operacje.Wi\u0119cej.Historia operacji\");\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\r\n\t\tmoreOperationButtons.push({\r\n\t\t\texpanded: true,\r\n\t\t\ttext: \"Zmie\u0144 status\",\r\n\t\t\ticon: \"fas fa-exchange-alt\",\r\n\t\t\torder: 8,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\topenListOfStatuses(id);\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddOperation(id, \"Operacje.Wi\u0119cej.Zmie\u0144 status\");\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\r\n\t\tif (id?.includes(\"Task\")) {\r\n\t\t\tmoreOperationButtons.push({\r\n\t\t\t\texpanded: true,\r\n\t\t\t\ttext: \"Zmie\u0144 status realizacji\",\r\n\t\t\t\ticon: \"fas fa-tasks\",\r\n\t\t\t\torder: 9,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\topenListOfProgressStatuses(id);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(id, \"Operacje.Wi\u0119cej.Zmie\u0144 status realizacji\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tmoreOperationButtons.push({\r\n\t\t\timportant: true,\r\n\t\t\texpanded: true,\r\n\t\t\ttext: \"W\u0142a\u015Bciwo\u015Bci\",\r\n\t\t\ticon: \"fas dx-icon-info\",\r\n\t\t\torder: 6.3,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tGetItemProperties(id);\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddOperation(id, \"Operacje.Wi\u0119cej.W\u0142a\u015Bciwo\u015Bci\");\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t}\r\n\r\n\tmoreOperationButtons.sort((a, b) => a.order - b.order);\r\n\treturn moreOperationButtons;\r\n}\r\n\r\n//dodatkowy floating button po wybraniu opcji otw\u00F3rz plik jako...\r\nexport function getOpenAsButtons(model: FloatingButtonData | null) {\r\n\tconst id = model?.key ?? model?.ItemID;\r\n\tconst openAsButtons: FloatingButtonItem[] = [];\r\n\r\n\tif (model?.contentFileExists === true) {\r\n\t\tfor (let i = 0; i < (model.childSources?.length ?? 0); i++) {\r\n\t\t\tconst sourceId = model.childSources?.[i].sourceId;\r\n\t\t\tlet icon = \"fas fa-file\";\r\n\r\n\t\t\tif (\r\n\t\t\t\tmodel.childSources?.[i] &&\r\n\t\t\t\t(model.childSources?.[i].extension?.length ?? 0) > 0\r\n\t\t\t) {\r\n\t\t\t\tswitch (model.childSources?.[i].extension.toLowerCase()) {\r\n\t\t\t\t\tcase \".docx\":\r\n\t\t\t\t\t\ticon = \"fas fa-file-word\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \".pdf\":\r\n\t\t\t\t\t\ticon = \"fas fa-file-pdf\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \".png\":\r\n\t\t\t\t\tcase \".jpg\":\r\n\t\t\t\t\tcase \".jpeg\":\r\n\t\t\t\t\tcase \".gif\":\r\n\t\t\t\t\t\ticon = \"fas fa-file-image\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \".txt\":\r\n\t\t\t\t\t\ticon = \"fas fa-file-alt\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \".mp4\":\r\n\t\t\t\t\tcase \".webm\":\r\n\t\t\t\t\tcase \".ogg\":\r\n\t\t\t\t\t\ticon = \"fas fa-file-video\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tconst link = `${GetBaseUrl()}/Vario/DownloadContentFile/${model.key}?download=false&sourceId=${sourceId}`;\r\n\r\n\t\t\tconst openLinkFuncs = getOpenLinkFunctions(\r\n\t\t\t\t{\r\n\t\t\t\t\tFileExtension: model.childSources?.[i].extension,\r\n\t\t\t\t\tlinkToView: link,\r\n\t\t\t\t},\r\n\t\t\t\tsourceId ?? \"\",\r\n\t\t\t\t(model.childSources?.[i].name ?? \"\") + model.childSources?.[i].extension\r\n\t\t\t);\r\n\r\n\t\t\topenLinkFuncs.push(() => {\r\n\t\t\t\taddOperation(\r\n\t\t\t\t\tid ?? \"\",\r\n\t\t\t\t\t`Operacje.Wi\u0119cej.Otw\u00F3rz plik jako${model.childSources?.[i].extension.replace(\".\", \" \")}`\r\n\t\t\t\t);\r\n\t\t\t});\r\n\r\n\t\t\topenAsButtons.push({\r\n\t\t\t\texpanded: true,\r\n\t\t\t\topenAs: true,\r\n\t\t\t\ttext:\r\n\t\t\t\t\t(model.childSources?.[i]?.name ?? \"\") +\r\n\t\t\t\t\tmodel.childSources?.[i]?.extension,\r\n\t\t\t\ticon: icon,\r\n\t\t\t\torder: i + 1,\r\n\t\t\t\tfunctions: openLinkFuncs,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\treturn openAsButtons;\r\n}\r\n\r\nexport function getContainer(containerId: string, containerKey: string) {\r\n\tif (checkWhereIsUser() === \"varioObject\") return containerKey;\r\n\treturn containerId;\r\n}\r\n\r\n//funkcja pobierajaca stan workflow\r\nexport async function getWorkflowButtons(\r\n\titemId: string | string[],\r\n\tcontainerId: string,\r\n\tcaption: string | string[],\r\n\tcanShowWorkflowOptionsForThisItem?: boolean,\r\n\twhere?: string\r\n) {\r\n\tconst id = Array.isArray(itemId) ? itemId[0] : itemId;\r\n\r\n\tconst first = $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/VarioObjectActionsDev`,\r\n\t\ttype: \"GET\",\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdataType: \"JSON\",\r\n\t\tcache: false,\r\n\t\tdata: { id: id, containerId: containerId, closeOnSuccess: false },\r\n\t});\r\n\r\n\tconst second = $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/VarioWorkflowStateDescriptionDev`,\r\n\t\ttype: \"GET\",\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdataType: \"JSON\",\r\n\t\tcache: false,\r\n\t\tdata: { id: id },\r\n\t});\r\n\r\n\tfirstWorkflowRequest = first;\r\n\tsecondWorkflowRequest = second;\r\n\r\n\tif (where !== \"varioObject\") {\r\n\t\tfirstRequest = first;\r\n\t\tsecondRequest = second;\r\n\t}\r\n\r\n\tconst promises = [first, second];\r\n\tconst promise = Promise.all(promises);\r\n\r\n\tpromise\r\n\t\t.then((results) => {\r\n\t\t\tconst [actions, descData] = results as [\r\n\t\t\t\tActionsViewModel,\r\n\t\t\t\tVarioWorkflowStateDescription,\r\n\t\t\t];\r\n\r\n\t\t\tif (actions)\r\n\t\t\t\taddRequiredWorkflowFields({\r\n\t\t\t\t\tworkflowRequiredFields: actions.workflowRequiredFields,\r\n\t\t\t\t\tworkflowSuggestedFields: actions.workflowSuggestedFields,\r\n\t\t\t\t});\r\n\t\t\tprocessWorkflowButtons(\r\n\t\t\t\t[actions, descData],\r\n\t\t\t\tid,\r\n\t\t\t\tcaption,\r\n\t\t\t\tcanShowWorkflowOptionsForThisItem ?? false,\r\n\t\t\t\twhere ?? \"\"\r\n\t\t\t);\r\n\t\t})\r\n\t\t.catch(() => {});\r\n\r\n\treturn promise;\r\n}\r\n\r\nexport function processWorkflowButtons(\r\n\tresults: [ActionsViewModel, VarioWorkflowStateDescription],\r\n\titemId: string,\r\n\tcaption: string | string[],\r\n\tcanShowWorkflowOptionsForThisItem: boolean | string,\r\n\twhere: string\r\n) {\r\n\tconst actions = results[0];\r\n\tconst descData = results[1];\r\n\tlet actionTitle = \"\";\r\n\tlet actionDesc = \"\";\r\n\r\n\tif (descData) {\r\n\t\tactionDesc = descData.description;\r\n\t\tactionTitle = descData.title;\r\n\r\n\t\tworkflowActionId = itemId;\r\n\t\tworkflowActionTitle = descData.title;\r\n\t\tworkflowActionDescription = descData.description;\r\n\t\tworkflowActionCaption = descData.watcherNotificationCaption;\r\n\t\tworkflowActionCreatedBy = descData.createdBy;\r\n\t\tworkflowActionCreationdDate = descData.creationDate;\r\n\t\tRefreshWorkflowMessageContainer();\r\n\t}\r\n\r\n\tif (actionTitle || actionDesc) {\r\n\t\tcanShowWorkflowMessageParam = true;\r\n\t}\r\n\r\n\tlet actionsCount = 0;\r\n\tif (actions) {\r\n\t\tactionsCount = actions.actions.length;\r\n\t\tcanShowWorkflowOptionsForThisItem = actions.canShowWorkflowOptions;\r\n\t} else {\r\n\t\tcanShowWorkflowOptionsForThisItem = false;\r\n\t}\r\n\r\n\tif (canShowWorkflowOptionsForThisItem === true) {\r\n\t\tothersWorkflowState = \"true\";\r\n\t\tconst phoneActionButtonPanel = document.getElementById(\r\n\t\t\t\"phoneActionButtonPanel\"\r\n\t\t);\r\n\t\tif (phoneActionButtonPanel) {\r\n\t\t\tAppendOthersWorkflowActions(\r\n\t\t\t\titemId,\r\n\t\t\t\t\"True\",\r\n\t\t\t\tcanShowWorkflowMessageParam ?? false,\r\n\t\t\t\tothersWorkflowState\r\n\t\t\t);\r\n\t\t}\r\n\t} else if (canShowWorkflowOptionsForThisItem === false) {\r\n\t\tothersWorkflowState = \"false\";\r\n\t\tconst phoneActionButtonPanel = document.getElementById(\r\n\t\t\t\"phoneActionButtonPanel\"\r\n\t\t);\r\n\t\tif (phoneActionButtonPanel) {\r\n\t\t\tAppendOthersWorkflowActions(\r\n\t\t\t\titemId,\r\n\t\t\t\t\"True\",\r\n\t\t\t\tcanShowWorkflowMessageParam ?? false,\r\n\t\t\t\tothersWorkflowState\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\tappendOtherWorkflowButtonsForSubelements(\r\n\t\titemId,\r\n\t\tcanShowWorkflowMessageParam ?? false,\r\n\t\tothersWorkflowState\r\n\t);\r\n\r\n\tif (actionsCount === 0) {\r\n\t\tworkflowState = \"false\";\r\n\t} else if (actionsCount > 0) {\r\n\t\tworkflowState = \"true\";\r\n\t}\r\n\r\n\tif (where === \"varioObject\") {\r\n\t\tworkflowActionsButtonsForVarioObject = [];\r\n\t\tworkflowStateForVarioObject = workflowState;\r\n\t} else {\r\n\t\tworkflowActionsButtons = [];\r\n\t}\r\n\tcustomActionsButtons = [];\r\n\r\n\tfor (let i = 0; i < actionsCount; i++) {\r\n\t\tconst recArray = JSON.stringify(actions.actions[i].recipients);\r\n\t\tlet recipients = \"\";\r\n\t\tif (recArray !== \"[]\") {\r\n\t\t\trecipients = encodeURI(recArray);\r\n\t\t}\r\n\t\tlet itemKey: string | string[] = \"\";\r\n\t\tconst actionIcon = ChooseWorkflowActionIcon(actions.actions[i].buttonType);\r\n\r\n\t\tif (!caption) {\r\n\t\t\tcaption = actions.actions[i].displayName;\r\n\t\t}\r\n\r\n\t\tif (!Array.isArray(caption)) {\r\n\t\t\tif ((globalItemsSelectedByUser?.length ?? 0) > 1) {\r\n\t\t\t\tcaption = lastSelectedRow.map((x) => x.Caption);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!Array.isArray(caption)) {\r\n\t\t\tif ((globalItemsSelectedByUser?.length ?? 0) > 1) {\r\n\t\t\t\tcaption = lastSelectedRow.map((x) => x.Caption);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!Array.isArray(itemKey)) {\r\n\t\t\tif ((globalItemsSelectedByUser?.length ?? 0) > 1) {\r\n\t\t\t\titemKey = globalItemsSelectedByUser ?? [];\r\n\t\t\t} else {\r\n\t\t\t\titemKey = actions.actions[i].itemKey;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst workflowButton = new WorkflowButton(\r\n\t\t\titemKey,\r\n\t\t\tactions.actions[i].actionKey,\r\n\t\t\tactions.actions[i].displayName,\r\n\t\t\tactions.actions[i].toolTip ?? \"\",\r\n\t\t\trecipients,\r\n\t\t\tactions.actions[i].messageTitle,\r\n\t\t\tactions.actions[i].messageDescription,\r\n\t\t\tactions.actions[i].selRecipientsTitle,\r\n\t\t\tfalse,\r\n\t\t\tcaption,\r\n\t\t\ti,\r\n\t\t\tactionIcon,\r\n\t\t\tactions.actions[i].duration ?? \"\",\r\n\t\t\tactions.actions[i].ignoreEmptyComment ?? false,\r\n\t\t\tactions.actions[i].selectRecipientsAsComplex ?? false,\r\n\t\t\tactions.actions[i].isCustomButton,\r\n\t\t\tactions.actions[i].removeFromList\r\n\t\t);\r\n\r\n\t\tif (workflowButton.isCustomButton) {\r\n\t\t\tcustomActionsButtons.push(workflowButton);\r\n\t\t} else if (workflowIsAvailable) {\r\n\t\t\tworkflowActionsButtons?.push(workflowButton);\r\n\t\t}\r\n\r\n\t\tworkflowStateForVarioObject = \"true\";\r\n\r\n\t\tif (where === \"varioObject\") {\r\n\t\t\t//osobny dla widoku varioobject + subelements\r\n\t\t\tworkflowActionsButtonsForVarioObject?.push(workflowButton);\r\n\r\n\t\t\tif (!workflowIsAvailable)\r\n\t\t\t\tworkflowActionsButtonsForVarioObject =\r\n\t\t\t\t\tworkflowActionsButtonsForVarioObject?.filter(\r\n\t\t\t\t\t\t(x) => x.isCustomButton\r\n\t\t\t\t\t) ?? [];\r\n\t\t}\r\n\t}\r\n\r\n\tif (where === \"varioObject\") {\r\n\t\talreadyDisplayed = 1;\r\n\t}\r\n\r\n\tappendWorkflowButtonsForVarioObject();\r\n\tappendWorkflowButtonsForSubelements();\r\n\r\n\tappendWorkflowButtons();\r\n}\r\n\r\nexport function appendWorkflowButtonsToDOM(\r\n\twhere: string,\r\n\tid: string,\r\n\tindexLocal: number,\r\n\telement: WorkflowButton\r\n) {\r\n\tconst typeFloating =\r\n\t\twhere === \"#popupWorkflowActions\" || where === \"#phoneActionButtonPanel\";\r\n\tif (typeFloating) {\r\n\t\t$(where).append(`\r\n
    \r\n
    ${element.displayName}
    \r\n
    \r\n
    `);\r\n\t} else {\r\n\t\t$(where).append(`\r\n
    \r\n
    \r\n

    ${element.displayName}

    \r\n
    `);\r\n\t}\r\n\r\n\t$(`${where} #${id}${indexLocal}`).on(\"mousedown touchstart\", () => {\r\n\t\tsetTimeout(\r\n\t\t\t() => {\r\n\t\t\t\tTryExecuteVarioAction(element);\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\twhere === \"#popupWorkflowActions\" ||\r\n\t\t\t\t\twhere === \"#phoneActionButtonPanel\"\r\n\t\t\t\t)\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t},\r\n\t\t\ttypeFloating ? 0 : 100\r\n\t\t);\r\n\t});\r\n}\r\n\r\n//funkcja sprawdzajaca stan workflow - wypluwa komunikat lub dodaje buttony\r\nexport function appendWorkflowButtons() {\r\n\tif (workflowState === \"true\" && workflowActionsButtons?.length) {\r\n\t\t//floating\r\n\t\t$(\"#popupWorkflowActions\").empty();\r\n\r\n\t\tfor (const element of workflowActionsButtons) {\r\n\t\t\tconst indexLocal = 0 + element.counter;\r\n\t\t\tappendWorkflowButtonsToDOM(\r\n\t\t\t\t\"#popupWorkflowActions\",\r\n\t\t\t\t\"workflowActionButton\",\r\n\t\t\t\tindexLocal,\r\n\t\t\t\telement\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\t//datagrid trzy kropki\r\n\t\twaitForElm(\"#workflowButtonsSubelementsView\").then(() => {\r\n\t\t\t$(\"#workflowButtonsSubelementsView\").empty();\r\n\t\t\t$(\"#workflowButtonsSubelementsView\").append(\"
    \");\r\n\r\n\t\t\tif (workflowActionsButtons)\r\n\t\t\t\tfor (const element of workflowActionsButtons) {\r\n\t\t\t\t\tconst indexLocal = 0 + element.counter;\r\n\t\t\t\t\tappendWorkflowButtonsToDOM(\r\n\t\t\t\t\t\t\"#workflowButtonsSubelementsView\",\r\n\t\t\t\t\t\t\"workflowActionButtonInPopover\",\r\n\t\t\t\t\t\tindexLocal,\r\n\t\t\t\t\t\telement\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t});\r\n\t} else if (\r\n\t\tworkflowState === \"false\" ||\r\n\t\t(workflowState === \"true\" && workflowActionsButtons?.length === 0)\r\n\t) {\r\n\t\t//Info o braku akcji\r\n\t\t$(\"#popupWorkflowActions\").empty();\r\n\t\t$(\"#popupWorkflowActions\").append(\r\n\t\t\t`

    Brak dost\u0119pnych polece\u0144 do wykonania

    `\r\n\t\t);\r\n\r\n\t\twaitForElm(\"#workflowButtonsSubelementsView\").then(() => {\r\n\t\t\t$(\"#workflowButtonsSubelementsView\").empty();\r\n\t\t\t$(\"#normalActionsSubelementsView hr\").remove();\r\n\t\t});\r\n\t} else if (workflowState === \"loading\") {\r\n\t\t$(\"#popupWorkflowActions\").empty();\r\n\t\t$(\"#popupWorkflowActions\").append(\r\n\t\t\t`

    Wczytywanie dost\u0119pnych polece\u0144 obiegu...

    `\r\n\t\t);\r\n\r\n\t\twaitForElm(\"#workflowButtonsSubelementsView\").then(() => {\r\n\t\t\t$(\"#workflowButtonsSubelementsView\").empty();\r\n\t\t\t$(\"#workflowButtonsSubelementsView\").append(\"
    \");\r\n\r\n\t\t\t$(\r\n\t\t\t\t\"#workflowButtonsSubelementsView\"\r\n\t\t\t).append(`
    \r\n
    \r\n
    .
    \r\n
    .
    \r\n
    .
    \r\n
    \r\n
    `);\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function appendWorkflowButtonsForSubelements() {\r\n\tif (modelSubElementsOnly !== \"True\") return;\r\n\r\n\tif (!$(\"#subelementsSidePanelWorkflow\").length && workflowIsAvailable)\r\n\t\t$(\"#subelementsSidePanel\").append(\r\n\t\t\t`
    `\r\n\t\t);\r\n\r\n\t$(\"#subelementsSidePanelWorkflow\").empty();\r\n\t$(\"#subelementsSidePanelOperationsCustom\").empty();\r\n\r\n\tif (customActionsButtons?.length) {\r\n\t\tfor (const element of customActionsButtons) {\r\n\t\t\tconst indexLocal = 0 + element.counter;\r\n\r\n\t\t\tappendWorkflowButtonsToDOM(\r\n\t\t\t\t\"#subelementsSidePanelOperationsCustom\",\r\n\t\t\t\t\"workflowActionButtonInToolbar\",\r\n\t\t\t\tindexLocal,\r\n\t\t\t\telement\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\tif (workflowState === \"true\" && workflowActionsButtons?.length) {\r\n\t\tfor (const element of workflowActionsButtons) {\r\n\t\t\tconst indexLocal = 0 + element.counter;\r\n\r\n\t\t\tappendWorkflowButtonsToDOM(\r\n\t\t\t\t\"#subelementsSidePanelWorkflow\",\r\n\t\t\t\t\"workflowActionButtonInToolbar\",\r\n\t\t\t\tindexLocal,\r\n\t\t\t\telement\r\n\t\t\t);\r\n\t\t}\r\n\t} else if (\r\n\t\tworkflowState === \"false\" ||\r\n\t\t(workflowState === \"true\" && workflowActionsButtons?.length === 0)\r\n\t) {\r\n\t\t//Info o braku akcji\r\n\t\tif (workflowIsAvailable) {\r\n\t\t\t$(\"#subelementsSidePanelWorkflow\").append(\r\n\t\t\t\t`

    Brak dost\u0119pnych polece\u0144 do wykonania

    `\r\n\t\t\t);\r\n\t\t}\r\n\t} else if (workflowState === \"loading\") {\r\n\t\tconst loadingCode = `
    \r\n
    \r\n
    .
    \r\n
    .
    \r\n
    .
    \r\n
    \r\n
    `;\r\n\r\n\t\t$(\"#subelementsSidePanelWorkflow\").append(loadingCode);\r\n\t\t$(\"#subelementsSidePanelOperationsCustom\").append(loadingCode);\r\n\t}\r\n}\r\n\r\nexport function appendOtherWorkflowButtonsForSubelements(\r\n\titemId: string,\r\n\tcanShowWorkflowMessageParam: string | boolean,\r\n\tothersWorkflowState: string\r\n) {\r\n\tconst panel = $(\"#subelementsSidePanel\");\r\n\r\n\tif (!panel.length) return;\r\n\r\n\tconst otherWorkflowOperations = getOtherWorkflowOperations(\r\n\t\titemId,\r\n\t\t\"True\",\r\n\t\tcanShowWorkflowMessageParam,\r\n\t\tothersWorkflowState\r\n\t);\r\n\r\n\tconst operationsDiv = panel.find(\"#subelementsSidePanelOperationsOther\");\r\n\r\n\tappendNotFloatingButtons(otherWorkflowOperations, operationsDiv);\r\n}\r\n\r\nexport function appendWorkflowButtonsForVarioObject() {\r\n\tconst btns =\r\n\t\tcheckWhereIsUser() === \"varioObject\"\r\n\t\t\t? workflowActionsButtonsForVarioObject\r\n\t\t\t: workflowActionsButtons;\r\n\r\n\tif (workflowStateForVarioObject === \"true\" && btns) {\r\n\t\t//trzy kropki na varioobject\r\n\t\t$(\"#buttonsPanelMiddle\").empty();\r\n\r\n\t\t//obliczanie czy guziki sie zmiescza - kazdy guzik ma 150px i odjecie guzika trzech kropek\r\n\t\tconst howManyButtonsFit = Math.floor(\r\n\t\t\t(($(\"#buttonsPanelMiddle\").width() ?? 0) -\r\n\t\t\t\t($(\"#workflowOperationsOptions\").width() ?? 0)) /\r\n\t\t\t\t150\r\n\t\t);\r\n\t\tconst howManyButtonsLeft = Math.floor(btns.length - howManyButtonsFit);\r\n\r\n\t\tif (!buttonsPanelMiddleResizer) {\r\n\t\t\tconst newResizeHandle = () => {\r\n\t\t\t\tappendWorkflowButtonsForVarioObject();\r\n\t\t\t};\r\n\t\t\tbuttonsPanelMiddleResizer = new ResizeObserver(newResizeHandle);\r\n\t\t\tif (document.getElementById(\"buttonsPanelMiddle\"))\r\n\t\t\t\tbuttonsPanelMiddleResizer.observe(\r\n\t\t\t\t\tdocument.getElementById(\"buttonsPanelMiddle\") as HTMLElement\r\n\t\t\t\t);\r\n\t\t}\r\n\r\n\t\t//dodawanie guzikow do panelu w variobject toolbar\r\n\t\tfor (const element of btns) {\r\n\t\t\tconst indexLocal = 0 + element.counter;\r\n\t\t\tif (indexLocal + 1 > howManyButtonsFit) break;\r\n\r\n\t\t\tappendWorkflowButtonsToDOM(\r\n\t\t\t\t\"#buttonsPanelMiddle\",\r\n\t\t\t\t\"workflowActionButtonInToolbar\",\r\n\t\t\t\tindexLocal,\r\n\t\t\t\telement\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\t//varioobject toolbar trzy kropki\r\n\t\twaitForElm(\"#workflowButtonsVarioObjectView\").then(() => {\r\n\t\t\t$(\"#workflowButtonsVarioObjectView\").empty();\r\n\t\t\t$(\"#customButtonsVarioObjectView\").empty();\r\n\r\n\t\t\tif (howManyButtonsLeft > 0 && btns) {\r\n\t\t\t\t//jesli nie miesci sie reszta to dodajemy do trzech kropek\r\n\t\t\t\tfor (const element of btns) {\r\n\t\t\t\t\tconst indexLocal = 0 + element.counter;\r\n\t\t\t\t\tif (indexLocal + 1 <= howManyButtonsFit) continue;\r\n\r\n\t\t\t\t\tlet where = \"#workflowButtonsVarioObjectView\";\r\n\r\n\t\t\t\t\tif (element.isCustomButton) {\r\n\t\t\t\t\t\tif ($(\"#customButtonsVarioObjectView\").find(\"hr\").length === 0)\r\n\t\t\t\t\t\t\t$(\"#customButtonsVarioObjectView\").append(\"
    \");\r\n\t\t\t\t\t\twhere = \"#customButtonsVarioObjectView\";\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif ($(\"#workflowButtonsVarioObjectView\").find(\"hr\").length === 0)\r\n\t\t\t\t\t\t\t$(\"#workflowButtonsVarioObjectView\").append(\"
    \");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tappendWorkflowButtonsToDOM(\r\n\t\t\t\t\t\twhere,\r\n\t\t\t\t\t\t\"workflowActionButtonInToolbar\",\r\n\t\t\t\t\t\tindexLocal,\r\n\t\t\t\t\t\telement\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} else if (workflowStateForVarioObject === \"false\") {\r\n\t\t//Info o braku akcji\r\n\t\tif (!isRunningOnMobile()) {\r\n\t\t\t$(\"#buttonsPanelMiddle\").empty();\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\t$(\"#buttonsPanelMiddle .noActions\").removeClass(\"visible-animation\");\r\n\t\t\t\t$(\"#buttonsPanelMiddle .noActions\").addClass(\"hidden-animation\");\r\n\t\t\t}, 2000);\r\n\r\n\t\t\twaitForElm(\"#workflowButtonsVarioObjectView\").then(() => {\r\n\t\t\t\t$(\"#workflowButtonsVarioObjectView\").empty();\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t$(\"#buttonsPanelMiddle\").empty();\r\n\t\t\twaitForElm(\"#workflowButtonsVarioObjectView\").then(() => {\r\n\t\t\t\t$(\"#workflowButtonsVarioObjectView\").empty();\r\n\t\t\t});\r\n\t\t}\r\n\t} else if (workflowStateForVarioObject === \"loading\") {\r\n\t\t$(\"#buttonsPanelMiddle\").empty();\r\n\t\t$(\r\n\t\t\t\"#buttonsPanelMiddle\"\r\n\t\t).append(`
    \r\n
    \r\n
    .
    \r\n
    .
    \r\n
    .
    \r\n
    \r\n
    `);\r\n\t}\r\n}\r\n\r\nexport function appendCustomActionButtons(where = \"#phoneActionButtonPanel\") {\r\n\tif (!customActionsButtons?.length) return;\r\n\r\n\tfor (const element of customActionsButtons) {\r\n\t\tconst indexLocal = 0 + element.counter;\r\n\t\tappendWorkflowButtonsToDOM(\r\n\t\t\twhere,\r\n\t\t\t\"customActionButton\",\r\n\t\t\tindexLocal,\r\n\t\t\telement\r\n\t\t);\r\n\t}\r\n}\r\n\r\n//Wylaczenie dynamicznie stworzonych akcji workflow floating buttona\r\nexport function clearDynamicWorkflowActionsForFloatingButton() {\r\n\tworkflowState = \"loading\";\r\n\r\n\tworkflowActionsButtons = null;\r\n\tcustomActionsButtons = null;\r\n\r\n\tappendWorkflowButtons();\r\n}\r\n\r\n//Wylaczenie dynamicznie stworzonych akcji workflow trzech kropek w varioobject\r\nexport function clearDynamicWorkflowActionsForVarioObject() {\r\n\tworkflowStateForVarioObject = \"loading\";\r\n\r\n\tworkflowActionsButtonsForVarioObject = null;\r\n\r\n\tappendWorkflowButtonsForVarioObject();\r\n}\r\n\r\nexport function getOtherWorkflowOperations(\r\n\titemId: string,\r\n\tcanShowWorkflowOptionsPar: string | boolean,\r\n\tcanShowWorkflowMessagePar: string | boolean,\r\n\tothersWorkflowState: string\r\n): FloatingButtonItem[] {\r\n\tconst otherWorkflowButtons: FloatingButtonItem[] = [];\r\n\r\n\tif (othersWorkflowState === \"true\") {\r\n\t\tif (\r\n\t\t\tcanShowWorkflowMessagePar === true ||\r\n\t\t\tcanShowWorkflowMessageParam === true\r\n\t\t) {\r\n\t\t\totherWorkflowButtons.push({\r\n\t\t\t\ttext: \"Tre\u015B\u0107 polecenia\",\r\n\t\t\t\ticon: \"fas fa-comment-dots\",\r\n\t\t\t\torder: 1,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tworkflowMessage(itemId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(itemId, \"Opcje obiegu.Tre\u015B\u0107 polecenia\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (itemId && canShowWorkflowOptionsPar === \"True\") {\r\n\t\t\totherWorkflowButtons.push({\r\n\t\t\t\ttext: \"Historia obiegu\",\r\n\t\t\t\ticon: \"fas fa-history\",\r\n\t\t\t\torder: 2,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tworkflowHistory(itemId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(itemId, \"Opcje obiegu.Historia obiegu\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\r\n\t\t\totherWorkflowButtons.push({\r\n\t\t\t\ttext: \"Diagram obiegu\",\r\n\t\t\t\ticon: \"fas fa-project-diagram\",\r\n\t\t\t\torder: 3,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tworkflowDiagram(itemId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(itemId, \"Opcje obiegu.Diagram obiegu\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\r\n\t\t\totherWorkflowButtons.push({\r\n\t\t\t\ttext: \"Diagram progresywny\",\r\n\t\t\t\ticon: \"fas fa-user-clock\",\r\n\t\t\t\torder: 4,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tworkflowDiagramProgressive(itemId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(itemId, \"Opcje obiegu.Diagram progresywny\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\r\n\t\t\totherWorkflowButtons.push({\r\n\t\t\t\ttext: \"Raport polece\u0144 obiegu\",\r\n\t\t\t\ticon: \"fas fa-table\",\r\n\t\t\t\torder: 5,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tworkflowReport(itemId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(itemId, \"Opcje obiegu.Raport polece\u0144 obiegu\");\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\totherWorkflowButtons.sort((a, b) => a.order - b.order);\r\n\treturn otherWorkflowButtons;\r\n}\r\n\r\nexport function AppendOthersWorkflowActions(\r\n\titemId: string,\r\n\tcanShowWorkflowOptionsPar: string | boolean,\r\n\tcanShowWorkflowMessagePar: string | boolean,\r\n\tothersWorkflowState: string,\r\n\twhere = \"#workflowActions\"\r\n) {\r\n\tlet otherWorkflowButtons: FloatingButtonItem[] = [];\r\n\t$(where).empty();\r\n\r\n\tif (othersWorkflowState === \"loading\") {\r\n\t\t$(where).append(\r\n\t\t\t'

    \u0141adowanie...

    '\r\n\t\t);\r\n\t} else if (othersWorkflowState === \"false\") {\r\n\t\t$(where).append(\r\n\t\t\t'

    Brak dost\u0119pnych opcji obiegu

    '\r\n\t\t);\r\n\t} else {\r\n\t\totherWorkflowButtons = getOtherWorkflowOperations(\r\n\t\t\titemId,\r\n\t\t\tcanShowWorkflowOptionsPar,\r\n\t\t\tcanShowWorkflowMessagePar,\r\n\t\t\tothersWorkflowState\r\n\t\t);\r\n\t\tappendFloatingButtons(otherWorkflowButtons, where);\r\n\t}\r\n}\r\n\r\nexport function getEditOperations(\r\n\titemId: string | string[],\r\n\tcontainerId: string,\r\n\tcaption: string,\r\n\tdefinitionKey: string,\r\n\thashId: string,\r\n\tfromVarioObject?: boolean | null,\r\n\tisReport?: boolean\r\n): FloatingButtonItem[] {\r\n\tconst editButtons: FloatingButtonItem[] = [];\r\n\r\n\t//czy klikniety na varioobject samym\r\n\tif (fromVarioObject == null) {\r\n\t\tfromVarioObject = !JSON.parse(modelSubElementsOnly.toLowerCase());\r\n\t\tif (\r\n\t\t\t$(\"#Tabela\").length > 0 &&\r\n\t\t\t(getSelectedRows().length || globalItemsSelectedByUser?.length)\r\n\t\t)\r\n\t\t\tfromVarioObject = false;\r\n\t}\r\n\r\n\tif (!fromVarioObject) {\r\n\t\teditButtons.push({\r\n\t\t\ttext: \"Dodaj kolumn\u0119\",\r\n\t\t\ticon: \"fas fa-grip-horizontal\",\r\n\t\t\torder: 1,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddColumnAdditionalPropertiesPopup(containerId);\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddOperation(itemId, \"Edycja.Dodaj kolumn\u0119\");\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t}\r\n\r\n\tif (itemId && !Array.isArray(itemId) && isReport && isReportDesigner) {\r\n\t\teditButtons.push({\r\n\t\t\ttext: \"Projektuj raport\",\r\n\t\t\ticon: \"fas fa-edit\",\r\n\t\t\torder: 2,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tchangeCurrentItem({\r\n\t\t\t\t\t\titemId: itemId,\r\n\t\t\t\t\t\tinnerCall: false,\r\n\t\t\t\t\t\tdesigner: true,\r\n\t\t\t\t\t});\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddOperation(itemId, \"Edycja.ProjektujRaport\");\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t}\r\n\r\n\tif (itemId && !Array.isArray(itemId) && !ContainMinusID(itemId)) {\r\n\t\tif (!fromVarioObject) {\r\n\t\t\teditButtons.push({\r\n\t\t\t\ttext: \"Wytnij\",\r\n\t\t\t\ticon: \"fas fa-cut\",\r\n\t\t\t\torder: 3,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\teditCut(itemId, containerId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(itemId, \"Edycja.Wytnij\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\teditButtons.push({\r\n\t\t\ttext: \"Kopiuj\",\r\n\t\t\ticon: \"fas fa-copy\",\r\n\t\t\torder: 4,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\teditCopy(itemId, containerId);\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddOperation(itemId, \"Edycja.Kopiuj\");\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\r\n\t\tif (!stringIsNullOrEmpty(hashId) && !!navigator?.clipboard?.writeText) {\r\n\t\t\teditButtons.push({\r\n\t\t\t\ttext: \"Kopiuj link\",\r\n\t\t\t\ticon: \"fas fa-link\",\r\n\t\t\t\torder: 8,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tcopyVarioObjectLink(hashId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(itemId, \"Edycja.Kopiuj link\");\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\tconst GlobalCopyBufferFromSession = JSON.parse(\r\n\t\tlocalStorage.getItem(\"GlobalCopyBuffer\") ?? \"null\"\r\n\t);\r\n\r\n\tlet canAppendPasteButton = true;\r\n\tif (fromVarioObject) {\r\n\t\tif (cardViewWithSubElements !== \"True\") {\r\n\t\t\tcanAppendPasteButton = false;\r\n\t\t}\r\n\t}\r\n\r\n\tif (\r\n\t\tGlobalCopyBufferFromSession?.itemsId?.length > 0 &&\r\n\t\tGlobalCopyBufferFromSession?.operation === \"CUT\"\r\n\t) {\r\n\t\tif (canAppendPasteButton) {\r\n\t\t\teditButtons.push({\r\n\t\t\t\ttext: \"Wklej\",\r\n\t\t\t\ticon: \"fas fa-clone\",\r\n\t\t\t\torder: 5,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\teditPaste(containerId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(containerId, \"Edycja.Wklej\");\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\tif (\r\n\t\tGlobalCopyBufferFromSession?.itemsId?.length > 0 &&\r\n\t\tGlobalCopyBufferFromSession?.operation === \"COPY\"\r\n\t) {\r\n\t\tif (canAppendPasteButton) {\r\n\t\t\teditButtons.push({\r\n\t\t\t\ttext: \"Wklej kopi\u0119\",\r\n\t\t\t\ticon: \"fas fa-clone\",\r\n\t\t\t\torder: 6,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\teditPasteAsCopy(containerId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(containerId, \"Edycja.Wklej kopi\u0119\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\r\n\t\t\teditButtons.push({\r\n\t\t\t\ttext: \"Wklej\",\r\n\t\t\t\ticon: \"fas fa-paste\",\r\n\t\t\t\torder: 7,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\teditPasteAsLink(containerId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(containerId, \"Edycja.Wklej\");\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\tif (\r\n\t\t!Array.isArray(itemId) &&\r\n\t\tcaption?.length > 0 &&\r\n\t\t!itemId.includes(\"Inbox\") &&\r\n\t\t!itemId.includes(\"Sent\") &&\r\n\t\t!itemId.includes(\"Correspondence\") &&\r\n\t\t!subElementsModel[modelSubElementsOnly].currentUrlItemId?.includes(\r\n\t\t\t\"Workflow\"\r\n\t\t) &&\r\n\t\t!subElementsModel[modelSubElementsOnly].currentUrlItemId?.includes(\r\n\t\t\t\"COperations\"\r\n\t\t) &&\r\n\t\t!subElementsModel[modelSubElementsOnly].currentUrlItemId?.includes(\r\n\t\t\t\"I3:TT\"\r\n\t\t) &&\r\n\t\t!caption.includes(\"Brak uprawnie\u0144 do odczytu\")\r\n\t) {\r\n\t\teditButtons.push({\r\n\t\t\timportant: true,\r\n\t\t\ttext: \"Edytuj\",\r\n\t\t\ticon: \"fas fa-pencil-alt\",\r\n\t\t\torder: 10,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tif (isRunningOnMobile() || gridInlineEditor === \"False\") {\r\n\t\t\t\t\t\tEditSelectedItem(itemId, definitionKey);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tconst obj = {\r\n\t\t\t\t\t\t\tcomponent: $(`#${lastSelectedRow[0].gridEl}`).dxDataGrid(\r\n\t\t\t\t\t\t\t\t\"instance\"\r\n\t\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\trow: { data: lastSelectedRow[0] },\r\n\t\t\t\t\t\t\telement: $(`#${lastSelectedRow[0].gridEl}`),\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tonEditRowClick(obj);\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\thideFloatingButtonOnOpeningEditor();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddOperation(itemId, \"Edycja.Edytuj\");\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t}\r\n\r\n\tlet havePermissions = true;\r\n\tconst dsDataSource = $(\"#Tabela\")\r\n\t\t?.dxDataGrid(\"instance\")\r\n\t\t?.getDataSource() as any;\r\n\tconst multiselect = lastSelectedRow?.length > 1;\r\n\r\n\tif (multiselect && dsDataSource?._items != null) {\r\n\t\tfor (let i = 0; i < dsDataSource?._items.length; i++) {\r\n\t\t\tif (globalItemsSelectedByUser?.includes(dsDataSource?._items[i].ItemID)) {\r\n\t\t\t\tif (\r\n\t\t\t\t\tdsDataSource?._items[i].Caption.includes(\"Brak uprawnie\u0144 do odczytu\")\r\n\t\t\t\t) {\r\n\t\t\t\t\thavePermissions = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (\r\n\t\t!multiselect &&\r\n\t\thavePermissions &&\r\n\t\tisAdmin &&\r\n\t\t!Array.isArray(itemId) &&\r\n\t\t!ContainMinusID(itemId)\r\n\t) {\r\n\t\teditButtons.push({\r\n\t\t\ttext: \"Sprawd\u017A wyra\u017Cenie wyliczane\",\r\n\t\t\ticon: \"fas fa-code\",\r\n\t\t\torder: 9,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tevalValuePopup(itemId, caption);\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddOperation(itemId, \"Edycja.Sprawd\u017A wyra\u017Cenie wyliczane\");\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t}\r\n\r\n\tconst canShowDeleteButton =\r\n\t\t(multiselect && havePermissions) || itemId || fromVarioObject;\r\n\r\n\tif (canShowDeleteButton) {\r\n\t\teditButtons.push({\r\n\t\t\timportant: true,\r\n\t\t\ttext: \"Usu\u0144\",\r\n\t\t\ticon: \"fas fa-trash\",\r\n\t\t\tstyle: \"color: rgb(167,59,67) !important\",\r\n\t\t\torder: 11,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\tif ($(\"#Tabela\").length > 0 && multiselect && havePermissions) {\r\n\t\t\t\t\t\t\t//Usuwanie multiSelect\r\n\t\t\t\t\t\t\tconst ids = lastSelectedRow?.map((x) => x.ItemID);\r\n\t\t\t\t\t\t\tTryDeleteVarioObjects(false, ids);\r\n\t\t\t\t\t\t\taddOperation(ids ?? [], \"Edycja.Usu\u0144\");\r\n\t\t\t\t\t\t} else if (\r\n\t\t\t\t\t\t\t$(\"#Tabela\").length > 0 &&\r\n\t\t\t\t\t\t\titemId &&\r\n\t\t\t\t\t\t\tfromVarioObject !== true\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\t//Usuwanie widok tabelki, pojedyncze zaznczenie\r\n\t\t\t\t\t\t\tTryDeleteVarioObjects(true, itemId);\r\n\t\t\t\t\t\t\taddOperation(itemId, \"Edycja.Usu\u0144\");\r\n\t\t\t\t\t\t} else if (fromVarioObject) {\r\n\t\t\t\t\t\t\t//Usuwanie widok karty\r\n\t\t\t\t\t\t\tTryDeleteVarioObject(modelId, containerKey);\r\n\t\t\t\t\t\t\taddOperation(modelId, \"Edycja.Usu\u0144\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, 100);\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\r\n\t\tif (!fromVarioObject) {\r\n\t\t\teditButtons.push({\r\n\t\t\t\ttext: \"Wypnij\",\r\n\t\t\t\ticon: \"fas fa-unlink\",\r\n\t\t\t\tstyle: \"color: rgb(167,59,67) !important\",\r\n\t\t\t\torder: 12,\r\n\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tif ($(\"#Tabela\").length > 0 && multiselect && havePermissions) {\r\n\t\t\t\t\t\t\t//Wypinanie multiSelect\r\n\t\t\t\t\t\t\tTryUnlinkVarioObjects(false);\r\n\t\t\t\t\t\t\taddOperation(globalItemsSelectedByUser ?? [], \"Edycja.Wypnij\");\r\n\t\t\t\t\t\t} else if ($(\"#Tabela\").length > 0 && itemId && !fromVarioObject) {\r\n\t\t\t\t\t\t\t//Wypinanie widok tabelki, pojedyncze zaznczenie\r\n\t\t\t\t\t\t\tTryUnlinkVarioObjects(true, itemId);\r\n\t\t\t\t\t\t\taddOperation(itemId, \"Edycja.Wypnij\");\r\n\t\t\t\t\t\t}\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\teditButtons.sort((a, b) => a.order - b.order);\r\n\treturn editButtons;\r\n}\r\n\r\nexport function AppendEditOperations(\r\n\titemId: string,\r\n\tcontainerId: string,\r\n\tcaption: string,\r\n\tdefinitionKey: string,\r\n\thashId: string,\r\n\tfromVarioObject: boolean,\r\n\twhere = \"#phoneSpecialActionsEdit\"\r\n) {\r\n\tconst editButtons = getEditOperations(\r\n\t\titemId,\r\n\t\tcontainerId,\r\n\t\tcaption,\r\n\t\tdefinitionKey,\r\n\t\thashId,\r\n\t\tfromVarioObject\r\n\t);\r\n\r\n\tappendFloatingButtons(editButtons, where);\r\n}\r\n\r\nexport function getCalendarOperations(model: FloatingButtonData | null) {\r\n\tconst calendarBtns: FloatingButtonItem[] = [];\r\n\tconst id = model?.id;\r\n\r\n\tif (id) {\r\n\t\tif (model?.canReject) {\r\n\t\t\tcalendarBtns.push({\r\n\t\t\t\ttext: \"Odrzu\u0107 uczestnictwo\",\r\n\t\t\t\ticon: \"fas fa-arrow-circle-left\",\r\n\t\t\t\torder: 2,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tRejectParticipationFromCallendar(\r\n\t\t\t\t\t\t\tid,\r\n\t\t\t\t\t\t\tmodel.rejectWithInfo ?? false,\r\n\t\t\t\t\t\t\tcontainerId\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(id, \"Terminarz.Odrzu\u0107 uczestnictwo\");\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (model?.canAccept) {\r\n\t\t\tcalendarBtns.push({\r\n\t\t\t\ttext: \"Akceptuj uczestnictwo\",\r\n\t\t\t\ticon: \"fas fa-arrow-circle-down\",\r\n\t\t\t\torder: 3,\r\n\t\t\t\tfunctions: [\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tAcceptParticipationFromCallendar(id, containerId);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\taddOperation(id, \"Terminarz.Akceptuj uczestnictwo\");\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\tif (model?.visibleShare && !!navigator?.clipboard?.writeText) {\r\n\t\tcalendarBtns.push({\r\n\t\t\ttext: \"Skopiuj link do terminarza\",\r\n\t\t\ticon: \"fas fa-clipboard\",\r\n\t\t\torder: 4,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCopyToClipboard();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddOperation(containerId, \"Terminarz.Skopiuj link do terminarza\");\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\r\n\t\tcalendarBtns.push({\r\n\t\t\ttext: \"Zako\u0144cz udost\u0119pnianie terminarza\",\r\n\t\t\ticon: \"fas fa-ban\",\r\n\t\t\torder: 5,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tDeleteShareCalendars();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddOperation(\r\n\t\t\t\t\t\tcontainerId,\r\n\t\t\t\t\t\t\"Terminarz.Zako\u0144cz udost\u0119pnianie terminarza\"\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\tif (!model?.visibleShare) {\r\n\t\tcalendarBtns.push({\r\n\t\t\ttext: \"Udost\u0119pnij terminarz\",\r\n\t\t\ticon: \"fas fa-share-alt\",\r\n\t\t\torder: 6,\r\n\t\t\tfunctions: [\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCloseDialogOperations();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tCreateShareCalendar();\r\n\t\t\t\t},\r\n\t\t\t\t() => {\r\n\t\t\t\t\taddOperation(containerId, \"Terminarz.Udost\u0119pnij terminarz\");\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t}\r\n\r\n\tcalendarBtns.sort((a, b) => a.order - b.order);\r\n\treturn calendarBtns;\r\n}\r\n\r\nexport function appendFloatingButtons(\r\n\tbuttons: FloatingButtonItem[] = globalThis.floatingButtons,\r\n\twhere: string | JQuery = \"#phoneActionButtonPanel\"\r\n) {\r\n\t$(where as string).empty();\r\n\r\n\tif (buttons) {\r\n\t\tif (where === \"#phoneActionButtonPanel\") {\r\n\t\t\t$(\"#mockupFAB\").off(\"click\");\r\n\r\n\t\t\t$(\"#mockupFAB\").on(\"click\", () => {\r\n\t\t\t\tCloseDialogOperations();\r\n\t\t\t});\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\t$(\"#devex-dialog-operations\").dxPopup(\"instance\").repaint();\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tfor (const btn of buttons) {\r\n\t\t\tif (btn.customHTML) {\r\n\t\t\t\t$(where as string).append(btn.customHTML);\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tlet icon = ``;\r\n\t\t\tif (btn.icon?.includes(\"\r\n
    \r\n ${btn.text}\r\n
    \r\n
    \r\n ${icon}\r\n
    \r\n
    \r\n `).appendTo(where as string);\r\n\r\n\t\t\tbutton.on(\"click\", () => {\r\n\t\t\t\tif (btn.items?.length) {\r\n\t\t\t\t\tappendInnerFloatingButtons(btn, where);\r\n\t\t\t\t} else if (btn.functions)\r\n\t\t\t\t\tfor (const func of btn.functions) {\r\n\t\t\t\t\t\tfunc();\r\n\t\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function appendInnerFloatingButtons(\r\n\tbtn: FloatingButtonItem,\r\n\twhere: string | JQuery\r\n) {\r\n\t$(\"#mockupFAB\").off(\"click\");\r\n\r\n\tconst isInner =\r\n\t\t$(\"#devex-dialog-operations\").data(\"actionsForButtons\") === true;\r\n\r\n\tconst buttons = isInner\r\n\t\t? globalThis.floatingButtons.find((x) => x?.text?.includes(\"Dla: \"))?.items\r\n\t\t: globalThis.floatingButtons;\r\n\r\n\tswitch (btn.text) {\r\n\t\tcase \"Polecenia obiegu\": {\r\n\t\t\tconst origWhere = where;\r\n\t\t\t$(where as string)\r\n\t\t\t\t.empty()\r\n\t\t\t\t.append('
    ');\r\n\t\t\twhere = \"#popupWorkflowActions\";\r\n\r\n\t\t\tappendFloatingButtons(\r\n\t\t\t\tbuttons\r\n\t\t\t\t\t?.flatMap((x) => x.items)\r\n\t\t\t\t\t?.find((x) => x?.text === \"Polecenia obiegu\")?.items,\r\n\t\t\t\twhere\r\n\t\t\t);\r\n\r\n\t\t\t$(\"#mockupFAB\").off(\"click\");\r\n\t\t\t$(\"#mockupFAB\").on(\"click\", () => {\r\n\t\t\t\tconst thisBtn = buttons?.find(\r\n\t\t\t\t\t(x) => x.text === \"Poka\u017C wi\u0119cej opcji...\"\r\n\t\t\t\t);\r\n\t\t\t\tif (thisBtn) appendInnerFloatingButtons(thisBtn, origWhere);\r\n\t\t\t});\r\n\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase \"Edycja\": {\r\n\t\t\tappendFloatingButtons(\r\n\t\t\t\tbuttons?.flatMap((x) => x.items)?.find((x) => x?.text === \"Edycja\")\r\n\t\t\t\t\t?.items,\r\n\t\t\t\twhere\r\n\t\t\t);\r\n\r\n\t\t\t$(\"#mockupFAB\").off(\"click\");\r\n\t\t\t$(\"#mockupFAB\").on(\"click\", () => {\r\n\t\t\t\tconst thisBtn = buttons?.find(\r\n\t\t\t\t\t(x) => x.text === \"Poka\u017C wi\u0119cej opcji...\"\r\n\t\t\t\t);\r\n\t\t\t\tif (thisBtn) appendInnerFloatingButtons(thisBtn, where);\r\n\t\t\t});\r\n\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase \"Operacje\": {\r\n\t\t\tappendFloatingButtons(\r\n\t\t\t\tbuttons?.flatMap((x) => x.items)?.find((x) => x?.text === \"Operacje\")\r\n\t\t\t\t\t?.items,\r\n\t\t\t\twhere\r\n\t\t\t);\r\n\r\n\t\t\t$(\"#mockupFAB\").off(\"click\");\r\n\t\t\t$(\"#mockupFAB\").on(\"click\", () => {\r\n\t\t\t\tconst thisBtn = buttons?.find(\r\n\t\t\t\t\t(x) => x.text === \"Poka\u017C wi\u0119cej opcji...\"\r\n\t\t\t\t);\r\n\t\t\t\tif (thisBtn) appendInnerFloatingButtons(thisBtn, where);\r\n\t\t\t});\r\n\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase \"Poka\u017C wi\u0119cej opcji...\": {\r\n\t\t\tappendFloatingButtons(\r\n\t\t\t\tbuttons?.find((x) => x?.text === \"Poka\u017C wi\u0119cej opcji...\")?.items,\r\n\t\t\t\twhere\r\n\t\t\t);\r\n\r\n\t\t\t$(\"#mockupFAB\").off(\"click\");\r\n\t\t\t$(\"#mockupFAB\").on(\"click\", () => {\r\n\t\t\t\tappendFloatingButtons(buttons, where);\r\n\t\t\t});\r\n\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase \"Otw\u00F3rz plik jako...\": {\r\n\t\t\tappendFloatingButtons(\r\n\t\t\t\tbuttons\r\n\r\n\t\t\t\t\t?.flatMap((x) => x?.items)\r\n\t\t\t\t\t.find((x) => x?.text === \"Otw\u00F3rz plik jako...\")?.items,\r\n\t\t\t\twhere\r\n\t\t\t);\r\n\r\n\t\t\t$(\"#mockupFAB\").off(\"click\");\r\n\t\t\t$(\"#mockupFAB\").on(\"click\", () => {\r\n\t\t\t\tconst thisBtn = buttons?.find(\r\n\t\t\t\t\t(x) => x?.text === \"Poka\u017C wi\u0119cej opcji...\"\r\n\t\t\t\t);\r\n\t\t\t\tif (thisBtn) appendInnerFloatingButtons(thisBtn, where);\r\n\t\t\t});\r\n\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tdefault:\r\n\t\t\tif (btn.text.includes(\"Dla: \")) {\r\n\t\t\t\tappendFloatingButtons(\r\n\t\t\t\t\tglobalThis.floatingButtons.find((x) => x?.text?.includes(\"Dla: \"))\r\n\t\t\t\t\t\t?.items,\r\n\t\t\t\t\twhere\r\n\t\t\t\t);\r\n\r\n\t\t\t\t$(\"#devex-dialog-operations\").data(\"actionsForButtons\", true);\r\n\r\n\t\t\t\t$(\"#mockupFAB\").off(\"click\");\r\n\t\t\t\t$(\"#mockupFAB\").on(\"click\", () => {\r\n\t\t\t\t\t$(\"#devex-dialog-operations\").data(\"actionsForButtons\", false);\r\n\t\t\t\t\tappendFloatingButtons(globalThis.floatingButtons, where);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t}\r\n}\r\n\r\nexport function appendNotFloatingButtons(\r\n\tbuttons: FloatingButtonItem[],\r\n\twhere: string | JQuery\r\n) {\r\n\tif (typeof where === \"string\") where = $(where);\r\n\twhere.empty();\r\n\r\n\tif (buttons)\r\n\t\tfor (const btn of buttons) {\r\n\t\t\tif (btn.customHTML) {\r\n\t\t\t\twhere.append(btn.customHTML);\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tlet icon = ``;\r\n\t\t\tif (btn.icon?.includes(\"\r\n
    \r\n ${icon}\r\n
    \r\n
    \r\n

    ${btn.text}

    \r\n
    \r\n
    `).appendTo(where);\r\n\r\n\t\t\titem.on(\"mousedown touchstart\", () => {\r\n\t\t\t\tif (btn.functions)\r\n\t\t\t\t\tfor (const func of btn.functions) {\r\n\t\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\t\tfunc();\r\n\t\t\t\t\t\t}, 0);\r\n\t\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n}\r\n\r\nexport function getOpenLinkFunctions(\r\n\tmodel: {\r\n\t\tcontentFileType?: string;\r\n\t\tFileExtension?: string;\r\n\t\tlinkToView?: string;\r\n\t\tSmallImage?: string;\r\n\t},\r\n\titemId: string,\r\n\tcaption: string\r\n) {\r\n\tconst openLinkFuncs = [\r\n\t\t() => {\r\n\t\t\tCloseDialogOperations();\r\n\t\t},\r\n\t];\r\n\r\n\tconst supported =\r\n\t\tsupportedContent.checkIfSupported(model?.contentFileType) ||\r\n\t\tsupportedContent.checkIfSupported(model?.FileExtension);\r\n\tconst whichType =\r\n\t\tsupportedContent.checkWhichTypeOfFile(model?.contentFileType ?? \"\") ||\r\n\t\tsupportedContent.checkWhichTypeOfFile(model?.FileExtension ?? \"\");\r\n\r\n\tif (\r\n\t\t!stringIsNullOrEmpty(itemId) &&\r\n\t\tisRunningOnMobile() &&\r\n\t\tconvertPDFToImagesOnMobile === \"True\" &&\r\n\t\t(model?.contentFileType?.includes(\"pdf\") ||\r\n\t\t\tmodel?.SmallImage?.includes(\".pdf\") ||\r\n\t\t\tmodel?.FileExtension === \".pdf\")\r\n\t) {\r\n\t\topenLinkFuncs.push(() => {\r\n\t\t\topenConvertedPDFsInNewTab(itemId);\r\n\t\t});\r\n\t} else if (supported && whichType !== \"spreadsheet\") {\r\n\t\topenLinkFuncs.push(() => {\r\n\t\t\tpreviewFile(itemId, undefined, undefined, model?.linkToView);\r\n\t\t});\r\n\t} else {\r\n\t\topenLinkFuncs.push(() => {\r\n\t\t\tdownloadFileFromLink(model?.linkToView, undefined, caption);\r\n\t\t});\r\n\t}\r\n\r\n\treturn openLinkFuncs;\r\n}\r\n", "import \"../types/dx.all.d.ts\";\r\nimport type { Appointment } from \"../types/models/vario-types\";\r\nimport { LoadSubElementsEditor } from \"./editor\";\r\nimport { AcceptParticipation, RejectParticipation } from \"./floating-actions\";\r\nimport { createFloatingButton, newDocument } from \"./floating-buttons\";\r\nimport { GetBaseUrl } from \"./page-navigation\";\r\nimport { ShowLoadingPanel, showDxToast } from \"./site\";\r\n\r\ndeclare global {\r\n\tvar calendarLink: string;\r\n\tvar lastAppointmentData: DevExpress.ui.dxScheduler.Appointment | null;\r\n\tvar lastClickedCell: boolean;\r\n\tvar exist: string;\r\n\tvar alreadyExist: boolean;\r\n\tvar itemType: string;\r\n\tvar itemId: string;\r\n\tvar scheduleData: Appointment[];\r\n}\r\n\r\nglobalThis.calendarLink = \"\";\r\nglobalThis.lastAppointmentData = null;\r\nglobalThis.exist = \"\";\r\nglobalThis.alreadyExist = false;\r\nglobalThis.itemType = \"\";\r\nglobalThis.itemId = \"\";\r\nglobalThis.scheduleData = [];\r\n\r\n// Okre\u015Bla czy nale\u017Cy wy\u0142\u0105czy\u0107 akcje akceptacji/ odrzucenia terminu po klikni\u0119ciu w pust\u0105 kom\u00F3rk\u0119.\r\nglobalThis.lastClickedCell = true;\r\n\r\nexport function onSchedulerReady() {\r\n\tgetCurrentDate();\r\n\tgetCurrentView();\r\n\r\n\tPrepareFloatingButton();\r\n}\r\n\r\nexport function getScheduleById(itemId: string) {\r\n\treturn DevExpress.data\r\n\t\t.query(scheduleData)\r\n\t\t.filter((x) => x.AppointmentId === itemId)\r\n\t\t.toArray()[0];\r\n}\r\n\r\nexport function getCurrentDate(\r\n\te?:\r\n\t\t| DevExpress.ui.dxScheduler.OptionChangedEvent\r\n\t\t| DevExpress.ui.dxScheduler.CellClickEvent\r\n\t\t| DevExpress.ui.dxScheduler.AppointmentClickEvent\r\n) {\r\n\tif (e) {\r\n\t\tif (\"cellData\" in e && e.cellData) {\r\n\t\t\tsessionStorage.setItem(\"currentDateInScheduler\", e.cellData.startDate);\r\n\t\t} else if (\"appointmentData\" in e && e.appointmentData) {\r\n\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\"currentDateInScheduler\",\r\n\t\t\t\te.appointmentData.StartDate\r\n\t\t\t);\r\n\t\t} else if (\"name\" in e && e.name === \"currentDate\") {\r\n\t\t\tsessionStorage.setItem(\"currentDateInScheduler\", e.value.toString());\r\n\t\t}\r\n\t} else if (sessionStorage.getItem(\"currentDateInScheduler\") != null) {\r\n\t\t$(\"#scheduler\")\r\n\t\t\t.dxScheduler(\"instance\")\r\n\t\t\t.option(\r\n\t\t\t\t\"currentDate\",\r\n\t\t\t\tsessionStorage.getItem(\"currentDateInScheduler\") ?? new Date()\r\n\t\t\t);\r\n\t}\r\n}\r\n\r\nexport function getCurrentView(\r\n\te?: DevExpress.ui.dxScheduler.OptionChangedEvent\r\n) {\r\n\tif (e) {\r\n\t\tsessionStorage.setItem(\"currentViewInScheduler\", e.value);\r\n\t}\r\n\tif (\r\n\t\tsessionStorage.getItem(\"currentViewInScheduler\") != null &&\r\n\t\tsessionStorage.getItem(\"currentDateInScheduler\") != null\r\n\t) {\r\n\t\t$(\"#scheduler\")\r\n\t\t\t.dxScheduler(\"instance\")\r\n\t\t\t.option(\r\n\t\t\t\t\"currentView\",\r\n\t\t\t\t(sessionStorage.getItem(\r\n\t\t\t\t\t\"currentViewInScheduler\"\r\n\t\t\t\t) as DevExpress.ui.dxScheduler.ViewType) ?? \"week\"\r\n\t\t\t);\r\n\t\t$(\"#scheduler\")\r\n\t\t\t.dxScheduler(\"instance\")\r\n\t\t\t.option(\r\n\t\t\t\t\"currentDate\",\r\n\t\t\t\tsessionStorage.getItem(\"currentDateInScheduler\") ?? new Date()\r\n\t\t\t);\r\n\t}\r\n}\r\n\r\nexport function onOptionChanged(\r\n\te: DevExpress.ui.dxScheduler.OptionChangedEvent\r\n) {\r\n\tif (e.name === \"currentView\") {\r\n\t\tgetCurrentView(e);\r\n\t}\r\n\r\n\tif (e.name === \"currentDate\") {\r\n\t\tgetCurrentDate(e);\r\n\t}\r\n}\r\n\r\nexport function onAppointmentClick(\r\n\te: DevExpress.ui.dxScheduler.AppointmentClickEvent\r\n) {\r\n\tgetCurrentDate(e);\r\n\tlastClickedCell = false;\r\n\tif (e != null && e.appointmentData != null) {\r\n\t\tlastAppointmentData = e.appointmentData;\r\n\t}\r\n}\r\n\r\nexport function onSchedulerCellClick(\r\n\te: DevExpress.ui.dxScheduler.CellClickEvent\r\n) {\r\n\tgetCurrentDate(e);\r\n\tif (!lastClickedCell) {\r\n\t\tlastClickedCell = true;\r\n\t}\r\n}\r\n\r\nfunction PrepareFloatingButton() {\r\n\tcreateFloatingButton();\r\n}\r\n\r\nexport function DeleteShareCalendars() {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Calendar/DeleteShareCalendars?itemType=${itemType}&itemId=${itemId}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (data: number) => {\r\n\t\t\tif (data > 0) {\r\n\t\t\t\texist = \"False\";\r\n\t\t\t\talreadyExist = false;\r\n\t\t\t\tshowDxToast(\"Udost\u0119pnienie terminarza zosta\u0142o wy\u0142\u0105czone.\", \"success\");\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"B\u0142\u0105d wy\u0142\u0105czenia udost\u0119pnienia terminarza.\", \"error\");\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function CreateShareCalendar() {\r\n\tconst link = calendarLink;\r\n\r\n\tif (exist === \"False\" && alreadyExist === false) {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Calendar/ShareNewScheduler`,\r\n\t\t\ttype: \"Post\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: { link: link, itemType: itemType, itemId: itemId },\r\n\t\t\tsuccess: (data: boolean) => {\r\n\t\t\t\tif (data) {\r\n\t\t\t\t\texist = \"True\";\r\n\t\t\t\t\talreadyExist = true;\r\n\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t'Terminarz zosta\u0142 udost\u0119pniony. Wykonaj operacj\u0119 \"Skopiuj link do terminarza\" w celu skonfigurowania terminarza na innym urz\u0105dzeniu.',\r\n\t\t\t\t\t\t\"success\"\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshowDxToast(\"B\u0142\u0105d udost\u0119pnienia terminarza.\", \"error\");\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function CopyToClipboard() {\r\n\tconst textToCopy = document.getElementById(\"myLink\")?.textContent ?? \"\";\r\n\tnavigator.clipboard\r\n\t\t.writeText(textToCopy)\r\n\t\t.then(() => {\r\n\t\t\tshowDxToast(\"Link zosta\u0142 skopiowany.\", \"success\");\r\n\t\t})\r\n\t\t.catch((error) => {\r\n\t\t\tconsole.log(`Copy failed! ${error}`);\r\n\t\t});\r\n}\r\n\r\nexport function RejectParticipationFromCallendar(\r\n\tid: string,\r\n\trejectWithInfo: boolean,\r\n\tcontainerID: string\r\n) {\r\n\tRejectParticipation(id, rejectWithInfo, containerID);\r\n}\r\n\r\nexport function AcceptParticipationFromCallendar(\r\n\tid: string,\r\n\tcontainerID: string\r\n) {\r\n\tAcceptParticipation(id, containerID);\r\n}\r\n\r\nexport function AddNewScheduler() {\r\n\tnewDocument({ forWhat: \"forScheduler\" });\r\n}\r\n\r\nexport function onAppointmentFormOpening(\r\n\te: DevExpress.ui.dxScheduler.AppointmentFormOpeningEvent\r\n) {\r\n\te.cancel = true;\r\n\tLoadSubElementsEditor(\r\n\t\te.appointmentData?.DefinitionKey,\r\n\t\ttrue,\r\n\t\te.appointmentData?.Identity,\r\n\t\t2\r\n\t);\r\n\tShowLoadingPanel(\"Wczytywanie...\");\r\n}\r\n\r\nexport function TimeCellTemplate(e) {\r\n\treturn new Date(e.date).toLocaleString(\"pl-PL\", {\r\n\t\thour: \"2-digit\",\r\n\t\tminute: \"2-digit\",\r\n\t});\r\n}\r\n", "\uFEFFimport \"../types/dx.all.d.ts\";\r\nimport {\r\n\ttype AdminState,\r\n\ttype Content,\r\n\ttype DialogRepresentation,\r\n\ttype FilesFromVario,\r\n\ttype InputBoxRepresentation,\r\n\ttype Item,\r\n\ttype LogonRequired,\r\n\tObjectCreationMode,\r\n\ttype RGB,\r\n\tRequestStatus,\r\n\ttype ServiceResponse,\r\n\ttype SiteInfo,\r\n\ttype Template,\r\n\ttype VarioCategory,\r\n\ttype VarioCategoryParsed,\r\n\ttype VarioEmployee,\r\n\ttype VarioNotificationData,\r\n\ttype WarningButtons,\r\n} from \"../types/models/vario-types\";\r\nimport { openChatFromToast } from \"./chat\";\r\nimport { CancelRequests } from \"./devextreme-table-functions\";\r\nimport { LoadDropDowns, SubmitForm, UndoItem, isDirty } from \"./editor\";\r\nimport { ChangeCorrespondenceActionButtonsStatus } from \"./emails\";\r\nimport {\r\n\tOpenInSelectedControll,\r\n\tshareCalendar,\r\n\tworkflowMessage,\r\n} from \"./floating-actions\";\r\nimport {\r\n\tclearDynamicWorkflowActionsForFloatingButton,\r\n\tclearDynamicWorkflowActionsForVarioObject,\r\n} from \"./floating-buttons\";\r\nimport { AfterEditorReadyWorkflow } from \"./initiate-workflow\";\r\nimport { ToggleNotifyPanel, removeAllNotifications } from \"./notifications\";\r\nimport {\r\n\tGetBaseUrl,\r\n\tLogout,\r\n\tchangeCurrentItem,\r\n\tcloseNav,\r\n\tsaveCurrentPlaceInHistory,\r\n\tsaveGridForBack,\r\n} from \"./page-navigation\";\r\nimport { checkPushNotificationsUserPreferences } from \"./push-notifications\";\r\nimport { createRecipientsList, getRecipientsFromHub } from \"./recipients\";\r\nimport { ignoreUnsavedDoc, isDirtyDoc, saveDoc } from \"./richedit\";\r\nimport { verificatieAuthCode } from \"./user-panel\";\r\nimport {\r\n\trefreshVarioObjectGridTabs,\r\n\ttoggleVarioObjectPanel,\r\n} from \"./vario-object\";\r\n\r\ndeclare global {\r\n\tvar VarioWebAppUrlDomainName: string;\r\n\tvar hubUrl: string;\r\n\tvar siteTitle: string;\r\n\r\n\tvar externalUser: string;\r\n\tvar currentUserId: string;\r\n\tvar currentUserName: string;\r\n\tvar currentUserLogin1: string;\r\n\r\n\tvar isReportDesigner: boolean;\r\n\tvar isAdmin: boolean; //Pobierze si\u0119 z API po zalogowaniu w metodzie GetAdminState();\r\n\tvar isSiteAdmin: boolean;\r\n\tvar siteName: string; //Pobierze si\u0119 z API po zalogowaniu w metodzie GetSiteInfo();\r\n\r\n\tvar registerEnabled: string;\r\n\tvar register4AllEnabled: string;\r\n\tvar auth2FAEnabled: string;\r\n\tvar sendMailViaMailBridge: string;\r\n\tvar currentUserEmail: string;\r\n\tvar VAPIDPublicKey: string;\r\n\r\n\tvar getNewNotificationsIntervalID: string;\r\n\tvar checkIfTriggerWait4UserTimeoutID: number;\r\n\tvar supportEmail: string;\r\n\tvar convertPDFToImagesOnMobile: string;\r\n\tvar pdfJSLicenseKey: string;\r\n\r\n\tvar gridInlineEditor: string;\r\n\tvar VarioSigningHostVersion: string | null;\r\n\r\n\tvar globalItemsSelectedByUser: string[] | null;\r\n\tvar globalAvailableTemplates: Template[] | null;\r\n\tvar globalUseTemplate: boolean;\r\n\tvar spreadSheetReloadPromise: JQueryXHR | null;\r\n\tvar forceCloseUnsavedPopup: boolean;\r\n\r\n\tvar workflowIsAvailable: boolean;\r\n\r\n\t//czas gdyby nie przyszedl z configu\r\n\t//1000 milliseconds = 1 second\r\n\tvar logoutTime: number;\r\n\r\n\t//podstawowy limit gdyby nie przyszedl z configu\r\n\tvar maxFileSize: number;\r\n\r\n\t// flaga okre\u015Blaj\u0105ca, \u017Ce ostatnio wybranym elementem edycji/dodawania by\u0142a pozycja z wzorcem, wi\u0119c jej undo powinno j\u0105 usun\u0105\u0107\r\n\tvar deleteOnUndo: boolean;\r\n\r\n\tvar containerId: string;\r\n\tvar draggedFilesBuffer: FileList | FilesFromVario[] | null;\r\n\r\n\tvar debug: boolean;\r\n\r\n\tvar sw: ServiceWorkerContainer;\r\n\r\n\tvar ctrlDown: boolean;\r\n\r\n\tvar loadedSubElementsDictionary: Record;\r\n\tvar loadedSubElementsDictionaryaElementId: Record;\r\n\tvar subElementsDefinitionsCount: number;\r\n\tvar keyToLoad: string;\r\n}\r\n\r\nglobalThis.VarioWebAppUrlDomainName = \"\";\r\nglobalThis.hubUrl = \"\";\r\nglobalThis.siteTitle = \"\";\r\nglobalThis.externalUser = \"\";\r\nglobalThis.currentUserId = \"\";\r\nglobalThis.currentUserName = \"\";\r\nglobalThis.currentUserLogin1 = \"\";\r\nglobalThis.isReportDesigner = false;\r\nglobalThis.isAdmin = false;\r\nglobalThis.isSiteAdmin = false;\r\nglobalThis.siteName = \"\";\r\nglobalThis.registerEnabled = \"False\";\r\nglobalThis.register4AllEnabled = \"False\";\r\nglobalThis.auth2FAEnabled = \"False\";\r\nglobalThis.sendMailViaMailBridge = \"\";\r\nglobalThis.currentUserEmail = \"\";\r\nglobalThis.VAPIDPublicKey = \"\";\r\nglobalThis.getNewNotificationsIntervalID = \"\";\r\nglobalThis.checkIfTriggerWait4UserTimeoutID = 0;\r\nglobalThis.supportEmail = \"\";\r\nglobalThis.convertPDFToImagesOnMobile = \"\";\r\nglobalThis.pdfJSLicenseKey = \"\";\r\nglobalThis.gridInlineEditor = \"\";\r\nglobalThis.VarioSigningHostVersion = null;\r\nglobalThis.globalItemsSelectedByUser = [];\r\nglobalThis.globalAvailableTemplates = [];\r\nglobalThis.globalUseTemplate = false;\r\nglobalThis.spreadSheetReloadPromise = null;\r\nglobalThis.forceCloseUnsavedPopup = false;\r\nglobalThis.workflowIsAvailable = true;\r\nglobalThis.deleteOnUndo = false;\r\nglobalThis.containerId = \"\";\r\nglobalThis.draggedFilesBuffer = null;\r\nglobalThis.debug = false;\r\nglobalThis.sw = navigator.serviceWorker;\r\nglobalThis.ctrlDown = false;\r\nglobalThis.loadedSubElementsDictionary = {};\r\nglobalThis.loadedSubElementsDictionaryaElementId = {};\r\nglobalThis.subElementsDefinitionsCount = 0;\r\nglobalThis.keyToLoad = \"\";\r\n\r\n//czas gdyby nie przyszedl z configu\r\n//1000 milliseconds = 1 second\r\nglobalThis.logoutTime = 1000 * 60 * 15;\r\n\r\n//podstawowy limit gdyby nie przyszedl z configu\r\nglobalThis.maxFileSize = 52428800;\r\n\r\nexport const supportedContent = new (class SupportedContent {\r\n\ttxt: Content = {\r\n\t\tfileExtensions: [\"txt\"],\r\n\t\tcontentTypes: [\"text/plain\", \"text/*\"],\r\n\t\ttype: \"document\",\r\n\t};\r\n\tdocx: Content = {\r\n\t\tfileExtensions: [\"docx\"],\r\n\t\tcontentTypes: [\r\n\t\t\t\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\r\n\t\t],\r\n\t\ttype: \"document\",\r\n\t};\r\n\trtf: Content = {\r\n\t\tfileExtensions: [\"rtf\"],\r\n\t\tcontentTypes: [\"application/rtf\", \"text/rtf\"],\r\n\t\ttype: \"document\",\r\n\t};\r\n\tgif: Content = {\r\n\t\tfileExtensions: [\"gif\"],\r\n\t\tcontentTypes: [\"image/gif\"],\r\n\t\ttype: \"image\",\r\n\t};\r\n\tjpg: Content = {\r\n\t\tfileExtensions: [\"jpg\", \"jpeg\"],\r\n\t\tcontentTypes: [\"image/jpeg\", \"image/jpg\"],\r\n\t\ttype: \"image\",\r\n\t};\r\n\tpng: Content = {\r\n\t\tfileExtensions: [\"png\"],\r\n\t\tcontentTypes: [\"image/png\"],\r\n\t\ttype: \"image\",\r\n\t};\r\n\tpdf: Content = {\r\n\t\tfileExtensions: [\"pdf\"],\r\n\t\tcontentTypes: [\"application/pdf\"],\r\n\t\ttype: \"pdf\",\r\n\t};\r\n\tmp4: Content = {\r\n\t\tfileExtensions: [\"mp4\"],\r\n\t\tcontentTypes: [\"video/mp4\"],\r\n\t\ttype: \"video\",\r\n\t};\r\n\togg: Content = {\r\n\t\tfileExtensions: [\"ogg\"],\r\n\t\tcontentTypes: [\"video/ogg\"],\r\n\t\ttype: \"video\",\r\n\t};\r\n\twebm: Content = {\r\n\t\tfileExtensions: [\"webm\"],\r\n\t\tcontentTypes: [\"video/webm\"],\r\n\t\ttype: \"video\",\r\n\t};\r\n\temail: Content = {\r\n\t\tfileExtensions: [\"html\"],\r\n\t\tcontentTypes: [\"text/html\"],\r\n\t\ttype: \"email\",\r\n\t};\r\n\tspreadsheet: Content = {\r\n\t\tfileExtensions: [\"xlsx\", \"xls\", \"xlsm\"],\r\n\t\tcontentTypes: [\r\n\t\t\t\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\r\n\t\t\t\"application/vnd.ms-excel\",\r\n\t\t\t\"application/vnd.ms-excel.sheet.macroEnabled.12\",\r\n\t\t\t\"application/excel\",\r\n\t\t],\r\n\t\ttype: \"spreadsheet\",\r\n\t};\r\n\r\n\tprepareValue(value = \"\") {\r\n\t\tlet whatToCheck = value?.trim();\r\n\t\tif (stringIsNullOrEmpty(whatToCheck)) return \"\";\r\n\t\tif (whatToCheck.startsWith(\".\")) whatToCheck = whatToCheck.substring(1);\r\n\t\tif (whatToCheck.includes(\";\")) whatToCheck = whatToCheck.split(\";\")[0];\r\n\t\twhatToCheck = whatToCheck.toLowerCase().trim();\r\n\r\n\t\treturn whatToCheck;\r\n\t}\r\n\r\n\tcheckIfSupported(toCheck = \"\"): boolean {\r\n\t\tconst whatToCheck = this.prepareValue(toCheck);\r\n\t\treturn !!this.getPropertiesOfSupportedContentToCheck(whatToCheck);\r\n\t}\r\n\r\n\tcheckWhichContentTypes(toCheck: string) {\r\n\t\tif (!this.checkIfSupported(toCheck)) return;\r\n\r\n\t\treturn this.getPropertiesOfSupportedContentToCheck(toCheck)?.contentTypes;\r\n\t}\r\n\r\n\tcheckWhichFileExtensions(toCheck: string) {\r\n\t\tif (!this.checkIfSupported(toCheck)) return;\r\n\r\n\t\treturn this.getPropertiesOfSupportedContentToCheck(toCheck)?.fileExtensions;\r\n\t}\r\n\r\n\tcheckWhichTypeOfFile(toCheck: string) {\r\n\t\tif (!this.checkIfSupported(toCheck)) return;\r\n\r\n\t\tlet type = this.getPropertiesOfSupportedContentToCheck(toCheck)?.type;\r\n\t\tif (type === \"pdf\") type = \"mobilePdf\";\r\n\r\n\t\treturn type;\r\n\t}\r\n\r\n\tgetSupportedContents(): Content[] {\r\n\t\treturn Object.values(this);\r\n\t}\r\n\r\n\tgetPropertiesOfSupportedContentToCheck(toCheck: string): Content | undefined {\r\n\t\tconst whatToCheck = this.prepareValue(toCheck);\r\n\r\n\t\treturn this.getSupportedContents().find((supportedContents) =>\r\n\t\t\tObject.values(supportedContents).some(\r\n\t\t\t\t(prop) => Array.isArray(prop) && prop.includes(whatToCheck)\r\n\t\t\t)\r\n\t\t);\r\n\t}\r\n})();\r\n\r\nexport const mousePosition = new (class MousePosition {\r\n\tx = 0;\r\n\ty = 0;\r\n})();\r\n\r\nwindow.onmousemove = (e: MouseEvent) => {\r\n\tmousePosition.x = e.clientX;\r\n\tmousePosition.y = e.clientY;\r\n};\r\n\r\nexport function delayCallback(\r\n\tcallback: (...args: ContextType) => void,\r\n\tms = 0 // Default value for ms\r\n) {\r\n\tlet timer: number | undefined; // Use `undefined` instead of `0` for clarity\r\n\treturn (...args: ContextType) => {\r\n\t\tif (timer !== undefined) {\r\n\t\t\tclearTimeout(timer);\r\n\t\t}\r\n\t\ttimer = setTimeout(() => {\r\n\t\t\tcallback(...args);\r\n\t\t}, ms) as any as number;\r\n\t};\r\n}\r\n\r\nexport const wait = (ms: number) => new Promise((res) => setTimeout(res, ms));\r\n\r\nexport function isRunningOnMobile() {\r\n\tconst smallWidth =\r\n\t\twindow.matchMedia(\"(max-device-width: 767px)\").matches ||\r\n\t\twindow.innerWidth <= 767;\r\n\treturn (\r\n\t\t(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(\r\n\t\t\tnavigator.userAgent\r\n\t\t) &&\r\n\t\t\tsmallWidth) ||\r\n\t\tsmallWidth\r\n\t);\r\n}\r\n\r\nexport function checkTheme() {\r\n\tconst darkThemeMq = window.matchMedia(\"(prefers-color-scheme: dark)\");\r\n\tconst localStor = JSON.parse(localStorage.getItem(\"darkTheme\") ?? \"null\");\r\n\r\n\tif ((darkThemeMq.matches && localStor !== false) || localStor) {\r\n\t\t$(\"html\").attr(\"data-theme\", \"dark\");\r\n\t\tlocalStorage.setItem(\"darkTheme\", \"true\");\r\n\t} else {\r\n\t\t$(\"html\").attr(\"data-theme\", \"\");\r\n\t\tlocalStorage.setItem(\"darkTheme\", \"false\");\r\n\t}\r\n}\r\n\r\nexport function flatten(arr: Item[]) {\r\n\tconst result: any[] = [];\r\n\r\n\tfunction extract(arr) {\r\n\t\tfor (const item of arr) {\r\n\t\t\tif (item.items) {\r\n\t\t\t\textract(item.items);\r\n\t\t\t} else if (item.collapsedItems) {\r\n\t\t\t\textract(item.collapsedItems);\r\n\t\t\t} else {\r\n\t\t\t\tresult.push(item);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\textract(arr);\r\n\r\n\treturn result;\r\n}\r\n\r\nexport function unflatten(items: VarioCategory[]) {\r\n\tconst tree: VarioCategoryParsed[] = [];\r\n\tconst mappedArr: Record = {};\r\n\r\n\t// Build a hash table and map items to objects\r\n\tfor (const item of items) {\r\n\t\tconst id = item.categoryID;\r\n\t\tif (!(\"id\" in mappedArr)) {\r\n\t\t\t// in case of duplicates\r\n\t\t\tmappedArr[id] = item; // the extracted id as key, and the item as value\r\n\t\t\tmappedArr[id].children = []; // under each item, add a key \"children\" with an empty array as value\r\n\t\t}\r\n\t}\r\n\r\n\t// Loop over hash table\r\n\tfor (const id in mappedArr) {\r\n\t\tif (\"id\" in mappedArr) {\r\n\t\t\tconst mappedElem = mappedArr[id];\r\n\r\n\t\t\t// If the element is not at the root level, add it to its parent array of children. Note this will continue till we have only root level elements left\r\n\t\t\tif (mappedElem.parentID) {\r\n\t\t\t\tconst parentId = mappedElem.parentID;\r\n\t\t\t\tmappedElem.parentName = mappedArr[parentId].name;\r\n\t\t\t\tmappedElem.parentCode = mappedArr[parentId].categoryCode;\r\n\t\t\t\tmappedArr[parentId].children?.push(mappedElem);\r\n\t\t\t}\r\n\r\n\t\t\t// If the element is at the root level, directly push to the tree\r\n\t\t\telse {\r\n\t\t\t\ttree.push(mappedElem);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn tree;\r\n}\r\n\r\nexport const hexToRgb = (hex: string): RGB | null => {\r\n\tconst result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\r\n\treturn result\r\n\t\t? {\r\n\t\t\t\tr: Number.parseInt(result[1], 16),\r\n\t\t\t\tg: Number.parseInt(result[2], 16),\r\n\t\t\t\tb: Number.parseInt(result[3], 16),\r\n\t\t\t}\r\n\t\t: null;\r\n};\r\n\r\nexport const setContrast = (rgb: RGB | null) => {\r\n\tif (!rgb) rgb = { r: 1, g: 1, b: 1 };\r\n\treturn (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000 > 125\r\n\t\t? \"black\"\r\n\t\t: \"white\";\r\n};\r\n\r\nexport function uuidv4() {\r\n\treturn `${1e7}${-1e3}${-4e3}${-8e3}${-1e11}`.replace(/[018]/g, (c) =>\r\n\t\t(\r\n\t\t\tNumber(c) ^\r\n\t\t\t(crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (Number(c) / 4)))\r\n\t\t).toString(16)\r\n\t);\r\n}\r\n\r\nexport function urlify(text: string) {\r\n\tconst urlRegex =\r\n\t\t/(\\b(https?|ftp|file):\\/\\/[-A-Z0-9+&@#\\/%?=~_|!:,.;]*[-A-Z0-9+&@#\\/%=~_|])/gi;\r\n\r\n\treturn text.replace(urlRegex, (url) => {\r\n\t\tconst type = supportedContent.checkWhichTypeOfFile(url.slice(-3));\r\n\t\tif (type === \"image\" || type === \"gif\") {\r\n\t\t\treturn ``;\r\n\t\t}\r\n\r\n\t\treturn `${url}`;\r\n\t});\r\n}\r\n\r\nexport function translator(text: string) {\r\n\tif (typeof text !== \"string\") return text;\r\n\tif (stringIsNullOrEmpty(text)) return text;\r\n\r\n\ttext = text.toString().replace(/"/g, '\"');\r\n\ttext = text.toString().replace(/Ą/g, \"\u0104\");\r\n\ttext = text.toString().replace(/ą/g, \"\u0105\");\r\n\ttext = text.toString().replace(/Ć/g, \"\u0106\");\r\n\ttext = text.toString().replace(/ć/g, \"\u0107\");\r\n\ttext = text.toString().replace(/Ę/g, \"\u0118\");\r\n\ttext = text.toString().replace(/ę/g, \"\u0119\");\r\n\ttext = text.toString().replace(/Ł/g, \"\u0141\");\r\n\ttext = text.toString().replace(/ł/g, \"\u0142\");\r\n\ttext = text.toString().replace(/Ń/g, \"\u0143\");\r\n\ttext = text.toString().replace(/ń/g, \"\u0144\");\r\n\ttext = text.toString().replace(/ś/g, \"\u015A\");\r\n\ttext = text.toString().replace(/Ŝ/g, \"\u015B\");\r\n\ttext = text.toString().replace(/ś/g, \"\u015B\");\r\n\ttext = text.toString().replace(/Ó/g, \"\u00D3\");\r\n\ttext = text.toString().replace(/ó/g, \"\u00F3\");\r\n\ttext = text.toString().replace(/Ź/g, \"\u0179\");\r\n\ttext = text.toString().replace(/ź/g, \"\u017A\");\r\n\ttext = text.toString().replace(/Ż/g, \"\u017B\");\r\n\ttext = text.toString().replace(/ż/g, \"\u017C\");\r\n\treturn text;\r\n}\r\n\r\nexport function convertToNonPolishLetters(text: string) {\r\n\ttext = text.toString().replace(/"/g, '\"');\r\n\ttext = text.toString().replaceAll(\"\u0104\", \"A\");\r\n\ttext = text.toString().replaceAll(\"\u0105\", \"a\");\r\n\ttext = text.toString().replaceAll(\"\u0106\", \"C\");\r\n\ttext = text.toString().replaceAll(\"\u0107\", \"c\");\r\n\ttext = text.toString().replaceAll(\"\u0118\", \"E\");\r\n\ttext = text.toString().replaceAll(\"\u0119\", \"e\");\r\n\ttext = text.toString().replaceAll(\"\u0141\", \"L\");\r\n\ttext = text.toString().replaceAll(\"\u0142\", \"l\");\r\n\ttext = text.toString().replaceAll(\"\u0143\", \"N\");\r\n\ttext = text.toString().replaceAll(\"\u0144\", \"n\");\r\n\ttext = text.toString().replaceAll(\"\u015A\", \"S\");\r\n\ttext = text.toString().replaceAll(\"\u015B\", \"s\");\r\n\ttext = text.toString().replaceAll(\"\u00D3\", \"O\");\r\n\ttext = text.toString().replaceAll(\"\u00F3\", \"o\");\r\n\ttext = text.toString().replaceAll(\"\u0179\", \"Z\");\r\n\ttext = text.toString().replaceAll(\"\u017A\", \"z\");\r\n\ttext = text.toString().replaceAll(\"\u017B\", \"Z\");\r\n\ttext = text.toString().replaceAll(\"\u017C\", \"z\");\r\n\treturn text;\r\n}\r\n\r\nexport function fixStringToPreventJSErrors(string?: string) {\r\n\t//fixes strings from c# model\r\n\r\n\tif (string && !stringIsNullOrEmpty(string))\r\n\t\treturn translator(string)\r\n\t\t\t.replaceAll(\"`\", \"\")\r\n\t\t\t.replaceAll(\"'\", \"\")\r\n\t\t\t.replaceAll('\"', \"\");\r\n\treturn \"\";\r\n}\r\n\r\nexport const loadHtml = async (\r\n\tpath: string,\r\n\tcallback: (res: any, text?: string) => void\r\n) =>\r\n\tnew Promise((resolve, reject) => {\r\n\t\tconst xhr = new XMLHttpRequest();\r\n\t\txhr.open(\"GET\", path, true);\r\n\t\txhr.onreadystatechange = function (this: XMLHttpRequest) {\r\n\t\t\tif (this.readyState !== 4) return;\r\n\r\n\t\t\tif (this.status === 200) {\r\n\t\t\t\tif (callback) callback(null, this.responseText); // Use callback if provided\r\n\t\t\t\tresolve(this.responseText); // Resolve the promise\r\n\t\t\t} else {\r\n\t\t\t\tconst error = new Error(`Failed to load HTML. Status: ${this.status}`);\r\n\t\t\t\tif (callback) callback(error); // Use callback if provided\r\n\t\t\t\treject(error); // Reject the promise\r\n\t\t\t}\r\n\t\t};\r\n\t\txhr.send();\r\n\t});\r\n\r\nexport function waitForElm(selector: string): Promise {\r\n\treturn new Promise((resolve) => {\r\n\t\tif (document.querySelector(selector)) {\r\n\t\t\treturn resolve(document.querySelector(selector) as HTMLElement);\r\n\t\t}\r\n\r\n\t\tconst observer = new MutationObserver(() => {\r\n\t\t\tif (document.querySelector(selector)) {\r\n\t\t\t\tresolve(document.querySelector(selector) as HTMLElement);\r\n\t\t\t\tobserver.disconnect();\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tobserver.observe(document.body, {\r\n\t\t\tchildList: true,\r\n\t\t\tsubtree: true,\r\n\t\t});\r\n\t});\r\n}\r\n\r\nexport function fixScrollInDx(element: string) {\r\n\t//fixes scroll event in dx elements\r\n\r\n\t$(`${element}`).on(\"dxmousewheel\", (e) => {\r\n\t\te.stopPropagation();\r\n\t});\r\n\r\n\t$(`${element}`).on(\"scroll\", (e) => {\r\n\t\te.stopPropagation();\r\n\t});\r\n\r\n\t$(`${element}`).on(\"touchmove\", (e) => {\r\n\t\te.stopPropagation();\r\n\t});\r\n}\r\n\r\nnavigator.serviceWorker?.addEventListener(\"message\", (event) => {\r\n\thandleServiceWorkerMessage(event.data);\r\n});\r\n\r\nexport const registerServiceWorker = async () => {\r\n\ttry {\r\n\t\tif (navigator?.serviceWorker?.controller?.state === \"activated\") {\r\n\t\t\tawait navigator.serviceWorker.ready.then((registration) => {\r\n\t\t\t\tcheckPushNotificationsUserPreferences(registration);\r\n\t\t\t});\r\n\t\t} else if (navigator && \"serviceWorker\" in navigator) {\r\n\t\t\tconst registration = await sw.register(\r\n\t\t\t\t`${GetBaseUrl()}/service-worker.js`\r\n\t\t\t);\r\n\t\t\tif (registration.installing) {\r\n\t\t\t\tconsole.log(\"Service worker installing\");\r\n\t\t\t} else if (registration.waiting) {\r\n\t\t\t\tconsole.log(\"Service worker installed\");\r\n\t\t\t} else if (registration.active) {\r\n\t\t\t\tconsole.log(\"Service worker active\");\r\n\t\t\t\tcheckPushNotificationsUserPreferences(registration);\r\n\t\t\t}\r\n\t\t}\r\n\t} catch (error) {\r\n\t\tconsole.error(`Registration failed with ${error}`);\r\n\t}\r\n};\r\n\r\nexport function pushNotification(\r\n\tnotification: Partial & { options: NotificationOptions }\r\n) {\r\n\tif (Notification.permission === \"granted\") {\r\n\t\tnavigator.serviceWorker.getRegistrations().then((registration) => {\r\n\t\t\tif (notification)\r\n\t\t\t\tregistration[0].showNotification(\r\n\t\t\t\t\tnotification.title ?? \"\",\r\n\t\t\t\t\tnotification.options\r\n\t\t\t\t);\r\n\t\t\telse if (debug)\r\n\t\t\t\tregistration[0].showNotification(\"Test notyfikacji\", {\r\n\t\t\t\t\tbody: \"Tutaj jest tre\u015B\u0107\",\r\n\t\t\t\t\ttag: Math.random().toString(),\r\n\t\t\t\t\ticon: `${GetBaseUrl()}/images/bell-icon.png`,\r\n\t\t\t\t\tdata: {\r\n\t\t\t\t\t\twebsitePath: GetBaseUrl(),\r\n\t\t\t\t\t\tisDebug: debug,\r\n\t\t\t\t\t\ttype: \"varioNotification\",\r\n\t\t\t\t\t\titemId: \"Type=DocumentVer;Id=4294967485261\",\r\n\t\t\t\t\t},\r\n\t\t\t\t});\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function handleServiceWorkerMessage(data: VarioNotificationData) {\r\n\tif (data.type === \"varioNotification\" && data.itemId) {\r\n\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\tchangeCurrentItem({\r\n\t\t\titemId: data.itemId,\r\n\t\t\tinnerCall: false,\r\n\t\t});\r\n\t} else if (data.type === \"hubNotification\") {\r\n\t\topenChatFromToast(data.responseMessage?.chatID);\r\n\t}\r\n}\r\n\r\nexport function getMaxFileSize() {\r\n\tif (localStorage.getItem(\"filesizeLimit\") == null) {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetFileSizeLimit`,\r\n\t\t\ttype: \"GET\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: true,\r\n\t\t\tsuccess: (data: number) => {\r\n\t\t\t\tif (data != null) {\r\n\t\t\t\t\tmaxFileSize = data * 1024;\r\n\t\t\t\t\tlocalStorage.setItem(\"filesizeLimit\", maxFileSize.toString());\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t});\r\n\t} else {\r\n\t\tmaxFileSize = Number(localStorage.getItem(\"filesizeLimit\"));\r\n\t}\r\n}\r\n\r\nexport function setSiteTitle(name: string) {\r\n\tif (!name || name === \"\") return;\r\n\r\n\tconst title = stringIsNullOrEmpty(siteTitle)\r\n\t\t? translator(`${name}`)\r\n\t\t: translator(`${name} - ${siteTitle}`);\r\n\r\n\tdocument.title = title;\r\n}\r\n\r\nexport function convertDate(date: string | Date) {\r\n\t//convert dat z c#\r\n\tif (stringIsNullOrEmpty(date)) return new Date(date);\r\n\tif (date instanceof Date) return date;\r\n\r\n\tlet parsedDate: Date;\r\n\r\n\tif (typeof date === \"number\") {\r\n\t\tparsedDate = new Date(date);\r\n\r\n\t\tif (!Number.isNaN(parsedDate.getTime())) return parsedDate;\r\n\t}\r\n\r\n\tlet dateArrayA: string[] = [];\r\n\tif (date.includes(\".\")) dateArrayA = date.split(/\\.|\\s|:/);\r\n\telse if (date.includes(\"-\")) dateArrayA = date.split(/\\-|\\s|:/);\r\n\telse if (date.includes(\"/\")) dateArrayA = date.split(/\\/|\\s|:/);\r\n\r\n\tif (dateArrayA[2]?.includes(\"T\")) return new Date(date);\r\n\r\n\t//day month year hour minute second\r\n\tif (dateArrayA[0]?.length === 4) {\r\n\t\tconst year = dateArrayA[0];\r\n\t\tdateArrayA[0] = dateArrayA[2];\r\n\t\tdateArrayA[2] = year;\r\n\t}\r\n\r\n\t//year month day hour minute second\r\n\t//months are zero indexed in js\r\n\treturn new Date(\r\n\t\tNumber(dateArrayA[2]),\r\n\t\tNumber.parseInt(dateArrayA[1]) - 1,\r\n\t\tNumber(dateArrayA[0]),\r\n\t\tNumber(dateArrayA[3] ?? \"\"),\r\n\t\tNumber(dateArrayA[4] ?? \"\"),\r\n\t\tNumber(dateArrayA[5] ?? \"\")\r\n\t);\r\n}\r\n\r\nexport function getConvertedDateAndTime(date: string | Date) {\r\n\t//returns converted date string\r\n\r\n\tlet converted = convertDate(date);\r\n\r\n\tif (Number.isNaN(converted.getTime())) converted = new Date(date);\r\n\tif (Number.isNaN(converted.getTime())) {\r\n\t\tconsole.error(`Invalid Date - ${date}`);\r\n\t}\r\n\r\n\tconst day = String(converted.getDate()).padStart(2, \"0\");\r\n\tconst month = String(converted.getMonth() + 1).padStart(2, \"0\");\r\n\tconst year = converted.getFullYear();\r\n\tconst hours = String(converted.getHours()).padStart(2, \"0\");\r\n\tconst minutes = String(converted.getMinutes()).padStart(2, \"0\");\r\n\r\n\treturn `${day}.${month}.${year} ${hours}:${minutes}`;\r\n}\r\n\r\nexport function ShowLoadingPanel(message: string, forceHide = false) {\r\n\tconst LoadPanel = $(\"#loadPanel\").dxLoadPanel(\"instance\");\r\n\tLoadPanel?.option(\"visible\", true);\r\n\tLoadPanel?.option(\"message\", message);\r\n\tif (forceHide) {\r\n\t\tLoadPanel?.option(\"wrapperAttr.class\", \"dontHide\");\r\n\t}\r\n}\r\n\r\nexport function HideLoadingPanel(forceHide = false) {\r\n\tconst LoadPanel = $(\"#loadPanel\").dxLoadPanel(\"instance\");\r\n\tif (forceHide) {\r\n\t\tLoadPanel?.option(\"wrapperAttr.class\", \"\");\r\n\t\tLoadPanel?.option(\"visible\", false);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst msg = LoadPanel?.option(\"message\");\r\n\tconst dontHide = LoadPanel?.option(\"wrapperAttr.class\") === \"dontHide\";\r\n\t//obejscie glownie dla contentready dxdatagrid (jest tam hideloadingpanel i czesto zamyka)\r\n\tif (\r\n\t\tmsg?.includes(\"Pobieranie danych wzorca\") ||\r\n\t\tmsg?.includes(\"Dodawanie podgl\u0105du\") ||\r\n\t\tmsg?.includes(\"Od\u015Bwie\u017Canie danych\") ||\r\n\t\tmsg?.includes(\"Zapisywanie...\") ||\r\n\t\tdontHide\r\n\t) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tLoadPanel?.option(\"visible\", false);\r\n}\r\n\r\nexport function CloseDialog() {\r\n\t$(\"#devex-dialog\").dxPopup(\"hide\");\r\n}\r\n\r\nexport function CloseDialogOperations() {\r\n\t$(\"#devex-dialog-operations\").data(\"forceHide\", true);\r\n\r\n\t$(\"#devex-dialog-operations\").dxPopup(\"hide\");\r\n}\r\n\r\nexport function CloseBigDialog() {\r\n\t$(\"#devex-big-dialog\").dxPopup(\"hide\");\r\n}\r\n\r\nexport function CloseAdditionalDialog() {\r\n\t$(\"#devex-dialog-additional\").dxPopup(\"hide\");\r\n}\r\n\r\nexport function CloseChatDialog() {\r\n\t$(\"#devex-dialog-chat\").dxPopup(\"hide\");\r\n}\r\n\r\nexport function CloseTriggerDialog() {\r\n\t$(\"#devex-dialog-trigger\").dxPopup(\"hide\");\r\n}\r\n\r\nexport function CloseExtraDialog() {\r\n\t$(\"#devex-extra-dialog\").dxPopup(\"hide\");\r\n}\r\n\r\nexport function checkWhereIsUser(checkExtra = false) {\r\n\t//sprawdzanie gdzie jest user\r\n\tconst hasGrid = document.getElementById(\"Tabela\");\r\n\tconst hasDashboard = document.getElementById(\"dashboardControl\");\r\n\tconst hasReport = document.getElementById(\"reportViewer\");\r\n\tconst hasReportDesigner = document.getElementById(\"reportDesigner\");\r\n\r\n\tif (\r\n\t\t(typeof modelSubElementsOnly !== \"undefined\" &&\r\n\t\t\tmodelSubElementsOnly === \"False\") ||\r\n\t\thasDashboard ||\r\n\t\thasReport\r\n\t) {\r\n\t\tif (checkExtra && (hasGrid || $(\".varioDatagridPanel\")?.length > 0))\r\n\t\t\treturn \"varioObjectWithSubElements\";\r\n\t\tif (checkExtra && hasDashboard) return \"dashboardControl\";\r\n\t\tif (checkExtra && hasReport) return \"reportViewer\";\r\n\t\tif (checkExtra && hasReportDesigner) return \"reportDesigner\";\r\n\r\n\t\treturn \"varioObject\";\r\n\t}\r\n\tif (document.getElementById(\"scheduler\")) {\r\n\t\treturn \"scheduler\";\r\n\t}\r\n\tif (hasGrid) {\r\n\t\treturn \"subElements\";\r\n\t}\r\n}\r\n\r\n//funkcja tworzaca pozycje w widoku karty\r\nexport async function CreateVarioObject(\r\n\tdefinitionKey: string,\r\n\tcontainerId: string,\r\n\tparentId: string,\r\n\tcontextItemId: string,\r\n\tmode: ObjectCreationMode\r\n) {\r\n\tif (isDirtyDoc()) {\r\n\t\tconst res = await ShowPopupWarningUnsavedRichEditDoc().catch(() => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\r\n\tif (isDirty()) {\r\n\t\tconst res = await ShowPopupWarningUnsaved().catch(() => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\r\n\tcleanUp();\r\n\r\n\tCancelRequests();\r\n\tclearDynamicWorkflowActionsForFloatingButton();\r\n\tclearDynamicWorkflowActionsForVarioObject();\r\n\r\n\tShowLoadingPanel(\"Wczytywanie widoku...\");\r\n\r\n\t$(\"#bodyElement\").each((_, item) => {\r\n\t\tconst url = `${GetBaseUrl()}/Vario/CreateVarioObject`;\r\n\t\tif (url && url.length > 0) {\r\n\t\t\t$.ajax({\r\n\t\t\t\turl: url,\r\n\t\t\t\ttype: \"Get\",\r\n\t\t\t\tcache: false,\r\n\t\t\t\tdata: {\r\n\t\t\t\t\tdefinitionId: definitionKey,\r\n\t\t\t\t\tcontainerKey: containerId,\r\n\t\t\t\t\tparentId: parentId,\r\n\t\t\t\t\tcontextItemId: contextItemId,\r\n\t\t\t\t\tmode: mode,\r\n\t\t\t\t\tbrowserTabGuid: sessionStorage.getItem(\"browserTabGuid\"),\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: (data: string & LogonRequired) => {\r\n\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tdata != null &&\r\n\t\t\t\t\t\tdata.logonRequired !== undefined &&\r\n\t\t\t\t\t\tdata.logonRequired === true\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tsaveGridForBack(data);\r\n\t\t\t\t\t\t//aktualny modelId/hashid to bedzie container pozycji do ktorej przechodzimy\r\n\t\t\t\t\t\tconst hashContainerId =\r\n\t\t\t\t\t\t\tcontainerId &&\r\n\t\t\t\t\t\t\ttypeof hashId !== \"undefined\" &&\r\n\t\t\t\t\t\t\t!stringIsNullOrEmpty(hashId)\r\n\t\t\t\t\t\t\t\t? hashId\r\n\t\t\t\t\t\t\t\t: null;\r\n\r\n\t\t\t\t\t\tif (checkWhereIsUser(true) === \"varioObjectWithSubElements\")\r\n\t\t\t\t\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\t\t\t\t\"lastSubelementsTypeInVarioObject\",\r\n\t\t\t\t\t\t\t\t$(\".subElementsNavSpanItem.active\").attr(\"id\") ?? \"\"\r\n\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t$(item as HTMLElement).empty();\r\n\t\t\t\t\t\t$(item as HTMLElement).append(data);\r\n\t\t\t\t\t\tvarioObjectLoaded(\r\n\t\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\t\tstringIsNullOrEmpty(contextItemId),\r\n\t\t\t\t\t\t\tmode,\r\n\t\t\t\t\t\t\tcontainerId,\r\n\t\t\t\t\t\t\tparentId\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tsaveCurrentPlaceInHistory(null, hashContainerId, containerId);\r\n\r\n\t\t\t\t\t\tcloseNav();\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\r\n//funkcja do pokazywania wiadomosci w widoku karty\r\nexport function ShowVarioMessage(\r\n\telementId: string,\r\n\tpartialUrl: string,\r\n\tmessage: string,\r\n\tallowClose: boolean,\r\n\tstatus: string\r\n) {\r\n\t$(elementId).each((_, item) => {\r\n\t\tconst url = GetBaseUrl() + partialUrl;\r\n\t\tif (url && url.length > 0) {\r\n\t\t\t$(item as HTMLElement).load(url, {\r\n\t\t\t\tmessage: message,\r\n\t\t\t\tallowClose: allowClose,\r\n\t\t\t\tstatus: status,\r\n\t\t\t\telementId: elementId,\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n}\r\n\r\n//funkcja ustawiaj\u0105ca opcje widoku karty\r\nexport function varioObjectLoaded(\r\n\tshowItemOnly?: boolean | string,\r\n\titemKey?: string,\r\n\tsubelementPageIndex: number | string = 1,\r\n\tcreateNewObject?: boolean,\r\n\tcorrespondenceMode = ObjectCreationMode.Undefined,\r\n\tcontainerId = \"\",\r\n\tparentId = \"\"\r\n) {\r\n\tloadedSubElementsDictionary = {};\r\n\tloadedSubElementsDictionaryaElementId = {};\r\n\tsubElementsDefinitionsCount = 0;\r\n\tkeyToLoad = \"\";\r\n\r\n\t//dodawanie pozycji zawartosci w widoku karty\r\n\tif (\r\n\t\tshowItemOnly == null ||\r\n\t\tshowItemOnly === false ||\r\n\t\tshowItemOnly === \"false\" ||\r\n\t\tshowItemOnly === \"False\" ||\r\n\t\tshowItemOnly === \"undefined\"\r\n\t) {\r\n\t\tif (\r\n\t\t\tsubelementPageIndex == null ||\r\n\t\t\tsubelementPageIndex === \"undefined\" ||\r\n\t\t\tNumber(subelementPageIndex) <= 0\r\n\t\t) {\r\n\t\t\tsubelementPageIndex = 1;\r\n\t\t}\r\n\r\n\t\tconst posTypesElements =\r\n\t\t\tdocument.getElementsByClassName(\"positonTypeElement\");\r\n\t\tif (!posTypesElements || posTypesElements.length <= 0) {\r\n\t\t\t$(\".subElements\").each((_, item) => {\r\n\t\t\t\tconst $item = item as HTMLElement;\r\n\t\t\t\t$($item).empty();\r\n\r\n\t\t\t\tconst siElement = document.getElementById(\r\n\t\t\t\t\t`ShowItemOnlyElementId${itemKey}`\r\n\t\t\t\t) as HTMLInputElement;\r\n\t\t\t\tif (\r\n\t\t\t\t\tsiElement == null ||\r\n\t\t\t\t\t(siElement != null &&\r\n\t\t\t\t\t\tsiElement.value !== \"undefined\" &&\r\n\t\t\t\t\t\tsiElement.value === \"False\")\r\n\t\t\t\t) {\r\n\t\t\t\t\tconst url = GetBaseUrl() + $($item).data(\"url\");\r\n\t\t\t\t\tconst itKey = $($item).data(\"id\");\r\n\t\t\t\t\tconst subPosType = $($item).data(\"val\");\r\n\t\t\t\t\tconst fromCache = $($item).data(\"fromcache\");\r\n\t\t\t\t\tconst forTableItems = $($item).data(\"fortableitems\");\r\n\r\n\t\t\t\t\tif (url && url.length > 0) {\r\n\t\t\t\t\t\tsubElementsRequest = $.ajax({\r\n\t\t\t\t\t\t\turl: url,\r\n\t\t\t\t\t\t\ttype: \"Post\",\r\n\t\t\t\t\t\t\tcache: false,\r\n\t\t\t\t\t\t\tdata: {\r\n\t\t\t\t\t\t\t\tid: itKey,\r\n\t\t\t\t\t\t\t\tposType: subPosType,\r\n\t\t\t\t\t\t\t\tpage: subelementPageIndex,\r\n\t\t\t\t\t\t\t\tgetFromCache: fromCache,\r\n\t\t\t\t\t\t\t\tlayoutKey: \"\",\r\n\t\t\t\t\t\t\t\tforTableItems: forTableItems,\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\tsuccess: (data: string & LogonRequired) => {\r\n\t\t\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t\t\tdata != null &&\r\n\t\t\t\t\t\t\t\t\tdata.logonRequired !== undefined &&\r\n\t\t\t\t\t\t\t\t\tdata.logonRequired === true\r\n\t\t\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t$(item as HTMLElement).empty();\r\n\t\t\t\t\t\t\t\t\t$(item as HTMLElement).append(data);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t$(item as HTMLElement).data(\"fromcache\", \"False\");\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$(item as HTMLElement).empty();\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\t//dodawanie pozycji zawartosci w widoku karty\r\n\trefreshVarioObjectGridTabs();\r\n\r\n\t//dodawanie wiadomosci\r\n\t$(\".varioObjectMessagePartial\").each((_, item) => {\r\n\t\tconst $item = item as HTMLElement;\r\n\t\tconst message = $($item).data(\"val\");\r\n\t\tconst allowClose = $($item).data(\"allowClose\");\r\n\t\tconst showCloseButtom =\r\n\t\t\ttypeof allowClose === \"undefined\" ? true : allowClose;\r\n\t\tconst status = $($item).data(\"status\");\r\n\t\tShowVarioMessage(\r\n\t\t\t\".varioObjectMessagePartial\",\r\n\t\t\t\"/Vario/VarioMessage\",\r\n\t\t\tmessage,\r\n\t\t\tshowCloseButtom,\r\n\t\t\tstatus\r\n\t\t);\r\n\t});\r\n\r\n\t//dodawanie danych do pol dropdown i source\r\n\tLoadDropDowns();\r\n\tconst workflowFiles = document.getElementById(\r\n\t\t\"filesWorkflow\"\r\n\t) as HTMLInputElement;\r\n\tconst files = document.getElementById(\"files\") as HTMLInputElement;\r\n\tconst filesInput = workflowFiles?.files?.length\r\n\t\t? workflowFiles\r\n\t\t: files?.files?.length\r\n\t\t\t? files\r\n\t\t\t: null;\r\n\tconst addedFiles = filesInput?.files?.length ? filesInput.files : [];\r\n\tif (addedFiles && addedFiles.length === 1) {\r\n\t\tconst fileName = addedFiles[0].name;\r\n\t\tconst fileNameNoExt = fileName.replace(/\\.[^/.]+$/, \"\");\r\n\t\tconst editFieldCaption = document.getElementById(\r\n\t\t\t\"Caption\"\r\n\t\t) as HTMLInputElement;\r\n\t\tif (editFieldCaption != null) {\r\n\t\t\teditFieldCaption.value = fileNameNoExt;\r\n\t\t\t$(editFieldCaption).trigger(\"keyup\");\r\n\t\t\t$(editFieldCaption).trigger(\"change\");\r\n\t\t}\r\n\r\n\t\tconst editFieldSource = document.getElementById(\r\n\t\t\t\"ChildSources\"\r\n\t\t) as HTMLInputElement;\r\n\t\tif (editFieldSource) {\r\n\t\t\teditFieldSource.value = fileName;\r\n\t\t}\r\n\t\tconst cont = document.getElementById(\"emptyDivForAppendingInput\");\r\n\t\tif (cont)\r\n\t\t\tcont.innerHTML = ``;\r\n\r\n\t\tconst inputUploadFiles = document.getElementById(\r\n\t\t\t\"inputUploadFiles\"\r\n\t\t) as HTMLInputElement;\r\n\t\tconst dt = new DataTransfer();\r\n\t\tif (addedFiles)\r\n\t\t\tfor (let i = 0; i < (addedFiles?.length ?? 0); i++) {\r\n\t\t\t\tconst f = addedFiles[i];\r\n\t\t\t\tdt.items.add(\r\n\t\t\t\t\tnew File([f.slice(0, f.size, f.type)], f.name, {\r\n\t\t\t\t\t\ttype: f.type,\r\n\t\t\t\t\t})\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\tif (inputUploadFiles) inputUploadFiles.files = dt.files;\r\n\t\tif (filesInput) filesInput.value = \"\";\r\n\t}\r\n\r\n\tif (createNewObject) {\r\n\t\tconst cont = document.getElementById(\"emptyDivForAppendingInput\");\r\n\t\tif (cont && cont.innerHTML.length === 0) {\r\n\t\t\tcont.innerHTML = `
    `;\r\n\t\t}\r\n\r\n\t\tAfterEditorReadyWorkflow(correspondenceMode, containerId, parentId);\r\n\t}\r\n\r\n\tvarioObjectReadyToSubmit = true;\r\n}\r\n\r\n//ladowanie subelementow w widoku karty\r\nexport function LoadSubElements(\r\n\tsubElementType: string,\r\n\titemKey: string,\r\n\tpage: string,\r\n\telement: HTMLElement,\r\n\tsize: number,\r\n\tfilters: string\r\n) {\r\n\tconst isActive = $(element).hasClass(\"active\");\r\n\tif (element) {\r\n\t\t$(\".subElementsNavSpanItem, .subElementsNavItem\").each((_, it) => {\r\n\t\t\t$(it as HTMLElement).removeClass(\"active\");\r\n\t\t});\r\n\r\n\t\tconst dvh = window.innerHeight * 0.8;\r\n\t\tconst varioFormHeight = $(\".mainVarioObjectFormContainer\")[0]?.scrollHeight;\r\n\t\tconst collapsed = $(\".varioFormPanel .varioObjectPanel\").hasClass(\r\n\t\t\t\"collapsedPanel\"\r\n\t\t);\r\n\r\n\t\tif (!isActive) {\r\n\t\t\t$(element.parentNode as HTMLElement).addClass(\"active\");\r\n\t\t\t$(element).addClass(\"active\");\r\n\t\t\tif (!collapsed && varioFormHeight > 250) {\r\n\t\t\t\t$(\".varioFormHeader .varioObjectToggler\").show();\r\n\t\t\t\t$(\".varioFormPanel .varioObjectToggler\").show();\r\n\t\t\t\ttoggleVarioObjectPanel(\".varioFormPanel\", \".varioFormHeader\");\r\n\t\t\t}\r\n\t\t} else if (collapsed && varioFormHeight <= dvh) {\r\n\t\t\t$(\".varioFormHeader .varioObjectToggler\").hide();\r\n\t\t\t$(\".varioFormPanel .varioObjectToggler\").hide();\r\n\t\t\ttoggleVarioObjectPanel(\".varioFormPanel\", \".varioFormHeader\");\r\n\t\t}\r\n\r\n\t\t//guziki zakladek zawartosci\r\n\t\tlet allChildrenWidth = 0;\r\n\t\tconst childrenWidths: number[] = [];\r\n\t\t$(\".subElementsNavTabs > li\").each((_, el) => {\r\n\t\t\tconst width = $(el as HTMLElement).width() ?? 0;\r\n\t\t\tallChildrenWidth += width;\r\n\t\t\tchildrenWidths.push(width);\r\n\t\t});\r\n\r\n\t\tif (\r\n\t\t\t$(element).parents(\".dropdownForSubelementsGridSelectInVarioObject\")\r\n\t\t\t\t.length > 0\r\n\t\t) {\r\n\t\t\tif (\r\n\t\t\t\tallChildrenWidth + ($(element).width() ?? 0) <=\r\n\t\t\t\t($(\".subElementsNavTabs\").width() ?? 0)\r\n\t\t\t) {\r\n\t\t\t\t$(\".dropdown-menu span.active\")\r\n\t\t\t\t\t.addClass(\"dropdown-item\")\r\n\t\t\t\t\t.removeClass(\"nav-link\");\r\n\t\t\t\t$(element)\r\n\t\t\t\t\t.prependTo($(\".subElementsNavTabs\"))\r\n\t\t\t\t\t.wrap('
  • ');\r\n\t\t\t} else {\r\n\t\t\t\tconst toRemoveIndex = childrenWidths.indexOf(\r\n\t\t\t\t\tMath.max(...childrenWidths)\r\n\t\t\t\t);\r\n\t\t\t\t$(\".dropdown-menu span.active\")\r\n\t\t\t\t\t.addClass(\"dropdown-item\")\r\n\t\t\t\t\t.removeClass(\"nav-link\");\r\n\t\t\t\t$(\".subElementsNavTabs .subElementsNavItem\")\r\n\t\t\t\t\t.eq(toRemoveIndex)\r\n\t\t\t\t\t.prependTo(\r\n\t\t\t\t\t\t$(\".subElementsNavTabs .responsivetabs-more .dropdown-menu\")\r\n\t\t\t\t\t);\r\n\t\t\t\t$(element)\r\n\t\t\t\t\t.prependTo($(\".subElementsNavTabs\"))\r\n\t\t\t\t\t.wrap('
  • ');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t$(element).removeClass(\"dropdown-item\").addClass(\"nav-link\");\r\n\r\n\t\tconst responsiveTabsMore = $(\".responsivetabs-more\");\r\n\t\tif ($(\".subElementsNavTabs\").find(\".dropdown-menu span\").length === 0) {\r\n\t\t\tresponsiveTabsMore.hide();\r\n\t\t\tresponsiveTabsMore.removeClass(\"show\");\r\n\t\t} else {\r\n\t\t\tresponsiveTabsMore.show();\r\n\t\t\tresponsiveTabsMore.addClass(\"show\");\r\n\t\t}\r\n\t}\r\n\r\n\tif (isActive) {\r\n\t\ttry {\r\n\t\t\tsubElementsRequest?.abort();\r\n\t\t\tsubElementsRequest = null;\r\n\t\t\t$(\".subElements\").empty();\r\n\t\t\t$(\"#SubElementsCounter\").empty();\r\n\t\t} catch (_) {}\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\t$(\".subElements\").each((_, item) => {\r\n\t\tconst $item = item as HTMLElement;\r\n\t\t$($item).empty();\r\n\t\taddSkeletonLoading($item);\r\n\r\n\t\tconst url = GetBaseUrl() + $($item).data(\"url\");\r\n\t\tconst fromCache = $($item).data(\"fromcache\");\r\n\t\tif (url && url.length > 0) {\r\n\t\t\tsubElementsRequest = $.ajax({\r\n\t\t\t\turl: url,\r\n\t\t\t\ttype: \"Post\",\r\n\t\t\t\tcache: false,\r\n\t\t\t\tdata: {\r\n\t\t\t\t\tid: itemKey,\r\n\t\t\t\t\tposType: subElementType,\r\n\t\t\t\t\tpage: page,\r\n\t\t\t\t\tgetFromCache: fromCache,\r\n\t\t\t\t\tpageSize: size,\r\n\t\t\t\t\tfilters: filters,\r\n\t\t\t\t\tlayoutKey: \"\",\r\n\t\t\t\t\tbrowserTabGuid: sessionStorage.getItem(\"browserTabGuid\"),\r\n\t\t\t\t},\r\n\t\t\t\terror: (xhr) => {\r\n\t\t\t\t\tconsole.log(xhr);\r\n\t\t\t\t\t$(item as HTMLElement).empty();\r\n\t\t\t\t\t$(item as HTMLElement).append(\r\n\t\t\t\t\t\t\"

    Wyst\u0105pi\u0142 b\u0142\u0105d podczas \u0142adowania strony

    \"\r\n\t\t\t\t\t);\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: (data: string & LogonRequired) => {\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tdata != null &&\r\n\t\t\t\t\t\tdata.logonRequired !== undefined &&\r\n\t\t\t\t\t\tdata.logonRequired === true\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tglobalThis.lastTempLayout = null;\r\n\t\t\t\t\t\t$(item as HTMLElement).empty();\r\n\t\t\t\t\t\t$(item as HTMLElement).append(data);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$(item as HTMLElement).data(\"fromcache\", \"False\");\r\n\t\t\t\t},\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n}\r\n//funkcje obslugujace zakladki pozycji zawartosci w widoku karty\r\n(($) => {\r\n\tfunction storeTabs(\r\n\t\t$tabs: JQuery,\r\n\t\t$destination: JQuery\r\n\t) {\r\n\t\t// measure width\r\n\t\t$tabs.each(function () {\r\n\t\t\tconst width =\r\n\t\t\t\t$(this as HTMLElement)\r\n\t\t\t\t\t.outerWidth(true)\r\n\t\t\t\t\t?.toString() ?? \"\";\r\n\t\t\t$(this as HTMLElement)\r\n\t\t\t\t.find(\"span\")\r\n\t\t\t\t.data(\"width\", width);\r\n\t\t});\r\n\t\t$tabs.prependTo($destination);\r\n\r\n\t\t$tabs\r\n\t\t\t.find(\"span\")\r\n\t\t\t.unwrap()\r\n\t\t\t.removeClass(\"nav-link\")\r\n\t\t\t.addClass(\"dropdown-item\");\r\n\t}\r\n\r\n\tfunction makeTabsResponsive($element: JQuery) {\r\n\t\tconst $tabs = $element.find(\"li\");\r\n\t\tconst $firstTab = $tabs.first();\r\n\r\n\t\tconst individualTabHeight = $firstTab.outerHeight() ?? 0;\r\n\t\tconst tabsHeight = $element.outerHeight() ?? 0;\r\n\r\n\t\tif (tabsHeight > individualTabHeight) {\r\n\t\t\t// get y pos of first tab\r\n\t\t\tconst firstTabPos = $firstTab.offset();\r\n\r\n\t\t\tlet thisTabPos: JQuery.Coordinates | undefined;\r\n\t\t\t$tabs.each(function () {\r\n\t\t\t\tconst $thisTab = $(this as HTMLElement);\r\n\r\n\t\t\t\tthisTabPos = $thisTab.offset();\r\n\r\n\t\t\t\tif ((thisTabPos?.top ?? 0) > (firstTabPos?.top ?? 0)) {\r\n\t\t\t\t\tlet $dropdown = $element.find(\".responsivetabs-more\");\r\n\r\n\t\t\t\t\tlet dropDownClass =\r\n\t\t\t\t\t\t'
    ';\r\n\t\t\t\t\tif (($(document).width() ?? 0) < 300) {\r\n\t\t\t\t\t\tdropDownClass =\r\n\t\t\t\t\t\t\t'
    ';\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (!$dropdown.length) {\r\n\t\t\t\t\t\tconst dropdownMarkup = `
  • ${dropDownClass}
  • `;\r\n\t\t\t\t\t\t$dropdown = $(dropdownMarkup);\r\n\t\t\t\t\t\t$element.append($dropdown);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst $previousTab = $thisTab.prev();\r\n\t\t\t\t\tconst $followingTabs = $thisTab.nextAll().not(\".dropdown\");\r\n\r\n\t\t\t\t\tconst $destination = $(\".dropdown-menu\", $dropdown);\r\n\r\n\t\t\t\t\tif (!$thisTab.hasClass(\"dropdown\")) {\r\n\t\t\t\t\t\tstoreTabs($followingTabs, $destination);\r\n\t\t\t\t\t\tstoreTabs($thisTab, $destination);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tstoreTabs($previousTab, $destination);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t// check if enough space to move a menu item back out of \"...\"\r\n\r\n\t\t\t// get parent width\r\n\t\t\tconst parentWidth = $element.parent().width() ?? 0;\r\n\t\t\tlet tabSetWidth = 0;\r\n\t\t\tlet xPxAvailable: number;\r\n\r\n\t\t\t// calculate total width of tab set (can't just use width of ul because it is 100% by default)\r\n\t\t\t$element.children(\"li\").each(function () {\r\n\t\t\t\ttabSetWidth += $(this as HTMLElement).outerWidth(true) ?? 0;\r\n\t\t\t});\r\n\r\n\t\t\t// calculate available horizontal space\r\n\t\t\txPxAvailable = parentWidth - tabSetWidth;\r\n\r\n\t\t\t$element.find(\".dropdown-menu span.active\").each(function () {\r\n\t\t\t\tif (Number($(this as HTMLElement).data(\"width\")) <= xPxAvailable) {\r\n\t\t\t\t\t// fix for bootstrap 4\r\n\t\t\t\t\t$(this as HTMLElement)\r\n\t\t\t\t\t\t.removeClass(\"dropdown-item\")\r\n\t\t\t\t\t\t.addClass(\"nav-link\");\r\n\t\t\t\t\t$(this as HTMLElement)\r\n\t\t\t\t\t\t.insertBefore($element.find(\".responsivetabs-more\"))\r\n\t\t\t\t\t\t.wrap('
  • ');\r\n\t\t\t\t\txPxAvailable -= Number($(this as HTMLElement).data(\"width\"));\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t// if no menu items left, remove \"...\"\r\n\t\t\tconst responsiveTabsMore = $(\".responsivetabs-more\");\r\n\t\t\tif ($element.find(\".dropdown-menu span\").length === 0) {\r\n\t\t\t\tresponsiveTabsMore.hide();\r\n\t\t\t\tresponsiveTabsMore.removeClass(\"show\");\r\n\t\t\t} else {\r\n\t\t\t\tresponsiveTabsMore.show();\r\n\t\t\t\tresponsiveTabsMore.addClass(\"show\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t($.fn as any).responsiveTabs = function () {\r\n\t\tthis.each(() => {\r\n\t\t\tconst tabs = $(this);\r\n\t\t\tmakeTabsResponsive(tabs);\r\n\t\t\t$(window).on(\"resize\", () => {\r\n\t\t\t\tmakeTabsResponsive(tabs);\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\treturn this;\r\n\t};\r\n})(jQuery);\r\n\r\n//funkcja sprawdzajaca czy id jest minusowa co oznacza ze pozycja nie jest zapisana na bazie\r\nexport function ContainMinusID(fullID?: string) {\r\n\tif (\r\n\t\tstringIsNullOrEmpty(fullID) ||\r\n\t\ttypeof fullID !== \"string\" ||\r\n\t\tfullID?.indexOf(\";\") === -1\r\n\t)\r\n\t\treturn;\r\n\r\n\tconst id = fullID.substring(fullID.indexOf(\";\") + 1, fullID.length);\r\n\tif (id.includes(\"-\")) {\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\n//funkcja sprawdzajaca czy user uzywa safari\r\nexport function RunningOnSafari() {\r\n\treturn /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\r\n}\r\n\r\n//funkcja czysczcza liste plikow przeciagnietych do grida\r\nexport function clearDraggedFilesBuffer() {\r\n\tdraggedFilesBuffer = null;\r\n}\r\n\r\n//funkcja dodajaca chevron z informacja o pozycji (tytul, typ) + link do przejscia na pozycje\r\nexport function addItemInfoToPopup(\r\n\tpopupContainer = \"#Dialog\",\r\n\ttext = \"\",\r\n\terror = false,\r\n\tdata?: DialogRepresentation | InputBoxRepresentation\r\n) {\r\n\t//jesli nie ma center-dialog to dodajemy do popupcontainer - popup dla triggerow\r\n\tconst whereToAppend = $(popupContainer).find(\".center-dialog\").length\r\n\t\t? $(popupContainer).find(\".center-dialog\")\r\n\t\t: $(popupContainer);\r\n\twhereToAppend.append(`
    `);\r\n\r\n\tconst popupDetails = $(whereToAppend).find(\"#popupDetails\");\r\n\r\n\t//jesli nie ma textu w param, to szukamy gdzie jest user\r\n\tif (!text) {\r\n\t\tconst whereIsUser = checkWhereIsUser();\r\n\r\n\t\t//data z triggera\r\n\t\tconst caption = {\r\n\t\t\ttitle: data?.SenderRunningOperationItemCaption ?? \"\",\r\n\t\t\ttype: data?.SenderRunningOperationItemDef ?? \"\",\r\n\t\t\tid: data?.SenderRunningOperationItemKey ?? \"\",\r\n\t\t};\r\n\r\n\t\t//jesli jest na karcie to pobieramy dane z modelu karty, w przeciwny wypadku z zaznaczonej pozycji / edytora jesli to nowa pozycja\r\n\t\tif (whereIsUser === \"varioObject\") {\r\n\t\t\tif (!caption.title) caption.title = title ?? \"\";\r\n\t\t\tif (!caption.type && !stringIsNullOrEmpty(modelDefinitionKey))\r\n\t\t\t\tcaption.type = $(\".buttonsPanelTypeName img\").attr(\"data-type\") ?? \"\";\r\n\t\t\tif (!caption.id) caption.id = modelId ?? \"\";\r\n\t\t} else {\r\n\t\t\tif (!caption.title)\r\n\t\t\t\tcaption.title =\r\n\t\t\t\t\tlastSelectedRow[0]?.Caption ??\r\n\t\t\t\t\t$('#Editor [data-id=\"Caption\"]').val() ??\r\n\t\t\t\t\t\"\";\r\n\t\t\tif (!caption.type)\r\n\t\t\t\tcaption.type =\r\n\t\t\t\t\tlastSelectedRow[0]?.DefinitionName?.toString() ??\r\n\t\t\t\t\t$(\"#Editor #plTitle\").attr(\"data-typeName\") ??\r\n\t\t\t\t\t\"\";\r\n\t\t\tif (!caption.id)\r\n\t\t\t\tcaption.id =\r\n\t\t\t\t\tlastSelectedRow[0]?.ItemID ??\r\n\t\t\t\t\t$(\"#Editor #plTitle\").attr(\"data-type\") ??\r\n\t\t\t\t\t\"\";\r\n\t\t}\r\n\r\n\t\tif (stringIsNullOrEmpty(caption?.title)) return;\r\n\r\n\t\tconst text = `Pozycja${caption.type ? ` [${caption.type}]` : \"\"}: ${caption.title}`;\r\n\r\n\t\tconst popup = $(`\r\n \r\n\t\t\t\t${text}\r\n `).appendTo(popupDetails);\r\n\r\n\t\tpopup.on(\"click\", (e) => {\r\n\t\t\te.preventDefault();\r\n\t\t\tchangeCurrentItem({\r\n\t\t\t\titemId: caption.id,\r\n\t\t\t\tinnerCall: false,\r\n\t\t\t});\r\n\t\t});\r\n\t} else {\r\n\t\t//dodajemy text przekazany do funkcji\r\n\t\tpopupDetails.append(\r\n\t\t\t`${text}`\r\n\t\t);\r\n\t}\r\n\r\n\t//dodawanie chevronu po guzikach w popup\r\n\t$(popupContainer)\r\n\t\t.find(\"button:last-of-type\")\r\n\t\t.after(``);\r\n\r\n\t$(popupContainer)\r\n\t\t.find(\"#expandDetails\")\r\n\t\t.on(\"click\", function () {\r\n\t\t\t$(this as HTMLElement).toggleClass(\"collapsed\");\r\n\t\t\tpopupDetails.toggleClass(\"hidden\");\r\n\t\t});\r\n}\r\n\r\n//funkcja informujaca o niezapisanych zmianach pozycji\r\n//funkcja czeka na wybor uzytkownika (tak, nie, anuluj) - przydatne gdy funkcja sie pojawila jak uzytkownik chcial cos zrobic np. przejsc do innej pozycji\r\nexport async function ShowPopupWarningUnsaved(\r\n\tclose = false,\r\n\tignoreAndSave = false\r\n) {\r\n\treturn new Promise(async (resolve, reject) => {\r\n\t\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\t\tpopup.option(\"minWidth\", 350);\r\n\t\tpopup.option(\"minHeight\", 120);\r\n\t\tpopup.option(\"showTitle\", false);\r\n\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\t\tpopup.show();\r\n\r\n\t\t//ignoreandsave - przed wykonaniem operacji wyswietla komunikat ze trzeba zapisac, jesli ta zmienna jest na false, to po prostu informuje ze jest pozycja niezapisana\r\n\t\tconst text = ignoreAndSave\r\n\t\t\t? \"

    W bie\u017C\u0105cym oknie znajduj\u0105 si\u0119 pozycje wymagaj\u0105ce zapisu.

    Przed wykonaniem operacji zmiany zostan\u0105 zapisane.

    \"\r\n\t\t\t: `

    W bie\u017C\u0105cym oknie znajduj\u0105 si\u0119 pozycje wymagaj\u0105ce zapisu.

    \r\n

    Zapisa\u0107?

    `;\r\n\r\n\t\t$(\"#Dialog\").empty();\r\n\t\t$(\"#Dialog\").append(`
    \r\n\t\t\t${text}\r\n\t\t
    `);\r\n\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t.find(\".DialogFooter\")\r\n\t\t\t.empty()\r\n\t\t\t.append(`\r\n\t\t
    \r\n \r\n \r\n \r\n
    \r\n\t`);\r\n\r\n\t\t//nie dajemy mozliwosci undo jesli chcemy tylko poinformowac uzytkownika ze pozycja zostanie zapisana przed przejsciem dalej (np. wysylanie korespondencji/workflow)\r\n\t\tif (ignoreAndSave) {\r\n\t\t\t$(\"#undoItemBtn\").remove();\r\n\t\t}\r\n\r\n\t\t//dodanie info o pozycji dla ktorej wyskoczyl popup z info o niezapisanych danych\r\n\t\taddItemInfoToPopup(\"#Dialog-Main-Footer\");\r\n\r\n\t\t//dodawnie funkcji dla guzikow\r\n\t\t$(\"#acceptSaveButton\").on(\"click\", async (event) => {\r\n\t\t\t//zapisanie pozycji i zwrocenie promise a poczekal na zapis przed wykonaniem dalszej akcji ktora uzytkownik chcial wykonac (np. przejscie do innej pozycji)\r\n\t\t\tconst promise = SubmitForm(null, close, event.originalEvent);\r\n\t\t\tCloseDialog();\r\n\r\n\t\t\tif (promise) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst result = await promise;\r\n\t\t\t\t\tresolve(\r\n\t\t\t\t\t\tresult && \"status\" in result\r\n\t\t\t\t\t\t\t? result.status === RequestStatus.success\r\n\t\t\t\t\t\t\t: result\r\n\t\t\t\t\t);\r\n\t\t\t\t} catch (_) {\r\n\t\t\t\t\treject(false);\r\n\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t}\r\n\t\t\t} else resolve(true);\r\n\t\t});\r\n\r\n\t\t$(\"#undoItemBtn\").on(\"click\", async () => {\r\n\t\t\tif ($(\".dxGridIconsHoverInEdit.dx-icon-revert\").length) {\r\n\t\t\t\tignoreIsDirty = true;\r\n\t\t\t\t$(\".dxGridIconsHoverInEdit.dx-icon-revert\").trigger(\"click\");\r\n\t\t\t} else {\r\n\t\t\t\tUndoItem(close, false);\r\n\t\t\t}\r\n\r\n\t\t\tCloseDialog();\r\n\r\n\t\t\tif (undoItemPromise) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tawait undoItemPromise;\r\n\t\t\t\t\tresolve(true);\r\n\t\t\t\t} catch (_) {\r\n\t\t\t\t\treject(false);\r\n\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t}\r\n\t\t\t} else resolve(true);\r\n\t\t});\r\n\r\n\t\t$(\"#cancelBtn\").on(\"click\", () => {\r\n\t\t\tCloseDialog();\r\n\t\t\treject(false);\r\n\t\t\tHideLoadingPanel();\r\n\t\t});\r\n\r\n\t\t//dodanie klikniecia enter dla guzika tak\r\n\t\t$(document).one(\"keypress\", (event) => {\r\n\t\t\tif (\r\n\t\t\t\t$(\"#acceptSaveButton\").length > 0 &&\r\n\t\t\t\tevent.originalEvent?.key === \"Enter\"\r\n\t\t\t) {\r\n\t\t\t\t$(\"#acceptSaveButton\").trigger(\"click\");\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t//Usuniecie ladowania przy niezapisanej pozycji po kliknieciu guzika wstecz\r\n\t\tsetTimeout(HideLoadingPanel, 100);\r\n\t});\r\n}\r\n\r\n//funkcja informujaca o niezapisanych zmianach w podgladzie richedit\r\n//funkcja czeka na wybor uzytkownika (tak, nie, anuluj) - przydatne gdy funkcja sie pojawila jak uzytkownik chcial cos zrobic np. przejsc do innej pozycji\r\nexport async function ShowPopupWarningUnsavedRichEditDoc(\r\n\tclose = false,\r\n\tignoreAndSave = false\r\n) {\r\n\treturn new Promise(async (resolve, reject) => {\r\n\t\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\t\tpopup.option(\"minWidth\", calcMinPopup(300));\r\n\t\tpopup.option(\"minHeight\", calcMinPopup(120, true));\r\n\t\tpopup.option(\"showTitle\", false);\r\n\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\t\tpopup.show();\r\n\r\n\t\t//ignoreandsave - przed wykonaniem operacji wyswietla komunikat ze trzeba zapisac, jesli ta zmienna jest na false, to po prostu informuje ze jest pozycja niezapisana\r\n\t\tconst text = ignoreAndSave\r\n\t\t\t? \"

    W bie\u017C\u0105cym oknie znajduj\u0105 si\u0119 pozycje wymagaj\u0105ce zapisu.

    Przed wykonaniem operacji zmiany zostan\u0105 zapisane.

    \"\r\n\t\t\t: `

    Masz nie zapisane zmiany w dokumencie.

    \r\n

    Zapisa\u0107?

    `;\r\n\r\n\t\t$(\"#Dialog\").empty();\r\n\t\t$(\"#Dialog\").append(`
    \r\n ${text}\r\n
    `);\r\n\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t.find(\".DialogFooter\")\r\n\t\t\t.empty()\r\n\t\t\t.append(`\r\n\t\t
    \r\n \r\n \r\n \r\n
    \r\n\t`);\r\n\r\n\t\t//nie dajemy mozliwosci undo jesli chcemy tylko poinformowac uzytkownika ze pozycja zostanie zapisana przed przejsciem dalej (np. wysylanie korespondencji/workflow)\r\n\t\tif (ignoreAndSave) {\r\n\t\t\t$(\"#richEditUndoBtn\").remove();\r\n\t\t}\r\n\r\n\t\t//dodanie info o pozycji dla ktorej wyskoczyl popup z info o niezapisanych danych\r\n\t\taddItemInfoToPopup(\"#Dialog-Main-Footer\");\r\n\r\n\t\t//dodawnie funkcji dla guzikow\r\n\t\t$(\"#richEditSaveBtn\").on(\"click\", async () => {\r\n\t\t\t//zapisanie pozycji i zwrocenie promise a poczekal na zapis przed wykonaniem dalszej akcji ktora uzytkownik chcial wykonac (np. przejscie do innej pozycji)\r\n\t\t\tconst promise = saveDoc(close);\r\n\t\t\tCloseDialog();\r\n\r\n\t\t\tif (promise) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst result = await promise;\r\n\t\t\t\t\tresolve(result);\r\n\t\t\t\t} catch (_) {\r\n\t\t\t\t\treject(false);\r\n\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t}\r\n\t\t\t} else resolve(true);\r\n\t\t});\r\n\r\n\t\t$(\"#richEditUndoBtn\").on(\"click\", async () => {\r\n\t\t\tignoreUnsavedDoc(close);\r\n\t\t\tCloseDialog();\r\n\r\n\t\t\tif (undoItemPromise) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tawait undoItemPromise;\r\n\t\t\t\t\tresolve(true);\r\n\t\t\t\t} catch (_) {\r\n\t\t\t\t\treject(false);\r\n\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t}\r\n\t\t\t} else resolve(true);\r\n\t\t});\r\n\r\n\t\t$(\"#richEditcancelBtn\").on(\"click\", () => {\r\n\t\t\tCloseDialog();\r\n\t\t\treject(false);\r\n\t\t\tHideLoadingPanel();\r\n\t\t});\r\n\r\n\t\t//dodanie klikniecia enter dla guzika tak\r\n\t\t$(document).one(\"keypress\", (event) => {\r\n\t\t\tif (\r\n\t\t\t\t$(\"#richEditSaveBtn\").length > 0 &&\r\n\t\t\t\tevent.originalEvent?.key === \"Enter\"\r\n\t\t\t) {\r\n\t\t\t\t$(\"#richEditSaveBtn\").trigger(\"click\");\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t//Usuniecie ladowania przy niezapisanej pozycji po kliknieciu guzika wstecz\r\n\t\tsetTimeout(HideLoadingPanel, 100);\r\n\t});\r\n}\r\n\r\n//funkcja do utworzenia NOWEJ pozycji glownej widoku karty po dodaniu do jej zawartosci\r\nexport async function saveNewPositionAfterAddingToGrid(\r\n\tcontainerId: string = globalThis.containerId\r\n) {\r\n\tif (ContainMinusID(containerId)) {\r\n\t\tignoreIsDirty = true;\r\n\t\tconst res = await ShowPopupWarningUnsaved(false, true).catch(() => {});\r\n\t\tignoreIsDirty = false;\r\n\t\tif (!res) return false;\r\n\r\n\t\t//zwraca zaaktualizowany id bez minusa\r\n\t\treturn modelId;\r\n\t}\r\n\r\n\t//zwraca ten sam id jesli jest juz utworzona\r\n\treturn containerId;\r\n}\r\n\r\n//popup do potwierdzenia usuniecia wszystkich powiadomien\r\nexport function showPopupNotificationConfirmation(where: string) {\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(300));\r\n\tpopup.option(\"minHeight\", calcMinPopup(120, true));\r\n\tpopup.option(\"showTitle\", false);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\tpopup.show();\r\n\r\n\t$(\r\n\t\t\".dx-overlay-wrapper.dx-popup-wrapper.dx-overlay-modal.dx-overlay-shader\"\r\n\t).css(\"zIndex\", \"1800\");\r\n\r\n\t$(\"#Dialog\").empty();\r\n\t$(\"#Dialog\").append(`
    \r\n

    Czy na pewno chcesz usun\u0105\u0107 wszystkie powiadomienia?

    \r\n\r\n\r\n
    `);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(`\r\n\t\t
    \r\n \r\n \r\n
    \r\n\t`);\r\n\r\n\t$(\"#removeNotificationsBtn\").on(\"click\", () => {\r\n\t\tremoveAllNotifications(where);\r\n\t\tCloseDialog();\r\n\t\tCloseAdditionalDialog();\r\n\t});\r\n\r\n\t$(\"#dismissNotificationsRemovalBtn\").on(\"click\", () => {\r\n\t\tCloseDialog();\r\n\t\tif (where === \"#notifyContainer\") ToggleNotifyPanel();\r\n\t\tCloseAdditionalDialog();\r\n\t});\r\n\r\n\t$(document).one(\"keypress\", (event) => {\r\n\t\tif (\r\n\t\t\t$(\"#removeNotificationsBtn\").length > 0 &&\r\n\t\t\tevent.originalEvent?.key === \"Enter\"\r\n\t\t) {\r\n\t\t\tremoveAllNotifications(where);\r\n\t\t\tCloseDialog();\r\n\t\t\tCloseAdditionalDialog();\r\n\t\t}\r\n\t});\r\n\r\n\tsetTimeout(HideLoadingPanel, 100);\r\n}\r\n\r\n//funkcja przeladowujaca widok kalendarza\r\nexport function ReloadScheduler(containerId: string) {\r\n\t// Doda\u0107 sprawdzenie z jakiego widoku wywo\u0142ujemy (kalendarz czy grid)\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\tif (containerId !== \"CScheduleInbox:TT:L_W0001s\" && containerId.length > 0) {\r\n\t\tOpenInSelectedControll(containerId, 2);\r\n\t} else {\r\n\t\tshareCalendar();\r\n\t}\r\n}\r\n\r\n//zamkniecie popupu z czasem wykonania polecenia workflow po odklikaniu\r\nexport function closingDurationPopup(e: JQuery.MouseUpEvent) {\r\n\tconst popup = $(\".durationSelector .popover\");\r\n\tconst durationDiv = $(\".durationSelector .bdp-input\");\r\n\tif (\r\n\t\t!popup.is(e.target) &&\r\n\t\tpopup.has(e.target).length === 0 &&\r\n\t\tpopup.length > 0 &&\r\n\t\t!durationDiv.is(e.target) &&\r\n\t\tdurationDiv.has(e.target).length === 0\r\n\t) {\r\n\t\tdurationDiv.trigger(\"click\");\r\n\t}\r\n}\r\n\r\n//zamkniecie panelu notyfikacji po odklikaniu\r\nexport function closingNotificationPanel(e: JQuery.MouseUpEvent) {\r\n\tconst panel = $(\"#notifyPanel\");\r\n\tconst bellIcon = $(\".notificationBell\");\r\n\tconst bellIconClick = $(\".notificationBell a\");\r\n\r\n\tif (\r\n\t\t!panel.is(e.target) &&\r\n\t\tpanel.has(e.target).length === 0 &&\r\n\t\tpanel.length > 0 &&\r\n\t\t!bellIcon.is(e.target) &&\r\n\t\tbellIcon.has(e.target).length === 0 &&\r\n\t\tpanel.hasClass(\"collapseNotify\")\r\n\t) {\r\n\t\tbellIconClick.trigger(\"click\");\r\n\t}\r\n}\r\n\r\n//zamkniecie opcji chatu po odklikaniu\r\nexport function closingChatExpanded(e: JQuery.MouseUpEvent) {\r\n\tconst panel = $(\".expandedChatUsers\");\r\n\tconst button = $(\"#expandedChatButton\");\r\n\r\n\tif (\r\n\t\t!panel.is(e.target) &&\r\n\t\tpanel.has(e.target).length === 0 &&\r\n\t\tpanel.length > 0 &&\r\n\t\t!button.is(e.target) &&\r\n\t\tbutton.has(e.target).length === 0\r\n\t) {\r\n\t\tpanel.remove();\r\n\t}\r\n}\r\n\r\n//zamkniecie sidenav chatow po odklikaniu na mobilce\r\nexport function closingChatSideNav(e: JQuery.MouseUpEvent) {\r\n\tif (!isRunningOnMobile()) return;\r\n\r\n\tconst panel = $(\"#leftPanelChat\");\r\n\tconst button = $(\"#chatNavToggler\");\r\n\r\n\tif (\r\n\t\t!panel.is(e.target) &&\r\n\t\tpanel.has(e.target).length === 0 &&\r\n\t\tpanel.length > 0 &&\r\n\t\t!button.is(e.target) &&\r\n\t\tbutton.has(e.target).length === 0\r\n\t) {\r\n\t\t$(\".dialogChat\").addClass(\"hiddenChatNav\");\r\n\t}\r\n}\r\n\r\n//dodanie funkcji odklikujacych na myszke\r\n$(document).on(\"mouseup\", (e) => {\r\n\tclosingDurationPopup(e);\r\n\tclosingNotificationPanel(e);\r\n\tclosingChatExpanded(e);\r\n\tclosingChatSideNav(e);\r\n});\r\n\r\n//funkcja zwracaja richedit z opracowania\r\nexport function checkOutDoc(\r\n\telementId: string,\r\n\tcallback: (res: boolean) => any\r\n): JQuery.jqXHR {\r\n\treturn $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/CheckOutDocument?key=${elementId}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (data: boolean) => {\r\n\t\t\tif (data && callback !== undefined) {\r\n\t\t\t\tcallback(data);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//funkcja zmieniajaca guziki zapisu w widoku karty\r\nexport function ChangeSaveBtnsStatus(enabled: boolean) {\r\n\tconst disabled = enabled ? null : \"disabled\";\r\n\t$(\r\n\t\t\"#btnSaveItem, #BarbtnSaveItemFloatingWithClose, #BarbtnSaveItemFloating\"\r\n\t).toggleClass(\"disabled\", !enabled);\r\n\t$(\r\n\t\t\"#btnSaveItem, #BarbtnSaveItemFloatingWithClose, #BarbtnSaveItemFloating\"\r\n\t).attr(\"disabled\", disabled);\r\n\tChangeCorrespondenceActionButtonsStatus(enabled);\r\n}\r\n\r\n//funkcja zwracajaca/pobierajaca z opracowania pozycji\r\nexport function checkInCheckOut(elementId: string, checkOut = false) {\r\n\tif (!elementId) return;\r\n\t//zmienna odpowiadajaca za zwrocenie dokumentu jesli sie kliklo edytuj ale faktycznie nie zedytowalo\r\n\tglobalThis.firstCheckOutClick = false;\r\n\treturn $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/CheckInCheckOut?id=${elementId}&checkOut=${checkOut}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (data: boolean) => {\r\n\t\t\tif (data) {\r\n\t\t\t\tconsole.log(\"zwr\u00F3cono z opracowania\");\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"Plik nie mo\u017Ce zosta\u0107 pobrany do opracowania\", \"warning\");\r\n\t\t\t\tglobalThis.checkOutDuring = false;\r\n\t\t\t\tglobalThis.checkOutNeed = true;\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//wlaczenie popupu z wiadomoscia workflow na start widoku karty (workflow, przejscie z linku)\r\nexport function workflowActionTitleClick() {\r\n\tif (alreadyDisplayed) return;\r\n\r\n\tworkflowMessage(modelId);\r\n}\r\n\r\n//funkcja dodajaca operacje do historii operacji\r\nexport function addOperation(\r\n\tid: string | string[],\r\n\toperationCaption: string,\r\n\toperationCode?: number\r\n) {\r\n\t//operacja dla wielu pozycji\r\n\tif (Array.isArray(id) || id?.includes(\",\")) {\r\n\t\t//splitowanie id do tablicy\r\n\t\tif (id.includes(\",\")) id = (id as string).split(\",\");\r\n\t\tfor (const x of id) {\r\n\t\t\taddOperation(x, operationCaption, operationCode);\r\n\t\t}\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (!id) return;\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/AddOperation?id=${id}&operationCaption=${operationCaption}&operationCode=${operationCode}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (_: ServiceResponse) => {},\r\n\t\terror: (error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t},\r\n\t});\r\n}\r\n\r\n//funkcja do odpisania na powiadomienie w signalr\r\n//obecnie zastapiane variochatem\r\nexport function SendMessageWindow(\r\n\tsender: string,\r\n\tsndMesssage: string,\r\n\tsndDate: string,\r\n\tsndId: string\r\n) {\r\n\tglobalSelectedRecipients = [];\r\n\t$(\"#BigDialog\").empty();\r\n\t$(\"#DialogFooter\").empty();\r\n\r\n\tconst popup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(500));\r\n\tpopup.option(\"minHeight\", calcMinPopup(470, true));\r\n\tpopup.option(\"title\", \"Wczytywanie odbiorc\u00F3w...\");\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t//div zeby sprawdzic czy nadal mam otwarty ten sam popup czy inny (bo potem nadpisuje)\r\n\t$(\"#BigDialog\").append(\r\n\t\t'
    '\r\n\t);\r\n\r\n\tlet recipients: VarioEmployee[] = [];\r\n\tif (sessionStorage.getItem(\"Recipients\") == null && sender.length <= 0) {\r\n\t\tgetRecipientsFromHub().then((res) => {\r\n\t\t\trecipients = res;\r\n\t\t\tif ($(\"#sendMessageWindowAdded\").length > 0)\r\n\t\t\t\tSendMessageWindowRecipients(\"\", \"\", \"\", \"\");\r\n\t\t});\r\n\t} else if (sender.length <= 0) {\r\n\t\trecipients = JSON.parse(sessionStorage.Recipients);\r\n\t\tif ($(\"#sendMessageWindowAdded\").length > 0)\r\n\t\t\tSendMessageWindowRecipients(\"\", \"\", \"\", \"\");\r\n\t} else {\r\n\t\tSendMessageWindowRecipients(sender, sndMesssage, sndDate, sndId);\r\n\t}\r\n\r\n\tfunction SendMessageWindowRecipients(sender, sndMesssage, sndDate, sndId) {\r\n\t\tlet title = \"Wy\u015Blij wiadomo\u015B\u0107\";\r\n\t\tlet warningNoOnline = \"\";\r\n\r\n\t\tif (sender.length > 0) {\r\n\t\t\ttitle = `Wy\u015Blij odpowied\u017A do: ${sender}`;\r\n\r\n\t\t\tif (sessionStorage.getItem(\"connectedWebClients\") != null) {\r\n\t\t\t\tconst connectedWebClients = JSON.parse(\r\n\t\t\t\t\tsessionStorage.getItem(\"connectedWebClients\") ?? \"null\"\r\n\t\t\t\t);\r\n\r\n\t\t\t\tconst sndOnline = connectedWebClients.filter((cli) => {\r\n\t\t\t\t\treturn cli.userName === sender;\r\n\t\t\t\t});\r\n\r\n\t\t\t\tif (sndOnline == null || sndOnline.length <= 0) {\r\n\t\t\t\t\twarningNoOnline = `
    U\u017Cytkownik ${sender} jest obecnie offline i nie otrzyma wiadomo\u015Bci!
    `;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst popup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\t\tpopup.option(\"minWidth\", calcMinPopup(500));\r\n\t\tpopup.option(\"maxHeight\", calcMinPopup(300, true));\r\n\t\tpopup.option(\"title\", title);\r\n\t\tpopup.option(\"showTitle\", true);\r\n\t\tpopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\t\tpopup.show();\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t?.parent()\r\n\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t$(\"#BigDialog\").empty();\r\n\t\t$(\"#DialogFooter\").empty();\r\n\r\n\t\tif (sender.length <= 0) {\r\n\t\t\tcreateRecipientsList(recipients, false, true);\r\n\t\t}\r\n\r\n\t\tlet recipientToReplay = \"\";\r\n\t\tif (sender.length > 0) {\r\n\t\t\t$(\"#BigDialog\").append(`
    \r\n ${warningNoOnline}\r\n
    ${sndDate}
    \r\n

    ${sndMesssage}

    \r\n
    `);\r\n\r\n\t\t\tfixScrollInDx(\".scrollText\");\r\n\t\t\trecipientToReplay = sndId;\r\n\t\t}\r\n\r\n\t\t$(\"#BigDialog\").append(\"
    \" + \"Tre\u015B\u0107 wiadomo\u015Bci\" + \"
    \");\r\n\t\t$(\"#BigDialog\").append(\r\n\t\t\t'
    '\r\n\t\t);\r\n\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t.find(\".DialogFooter\")\r\n\t\t\t.empty()\r\n\t\t\t.append(\r\n\t\t\t\t`
    `\r\n\t\t\t);\r\n\t}\r\n\r\n\tglobalSelectedRecipients = [];\r\n}\r\n\r\n//wyslanie wiadomosci signalr\r\nexport function ExecuteSendMessage(recipientToReplay: string) {\r\n\ttry {\r\n\t\tconst message = (\r\n\t\t\tdocument.getElementById(\"MessageTextArea\") as HTMLTextAreaElement\r\n\t\t).value;\r\n\t\tconst recipients: string[] = [];\r\n\t\tconst recipientsID: string[] = [];\r\n\r\n\t\t//Odpowiadamy na wiadomo\u015B\u0107\r\n\t\tif (typeof recipientToReplay !== \"undefined\" && recipientToReplay?.length) {\r\n\t\t\trecipientsID.push(recipientToReplay);\r\n\t\t}\r\n\t\t//Piszemy nowa wiadomo\u015B\u0107\r\n\t\telse {\r\n\t\t\tif (globalSelectedRecipients.length <= 0) {\r\n\t\t\t\tshowDxToast(\"Wybierz przynajmniej jednego adresata!\", \"warning\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tfor (const item of globalSelectedRecipients) {\r\n\t\t\t\trecipients.push(item.id);\r\n\t\t\t}\r\n\r\n\t\t\tfor (let i = 0; i < recipients.length; i++) {\r\n\t\t\t\tconst str = recipients[i];\r\n\t\t\t\tconst index = str.indexOf(\"Id=\");\r\n\r\n\t\t\t\tif (index !== -1) {\r\n\t\t\t\t\tconst userID = str.split(\"Id=\")[1];\r\n\t\t\t\t\tconst constUserIDNumber = Number.parseInt(userID);\r\n\t\t\t\t\trecipientsID.push(constUserIDNumber.toString());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tglobalSelectedRecipients = [];\r\n\t\t$(\"#ExecuteSendMessage\").addClass(\"disabled\").attr(\"disabled\", \"disabled\");\r\n\r\n\t\tCloseBigDialog();\r\n\r\n\t\tconst messageRequestModel = {\r\n\t\t\tRecipients: recipientsID,\r\n\t\t\tMessage: message,\r\n\t\t\tTopic: \"\",\r\n\t\t\tMessageLevel: 1,\r\n\t\t\tIcon: \"\",\r\n\t\t\tMessageType: 1,\r\n\t\t\tDelay: 0,\r\n\t\t\tRequired: false,\r\n\t\t};\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/HubProxy/SendMessage`,\r\n\t\t\ttype: \"Post\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: { requestMessage: messageRequestModel },\r\n\t\t\tsuccess: (_: boolean) => {},\r\n\t\t\terror: (error) => {\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t},\r\n\t\t});\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t}\r\n}\r\n\r\n//funkcja do zmienienia guzika wyslij dla wysylania wiadomosci signalr\r\nexport function MessageTextAreaOnChange(e: HTMLInputElement) {\r\n\tconst ExecuteSendMessageBtn = document.getElementById(\"ExecuteSendMessage\");\r\n\tif (ExecuteSendMessageBtn) {\r\n\t\tif (e?.value?.length > 0) {\r\n\t\t\tExecuteSendMessageBtn.removeAttribute(\"disabled\");\r\n\t\t} else {\r\n\t\t\tExecuteSendMessageBtn.setAttribute(\"disabled\", \"true\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\n//pobranie czy user jest adminem lub adminem organizacji\r\nexport function getAdminState() {\r\n\tif (!currentUserId || currentUserId === \"0\") return;\r\n\r\n\tif (\r\n\t\tsessionStorage.getItem(\"AdminState\") == null ||\r\n\t\tsessionStorage.getItem(\"isReportDesigner\") == null\r\n\t) {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetAdminState`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: true,\r\n\t\t\tsuccess: (data: AdminState) => {\r\n\t\t\t\tisAdmin = data?.isAdmin ?? false;\r\n\t\t\t\tisReportDesigner = data?.isReportDesigner ?? false;\r\n\t\t\t\tsessionStorage.setItem(\"AdminState\", isAdmin.toString());\r\n\t\t\t\tsessionStorage.setItem(\"isReportDesigner\", isReportDesigner.toString());\r\n\t\t\t\tgetAdminState();\r\n\t\t\t},\r\n\t\t});\r\n\t} else {\r\n\t\tisAdmin = sessionStorage.getItem(\"AdminState\") === \"true\";\r\n\t\tisReportDesigner = sessionStorage.getItem(\"isReportDesigner\") === \"true\";\r\n\t}\r\n\r\n\t//jesli jest adminem to moze edytowac zaproszonych uzytkownikow\r\n\tif (isAdmin || isSiteAdmin) {\r\n\t\tif ($(\"#inviteUsersButton\").length === 0 && registerEnabled) {\r\n\t\t\t$(\"#NavUserOptions\").prepend(`\r\n
  • \r\n \r\n \r\n Do\u0142\u0105cz innych...\r\n \r\n
  • \r\n `);\r\n\t\t}\r\n\r\n\t\tif (!$(\"#navUserIcon\").hasClass(\"fa-user-cog\")) {\r\n\t\t\t$(\"#navUserIcon\").removeClass(\"fa-user\");\r\n\t\t\t$(\"#navUserIcon\").addClass(\"fa-user-cog\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\n//pobranie wiadomosci o organizacji\r\nexport function getSiteInfo() {\r\n\tif (!currentUserId || currentUserId === \"0\") return;\r\n\r\n\tif (sessionStorage.getItem(\"SiteInfo\") == null) {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetSiteInfo`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: true,\r\n\t\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\t\tif (response?.success) {\r\n\t\t\t\t\tsessionStorage.setItem(\"SiteInfo\", response.data.siteName);\r\n\t\t\t\t\tsiteName = response.data.siteName;\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t});\r\n\t} else {\r\n\t\tsiteName = sessionStorage.getItem(\"SiteInfo\") ?? \"\";\r\n\t}\r\n}\r\n\r\n//sprawdzanie czy moze byc guzik uruchom dostepny\r\nexport function checkIfWorkflowIsAvailable() {\r\n\tfunction deleteWorkflowBtn() {\r\n\t\tif (!workflowIsAvailable) {\r\n\t\t\t//mobilka i desktop\r\n\t\t\t$(\"[id=workflowInitializeBtn]\").remove();\r\n\t\t}\r\n\t}\r\n\r\n\tif (sessionStorage.getItem(\"WorkflowIsAvailable\") == null) {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/WorkflowIsAvailable`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tsuccess: (res: ServiceResponse) => {\r\n\t\t\t\tif (res?.success) {\r\n\t\t\t\t\tsessionStorage.setItem(\"WorkflowIsAvailable\", res.data.toString());\r\n\t\t\t\t\tworkflowIsAvailable = JSON.parse(res.data.toString());\r\n\r\n\t\t\t\t\tdeleteWorkflowBtn();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t});\r\n\t} else {\r\n\t\tworkflowIsAvailable = JSON.parse(\r\n\t\t\tsessionStorage.getItem(\"WorkflowIsAvailable\") ?? \"true\"\r\n\t\t);\r\n\t}\r\n\r\n\tdeleteWorkflowBtn();\r\n}\r\n\r\n//otwieranie sidenav w debug\r\n//zeby od razu otwieral a nie trzeba bylo najezdzac na kropki\r\nexport function toggleSidenavDebug() {\r\n\tif (!debug) return;\r\n\r\n\ttoggleSidenav();\r\n}\r\n\r\n//funkcja otwierajaca sidenav\r\nexport async function toggleSidenav(e?: MouseEvent) {\r\n\tif (debug && e) return;\r\n\r\n\t//poczekanie az user przejdzie myszka poza trzy kropki zeby dalo sie wybrac folder bez otwierania calego sidenava\r\n\tif (typeof e !== \"undefined\" && e) {\r\n\t\tawait wait(150);\r\n\r\n\t\tconst button = $(\".miniSideNavToggler\");\r\n\t\tconst sidenav = $(\"#accordionN\");\r\n\t\tconst location = document.elementFromPoint(\r\n\t\t\tmousePosition.x,\r\n\t\t\tmousePosition.y\r\n\t\t) as HTMLElement;\r\n\r\n\t\tconst mouseNotOnButton =\r\n\t\t\t!button.is(location) && button.has(location).length === 0;\r\n\t\tconst mouseOnSidenav = sidenav.has(location).length > 0;\r\n\r\n\t\tif ((mouseNotOnButton || mouseOnSidenav) && !debug) return;\r\n\t}\r\n\r\n\tconst sidenav = $(\".sidenav\");\r\n\r\n\tif (sidenav.hasClass(\"hoverSidenav\")) {\r\n\t\tsidenav.removeClass(\"hoverSidenav\");\r\n\t\treturn;\r\n\t}\r\n\r\n\tsidenav.addClass(\"hoverSidenav\");\r\n\tsidenav.one(\"mouseleave\", () => {\r\n\t\tsidenav.removeClass(\"hoverSidenav\");\r\n\t});\r\n}\r\n\r\n//pokazanie trzech kropek z reszta folderow w mini sidenavie na hoverze\r\nexport function showExpandedMiniSidenav() {\r\n\tif ($(\".expandedMiniSidenav\").length > 0) {\r\n\t\t$(\".expandedMiniSidenav\").remove();\r\n\t\treturn;\r\n\t}\r\n\r\n\t//sprawdzenie czy sa jakies foldery ktore sie nie mieszcza\r\n\tconst panels = $(\".sidenav-container .panel.hiddenForMiniClass\");\r\n\tif (panels.length === 0) return;\r\n\r\n\t$(\".sidenav\").after(`
    `);\r\n\r\n\tconst container = $(\".expandedMiniSidenav\");\r\n\r\n\tpanels.clone(true, true).appendTo(container);\r\n\r\n\t$(window).on(\"mouseup\", (e) => {\r\n\t\tconst button = $(\".miniSideNavExpand\");\r\n\t\tif (\r\n\t\t\te.target instanceof HTMLElement &&\r\n\t\t\t!button.is(e.target) &&\r\n\t\t\tbutton.has(e.target as HTMLElement).length === 0\r\n\t\t) {\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tcontainer.remove();\r\n\t\t\t}, 5);\r\n\t\t}\r\n\t});\r\n}\r\n\r\n//usuniecie fullscreen diagramu, richedita, excela\r\nexport function deleteFullScreenDxComponent() {\r\n\tconst isFullscreen = $(\"#emailEmbed\").children().length === 0;\r\n\tif (!isFullscreen) return;\r\n\r\n\t$(\"body\").find(\"> .richEdit\").remove();\r\n\t$(\"body\").find(\"> #spreadsheet\").remove();\r\n\t$(\"body\").find(\"> .dx-diagram-fullscreen\").remove();\r\n}\r\n\r\n//usuniecie dynamicznego popupa ktory nie ma odwolania na stale w html\r\n//przyklad popup - podglad komenatrzy/zmian w richedit\r\nexport function removeJSPopup() {\r\n\tconst popup = $(\"#dynamicPopupContainer\").dxPopup(\"instance\");\r\n\tpopup?.dispose();\r\n\t$(\"#dynamicPopupContainer\").remove();\r\n}\r\n\r\n//funkcja sprawdzajaca czas ile uzytkownik nic nie robi aaby go potem wylogowac\r\nexport const inactivityTime = () => {\r\n\tif (logoutTime === 0) return;\r\n\r\n\t//jesli wykona sie dany z eventow to resetujemy timer wylogowania\r\n\tlet time: number;\r\n\twindow.addEventListener(\"load\", resetTimer, true);\r\n\tconst events = [\r\n\t\t\"mousedown\",\r\n\t\t\"mousemove\",\r\n\t\t\"keypress\",\r\n\t\t\"scroll\",\r\n\t\t\"touchstart\",\r\n\t\t\"click\",\r\n\t];\r\n\tfor (const name of events) {\r\n\t\tdocument.addEventListener(name, resetTimer, true);\r\n\t}\r\n\r\n\tfunction resetTimer() {\r\n\t\tclearTimeout(time);\r\n\t\tlocalStorage.setItem(\"logoutPending\", \"false\");\r\n\t\ttime = setTimeout(() => {\r\n\t\t\tlocalStorage.setItem(\"logoutPending\", \"true\");\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tif (window.location.pathname.includes(\"/Account\")) return;\r\n\t\t\t\tif (currentUserId === \"0\") return;\r\n\t\t\t\tif (!JSON.parse(localStorage.getItem(\"logoutPending\") ?? \"null\")) {\r\n\t\t\t\t\tclearTimeout(time);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tLogout(\"Inactivity\");\r\n\t\t\t}, 1000);\r\n\t\t}, logoutTime) as any as number;\r\n\t}\r\n};\r\n\r\n//sprawdzanie czy email potrzebuje potwierdzenia przeczytania\r\nexport function checkIfHasRequestReadReceipt(itemsParam: string[]) {\r\n\treturn new Promise((resolve) => {\r\n\t\ttry {\r\n\t\t\t$.ajax({\r\n\t\t\t\turl: `${GetBaseUrl()}/Vario/HasRequestReadReceipt`,\r\n\t\t\t\ttype: \"Post\",\r\n\t\t\t\tdata: { itemsParam: itemsParam },\r\n\t\t\t\tcache: false,\r\n\t\t\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\t\t\tif (response?.success) {\r\n\t\t\t\t\t\tif (debug) console.log(\"checkIfHasRequestReadReceipt\", response);\r\n\r\n\t\t\t\t\t\tresolve(response.data);\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\terror: (err) => {\r\n\t\t\t\t\tconsole.log(err);\r\n\t\t\t\t},\r\n\t\t\t});\r\n\t\t} catch (e) {\r\n\t\t\tconsole.error(e);\r\n\t\t}\r\n\t});\r\n}\r\n\r\n//funkcja anulujaca wykonywane workflow / triggery / custom buttony\r\nexport function CancelExecutingOperations(id: string, all: boolean) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/CancelExecutingOperations?id=${id}&all=${all}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: () => {},\r\n\t\terror: (error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function stringIsNullOrEmpty(string?: any) {\r\n\treturn typeof string === \"undefined\" || !string || string === \"\";\r\n}\r\n\r\n//funkcja pobierajaca plik z linka lub floating buttona\r\nexport function downloadFileFromLink(\r\n\turl = \"\",\r\n\titemId: string | string[] = \"\",\r\n\ttitle = \"\"\r\n) {\r\n\tif (stringIsNullOrEmpty(url) && !stringIsNullOrEmpty(itemId))\r\n\t\turl = `${GetBaseUrl()}/Vario/DownloadContentFile/${itemId}?download=true`;\r\n\r\n\tconst text = url.includes(\"Multiple\")\r\n\t\t? \"Pobieranie plik\u00F3w...\"\r\n\t\t: \"Pobieranie pliku...\";\r\n\tshowDxToast(\r\n\t\ttext,\r\n\t\t\"info\",\r\n\t\tundefined,\r\n\t\t`
    ${text}
    `,\r\n\t\t\"downloadProgress\"\r\n\t);\r\n\r\n\t//progres pobierania, im wiecej plikow tym wolniej leci\r\n\tconst interval = setInterval(() => {\r\n\t\tlet current = $(\"#FileDownloadingProgress\").attr(\"value\") ?? 0;\r\n\t\tif (Number(current) >= 99) current = 75;\r\n\t\t$(\"#FileDownloadingProgress\").attr(\r\n\t\t\t\"value\",\r\n\t\t\tNumber(current) +\r\n\t\t\t\tMath.floor(5 / (url.includes(\"Multiple\") ? itemId.length || 1 : 1))\r\n\t\t);\r\n\t}, 200);\r\n\r\n\tconst bodyParam = url.includes(\"Multiple\")\r\n\t\t? JSON.stringify({ ids: itemId })\r\n\t\t: \"\";\r\n\r\n\t// uzywamy fetch bo ajax ma problem z pobieraniem plikow html/xml jako blob\r\n\tfetch(url, {\r\n\t\tmethod: \"POST\",\r\n\t\theaders: {\r\n\t\t\t\"Content-Type\": \"application/json\",\r\n\t\t},\r\n\t\tbody: bodyParam,\r\n\t})\r\n\t\t.then(async (response) => {\r\n\t\t\ttry {\r\n\t\t\t\tclearInterval(interval);\r\n\r\n\t\t\t\tif (!response.ok) {\r\n\t\t\t\t\tthrow new Error(`Failed to fetch file: ${response.statusText}`);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst blob = await response.blob();\r\n\r\n\t\t\t\tconst link = document.createElement(\"a\");\r\n\t\t\t\tconst downloadUrl = window.URL.createObjectURL(blob);\r\n\t\t\t\tlink.href = downloadUrl;\r\n\r\n\t\t\t\t// Set the download attribute with the specified filename\r\n\t\t\t\tlink.download =\r\n\t\t\t\t\tresponse.headers\r\n\t\t\t\t\t\t.get(\"content-disposition\")\r\n\t\t\t\t\t\t?.split(\"filename\")[1]\r\n\t\t\t\t\t\t?.split(\"=\")[1]\r\n\t\t\t\t\t\t?.split(\";\")[0]\r\n\t\t\t\t\t\t?.replaceAll('\"', \"\")\r\n\t\t\t\t\t\t?.trim() ??\r\n\t\t\t\t\ttitle ??\r\n\t\t\t\t\t\"Plik\";\r\n\r\n\t\t\t\t// Append the link to the body (it's required for the click event)\r\n\t\t\t\tdocument.body.appendChild(link);\r\n\t\t\t\t$(link)[0].click();\r\n\r\n\t\t\t\tdocument.body.removeChild(link);\r\n\t\t\t\twindow.URL.revokeObjectURL(downloadUrl);\r\n\r\n\t\t\t\t$(\"#FileDownloadingProgress\").attr(\"value\", 100);\r\n\t\t\t} catch (ex) {\r\n\t\t\t\tconsole.error(ex);\r\n\t\t\t\tshowDxToast(\"B\u0142\u0105d pobierania pliku\", \"error\");\r\n\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tcloseToast(\"downloadProgress\");\r\n\t\t\t\t}, 1000);\r\n\t\t\t}\r\n\t\t})\r\n\t\t.catch((err) => {\r\n\t\t\tconsole.error(err);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d pobierania pliku\", \"error\");\r\n\t\t})\r\n\t\t.finally(() => {\r\n\t\t\tclearInterval(interval);\r\n\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tcloseToast(\"downloadProgress\");\r\n\t\t\t}, 1000);\r\n\t\t});\r\n}\r\n\r\n//funkcja pobierajaca wiele plikow z grida jako zip\r\nexport function downloadMultipleFiles(ids: string[]) {\r\n\tdownloadFileFromLink(`${GetBaseUrl()}/Vario/DownloadMultipleFiles`, ids);\r\n}\r\n\r\n//funkcja tworzaca popup z sliderem na wlaczenie strony\r\nexport function prepareSlider() {\r\n\tlet varioSliderConfirmation = null;\r\n\ttry {\r\n\t\tvarioSliderConfirmation = JSON.parse(\r\n\t\t\tlocalStorage.getItem(\"varioSlider\") ?? \"null\"\r\n\t\t);\r\n\t} catch (_) {\r\n\t\tlocalStorage.removeItem(\"varioSlider\");\r\n\t\tsessionStorage.removeItem(\"shownVarioSlider\");\r\n\t\treturn;\r\n\t}\r\n\r\n\t//jesli nie ustawiono ze ma sie ciagle chowac\r\n\t//slider pobiera pliki z folderu slider w wwwroot\r\n\tif (varioSliderConfirmation !== false) {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Slider/GetFiles`,\r\n\t\t\ttype: \"GET\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: (data: string[]) => {\r\n\t\t\t\tif (data?.length > 0) {\r\n\t\t\t\t\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\r\n\t\t\t\t\tpopup.option(\"minWidth\", calcMinPopup(\"85vw\"));\r\n\t\t\t\t\tpopup.option(\"minHeight\", calcMinPopup(\"81vh\", true));\r\n\t\t\t\t\tpopup.option(\"showTitle\", true);\r\n\t\t\t\t\tpopup.option(\"title\", \"Porady u\u017Cytkowania\");\r\n\t\t\t\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\t\t\t\t\tpopup.show();\r\n\t\t\t\t\tpopup\r\n\t\t\t\t\t\t.content()\r\n\t\t\t\t\t\t?.parent()\r\n\t\t\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t\t\t\t$(\"#Dialog\").empty();\r\n\t\t\t\t\t$(\"#Dialog\").append(`\r\n
    \r\n
    \r\n\r\n \r\n
    \r\n\r\n \r\n
      \r\n
    \r\n\r\n \r\n
    \r\n
    \r\n\r\n \r\n \r\n \r\n Poprzedni\r\n \r\n \r\n \r\n Nast\u0119pny\r\n \r\n\r\n
    \r\n\r\n
    \r\n
    `);\r\n\r\n\t\t\t\t\tpopup\r\n\t\t\t\t\t\t.content()\r\n\t\t\t\t\t\t.find(\".DialogFooter\")\r\n\t\t\t\t\t\t.empty()\r\n\t\t\t\t\t\t.append(\r\n\t\t\t\t\t\t\t` `\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\tif (data?.length === 1) {\r\n\t\t\t\t\t\t$(\".carousel-indicators, .carousel-control\").addClass(\"hidden\");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tdata.forEach((item, index) => {\r\n\t\t\t\t\t\tconst linkToItem = `${GetBaseUrl()}/slider/${item}`;\r\n\t\t\t\t\t\t$(\"#vario-slider .carousel-inner\").append(`\r\n
    \r\n \r\n
    \r\n `);\r\n\r\n\t\t\t\t\t\t$(\"#vario-slider .carousel-indicators\").append(`\r\n
  • \r\n `);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t$(\"#vario-slider .carousel-inner .item:first\").addClass(\"active\");\r\n\t\t\t\t\t$(\"#vario-slider .carousel-indicators li:first\").addClass(\"active\");\r\n\r\n\t\t\t\t\tfixScrollInDx(\"#vario-slider\");\r\n\r\n\t\t\t\t\tpopup.repaint();\r\n\t\t\t\t\tpopup.show();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t});\r\n\t} else if (varioSliderConfirmation === false) {\r\n\t\tremoveSlider();\r\n\t}\r\n}\r\n\r\n//funkcja usuwajaca slider\r\nexport function removeSlider() {\r\n\t$(\"#vario-slider\").remove();\r\n\tCloseDialog();\r\n\tlocalStorage.setItem(\"varioSlider\", \"false\");\r\n}\r\n\r\n//checkbox z trzema stanami\r\nexport function tristate(control: HTMLInputElement) {\r\n\tswitch (control.value) {\r\n\t\tcase \"\":\r\n\t\t\tcontrol.innerHTML = \"⨉\";\r\n\t\t\tcontrol.title = \"Odrzu\u0107\";\r\n\t\t\tcontrol.value = \"false\";\r\n\t\t\tbreak;\r\n\t\tcase \"false\":\r\n\t\t\tcontrol.innerHTML = \"✓\";\r\n\t\t\tcontrol.title = \"Akceptuj\";\r\n\t\t\tcontrol.value = \"true\";\r\n\t\t\tbreak;\r\n\t\tcase \"true\":\r\n\t\t\tcontrol.innerHTML = \"\";\r\n\t\t\tcontrol.title = \"\";\r\n\t\t\tcontrol.value = \"\";\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\t// display the current value if it's unexpected\r\n\t\t\tconsole.log(control.value);\r\n\t}\r\n}\r\n\r\n//checkbox ktory wyglada jak ten z trzema stanami ale ma dwa stany\r\nexport function doubleState(control: HTMLInputElement) {\r\n\tswitch (control.value) {\r\n\t\tcase \"\":\r\n\t\t\tcontrol.innerHTML = \"⨉\";\r\n\t\t\tcontrol.title = \"Usu\u0144\";\r\n\t\t\tcontrol.value = \"false\";\r\n\t\t\tbreak;\r\n\t\tcase \"false\":\r\n\t\t\tcontrol.innerHTML = \"\";\r\n\t\t\tcontrol.title = \"\";\r\n\t\t\tcontrol.value = \"\";\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\t// display the current value if it's unexpected\r\n\t\t\tconsole.log(control.value);\r\n\t}\r\n}\r\n\r\n//dispose pdfjs express przy przejsciu na inna strone\r\nexport function disposePDF(container?: HTMLElement) {\r\n\tif (container) globalThis.WebViewer.getInstance(container)?.dispose();\r\n}\r\n\r\n//funkcja czyszczaca elementy ktore zostaja przy zmianie strony\r\nexport function cleanUp() {\r\n\tdisposePDF(document.getElementById(\"pdf-js-viewer\") as HTMLElement);\r\n\tdeleteFullScreenDxComponent();\r\n\tglobalThis.specialFields = null;\r\n\tglobalThis.pdfVerifiedSignatures = null;\r\n\r\n\tconst node = $(\"#reportViewer\")[0];\r\n\tif (node) globalThis.ko.cleanNode(node);\r\n\r\n\tremoveJSPopup();\r\n\r\n\tglobalThis.globalItemsSelectedByUser = [];\r\n\tglobalThis.allowedDefinitionsGlobal = null;\r\n\r\n\tglobalThis.htmlEditorChanges = null;\r\n\tglobalThis.recipientStorage = {};\r\n\r\n\tglobalThis.lastTempLayout = null;\r\n\tglobalThis.lastTempLayout4Id = null;\r\n\tglobalThis.changedLayout = false;\r\n\tcloseToast(\"saveLayout\");\r\n}\r\n\r\n//funkcja dodajaca ladowanie typu skeleton jak np. na facebooku\r\nexport function addSkeletonLoading(\r\n\tdiv: string | HTMLElement | JQuery\r\n) {\r\n\tHideLoadingPanel();\r\n\t$(div as HTMLElement).addClass(\"skeletonSupport\");\r\n\t$(div as HTMLElement).append(`\r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n `);\r\n}\r\n\r\nexport function removeSkeletonLoading(\r\n\tdiv: string | HTMLElement | JQuery\r\n) {\r\n\t$(div as HTMLElement).removeClass(\"skeletonSupport\");\r\n\t$(div as HTMLElement)\r\n\t\t.find(\".skeleton\")\r\n\t\t.remove();\r\n}\r\n\r\n//funkcja dodajaca eventy ktore blokuja guzik weryfikacji autoryzacji 2fa logowania\r\nexport function authVerifyBtnDisableState(\r\n\tinput: HTMLInputElement,\r\n\tbuttonID: string\r\n) {\r\n\tfor (const e of [\"keyup\", \"change\"]) {\r\n\t\tinput.addEventListener(e, () => {\r\n\t\t\tif (input.value.length === 6) {\r\n\t\t\t\t$(`#${buttonID}`).removeClass(\"disabled\");\r\n\t\t\t\t$(`#${buttonID}`).removeAttr(\"disabled\");\r\n\t\t\t\tverificatieAuthCode();\r\n\t\t\t} else {\r\n\t\t\t\t$(`#${buttonID}`).addClass(\"disabled\");\r\n\t\t\t\t$(`#${buttonID}`).attr(\"disabled\", \"disabled\");\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n}\r\n\r\n//funkcja obliczajaca min height/width dla popupow dx\r\nexport function calcMinPopup(min: string | number, height = false) {\r\n\t//jesli wartosc jest wieksza od 90vh/vw ekranu to ustawi 90 a nie przekazana wartosc\r\n\tif (typeof min === \"number\") min = `${min.toString()}px`;\r\n\treturn `min(90${height ? \"vh\" : \"vw\"}, ${min})`;\r\n}\r\n\r\n//funkcja resetujaca popup po jego schowaniu\r\nexport function onPopupHidden(e: DevExpress.ui.dxPopup.HiddenEvent) {\r\n\tconst popupId = e.element[0].id;\r\n\tresetPopup(popupId);\r\n\r\n\tforceCloseUnsavedPopup = false;\r\n}\r\n\r\n//funkcja resetujaca popup do jest stanu poczatkowego\r\nexport function resetPopup(popupId: string) {\r\n\tconst popup = $(`#${popupId}`).dxPopup(\"instance\");\r\n\tif (popupId === \"devex-dialog-chat\") {\r\n\t\tpopup.resetOption(\"max-width\");\r\n\t\tpopup.resetOption(\"max-height\");\r\n\t\tpopup.resetOption(\"min-height\");\r\n\t\tpopup.resetOption(\"min-width\");\r\n\t\tpopup.resetOption(\"min-width\");\r\n\t\tpopup.option(\"width\", \"98%\");\r\n\t\tpopup.option(\"height\", \"100%\");\r\n\t} else {\r\n\t\tpopup.option(\"maxWidth\", \"90vw\");\r\n\t\tpopup.option(\"maxHeight\", \"90vh\");\r\n\t\tpopup.option(\"minHeight\", \"20vh\");\r\n\t\tpopup.option(\"minWidth\", \"30vw\");\r\n\t\tpopup.option(\"width\", \"auto\");\r\n\t\tpopup.option(\"height\", \"auto\");\r\n\t}\r\n\tpopup.option(\"showTitle\", false);\r\n\tpopup.option(\"hideOnOutsideClick\", true);\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.removeClass(\"popupTitleAccent\");\r\n\t(popup as any)?._$popupContent?.find(\".DialogFooter\")?.empty();\r\n\tif (popupId === \"devex-big-dialog\")\r\n\t\t$(\"#BigDialog\").removeClass(\"managementPopup\");\r\n}\r\n\r\n//funkcja sprawdzajace czy mozna zamknac popup\r\n//jesli sa jakies zmiany na popup to wyskoczy info o tym czy chcemy zamknac popup\r\nexport function onPopupHiding(e: DevExpress.ui.dxPopup.HidingEvent) {\r\n\t$(\".focusInPopup\").removeClass(\"focusInPopup\");\r\n\r\n\tif (forceCloseUnsavedPopup) return;\r\n\r\n\tconst dialogDiv = e.component.content();\r\n\r\n\t//lista guzikow ktore odpowiadaja zmiana na popupie\r\n\t//checkfunc to customowa funkcja weryfikujaca czy mozna zamknac popup\r\n\tconst buttons: WarningButtons[] = [\r\n\t\t{\r\n\t\t\tid: \"#authVerificationBtn\",\r\n\t\t\tcheckFunc: () =>\r\n\t\t\t\t$(\"#auth2btn\").is(\":checked\") &&\r\n\t\t\t\t!$(dialogDiv).find(\"#authVerification\").hasClass(\"hidden\") &&\r\n\t\t\t\t$(dialogDiv).find(\"#authVerificationBtn\").hasClass(\"disabled\") &&\r\n\t\t\t\t!$(\"#authVerification\").hasClass(\"hidden\"),\r\n\t\t\ttext: \"

    Aby aktywowa\u0107 dwusk\u0142adnikowe uwierzytelnianie, musisz je zweryfikowa\u0107.

    \",\r\n\t\t\tbtnFunctions: [{ text: \"OK\" }],\r\n\t\t},\r\n\t\t{ id: \"#btnCreateCancelShareLink\" },\r\n\t\t{ id: \"#saveProperties\" },\r\n\t\t{ id: \"#ExecuteDecreeButton\" },\r\n\t\t{ id: \"#ExecuteButton\" },\r\n\t\t{ id: \"#statusListSave\" },\r\n\t\t{ id: \"#btnAddNote\" },\r\n\t\t{\r\n\t\t\tid: \"#SignDocument\",\r\n\t\t\tcheckFunc: () =>\r\n\t\t\t\t!!(\r\n\t\t\t\t\t$(dialogDiv).find(\"#SignDocument\").length &&\r\n\t\t\t\t\t$(\".dx-state-invisible #signatureOk\").length\r\n\t\t\t\t),\r\n\t\t},\r\n\t\t{ id: \"#ExecuteSendMessage\" },\r\n\t\t{ id: \"#btnUpdateUserRole\" },\r\n\t];\r\n\r\n\tconst showWarning = buttons.find(\r\n\t\t(x) =>\r\n\t\t\tx.checkFunc?.() ||\r\n\t\t\t(x.checkFunc == null &&\r\n\t\t\t\t$(dialogDiv).find(x.id).length &&\r\n\t\t\t\t!$(dialogDiv).find(x.id).hasClass(\"disabled\") &&\r\n\t\t\t\t!$(dialogDiv).find(x.id).attr(\"disabled\"))\r\n\t);\r\n\r\n\tif (showWarning) {\r\n\t\te.cancel = true;\r\n\t\tshowPopupWarningUnsavedInPopup(e, showWarning);\r\n\t}\r\n}\r\n\r\n//funkcja informujaca ze sa zmiany na popup\r\nexport function showPopupWarningUnsavedInPopup(\r\n\te: DevExpress.ui.dxPopup.HidingEvent,\r\n\tbutton: WarningButtons\r\n) {\r\n\tconst popup = $(\"#devex-extra-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(300));\r\n\tpopup.option(\"minHeight\", calcMinPopup(120, true));\r\n\tpopup.option(\"showTitle\", false);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevExtraDialog\"));\r\n\tpopup.show();\r\n\r\n\t$(\"#ExtraDialog\").empty();\r\n\t$(\"#ExtraDialog\").append(`
    \r\n ${button.text ?? \"

    Czy na pewno przerwa\u0107 operacj\u0119?

    \"}\r\n
    `);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(`
    `);\r\n\r\n\tif (!button.btnFunctions?.length)\r\n\t\tbutton.btnFunctions = [\r\n\t\t\t{\r\n\t\t\t\ttext: \"OK\",\r\n\t\t\t\tfunc: () => {\r\n\t\t\t\t\tforceCloseUnsavedPopup = true;\r\n\t\t\t\t\te.component.hide();\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\ttext: \"Anuluj\",\r\n\t\t\t},\r\n\t\t];\r\n\r\n\t//dodanie guzikow do popupu\r\n\tbutton.btnFunctions.forEach((btn, index) => {\r\n\t\tconst buttonClass = index === 0 ? \"btn-docusoft\" : \"btn-default\";\r\n\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t.find(\".DialogFooter .popup-button-container\")\r\n\t\t\t.append(\r\n\t\t\t\t``\r\n\t\t\t);\r\n\r\n\t\t$(`#${btn.text}-DialogButton`).on(\"click\", () => {\r\n\t\t\tif (btn.func) btn.func();\r\n\t\t\tCloseExtraDialog();\r\n\t\t\tforceCloseUnsavedPopup = false;\r\n\t\t});\r\n\r\n\t\t//dodanie obslugi enter dla pierwszego guzika\r\n\t\tif (index === 0) {\r\n\t\t\t$(document).one(\"keypress\", (event) => {\r\n\t\t\t\tif (\r\n\t\t\t\t\t$(`#${btn.text}-DialogButton`).length > 0 &&\r\n\t\t\t\t\tevent.originalEvent?.key === \"Enter\"\r\n\t\t\t\t) {\r\n\t\t\t\t\tif (btn.func) btn.func();\r\n\t\t\t\t\tCloseExtraDialog();\r\n\t\t\t\t\tforceCloseUnsavedPopup = false;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\r\n\tsetTimeout(HideLoadingPanel, 100);\r\n}\r\n\r\n//usuniecie remove z guzika\r\nexport function removeDisabled(\r\n\tbtn: string | HTMLElement | JQuery\r\n) {\r\n\t$(btn as HTMLElement).removeClass(\"disabled\");\r\n\t$(btn as HTMLElement).attr(\"disabled\", null);\r\n}\r\n\r\n//pokazanie komunikatu typu toast na stronie\r\nexport function showDxToast(\r\n\tmessage: string,\r\n\tstatus: \"success\" | \"warning\" | \"error\" | \"info\",\r\n\tdisplayTime?: number,\r\n\tcontentTemp?: string,\r\n\tcustomClass = \"\"\r\n) {\r\n\t//jesli nie jest to customowy komunikat to wyswietlamy przez 5 sek\r\n\tDevExpress.ui.notify(\r\n\t\t{\r\n\t\t\ttype: status ?? \"info\",\r\n\t\t\tmessage: contentTemp ? null : message,\r\n\t\t\tdisplayTime:\r\n\t\t\t\tcontentTemp && !displayTime\r\n\t\t\t\t\t? 10000000\r\n\t\t\t\t\t: !displayTime\r\n\t\t\t\t\t\t? 5000\r\n\t\t\t\t\t\t: displayTime,\r\n\t\t\twrapperAttr: {\r\n\t\t\t\tid: \"devex-toast\",\r\n\t\t\t\tclass: `toast-for-vario ${customClass}`,\r\n\t\t\t},\r\n\t\t\tcontentTemplate: contentTemp ? () => $(contentTemp) : null,\r\n\t\t\twidth: \"fit-content\",\r\n\t\t\tminWidth: 200,\r\n\t\t\tmaxWidth: \"80vw\",\r\n\t\t\thideOnOutsideClick: false,\r\n\t\t\tcloseOnClick: true,\r\n\t\t},\r\n\t\t{\r\n\t\t\tposition: \"bottom center\",\r\n\t\t\tdirection: \"up-stack\",\r\n\t\t}\r\n\t);\r\n}\r\n\r\n//zamkniecie custom komunikatow typu toast\r\nexport function closeToast(customClass: string) {\r\n\tconst toast = customClass\r\n\t\t? $(`#devex-toast.${customClass}`)\r\n\t\t: $(\"#devex-toast\");\r\n\ttoast.find(\"> div\").trigger(\"dxclick\");\r\n}\r\n\r\nexport function compareObjects(object1: object, object2: object) {\r\n\tif (!object1 || !object2) return false;\r\n\r\n\tconst keys1 = Object.keys(object1);\r\n\tconst keys2 = Object.keys(object2);\r\n\r\n\tif (keys1.length !== keys2.length) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tfor (const key of keys1) {\r\n\t\tconst val1 = object1[key];\r\n\t\tconst val2 = object2[key];\r\n\t\tconst areObjects = isObject(val1) && isObject(val2);\r\n\r\n\t\tif (!areObjects && val1 !== val2) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\treturn true;\r\n}\r\n\r\nexport function isObject(object: any) {\r\n\treturn object != null && typeof object === \"object\";\r\n}\r\n\r\nexport function isGuid(guid: string) {\r\n\tconst guidPattern =\r\n\t\t/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;\r\n\treturn guidPattern.test(guid);\r\n}\r\n\r\nexport function capitalizeKeys(obj: object) {\r\n\tconst newObj = {};\r\n\tfor (const key in obj) {\r\n\t\tif (key in obj) {\r\n\t\t\tnewObj[key.charAt(0).toUpperCase() + key.slice(1)] = obj[key];\r\n\t\t}\r\n\t}\r\n\treturn newObj;\r\n}\r\n\r\nexport function getOS() {\r\n\tconst userAgent = window.navigator.userAgent.toLowerCase();\r\n\tconst macosPlatforms = /(macintosh|macintel|macppc|mac68k|macos)/i;\r\n\tconst windowsPlatforms = /(win32|win64|windows|wince)/i;\r\n\tconst iosPlatforms = /(iphone|ipad|ipod)/i;\r\n\tlet os = \"\";\r\n\r\n\tif (macosPlatforms.test(userAgent)) {\r\n\t\tos = \"macos\";\r\n\t} else if (iosPlatforms.test(userAgent)) {\r\n\t\tos = \"ios\";\r\n\t} else if (windowsPlatforms.test(userAgent)) {\r\n\t\tos = \"windows\";\r\n\t} else if (/android/.test(userAgent)) {\r\n\t\tos = \"android\";\r\n\t} else if (!os && /linux/.test(userAgent)) {\r\n\t\tos = \"linux\";\r\n\t}\r\n\r\n\treturn os;\r\n}\r\n\r\nexport function checkIfNumber(value: any) {\r\n\tconst number = Number(value);\r\n\treturn !Number.isNaN(number);\r\n}\r\n\r\n//funkcja grupuj\u0105ca po elemencie arraya\r\nexport const groupBy = (xs: any[], key: string) =>\r\n\txs.reduce((rv, x) => {\r\n\t\trv[x[key]] = rv[x[key]] || [];\r\n\t\trv[x[key]].push(x);\r\n\t\treturn rv;\r\n\t}, {});\r\n", "\uFEFFimport \"../types/dx.all.d.ts\";\r\nimport type {\r\n\tServiceResponse,\r\n\tVarioHubModels,\r\n\tWebNotificationExtra,\r\n} from \"../types/models/vario-types\";\r\nimport type { WebNotificationsCollection } from \"../types/models/vario-types\";\r\nimport { GetBaseUrl, changeCurrentItem } from \"./page-navigation\";\r\nimport {\r\n\tCloseAdditionalDialog,\r\n\tHideLoadingPanel,\r\n\tSendMessageWindow,\r\n\tShowLoadingPanel,\r\n\tcalcMinPopup,\r\n\tconvertDate,\r\n\tfixScrollInDx,\r\n\tisRunningOnMobile,\r\n\tpushNotification,\r\n\tshowDxToast,\r\n\tuuidv4,\r\n\twaitForElm,\r\n} from \"./site\";\r\n\r\nlet clearNotifyPanelTimeout: number;\r\n\r\nexport function getNewNotifications() {\r\n\tif (typeof Notification !== \"undefined\") Notification?.requestPermission();\r\n\r\n\tif (\r\n\t\tcurrentUserId.length > 0 &&\r\n\t\tNumber(currentUserId) !== 0 &&\r\n\t\tcurrentUserName &&\r\n\t\tcurrentUserName.length > 0\r\n\t) {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetNewNotifications`,\r\n\t\t\ttype: \"GET\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: true,\r\n\t\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\t\tif (response?.success) {\r\n\t\t\t\t\tconst wfNotify = response.data[0];\r\n\t\t\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\t\t\"NewNotifyCollectionWorkflow\",\r\n\t\t\t\t\t\tJSON.stringify(wfNotify)\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tconst postNotify = response.data[1];\r\n\t\t\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\t\t\"NewNotifyCollectionPost\",\r\n\t\t\t\t\t\tJSON.stringify(postNotify)\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tconst taskNotify = response.data[2];\r\n\t\t\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\t\t\"NewNotifyCollectionTask\",\r\n\t\t\t\t\t\tJSON.stringify(taskNotify)\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tconst customNotify = response.data[3];\r\n\t\t\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\t\t\"NewNotifyCollectionCustom\",\r\n\t\t\t\t\t\tJSON.stringify(customNotify)\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\trefreshMainViewButtons(wfNotify, postNotify, taskNotify);\r\n\t\t\t\t\trefreshLeftPanelConters(wfNotify, postNotify, taskNotify);\r\n\t\t\t\t\trefreshNotifyNumber(\"gotNewNotifications\");\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: (error) => {\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function refreshMainViewButtons(\r\n\twfNotify: WebNotificationsCollection,\r\n\tpostNotify: WebNotificationsCollection,\r\n\ttaskNotify: WebNotificationsCollection\r\n) {\r\n\tconst mainBtnWFBox = document.getElementsByClassName(\"mainBtnWFBox\");\r\n\tconst mainBtnPostBox = document.getElementsByClassName(\"mainBtnPostBox\");\r\n\tconst mainBtnTaskBox = document.getElementsByClassName(\"mainBtnTaskBox\");\r\n\r\n\tif (mainBtnWFBox != null && mainBtnWFBox.length > 0) {\r\n\t\tif (wfNotify != null) {\r\n\t\t\tconst newItemsCount = wfNotify.newCount;\r\n\t\t\tconst noReadCount = wfNotify.noReadCount;\r\n\r\n\t\t\tif (newItemsCount > 0) {\r\n\t\t\t\t(mainBtnWFBox[0] as HTMLElement).title =\r\n\t\t\t\t\t`Nowych pozycji: (${newItemsCount})`;\r\n\t\t\t\tmainBtnWFBox[0].classList.remove(\"hidden\");\r\n\t\t\t\t(mainBtnWFBox[0] as HTMLElement).title =\r\n\t\t\t\t\t`Nowych pozycji: (${newItemsCount})`;\r\n\t\t\t\tmainBtnWFBox[0]?.firstElementChild?.classList.remove(\r\n\t\t\t\t\t\"countContainerNoRead\"\r\n\t\t\t\t);\r\n\t\t\t\tmainBtnWFBox[0]?.firstElementChild?.classList.add(\r\n\t\t\t\t\t\"countContainerNewItems\"\r\n\t\t\t\t);\r\n\t\t\t\tif (mainBtnWFBox[0].firstElementChild)\r\n\t\t\t\t\tmainBtnWFBox[0].firstElementChild.textContent =\r\n\t\t\t\t\t\tnewItemsCount.toString();\r\n\t\t\t} else if (noReadCount > 0) {\r\n\t\t\t\tmainBtnWFBox[0].classList.remove(\"hidden\");\r\n\t\t\t\t(mainBtnWFBox[0] as HTMLElement).title =\r\n\t\t\t\t\t`Nieprzeczytane: (${noReadCount})`;\r\n\t\t\t\tmainBtnWFBox[0]?.firstElementChild?.classList.remove(\r\n\t\t\t\t\t\"countContainerNewItems\"\r\n\t\t\t\t);\r\n\t\t\t\tmainBtnWFBox[0]?.firstElementChild?.classList.add(\r\n\t\t\t\t\t\"countContainerNoRead\"\r\n\t\t\t\t);\r\n\t\t\t\tif (mainBtnWFBox[0].firstElementChild)\r\n\t\t\t\t\tmainBtnWFBox[0].firstElementChild.textContent =\r\n\t\t\t\t\t\tnoReadCount.toString();\r\n\t\t\t} else {\r\n\t\t\t\tmainBtnWFBox[0].classList.add(\"hidden\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (mainBtnPostBox != null && mainBtnPostBox.length > 0) {\r\n\t\tif (postNotify != null) {\r\n\t\t\tconst newItemsCount = postNotify.newCount;\r\n\t\t\tconst noReadCount = postNotify.noReadCount;\r\n\r\n\t\t\tif (newItemsCount > 0) {\r\n\t\t\t\tmainBtnPostBox[0].classList.remove(\"hidden\");\r\n\t\t\t\t(mainBtnPostBox[0] as HTMLElement).title =\r\n\t\t\t\t\t`Nowych pozycji: (${newItemsCount})`;\r\n\t\t\t\tmainBtnPostBox[0]?.firstElementChild?.classList.remove(\r\n\t\t\t\t\t\"countContainerNoRead\"\r\n\t\t\t\t);\r\n\t\t\t\tmainBtnPostBox[0]?.firstElementChild?.classList.add(\r\n\t\t\t\t\t\"countContainerNewItems\"\r\n\t\t\t\t);\r\n\t\t\t\tif (mainBtnPostBox[0].firstElementChild)\r\n\t\t\t\t\tmainBtnPostBox[0].firstElementChild.textContent =\r\n\t\t\t\t\t\tnewItemsCount.toString();\r\n\t\t\t} else if (noReadCount > 0) {\r\n\t\t\t\tmainBtnPostBox[0].classList.remove(\"hidden\");\r\n\t\t\t\t(mainBtnPostBox[0] as HTMLElement).title =\r\n\t\t\t\t\t`Nieprzeczytane: (${noReadCount})`;\r\n\t\t\t\tmainBtnPostBox[0]?.firstElementChild?.classList.remove(\r\n\t\t\t\t\t\"countContainerNewItems\"\r\n\t\t\t\t);\r\n\t\t\t\tmainBtnPostBox[0]?.firstElementChild?.classList.add(\r\n\t\t\t\t\t\"countContainerNoRead\"\r\n\t\t\t\t);\r\n\t\t\t\tif (mainBtnPostBox[0].firstElementChild)\r\n\t\t\t\t\tmainBtnPostBox[0].firstElementChild.textContent =\r\n\t\t\t\t\t\tnoReadCount.toString();\r\n\t\t\t} else {\r\n\t\t\t\tmainBtnPostBox[0].classList.add(\"hidden\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (mainBtnTaskBox != null && mainBtnTaskBox.length > 0) {\r\n\t\tif (taskNotify != null) {\r\n\t\t\tconst newItemsCount = taskNotify.newCount;\r\n\t\t\tconst noReadCount = taskNotify.noReadCount;\r\n\r\n\t\t\tif (newItemsCount > 0) {\r\n\t\t\t\tmainBtnTaskBox[0].classList.remove(\"hidden\");\r\n\t\t\t\t(mainBtnTaskBox[0] as HTMLElement).title =\r\n\t\t\t\t\t`Nowych pozycji: (${newItemsCount})`;\r\n\t\t\t\tmainBtnTaskBox[0]?.firstElementChild?.classList.remove(\r\n\t\t\t\t\t\"countContainerNoRead\"\r\n\t\t\t\t);\r\n\t\t\t\tmainBtnTaskBox[0]?.firstElementChild?.classList.add(\r\n\t\t\t\t\t\"countContainerNewItems\"\r\n\t\t\t\t);\r\n\t\t\t\tif (mainBtnTaskBox[0].firstElementChild)\r\n\t\t\t\t\tmainBtnTaskBox[0].firstElementChild.textContent =\r\n\t\t\t\t\t\tnewItemsCount.toString();\r\n\t\t\t} else if (noReadCount > 0) {\r\n\t\t\t\tmainBtnTaskBox[0].classList.remove(\"hidden\");\r\n\t\t\t\t(mainBtnTaskBox[0] as HTMLElement).title = \"\";\r\n\t\t\t\tmainBtnTaskBox[0]?.firstElementChild?.classList.remove(\r\n\t\t\t\t\t\"countContainerNewItems\"\r\n\t\t\t\t);\r\n\t\t\t\tmainBtnTaskBox[0]?.firstElementChild?.classList.add(\r\n\t\t\t\t\t\"countContainerNoRead\"\r\n\t\t\t\t);\r\n\t\t\t\tif (mainBtnTaskBox[0].firstElementChild)\r\n\t\t\t\t\tmainBtnTaskBox[0].firstElementChild.textContent =\r\n\t\t\t\t\t\tnoReadCount.toString();\r\n\t\t\t} else {\r\n\t\t\t\tmainBtnTaskBox[0].classList.add(\"hidden\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function refreshLeftPanelConters(\r\n\twfNotify: WebNotificationsCollection,\r\n\tpostNotify: WebNotificationsCollection,\r\n\ttaskNotify: WebNotificationsCollection\r\n) {\r\n\tconst noReadCountWf = wfNotify?.noReadCount;\r\n\tconst noReadCountPost = postNotify?.noReadCount;\r\n\tconst noReadCountTask = taskNotify?.noReadCount;\r\n\r\n\tconst linkDivs = $(\r\n\t\t\".CWorkflowBoxLeftPanelLink, .CPostOfficeLeftPanelLink, .CTasksInboxLeftPanelLink\"\r\n\t);\r\n\r\n\tlinkDivs.each((_, element) => {\r\n\t\tconst $element = $(element);\r\n\t\tconst childId = $element\r\n\t\t\t.parents(\".navigationPanelHeader\")\r\n\t\t\t.attr(\"data-itemid\");\r\n\t\tconst child = $(`.sidenavButton[data-itemid=\"${childId}\"] a`);\r\n\r\n\t\tconst divs = $.merge(child, $element);\r\n\r\n\t\tif (typeof modelId !== \"undefined\" && childId === modelId)\r\n\t\t\t$.merge(divs, $(\"#path-title\"));\r\n\r\n\t\tfor (const el of divs) {\r\n\t\t\tconst linkTitle = el.textContent;\r\n\t\t\tlet linkTitleNoCount =\r\n\t\t\t\tlinkTitle?.substring(0, linkTitle.indexOf(\" (\")) || linkTitle;\r\n\t\t\tconst noReadCount = $element.hasClass(\"CWorkflowBoxLeftPanelLink\")\r\n\t\t\t\t? noReadCountWf\r\n\t\t\t\t: $element.hasClass(\"CPostOfficeLeftPanelLink\")\r\n\t\t\t\t\t? noReadCountPost\r\n\t\t\t\t\t: noReadCountTask;\r\n\r\n\t\t\tif (noReadCount > 0) {\r\n\t\t\t\tlinkTitleNoCount += ` (${noReadCount})`;\r\n\t\t\t}\r\n\t\t\tel.textContent = linkTitleNoCount;\r\n\t\t}\r\n\t});\r\n}\r\nexport function showNewNotificationsPopup(type: string) {\r\n\tif (type) {\r\n\t\tlet newNotifyCollection: WebNotificationsCollection | null = null;\r\n\t\tif (type === \"Workflow\") {\r\n\t\t\tnewNotifyCollection = JSON.parse(\r\n\t\t\t\tsessionStorage.getItem(\"NewNotifyCollectionWorkflow\") ?? \"[]\"\r\n\t\t\t);\r\n\t\t} else if (type === \"Post\") {\r\n\t\t\tnewNotifyCollection = JSON.parse(\r\n\t\t\t\tsessionStorage.getItem(\"NewNotifyCollectionPost\") ?? \"[]\"\r\n\t\t\t);\r\n\t\t} else if (type === \"Task\") {\r\n\t\t\tnewNotifyCollection = JSON.parse(\r\n\t\t\t\tsessionStorage.getItem(\"NewNotifyCollectionTask\") ?? \"[]\"\r\n\t\t\t);\r\n\t\t}\r\n\t\tif (newNotifyCollection?.newNotifications?.length) {\r\n\t\t\tconst popup = $(\"#devex-dialog-additional\").dxPopup(\"instance\");\r\n\t\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog-Additional\"));\r\n\t\t\tpopup.option(\"minWidth\", calcMinPopup(600));\r\n\t\t\tpopup.option(\"minHeight\", calcMinPopup(100, true));\r\n\t\t\tpopup.option(\"title\", \"Nowe powiadomienia\");\r\n\t\t\tpopup.option(\"showTitle\", true);\r\n\t\t\tpopup.show();\r\n\t\t\tpopup\r\n\t\t\t\t.content()\r\n\t\t\t\t?.parent()\r\n\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t.addClass(\"popupTitleAccent\");\r\n\r\n\t\t\t$(\"#Dialog-Additional\").empty();\r\n\r\n\t\t\t$(\"#Dialog-Additional\").append(\r\n\t\t\t\t`
    \r\n \r\n
    `\r\n\t\t\t);\r\n\r\n\t\t\tfor (let i = 0; i < newNotifyCollection.newNotifications.length; i++) {\r\n\t\t\t\tconst notifyMessage = newNotifyCollection.newNotifications[i].message;\r\n\t\t\t\tconst notifydate = newNotifyCollection.newNotifications[i].creationDate;\r\n\t\t\t\tconst titleAuthor = newNotifyCollection.newNotifications[i].titleAuthor;\r\n\t\t\t\tconst fullReferencedItemID =\r\n\t\t\t\t\tnewNotifyCollection.newNotifications[i].fullReferencedItemID;\r\n\t\t\t\tconst id = newNotifyCollection.newNotifications[i].notificationID;\r\n\r\n\t\t\t\t$(\r\n\t\t\t\t\t\"#panelForNewNotifications\"\r\n\t\t\t\t).append(`
    \r\n
    \r\n ${notifyMessage} ${notifydate}\r\n
    \r\n
    \r\n ${titleAuthor}\r\n \r\n \r\n
    \r\n
    `);\r\n\r\n\t\t\t\t$(`#deleteNewNotification-${id}`).on(\"click\", function () {\r\n\t\t\t\t\tremoveNotification(this);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tfixScrollInDx(\".workflowMessagePanel\");\r\n\r\n\t\t\tpopup.repaint();\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function clearNewNotifications() {\r\n\tsessionStorage.removeItem(\"NewNotifyCollectionWorkflow\");\r\n\tsessionStorage.removeItem(\"NewNotifyCollectionPost\");\r\n\tsessionStorage.removeItem(\"NewNotifyCollectionTask\");\r\n\tsessionStorage.removeItem(\"NewNotifyCollectionCustom\");\r\n}\r\n\r\nexport function refreshNotifyNumber(reason = \"\") {\r\n\tconst notifyNumber = countNotifications();\r\n\r\n\tlet notifyNumberChanged = false;\r\n\tlet oldNotifyNumber = $(\"#notifyNumber\").text();\r\n\tif (oldNotifyNumber === \"\") {\r\n\t\toldNotifyNumber = \"0\";\r\n\t}\r\n\tnotifyNumberChanged = oldNotifyNumber !== notifyNumber;\r\n\r\n\t$(\"#notifyNumber\").text(notifyNumber);\r\n\t$(\"#notifyNumber-mobile\").text(notifyNumber);\r\n\r\n\tif (notifyNumber <= 0) {\r\n\t\t$(\"#notifyNumber\").addClass(\"hidden\");\r\n\t\t$(\"#notifyNumber-mobile\").addClass(\"hidden\");\r\n\t} else {\r\n\t\t$(\"#notifyNumber\").removeClass(\"hidden\");\r\n\t\t$(\"#notifyNumber-mobile\").removeClass(\"hidden\");\r\n\t\tif (\r\n\t\t\treason === \"NewMessageRecived\" ||\r\n\t\t\t(reason === \"gotNewNotifications\" && oldNotifyNumber < notifyNumber)\r\n\t\t) {\r\n\t\t\t$(\"#notifyBellIcon\").addClass(\"notifyBellIconAnim\");\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\t$(\"#notifyBellIcon\").removeClass(\"notifyBellIconAnim\");\r\n\t\t\t}, 2000);\r\n\r\n\t\t\t$(\".navbar-toggle\").addClass(\"notifyBellIconAnim\");\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\t$(\".navbar-toggle\").removeClass(\"notifyBellIconAnim\");\r\n\t\t\t}, 2000);\r\n\t\t}\r\n\t}\r\n\t//Zmieni\u0142a si\u0119 liczba powiadomie\u0144 wi\u0119c trzeba od\u015Bwie\u017Cy\u0107 panel je\u017Celi jest otwarty\r\n\tif (\r\n\t\t(reason === \"gotNewNotifications\" || reason === \"removeAll\") &&\r\n\t\tnotifyNumberChanged\r\n\t) {\r\n\t\trefreshNotifyPanel();\r\n\t}\r\n\t//Pojawi\u0142o si\u0119 nowe powiadomienie wi\u0119c wy\u015Bwietlamy je (z najnowsz\u0105 dat\u0105)\r\n\tif (reason === \"gotNewNotifications\" && oldNotifyNumber < notifyNumber) {\r\n\t\tconst mixNotifications = sortAllNotifications(true);\r\n\t\tif (mixNotifications && mixNotifications.length > 0) {\r\n\t\t\t//Je\u017Celi najnowsze powiadomienie ma dat\u0119 starsz\u0105 ni\u017C ostatnie powaidomienie pokazane u\u017Cytkownikowi to przerwij, prawdopodobnie wcze\u015Bniej nie pobra\u0142y si\u0119 poprawnie\r\n\t\t\tif (sessionStorage.getItem(\"LastShowedNotiCreationDate\") !== null) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tlet lastNotiDate: string | string[] =\r\n\t\t\t\t\t\tsessionStorage.getItem(\"LastShowedNotiCreationDate\") ?? \"\";\r\n\t\t\t\t\tlet newNotifyCurrentDate: string | string[] =\r\n\t\t\t\t\t\tmixNotifications[mixNotifications.length - 1].creationDate ?? \"\";\r\n\r\n\t\t\t\t\tlastNotiDate = lastNotiDate.split(/\\.|\\s|:/);\r\n\t\t\t\t\tconst d1 = new Date(\r\n\t\t\t\t\t\tNumber(lastNotiDate[2]),\r\n\t\t\t\t\t\tNumber.parseInt(lastNotiDate[1]) - 1,\r\n\t\t\t\t\t\tNumber(lastNotiDate[0]),\r\n\t\t\t\t\t\tNumber(lastNotiDate[3]),\r\n\t\t\t\t\t\tNumber(lastNotiDate[4]),\r\n\t\t\t\t\t\tNumber(lastNotiDate[5]) ?? \"\"\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tnewNotifyCurrentDate = newNotifyCurrentDate.split(/\\.|\\s|:/);\r\n\t\t\t\t\tconst d2 = new Date(\r\n\t\t\t\t\t\tNumber(newNotifyCurrentDate[2]),\r\n\t\t\t\t\t\tNumber.parseInt(newNotifyCurrentDate[1]) - 1,\r\n\t\t\t\t\t\tNumber(newNotifyCurrentDate[0]),\r\n\t\t\t\t\t\tNumber(newNotifyCurrentDate[3]),\r\n\t\t\t\t\t\tNumber(newNotifyCurrentDate[4]),\r\n\t\t\t\t\t\tNumber(newNotifyCurrentDate[5]) ?? \"\"\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tif (d1 >= d2) return;\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tconsole.log(e);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tconst msg = `${mixNotifications[mixNotifications.length - 1].title}: ${mixNotifications[mixNotifications.length - 1].message}`;\r\n\t\t\tshowDxToast(msg, \"info\");\r\n\r\n\t\t\t//poczekanie az pojawi sie toast dx i dodanie na niego clicka ktory wlacza pozycje\r\n\t\t\twaitForElm(\r\n\t\t\t\t\".dx-toast-wrapper .dx-overlay-content.dx-toast-info.dx-toast-content\"\r\n\t\t\t).then((elm) => {\r\n\t\t\t\t$(elm).off(\"click\", openLinkFromDxToast);\r\n\t\t\t\t$(elm).css(\"cursor\", \"pointer\");\r\n\t\t\t\t$(elm).on(\r\n\t\t\t\t\t\"click\",\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\telm: elm,\r\n\t\t\t\t\t\tmixNotification: mixNotifications[mixNotifications.length - 1],\r\n\t\t\t\t\t},\r\n\t\t\t\t\topenLinkFromDxToast\r\n\t\t\t\t);\r\n\r\n\t\t\t\t//wylaczenia tego clicka po zniknieciu toasta na wszelki wypadek\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t$(elm).off(\"click\", openLinkFromDxToast);\r\n\t\t\t\t}, 5001);\r\n\t\t\t});\r\n\r\n\t\t\tif (Notification?.permission === \"granted\") {\r\n\t\t\t\tconst baseUrl = GetBaseUrl();\r\n\t\t\t\tlet iconSrc = \"\";\r\n\t\t\t\tswitch (mixNotifications[mixNotifications.length - 1].type) {\r\n\t\t\t\t\tcase \"Workflow\":\r\n\t\t\t\t\t\ticonSrc = `${baseUrl}/images/workflowInbox.png`;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"Post\":\r\n\t\t\t\t\t\ticonSrc = `${baseUrl}/images/postofice.png`;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"Task\":\r\n\t\t\t\t\t\ticonSrc = `${baseUrl}/images/tasks.png`;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\ticonSrc = `${baseUrl}/images/bell-icon.png`;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tNumber(mixNotifications[mixNotifications.length - 1].notifyType) >=\r\n\t\t\t\t\t\t20 &&\r\n\t\t\t\t\tNumber(mixNotifications[mixNotifications.length - 1].notifyType) <= 22\r\n\t\t\t\t) {\r\n\t\t\t\t\ticonSrc = `${baseUrl}/images/share.png`;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst notification: Partial & {\r\n\t\t\t\t\toptions: NotificationOptions;\r\n\t\t\t\t} = {\r\n\t\t\t\t\ttitle: mixNotifications[mixNotifications.length - 1].title,\r\n\t\t\t\t\toptions: {\r\n\t\t\t\t\t\tbody: mixNotifications[mixNotifications.length - 1].message,\r\n\t\t\t\t\t\ttag: Number(\r\n\t\t\t\t\t\t\tmixNotifications[mixNotifications.length - 1].notificationID\r\n\t\t\t\t\t\t).toString(),\r\n\t\t\t\t\t\ticon: iconSrc,\r\n\t\t\t\t\t\tdata: {\r\n\t\t\t\t\t\t\tisDebug: debug,\r\n\t\t\t\t\t\t\twebsitePath: GetBaseUrl(),\r\n\t\t\t\t\t\t\ttype: \"varioNotification\",\r\n\t\t\t\t\t\t\titemId:\r\n\t\t\t\t\t\t\t\tmixNotifications[mixNotifications.length - 1]\r\n\t\t\t\t\t\t\t\t\t.fullReferencedItemID,\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t},\r\n\t\t\t\t};\r\n\t\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\t\"LastShowedNotiCreationDate\",\r\n\t\t\t\t\tmixNotifications[mixNotifications.length - 1].creationDate ?? \"\"\r\n\t\t\t\t);\r\n\t\t\t\tpushNotification(notification);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n//funkcja otwierajaca pozycje po kliknieciu na dx toasta\r\nexport function openLinkFromDxToast(event: {\r\n\tdata: { mixNotification: WebNotificationExtra; elm: HTMLElement };\r\n}) {\r\n\tconst mixNotification = event.data.mixNotification;\r\n\tconst elm = event.data.elm;\r\n\t$(elm).off(\"click\", openLinkFromDxToast);\r\n\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\tchangeCurrentItem({\r\n\t\titemId: mixNotification.fullReferencedItemID ?? \"\",\r\n\t});\r\n}\r\n\r\nexport function refreshNotifyPanel(_reason = \"\") {\r\n\tif ($(\"#notifyPanel\").hasClass(\"collapseNotify\")) {\r\n\t\tclearTimeout(clearNotifyPanelTimeout);\r\n\r\n\t\t//if (reason == \"NewMessageRecived\") {\r\n\t\t$(\"#notifyContainer\").empty();\r\n\t\t//}\r\n\r\n\t\tconst mixNotifications = sortAllNotifications(false);\r\n\r\n\t\tif (mixNotifications.length > 0) {\r\n\t\t\t$(\"#noNewNotify\").addClass(\"hidden\");\r\n\t\t\t$(\"#removeAllNotificationsBtn\").removeClass(\"hidden\");\r\n\t\t\tconst baseUrl = GetBaseUrl();\r\n\t\t\tfor (let i = 0; i < mixNotifications.length; i++) {\r\n\t\t\t\tlet type = \"\";\r\n\t\t\t\tlet id = \"\";\r\n\t\t\t\tlet icon = \"\";\r\n\t\t\t\tlet creationDate = \"\";\r\n\t\t\t\tlet message = \"\";\r\n\t\t\t\tlet title = \"\";\r\n\t\t\t\tlet messageLevel = \"primary\";\r\n\t\t\t\tlet href = \"href = ''\";\r\n\r\n\t\t\t\t//Wiadomosc z hub\r\n\t\t\t\tif (\"messageLevel\" in mixNotifications[i]) {\r\n\t\t\t\t\ttype = \"HubNotify\";\r\n\t\t\t\t\tid = mixNotifications[i].id ?? \"\";\r\n\t\t\t\t\ticon = ``;\r\n\t\t\t\t\tcreationDate = mixNotifications[i].creationDate ?? \"\";\r\n\r\n\t\t\t\t\tswitch (mixNotifications[i].messageLevel) {\r\n\t\t\t\t\t\tcase 0:\r\n\t\t\t\t\t\tcase 1:\r\n\t\t\t\t\t\t\tmessageLevel = \"primary\";\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\t\tmessageLevel = \"danger\";\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 3:\r\n\t\t\t\t\t\t\tmessageLevel = \"warning\";\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\tmessageLevel = \"primary\";\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (!mixNotifications[i].topic?.length) {\r\n\t\t\t\t\t\tif (isRunningOnMobile())\r\n\t\t\t\t\t\t\ttitle = `Od: ${mixNotifications[i].messageSenderName}`;\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\ttitle = `Wiadomo\u015B\u0107 od: ${mixNotifications[i].messageSenderName}`;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\ttitle = mixNotifications[i].topic ?? \"\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst html = $.parseHTML(mixNotifications[i].message ?? \"\");\r\n\t\t\t\t\tmessage =\r\n\t\t\t\t\t\thtml.find((x) => x.nodeName.toLowerCase().includes(\"text\"))\r\n\t\t\t\t\t\t\t?.textContent ?? \"\";\r\n\t\t\t\t\tconst img = html.find((x) =>\r\n\t\t\t\t\t\tx.nodeName.toLowerCase().includes(\"img\")\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (img instanceof HTMLImageElement && img.src) {\r\n\t\t\t\t\t\tmessage += ``;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//Powiadomienie z vario\r\n\t\t\t\telse if (\"fullReferencedItemID\" in mixNotifications[i]) {\r\n\t\t\t\t\ttype = \"VarioNotify\";\r\n\t\t\t\t\tid = mixNotifications[i].notificationID?.toString() ?? \"\";\r\n\t\t\t\t\tcreationDate = mixNotifications[i].creationDate ?? \"\";\r\n\t\t\t\t\tmessage = mixNotifications[i].message ?? \"\";\r\n\t\t\t\t\ttitle = mixNotifications[i].title ?? \"\";\r\n\t\t\t\t\tif (isRunningOnMobile()) title = mixNotifications[i].shortTitle ?? \"\";\r\n\t\t\t\t\tlet iconSrc = \"\";\r\n\t\t\t\t\thref = `href=${GetBaseUrl()}/Vario/VarioObject?id=${\r\n\t\t\t\t\t\tmixNotifications[i].hashKey\r\n\t\t\t\t\t}&asPartialView=false&innerCall=false&browserTabGuid=${uuidv4()}`;\r\n\r\n\t\t\t\t\tswitch (mixNotifications[i].type) {\r\n\t\t\t\t\t\tcase \"Workflow\":\r\n\t\t\t\t\t\t\ticonSrc = `${baseUrl}/images/workflowInbox.png`;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"Post\":\r\n\t\t\t\t\t\t\ticonSrc = `${baseUrl}/images/postofice.png`;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"Task\":\r\n\t\t\t\t\t\t\ticonSrc = `${baseUrl}/images/tasks.png`;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\ticonSrc = `${baseUrl}/VarioIcon.ico`;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tNumber(mixNotifications[i].notifyType) >= 20 &&\r\n\t\t\t\t\t\tNumber(mixNotifications[i].notifyType) <= 22\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\ticonSrc = `${baseUrl}/images/share.png`;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ticon = ``;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst panel = `
    \r\n
    \r\n ${icon}\r\n

    ${title}

    \r\n \r\n
    \r\n
    \r\n
    ${creationDate}
    \r\n \r\n
    \r\n
    `;\r\n\r\n\t\t\t\t$(\"#notifyContainer\").prepend($(panel));\r\n\r\n\t\t\t\tif (mixNotifications[i].isRead) {\r\n\t\t\t\t\t$(`#notifyPanel-${id} h3`).css(\"font-weight\", \"400\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$(`#notifyPanel-${id} h3, #notifyPanel-${id} .panel-body`).on(\r\n\t\t\t\t\t\"click\",\r\n\t\t\t\t\t(event) => {\r\n\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t\tif (type === \"HubNotify\") {\r\n\t\t\t\t\t\t\tSendMessageWindow(\r\n\t\t\t\t\t\t\t\tmixNotifications[i].messageSenderName ?? \"\",\r\n\t\t\t\t\t\t\t\tmessage,\r\n\t\t\t\t\t\t\t\tmixNotifications[i].creationDate ?? \"\",\r\n\t\t\t\t\t\t\t\tmixNotifications[i].messageSenderId?.toString() ?? \"\"\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t} else if (type === \"VarioNotify\") {\r\n\t\t\t\t\t\t\tchangeCurrentItem({\r\n\t\t\t\t\t\t\t\titemId: mixNotifications[i].fullReferencedItemID ?? \"\",\r\n\t\t\t\t\t\t\t\tinnerCall: false,\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tToggleNotifyPanel();\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\r\n\t\t\t\t$(`#notifyPanel-${id} button`).on(\"click\", function () {\r\n\t\t\t\t\tremoveNotification(this);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$(\"#noNewNotify\").removeClass(\"hidden\");\r\n\t\t\t$(\"#removeAllNotificationsBtn\").addClass(\"hidden\");\r\n\t\t}\r\n\t} else {\r\n\t\tclearNotifyPanelTimeout = setTimeout(() => {\r\n\t\t\t$(\"#notifyContainer\").empty();\r\n\t\t}, 500) as any as number;\r\n\t}\r\n}\r\n\r\nexport function sortAllNotifications(\r\n\tignoreNotifyFromHUB: boolean\r\n): WebNotificationExtra[] {\r\n\tlet NewNotifyCollectionWorkflow: WebNotificationsCollection | null = null;\r\n\tlet NewNotifyCollectionPost: WebNotificationsCollection | null = null;\r\n\tlet NewNotifyCollectionTask: WebNotificationsCollection | null = null;\r\n\tlet NewNotifyCollectionCustom: WebNotificationsCollection | null = null;\r\n\tlet HubNotifications: VarioHubModels.ResponseMessageExtra[] | null = null;\r\n\tif (sessionStorage.getItem(\"NewNotifyCollectionWorkflow\") != null) {\r\n\t\tNewNotifyCollectionWorkflow = JSON.parse(\r\n\t\t\tsessionStorage.NewNotifyCollectionWorkflow\r\n\t\t);\r\n\t}\r\n\tif (sessionStorage.getItem(\"NewNotifyCollectionPost\") != null) {\r\n\t\tNewNotifyCollectionPost = JSON.parse(\r\n\t\t\tsessionStorage.NewNotifyCollectionPost\r\n\t\t);\r\n\t}\r\n\tif (sessionStorage.getItem(\"NewNotifyCollectionTask\") != null) {\r\n\t\tNewNotifyCollectionTask = JSON.parse(\r\n\t\t\tsessionStorage.NewNotifyCollectionTask\r\n\t\t);\r\n\t}\r\n\tif (sessionStorage.getItem(\"NewNotifyCollectionCustom\") != null) {\r\n\t\tNewNotifyCollectionCustom = JSON.parse(\r\n\t\t\tsessionStorage.NewNotifyCollectionCustom\r\n\t\t);\r\n\t}\r\n\tif (\r\n\t\tignoreNotifyFromHUB === false &&\r\n\t\tsessionStorage.getItem(\"notifyHub\") != null\r\n\t) {\r\n\t\tHubNotifications = JSON.parse(sessionStorage.notifyHub);\r\n\t}\r\n\r\n\tconst mixNotifications: WebNotificationExtra[] = [];\r\n\r\n\tif (\r\n\t\tNewNotifyCollectionWorkflow != null &&\r\n\t\tNewNotifyCollectionWorkflow.newCount > 0\r\n\t) {\r\n\t\tfor (\r\n\t\t\tlet i = 0;\r\n\t\t\ti < NewNotifyCollectionWorkflow.newNotifications.length;\r\n\t\t\ti++\r\n\t\t) {\r\n\t\t\tNewNotifyCollectionWorkflow.newNotifications[i].type = \"Workflow\";\r\n\t\t\tmixNotifications.push(NewNotifyCollectionWorkflow.newNotifications[i]);\r\n\t\t}\r\n\t}\r\n\tif (NewNotifyCollectionPost != null && NewNotifyCollectionPost.newCount > 0) {\r\n\t\tfor (let i = 0; i < NewNotifyCollectionPost.newNotifications.length; i++) {\r\n\t\t\tNewNotifyCollectionPost.newNotifications[i].type = \"Post\";\r\n\t\t\tmixNotifications.push(NewNotifyCollectionPost.newNotifications[i]);\r\n\t\t}\r\n\t}\r\n\tif (NewNotifyCollectionTask != null && NewNotifyCollectionTask.newCount > 0) {\r\n\t\tfor (let i = 0; i < NewNotifyCollectionTask.newNotifications.length; i++) {\r\n\t\t\tNewNotifyCollectionTask.newNotifications[i].type = \"Task\";\r\n\t\t\tmixNotifications.push(NewNotifyCollectionTask.newNotifications[i]);\r\n\t\t}\r\n\t}\r\n\tif (\r\n\t\tNewNotifyCollectionCustom != null &&\r\n\t\tNewNotifyCollectionCustom.newCount > 0\r\n\t) {\r\n\t\tfor (\r\n\t\t\tlet i = 0;\r\n\t\t\ti < NewNotifyCollectionCustom.newNotifications.length;\r\n\t\t\ti++\r\n\t\t) {\r\n\t\t\tNewNotifyCollectionCustom.newNotifications[i].type = \"Custom\";\r\n\t\t\tmixNotifications.push(NewNotifyCollectionCustom.newNotifications[i]);\r\n\t\t}\r\n\t}\r\n\tif (HubNotifications?.length) {\r\n\t\tfor (let i = 0; i < HubNotifications.length; i++) {\r\n\t\t\tmixNotifications.push(HubNotifications[i]);\r\n\t\t}\r\n\t}\r\n\r\n\tmixNotifications.sort((a, b) => {\r\n\t\tconst aDate = Number(convertDate(a.creationDate ?? \"\"));\r\n\t\tconst bDate = Number(convertDate(b.creationDate ?? \"\"));\r\n\r\n\t\treturn aDate - bDate;\r\n\t});\r\n\r\n\treturn mixNotifications;\r\n}\r\n\r\nexport function countNotifications(type = \"\") {\r\n\tlet notifyNumber = 0;\r\n\tif (sessionStorage.getItem(\"NewNotifyCollectionWorkflow\") != null) {\r\n\t\ttry {\r\n\t\t\tconst NewNotifyCollectionWorkflow = JSON.parse(\r\n\t\t\t\tsessionStorage.NewNotifyCollectionWorkflow\r\n\t\t\t);\r\n\t\t\tif (NewNotifyCollectionWorkflow != null) {\r\n\t\t\t\tnotifyNumber += NewNotifyCollectionWorkflow.newCount;\r\n\t\t\t}\r\n\r\n\t\t\tif (type === \"Workflow\")\r\n\t\t\t\treturn NewNotifyCollectionWorkflow?.newCount ?? 0;\r\n\t\t} catch (e) {\r\n\t\t\tconsole.log(e);\r\n\t\t}\r\n\t}\r\n\tif (sessionStorage.getItem(\"NewNotifyCollectionPost\") != null) {\r\n\t\ttry {\r\n\t\t\tconst NewNotifyCollectionPost = JSON.parse(\r\n\t\t\t\tsessionStorage.NewNotifyCollectionPost\r\n\t\t\t);\r\n\t\t\tif (NewNotifyCollectionPost != null) {\r\n\t\t\t\tnotifyNumber += NewNotifyCollectionPost.newCount;\r\n\t\t\t}\r\n\r\n\t\t\tif (type === \"Post\") return NewNotifyCollectionPost?.newCount ?? 0;\r\n\t\t} catch (e) {\r\n\t\t\tconsole.log(e);\r\n\t\t}\r\n\t}\r\n\tif (sessionStorage.getItem(\"NewNotifyCollectionTask\") != null) {\r\n\t\ttry {\r\n\t\t\tconst NewNotifyCollectionTask = JSON.parse(\r\n\t\t\t\tsessionStorage.NewNotifyCollectionTask\r\n\t\t\t);\r\n\t\t\tif (NewNotifyCollectionTask != null) {\r\n\t\t\t\tnotifyNumber += NewNotifyCollectionTask.newCount;\r\n\t\t\t}\r\n\r\n\t\t\tif (type === \"Task\") return NewNotifyCollectionTask?.newCount ?? 0;\r\n\t\t} catch (e) {\r\n\t\t\tconsole.log(e);\r\n\t\t}\r\n\t}\r\n\tif (sessionStorage.getItem(\"NewNotifyCollectionCustom\") != null) {\r\n\t\ttry {\r\n\t\t\tconst NewNotifyCollectionCustom = JSON.parse(\r\n\t\t\t\tsessionStorage.NewNotifyCollectionCustom\r\n\t\t\t);\r\n\t\t\tif (NewNotifyCollectionCustom != null) {\r\n\t\t\t\tnotifyNumber += NewNotifyCollectionCustom.newCount;\r\n\t\t\t}\r\n\r\n\t\t\tif (type === \"Custom\") return NewNotifyCollectionCustom?.newCount ?? 0;\r\n\t\t} catch (e) {\r\n\t\t\tconsole.log(e);\r\n\t\t}\r\n\t}\r\n\r\n\tif (sessionStorage.getItem(\"notifyHub\") != null) {\r\n\t\ttry {\r\n\t\t\tconst oldNotifications = JSON.parse(sessionStorage.notifyHub);\r\n\t\t\tif (oldNotifications != null) {\r\n\t\t\t\tnotifyNumber += oldNotifications.length;\r\n\t\t\t}\r\n\r\n\t\t\tif (type === \"notifyHub\") return oldNotifications?.newCount ?? 0;\r\n\t\t} catch (e) {\r\n\t\t\tconsole.log(e);\r\n\t\t}\r\n\t}\r\n\r\n\treturn notifyNumber;\r\n}\r\n\r\nexport function removeNotification(e: HTMLElement) {\r\n\tif (e != null && e.dataset.target != null) {\r\n\t\tconst panel = $(`${e.dataset.target}`);\r\n\t\tconst notifyId = e?.getAttribute(\"data-target\")?.split(/-(.*)/s)[1];\r\n\r\n\t\tif (panel?.length && panel.data(\"notifytype\") === \"HubNotify\") {\r\n\t\t\tconst oldNotifications = JSON.parse(sessionStorage.notifyHub);\r\n\t\t\tfor (let i = 0; i < oldNotifications.length; i++) {\r\n\t\t\t\tif (oldNotifications[i].id === notifyId) {\r\n\t\t\t\t\toldNotifications.splice(i, 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tsessionStorage.setItem(\"notifyHub\", JSON.stringify(oldNotifications));\r\n\t\t} else if (panel?.length && panel.data(\"notifytype\") === \"VarioNotify\") {\r\n\t\t\tif (Number(notifyId) > 0) {\r\n\t\t\t\tMarkAsViewed(notifyId ?? \"\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tconst type = $(e).attr(\"data-type\") ?? null;\r\n\tconst notifyNumber = countNotifications(type ?? \"\");\r\n\tif (type && (notifyNumber === 1 || notifyNumber === 0)) {\r\n\t\tCloseAdditionalDialog();\r\n\t} else if (notifyNumber === 0) {\r\n\t\t$(\"#noNewNotify\").removeClass(\"hidden\");\r\n\t\t$(\"#removeAllNotificationsBtn\").addClass(\"hidden\");\r\n\t}\r\n\trefreshNotifyNumber();\r\n}\r\n\r\nexport function MarkAsViewed(id: string | string[]) {\r\n\tlet itemsToMark: string[] = [];\r\n\tif (Array.isArray(id)) {\r\n\t\titemsToMark = id;\r\n\t} else {\r\n\t\titemsToMark.push(id);\r\n\t}\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/MarkAsViewed`,\r\n\t\ttype: \"Post\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: { items: itemsToMark },\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tconst wfNotify = response.data[0];\r\n\t\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\t\"NewNotifyCollectionWorkflow\",\r\n\t\t\t\t\tJSON.stringify(wfNotify)\r\n\t\t\t\t);\r\n\r\n\t\t\t\tconst postNotify = response.data[1];\r\n\t\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\t\"NewNotifyCollectionPost\",\r\n\t\t\t\t\tJSON.stringify(postNotify)\r\n\t\t\t\t);\r\n\r\n\t\t\t\tconst taskNotify = response.data[2];\r\n\t\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\t\"NewNotifyCollectionTask\",\r\n\t\t\t\t\tJSON.stringify(taskNotify)\r\n\t\t\t\t);\r\n\r\n\t\t\t\tconst customNotify = response.data[3];\r\n\t\t\t\tsessionStorage.setItem(\r\n\t\t\t\t\t\"NewNotifyCollectionCustom\",\r\n\t\t\t\t\tJSON.stringify(customNotify)\r\n\t\t\t\t);\r\n\r\n\t\t\t\trefreshMainViewButtons(wfNotify, postNotify, taskNotify);\r\n\t\t\t\trefreshLeftPanelConters(wfNotify, postNotify, taskNotify);\r\n\t\t\t\trefreshNotifyNumber(\"gotNewNotifications\");\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function ToggleNotifyPanel() {\r\n\t$(\"#notifyPanel\").toggleClass(\"collapseNotify\");\r\n\trefreshNotifyPanel();\r\n}\r\n\r\nexport function removeAllNotifications(where: string) {\r\n\tconst varioNotificationsToDelete: string[] = [];\r\n\t$(where)\r\n\t\t.children()\r\n\t\t.each(function () {\r\n\t\t\tif (this == null) return;\r\n\t\t\tlet notifyId = this.id;\r\n\t\t\tnotifyId = notifyId.split(\"-\")[1];\r\n\r\n\t\t\tif ($(this).data(\"notifytype\") === \"HubNotify\") {\r\n\t\t\t\tconst oldNotifications = JSON.parse(sessionStorage.notifyHub);\r\n\t\t\t\tfor (let i = 0; i < oldNotifications.length; i++) {\r\n\t\t\t\t\tif (oldNotifications[i].id === notifyId) {\r\n\t\t\t\t\t\toldNotifications.splice(i, 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tsessionStorage.setItem(\"notifyHub\", JSON.stringify(oldNotifications));\r\n\t\t\t} else if ($(this).data(\"notifytype\") === \"VarioNotify\") {\r\n\t\t\t\tvarioNotificationsToDelete.push(notifyId);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\tif (varioNotificationsToDelete.length > 0) {\r\n\t\tMarkAsViewed(varioNotificationsToDelete);\r\n\t}\r\n\r\n\tconst notifyNumber = countNotifications();\r\n\tif (notifyNumber === 0) {\r\n\t\t$(\"#noNewNotify\").removeClass(\"hidden\");\r\n\t\t$(\"#removeAllNotificationsBtn\").addClass(\"hidden\");\r\n\t}\r\n\trefreshNotifyNumber(\"removeAll\");\r\n}\r\n", "\uFEFFimport type { ServiceResponse } from \"../types/models/vario-types\";\r\nimport { GetBaseUrl } from \"./page-navigation\";\r\nimport {\r\n\tcheckIfNumber,\r\n\tregisterServiceWorker,\r\n\tshowDxToast,\r\n\tstringIsNullOrEmpty,\r\n} from \"./site\";\r\nimport \"../types/dx.all.d.ts\";\r\n\r\nexport async function checkPushNotificationsUserPreferences(\r\n\tregistration: ServiceWorkerRegistration\r\n) {\r\n\tif (stringIsNullOrEmpty(currentUserId)) return;\r\n\r\n\tif (stringIsNullOrEmpty(VAPIDPublicKey)) return;\r\n\r\n\tconst pushNotificationsOption = localStorage.getItem(\r\n\t\t`pushNotifications4user${currentUserId}`\r\n\t);\r\n\tif (pushNotificationsOption == null) {\r\n\t\treturn;\r\n\t}\r\n\r\n\t//Sprawdzic czy ID subskrybenta istnieje lub czy jestesmy w trakcie tworzenia nowego subskrybenta (createSubscriber)\r\n\tif (pushNotificationsOption !== \"createSubscriber\") {\r\n\t\tconst res = await retrievePushSubscribers(pushNotificationsOption);\r\n\t\tif (res?.success && res?.data) {\r\n\t\t\t//Subskrybent wci\u0105\u017C aktywny. Mo\u017Cemy zrobic request(zaktualizuje last activityDate i usunie potencjalnych innych subskrybentow na tej maszynie)\r\n\t\t\t$(\"#pushNotiBtn\").prop(\"checked\", true);\r\n\t\t} else {\r\n\t\t\t//Subskrybent nie istnieje, przerwac!\r\n\t\t\tlocalStorage.removeItem(`pushNotifications4user${currentUserId}`);\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\tif (Notification.permission === \"granted\") {\r\n\t\tgetSubscription(registration);\r\n\t} else if (\r\n\t\t(Notification.permission as any) === \"blocked\" ||\r\n\t\tNotification.permission === \"denied\"\r\n\t) {\r\n\t\tshowDxToast(\r\n\t\t\t\"Twoja przegl\u0105darka nie obs\u0142uguje powiadomie\u0144 push lub zablokowa\u0142e\u015B powiadomienia\",\r\n\t\t\t\"warning\"\r\n\t\t);\r\n\t} else {\r\n\t\trequestNotificationAccess(registration);\r\n\t}\r\n}\r\n\r\nexport function requestNotificationAccess(reg: ServiceWorkerRegistration) {\r\n\tNotification.requestPermission((status) => {\r\n\t\tif (status === \"granted\") {\r\n\t\t\tgetSubscription(reg);\r\n\t\t} else {\r\n\t\t\tshowDxToast(\r\n\t\t\t\t\"Twoja przegl\u0105darka nie obs\u0142uguje powiadomie\u0144 push lub zablokowa\u0142e\u015B powiadomienia\",\r\n\t\t\t\t\"warning\"\r\n\t\t\t);\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function changeUserPushNotificationPreferences(selectedValue: string) {\r\n\tif (selectedValue) {\r\n\t\tlocalStorage.setItem(\r\n\t\t\t`pushNotifications4user${currentUserId}`,\r\n\t\t\t\"createSubscriber\"\r\n\t\t);\r\n\t\tregisterServiceWorker();\r\n\t} else {\r\n\t\tlet subscriberID = -1;\r\n\t\tconst pushNotificationsOption = Number(\r\n\t\t\tlocalStorage.getItem(`pushNotifications4user${currentUserId}`)\r\n\t\t);\r\n\t\tif (checkIfNumber(pushNotificationsOption)) {\r\n\t\t\tsubscriberID = pushNotificationsOption ?? -1;\r\n\t\t\tremovePushSubscriber(subscriberID);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function getSubscription(reg: ServiceWorkerRegistration) {\r\n\treg.pushManager.getSubscription().then((sub) => {\r\n\t\tif (!sub) {\r\n\t\t\treg.pushManager\r\n\t\t\t\t.subscribe({\r\n\t\t\t\t\tuserVisibleOnly: true,\r\n\t\t\t\t\tapplicationServerKey: VAPIDPublicKey,\r\n\t\t\t\t})\r\n\t\t\t\t.then((sub) => {\r\n\t\t\t\t\tcreatePushSubscriberRequest(sub);\r\n\t\t\t\t})\r\n\t\t\t\t.catch((e) => {\r\n\t\t\t\t\tconsole.error(\"Unable to subscribe to push\", e);\r\n\t\t\t\t});\r\n\t\t} else {\r\n\t\t\tcreatePushSubscriberRequest(sub);\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function arrayBufferToBase64(buffer: ArrayBuffer) {\r\n\tlet binary = \"\";\r\n\tconst bytes = new Uint8Array(buffer);\r\n\tconst len = bytes.byteLength;\r\n\tfor (let i = 0; i < len; i++) {\r\n\t\tbinary += String.fromCharCode(bytes[i]);\r\n\t}\r\n\treturn window.btoa(binary);\r\n}\r\n\r\nexport function createPushSubscriberRequest(sub: PushSubscription) {\r\n\tconst endpoint = sub.endpoint;\r\n\tconst p256dh = arrayBufferToBase64(\r\n\t\tsub.getKey(\"p256dh\") ?? new ArrayBuffer(0)\r\n\t);\r\n\tconst auth = arrayBufferToBase64(sub.getKey(\"auth\") ?? new ArrayBuffer(0));\r\n\r\n\tconsole.log(navigator.userAgent);\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/CreatePushSubscriber`,\r\n\t\ttype: \"Post\",\r\n\t\tdata: {\r\n\t\t\tdescription: navigator.userAgent,\r\n\t\t\tendPointURL: endpoint,\r\n\t\t\tp256dh: p256dh,\r\n\t\t\tauth: auth,\r\n\t\t},\r\n\t\tsuccess: (res: ServiceResponse) => {\r\n\t\t\tif (res?.success) {\r\n\t\t\t\tconsole.log(\"CreatePushSubscriber = new created or updated\");\r\n\t\t\t\tconsole.log(res.data);\r\n\t\t\t\tlocalStorage.setItem(\r\n\t\t\t\t\t`pushNotifications4user${currentUserId}`,\r\n\t\t\t\t\tres.data.toString()\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (data) => {\r\n\t\t\tconsole.error(\"Dodanie nowego subskrybenta nie powiod\u0142o si\u0119\", data);\r\n\t\t},\r\n\t\tcomplete: () => {},\r\n\t});\r\n}\r\n\r\nexport function removePushSubscriber(id: number) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/RemovePushSubscriber/${id}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (data: ServiceResponse) => {\r\n\t\t\tconsole.log(data);\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function retrievePushSubscribers(id: number | string) {\r\n\treturn $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/RetrievePushSubscribers/${id}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (data: ServiceResponse) => {\r\n\t\t\tconsole.log(data);\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t},\r\n\t});\r\n}\r\n", "import {\r\n\tAddressingScope,\r\n\ttype GroupedRecipients,\r\n\ttype RetrievedChatUsers,\r\n\ttype VarioEmployee,\r\n} from \"../types/models/vario-types\";\r\nimport { validateEmail } from \"./emails\";\r\nimport { GetBaseUrl } from \"./page-navigation\";\r\nimport { fixScrollInDx, groupBy, showDxToast } from \"./site\";\r\nimport \"../types/dx.all.d.ts\";\r\n\r\nconst requeriedUsers = {};\r\n\r\nexport function SearchRecipient() {\r\n\tlet userContainer: JQuery;\r\n\tlet txtValue: string;\r\n\tconst filter = (\r\n\t\tdocument.getElementById(\"RecipientSearch\") as HTMLInputElement\r\n\t).value.toUpperCase();\r\n\t$(\"#SelectRecipientTable .recipient\").each((_, item) => {\r\n\t\tuserContainer = $(item as HTMLElement).find(\"label\");\r\n\t\tif (userContainer) {\r\n\t\t\ttxtValue = userContainer.text().trim();\r\n\r\n\t\t\tif (txtValue.toUpperCase().indexOf(filter) === -1) {\r\n\t\t\t\t(item as HTMLElement).style.display = \"none\";\r\n\t\t\t} else {\r\n\t\t\t\t(item as HTMLElement).style.display = \"\";\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#selectAllRecipientsBtn\").attr(\r\n\t\t\"disabled\",\r\n\t\t$('#SelectRecipientTable .recipient:not([style*=\"display: none\"])').length\r\n\t\t\t? null\r\n\t\t\t: \"disabled\"\r\n\t);\r\n}\r\n\r\nexport function selectAllRecipientsInGroup(\r\n\telement: HTMLInputElement,\r\n\tgroupName: string\r\n) {\r\n\t$(\r\n\t\t`#${groupName} .form-check:not([style*=\"display: none\"]) .form-check-input`\r\n\t).each(function () {\r\n\t\tif (\r\n\t\t\t(!$(this).is(\":checked\") && element.checked) ||\r\n\t\t\t($(this).is(\":checked\") && !element.checked)\r\n\t\t) {\r\n\t\t\t$(this).trigger(\"click\");\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function SelectThisRecipient(\r\n\telement?: HTMLInputElement,\r\n\titemId?: string,\r\n\tname?: string\r\n) {\r\n\tif (itemId && name && element) {\r\n\t\tconst convertedName = name.replace(/[^a-zA-Z0-9]/g, \"\");\r\n\r\n\t\tif (element.checked) {\r\n\t\t\t//dodawanie adresata\r\n\t\t\t$(`.${convertedName}`).prop(\"checked\", true);\r\n\r\n\t\t\tconst recipientExists = globalSelectedRecipients.some(\r\n\t\t\t\t(el) => el.id === itemId\r\n\t\t\t);\r\n\t\t\tif (!recipientExists) {\r\n\t\t\t\tglobalSelectedRecipients.push({ id: itemId, name: name });\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t//usuwanie adresata\r\n\t\t\t$(`.${convertedName}`).prop(\"checked\", false);\r\n\r\n\t\t\t//usuwanie guzika zaznaczenia grupy\r\n\t\t\tlet id = $(element).attr(\"id\") ?? \"\";\r\n\t\t\tid = id.substring(id.indexOf(\"-\") + 1);\r\n\t\t\t$(`.groupingHeader${id} .form-check-input`).prop(\"checked\", false);\r\n\r\n\t\t\tconst index = globalSelectedRecipients\r\n\t\t\t\t.map((x) => {\r\n\t\t\t\t\treturn x.id;\r\n\t\t\t\t})\r\n\t\t\t\t.indexOf(itemId);\r\n\t\t\tglobalSelectedRecipients.splice(index, 1);\r\n\t\t}\r\n\r\n\t\t//licznik adresat\u00F3w\r\n\t\t$(\"#recipientCounter\").empty();\r\n\t\t$(\"#recipientCounter\").append(\r\n\t\t\t`Wybranych: ${globalSelectedRecipients.length}`\r\n\t\t);\r\n\r\n\t\t//wy\u0142\u0105czanie/w\u0142\u0105czanie guzika wysy\u0142ania\r\n\t\tif (globalSelectedRecipients.length > 0) {\r\n\t\t\t$(\"#ExecuteButton\").attr(\"disabled\", null);\r\n\t\t\t$(\"#ExecuteDecreeButton\").attr(\"disabled\", null);\r\n\t\t} else {\r\n\t\t\t$(\"#ExecuteButton\").attr(\"disabled\", \"disabled\");\r\n\t\t\t$(\"#ExecuteDecreeButton\").attr(\"disabled\", \"disabled\");\r\n\t\t}\r\n\t} else {\r\n\t\t//je\u015Bli przechodzimy na inne grupowanie\r\n\t\tfor (const element of globalSelectedRecipients) {\r\n\t\t\tconst convertedName = element.name.replace(/[^a-zA-Z0-9]/g, \"\");\r\n\t\t\t//zaznaczenie wcze\u015Bniej zaznaczonych adresat\u00F3w\r\n\t\t\t$(`.${convertedName}`).prop(\"checked\", true);\r\n\t\t}\r\n\t}\r\n\r\n\t//zaznaczanie ca\u0142ych zaznaczonych grup\r\n\t$(\"#SelectRecipientTable .collapse\").each(function () {\r\n\t\tconst group = $(this);\r\n\t\tconst id = $(this).attr(\"id\");\r\n\r\n\t\tif (\r\n\t\t\tgroup.find(\".form-check-input:checked\").length ===\r\n\t\t\tgroup.find(\".form-check-input\").length\r\n\t\t) {\r\n\t\t\t$(`.groupingHeader${id} input`).prop(\"checked\", true);\r\n\t\t}\r\n\t});\r\n}\r\n\r\nexport function enableExecuteButton() {\r\n\t$(\"#ExecuteButton\").attr(\"disabled\", null);\r\n\t$(\"#ExecuteDecreeButton\").attr(\"disabled\", null);\r\n}\r\n\r\nexport function addDynamicUserToRecipients(\r\n\trecipients: VarioEmployee[],\r\n\tcomplexView: boolean\r\n) {\r\n\tconst dynamicUser = (\r\n\t\tdocument.getElementById(\"dynamicUser\") as HTMLInputElement\r\n\t)?.value;\r\n\tif (dynamicUser.length > 0) {\r\n\t\tif (!validateEmail(dynamicUser)) {\r\n\t\t\tshowDxToast(\"Z\u0142y email\", \"error\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tglobalSelectedRecipients.push({\r\n\t\t\tid: dynamicUser,\r\n\t\t\tname: dynamicUser,\r\n\t\t});\r\n\r\n\t\trecipients.push({\r\n\t\t\trecipientIcon: ``,\r\n\t\t\trecipientKey: dynamicUser,\r\n\t\t\trecipientName: dynamicUser,\r\n\t\t\trecipientRoles: [],\r\n\t\t});\r\n\r\n\t\tcreateRecipientsList(recipients, complexView);\r\n\r\n\t\tenableExecuteButton();\r\n\t}\r\n}\r\n\r\nexport function createRecipientsList(\r\n\trecipients: VarioEmployee[],\r\n\tcomplexView: boolean,\r\n\tshowOnlineStatus = false,\r\n\tappendDynamicUsr = true\r\n) {\r\n\tconst recipientsNoOutside = recipients.filter(\r\n\t\t(item) => !item.outsideRecipient\r\n\t);\r\n\tconst recipientsOutside = recipients.filter((item) => item.outsideRecipient);\r\n\r\n\tif ($(\"#recipientsContainer\").length === 0) {\r\n\t\t$(\"#BigDialog\").append('
    ');\r\n\t}\r\n\r\n\t$(\"#recipientsContainer\").empty();\r\n\r\n\tif (\r\n\t\t$(\"#recipientCounter\").length === 0 ||\r\n\t\t$(\"#recipientCounter\").is(\":empty\")\r\n\t) {\r\n\t\t$(\"#recipientsContainer\").append(\r\n\t\t\t`
    Wybierz:
    `\r\n\t\t);\r\n\t}\r\n\r\n\t//tworzenie glownego elementu wraz z wyszukiwark\u0105\r\n\t$(\r\n\t\t\"#recipientsContainer\"\r\n\t).append(`
    \r\n
    \r\n \r\n \r\n
    \r\n\r\n
    \r\n
    `);\r\n\r\n\tif (appendDynamicUsr) {\r\n\t\t$(\"#recipientsContainer\").prepend(\r\n\t\t\t`
    `\r\n\t\t);\r\n\t}\r\n\r\n\tif (registerEnabled === \"True\" || register4AllEnabled === \"True\") {\r\n\t\t$(\"#addDynamicUserContainer\").append(`\r\n \r\n `);\r\n\r\n\t\t$(\"#dynamicUser\").on(\"keyup\", (event) => {\r\n\t\t\tif (event.key === \"Enter\") {\r\n\t\t\t\t$(\"#addDynamicUserBtn\").trigger(\"click\");\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t$(\"#addDynamicUserBtn\").on(\"click\", () => {\r\n\t\t\taddDynamicUserToRecipients(recipientsNoOutside, complexView);\r\n\t\t});\r\n\t}\r\n\r\n\tif (showOnlineStatus) {\r\n\t\tconst recipientsOnlyOnline: VarioEmployee[] = [];\r\n\t\tconst connectedWebClients = JSON.parse(\r\n\t\t\tsessionStorage.getItem(\"connectedWebClients\") ?? \"null\"\r\n\t\t);\r\n\r\n\t\tfor (const elem of recipients) {\r\n\t\t\tif (\r\n\t\t\t\ttypeof connectedWebClients !== \"undefined\" &&\r\n\t\t\t\tconnectedWebClients != null\r\n\t\t\t) {\r\n\t\t\t\tconst clients = connectedWebClients.filter((cli) => {\r\n\t\t\t\t\treturn cli.userName === elem.recipientName;\r\n\t\t\t\t});\r\n\r\n\t\t\t\tif (clients != null && clients.length > 0) {\r\n\t\t\t\t\trecipientsOnlyOnline.push(elem);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\trecipients = recipientsOnlyOnline;\r\n\t}\r\n\r\n\t//grupowanie odbiorc\u00F3w\r\n\tconst recipientsGroupedByMembershipGroup = groupBy(\r\n\t\trecipientsNoOutside,\r\n\t\t\"recipientMembershipGroup\"\r\n\t);\r\n\tconst recipientsGroupedByPosition = groupBy(\r\n\t\trecipientsNoOutside,\r\n\t\t\"recipientPosition\"\r\n\t);\r\n\tconst recipientsGroupedByType = groupBy(recipientsNoOutside, \"recipientType\");\r\n\r\n\t//grupowanie po roli\r\n\tlet recipientRoles: string[] = [];\r\n\tlet recipientsGroupedByRoles: GroupedRecipients = { null: [] };\r\n\r\n\tfor (const recipient of recipientsNoOutside) {\r\n\t\tif ((recipient?.recipientRoles?.length ?? 0) > 0) {\r\n\t\t\tif (recipient?.recipientRoles)\r\n\t\t\t\tfor (const role of recipient.recipientRoles) recipientRoles.push(role);\r\n\t\t} else {\r\n\t\t\trecipientRoles.push(\"null\");\r\n\t\t}\r\n\t}\r\n\trecipientRoles = recipientRoles.filter((v, i, a) => a.indexOf(v) === i);\r\n\r\n\tif (recipientRoles.length > 0) {\r\n\t\trecipientsGroupedByRoles = Object.assign(\r\n\t\t\t{},\r\n\t\t\t...recipientRoles.map((role) => ({ [role]: [] }))\r\n\t\t);\r\n\r\n\t\tfor (const role of recipientRoles) {\r\n\t\t\tfor (const recipient of recipientsNoOutside) {\r\n\t\t\t\tif (recipient?.recipientRoles?.includes(role)) {\r\n\t\t\t\t\trecipientsGroupedByRoles[role].push(recipient);\r\n\t\t\t\t} else if (\r\n\t\t\t\t\trecipient?.recipientRoles?.length === 0 &&\r\n\t\t\t\t\trecipientsGroupedByRoles.null.indexOf(recipient) === -1\r\n\t\t\t\t) {\r\n\t\t\t\t\trecipientsGroupedByRoles.null.push(recipient);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\trecipientsGroupedByRoles.null = recipientsNoOutside;\r\n\t}\r\n\r\n\tif (!complexView) {\r\n\t\t//dodawanie guzik\u00F3w wygl\u0105du niekompleksowego\r\n\t\t$(\r\n\t\t\t\"#recipientsContainer\"\r\n\t\t).append(`
    \r\n \r\n \r\n \r\n \r\n
    `);\r\n\r\n\t\t//dodawanie adresat\u00F3w bez grupowania\r\n\t\tappendRecipientsList(\r\n\t\t\trecipientsNoOutside,\r\n\t\t\tfalse,\r\n\t\t\tfalse,\r\n\t\t\tundefined,\r\n\t\t\tshowOnlineStatus\r\n\t\t);\r\n\r\n\t\t$(\"#recipients-no-grouping\").on(\"click\", function () {\r\n\t\t\tappendRecipientsList(\r\n\t\t\t\trecipientsNoOutside,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tundefined,\r\n\t\t\t\tshowOnlineStatus\r\n\t\t\t);\r\n\t\t\t$(\".recipients-grouping-buttons button\").removeClass(\"active\");\r\n\t\t\t$(this).addClass(\"active\");\r\n\t\t});\r\n\t\t$(\"#recipients-group\").on(\"click\", function () {\r\n\t\t\tappendRecipientsList(\r\n\t\t\t\trecipientsGroupedByMembershipGroup,\r\n\t\t\t\ttrue,\r\n\t\t\t\tfalse,\r\n\t\t\t\t\"group\",\r\n\t\t\t\tshowOnlineStatus\r\n\t\t\t);\r\n\t\t\t$(\".recipients-grouping-buttons button\").removeClass(\"active\");\r\n\t\t\t$(this).addClass(\"active\");\r\n\t\t});\r\n\t\t$(\"#recipients-position\").on(\"click\", function () {\r\n\t\t\tappendRecipientsList(\r\n\t\t\t\trecipientsGroupedByPosition,\r\n\t\t\t\ttrue,\r\n\t\t\t\tfalse,\r\n\t\t\t\t\"position\",\r\n\t\t\t\tshowOnlineStatus\r\n\t\t\t);\r\n\t\t\t$(\".recipients-grouping-buttons button\").removeClass(\"active\");\r\n\t\t\t$(this).addClass(\"active\");\r\n\t\t});\r\n\t\t$(\"#recipients-roles\").on(\"click\", function () {\r\n\t\t\tappendRecipientsList(\r\n\t\t\t\trecipientsGroupedByRoles,\r\n\t\t\t\ttrue,\r\n\t\t\t\tfalse,\r\n\t\t\t\t\"roles\",\r\n\t\t\t\tshowOnlineStatus\r\n\t\t\t);\r\n\t\t\t$(\".recipients-grouping-buttons button\").removeClass(\"active\");\r\n\t\t\t$(this).addClass(\"active\");\r\n\t\t});\r\n\t} else {\r\n\t\t//dodawanie guzik\u00F3w wygl\u0105du kompleksowego\r\n\t\t$(\r\n\t\t\t\"#recipientsContainer\"\r\n\t\t).append(`
    \r\n \r\n \r\n
    `);\r\n\r\n\t\t//dodawanie adresat\u00F3w bez grupowania\r\n\t\tappendRecipientsList(recipientsNoOutside, false, true);\r\n\r\n\t\t$(\"#recipients-no-grouping-complex\").on(\"click\", function () {\r\n\t\t\tappendRecipientsList(recipientsNoOutside, false, true);\r\n\t\t\t$(\".recipients-grouping-buttons button\").removeClass(\"active\");\r\n\t\t\t$(this).addClass(\"active\");\r\n\t\t});\r\n\t\t$(\"#recipients-type\").on(\"click\", function () {\r\n\t\t\tappendRecipientsList(recipientsGroupedByType, true, true, \"type\");\r\n\t\t\t$(\".recipients-grouping-buttons button\").removeClass(\"active\");\r\n\t\t\t$(this).addClass(\"active\");\r\n\t\t});\r\n\t}\r\n\r\n\tif (\r\n\t\t(registerEnabled === \"True\" || register4AllEnabled === \"True\") &&\r\n\t\tappendDynamicUsr\r\n\t) {\r\n\t\t$(\".recipients-buttons-container\").append(`\r\n
    \r\n \r\n \r\n \r\n
    `);\r\n\r\n\t\t$(\"#recipientSwitcher\").on(\"change.switcher\", function () {\r\n\t\t\tconst currentIsOutside = $(this).prop(\"title\") === \"Adresaci zewn\u0119trzni\";\r\n\r\n\t\t\tif (!currentIsOutside) {\r\n\t\t\t\t$(\".recipients-grouping-buttons button\").removeClass(\"active\");\r\n\t\t\t\t$(\".recipients-grouping-buttons button:first-of-type\").addClass(\r\n\t\t\t\t\t\"active\"\r\n\t\t\t\t);\r\n\t\t\t\tappendRecipientsList(\r\n\t\t\t\t\trecipientsNoOutside,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tcomplexView,\r\n\t\t\t\t\tundefined,\r\n\t\t\t\t\tshowOnlineStatus\r\n\t\t\t\t);\r\n\t\t\t} else\r\n\t\t\t\tappendRecipientsList(\r\n\t\t\t\t\trecipientsOutside,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\t\"outsideRecipients\",\r\n\t\t\t\t\tshowOnlineStatus\r\n\t\t\t\t);\r\n\r\n\t\t\t$(\".recipients-grouping-buttons\").toggleClass(\"hidden\");\r\n\t\t\t$(this).prop(\r\n\t\t\t\t\"title\",\r\n\t\t\t\tcurrentIsOutside ? \"Adresaci wewn\u0119trzni\" : \"Adresaci zewn\u0119trzni\"\r\n\t\t\t);\r\n\t\t});\r\n\t}\r\n\r\n\tfixScrollInDx(\"#SelectRecipientTable\");\r\n\tfixScrollInDx(\".select-recipients-table\");\r\n}\r\n\r\n//funkcja dodaj\u0105ca adresat\u00F3w do listy np. podczas dekretowania lub wysy\u0142ania polecenia\r\nexport function appendRecipientsList(\r\n\trecipients: VarioEmployee[] | GroupedRecipients,\r\n\tisGrouped: boolean,\r\n\tisComplex: boolean,\r\n\tgroupingType?: string,\r\n\tshowOnlineStatus = false\r\n) {\r\n\t$(\"#SelectRecipientTable\").empty();\r\n\r\n\tif (!isGrouped && !isComplex) {\r\n\t\t$(\"#SelectRecipientTable\").append(\r\n\t\t\t`
      `\r\n\t\t);\r\n\r\n\t\tfor (const elem of recipients as VarioEmployee[]) {\r\n\t\t\tconst convertedName = elem.recipientName.replace(/[^a-zA-Z0-9]/g, \"\");\r\n\t\t\tlet displayName = elem.recipientName;\r\n\t\t\tif (showOnlineStatus) {\r\n\t\t\t\tconst connectedWebClients = JSON.parse(\r\n\t\t\t\t\tsessionStorage.getItem(\"connectedWebClients\") ?? \"null\"\r\n\t\t\t\t);\r\n\t\t\t\tif (\r\n\t\t\t\t\ttypeof connectedWebClients !== \"undefined\" &&\r\n\t\t\t\t\tconnectedWebClients != null\r\n\t\t\t\t) {\r\n\t\t\t\t\tconst clients = connectedWebClients.filter((cli) => {\r\n\t\t\t\t\t\treturn cli.userName === elem.recipientName;\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tif (clients != null && clients.length > 0) {\r\n\t\t\t\t\t\tlet desktopUserOnline = false;\r\n\t\t\t\t\t\tlet webUserOnline = false;\r\n\r\n\t\t\t\t\t\tfor (let i = 0; i < clients.length; i++) {\r\n\t\t\t\t\t\t\tswitch (clients[i].applicationType) {\r\n\t\t\t\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\t\t\t\tdesktopUserOnline = true;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase 3:\r\n\t\t\t\t\t\t\t\t\twebUserOnline = true;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdisplayName = \"\";\r\n\t\t\t\t\t\tif (desktopUserOnline) {\r\n\t\t\t\t\t\t\tdisplayName += ``;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (webUserOnline) {\r\n\t\t\t\t\t\t\tdisplayName += ``;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tdisplayName += elem.recipientName;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tlet icon = \"\";\r\n\t\t\tif (elem.recipientIcon != null && elem.recipientIcon.length > 0) {\r\n\t\t\t\tif (elem.recipientIcon.includes(\"\")) {\r\n\t\t\t\t\ticon = elem.recipientIcon;\r\n\t\t\t\t} else\r\n\t\t\t\t\ticon = ``;\r\n\t\t\t}\r\n\r\n\t\t\t$(\r\n\t\t\t\t\"#SelectRecipientTable .list-group\"\r\n\t\t\t).append(`
      \r\n \r\n ${icon}\r\n \r\n
      `);\r\n\t\t}\r\n\t} else if (isGrouped && !isComplex) {\r\n\t\tlet specificGroupText = \"\";\r\n\t\tif (groupingType === \"group\") {\r\n\t\t\tspecificGroupText = \"Cz\u0142onek grupy: \";\r\n\t\t} else if (groupingType === \"position\") {\r\n\t\t\tspecificGroupText = \"Stanowisko: \";\r\n\t\t} else if (groupingType === \"roles\") {\r\n\t\t\tspecificGroupText = \"Rola: \";\r\n\t\t\trecipients = Object.keys(recipients)\r\n\t\t\t\t.sort()\r\n\t\t\t\t.reduce((r, k) => {\r\n\t\t\t\t\tr[k] = recipients[k];\r\n\t\t\t\t\treturn r;\r\n\t\t\t\t}, {});\r\n\t\t} else if (groupingType === \"outsideRecipients\") {\r\n\t\t\tspecificGroupText = \"Adresaci zewn\u0119trzni: \";\r\n\t\t}\r\n\r\n\t\t$(\"#SelectRecipientTable\").append(\r\n\t\t\t`
        `\r\n\t\t);\r\n\t\tfor (const [key, value] of Object.entries(\r\n\t\t\trecipients as GroupedRecipients\r\n\t\t)) {\r\n\t\t\tlet groupName = key.trim();\r\n\t\t\tlet groupNameText = key.trim();\r\n\t\t\tif (key === \"null\") {\r\n\t\t\t\tgroupName = \"brak\";\r\n\t\t\t\tgroupNameText = \"(brak)\";\r\n\t\t\t}\r\n\t\t\tgroupName = groupName.replace(/[^a-zA-Z0-9]/g, \"\");\r\n\r\n\t\t\t$(\r\n\t\t\t\t\"#SelectRecipientTable .main-container.list-group\"\r\n\t\t\t).append(`
        \r\n \r\n \r\n

        ${specificGroupText} ${groupNameText}

        \r\n
        \r\n
        \r\n
        \r\n
          \r\n
        \r\n
        \r\n
        `);\r\n\r\n\t\t\tfor (const [_key2, elem] of Object.entries(value)) {\r\n\t\t\t\tconst convertedName = elem.recipientName.replace(/[^a-zA-Z0-9]/g, \"\");\r\n\t\t\t\tlet displayName = elem.recipientName;\r\n\t\t\t\tif (showOnlineStatus) {\r\n\t\t\t\t\tconst connectedWebClients = JSON.parse(\r\n\t\t\t\t\t\tsessionStorage.getItem(\"connectedWebClients\") ?? \"null\"\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\ttypeof connectedWebClients !== \"undefined\" &&\r\n\t\t\t\t\t\tconnectedWebClients != null\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tconst clients = connectedWebClients.filter((cli) => {\r\n\t\t\t\t\t\t\treturn cli.userName === elem.recipientName;\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\tif (clients != null && clients.length > 0) {\r\n\t\t\t\t\t\t\tlet desktopUserOnline = false;\r\n\t\t\t\t\t\t\tlet webUserOnline = false;\r\n\r\n\t\t\t\t\t\t\tfor (let i = 0; i < clients.length; i++) {\r\n\t\t\t\t\t\t\t\tswitch (clients[i].applicationType) {\r\n\t\t\t\t\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\t\t\t\t\tdesktopUserOnline = true;\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\tcase 3:\r\n\t\t\t\t\t\t\t\t\t\twebUserOnline = true;\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tdisplayName = \"\";\r\n\t\t\t\t\t\t\tif (desktopUserOnline) {\r\n\t\t\t\t\t\t\t\tdisplayName += ``;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (webUserOnline) {\r\n\t\t\t\t\t\t\t\tdisplayName += ``;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tdisplayName += elem.recipientName;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet icon = \"\";\r\n\t\t\t\tif (elem.recipientIcon != null && elem.recipientIcon.length > 0) {\r\n\t\t\t\t\tif (elem.recipientIcon.includes(\"\")) {\r\n\t\t\t\t\t\ticon = elem.recipientIcon;\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t\ticon = ``;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$(\r\n\t\t\t\t\t`#SelectRecipientTable #${groupName} .list-group`\r\n\t\t\t\t).append(`
        \r\n \r\n ${icon}\r\n \r\n
        `);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (!isGrouped && isComplex) {\r\n\t\t$(\"#SelectRecipientTable\").append(`
        \r\n
        \r\n

        Nazwa

        Typ

        \r\n
        \r\n
          `);\r\n\t\tfor (const elem of recipients as VarioEmployee[]) {\r\n\t\t\tconst convertedName = elem.recipientName.replace(/[^a-zA-Z0-9]/g, \"\");\r\n\r\n\t\t\tlet icon = \"\";\r\n\t\t\tif (elem.recipientIcon != null && elem.recipientIcon.length > 0) {\r\n\t\t\t\tif (elem.recipientIcon.includes(\"\")) {\r\n\t\t\t\t\ticon = elem.recipientIcon;\r\n\t\t\t\t} else\r\n\t\t\t\t\ticon = ``;\r\n\t\t\t}\r\n\r\n\t\t\t$(\r\n\t\t\t\t\"#SelectRecipientTable .list-group\"\r\n\t\t\t).append(`
          \r\n \r\n ${icon}\r\n
          \r\n \r\n \r\n
          \r\n
          `);\r\n\t\t}\r\n\t} else if (isGrouped && isComplex) {\r\n\t\t$(\"#SelectRecipientTable\").append(`
          \r\n
          \r\n

          Nazwa

          Typ

          \r\n
          \r\n
            `);\r\n\t\tfor (const [key, value] of Object.entries(\r\n\t\t\trecipients as GroupedRecipients\r\n\t\t)) {\r\n\t\t\tlet groupName = key.trim();\r\n\t\t\tlet groupNameText = key.trim();\r\n\t\t\tif (key === \"null\") {\r\n\t\t\t\tgroupName = \"brak\";\r\n\t\t\t\tgroupNameText = \"(brak)\";\r\n\t\t\t}\r\n\t\t\tgroupName = groupName.replace(/[^a-zA-Z0-9]/g, \"\");\r\n\r\n\t\t\t$(\r\n\t\t\t\t\"#SelectRecipientTable .main-container.list-group\"\r\n\t\t\t).append(`
            \r\n \r\n \r\n

            Typ: ${groupNameText}

            \r\n
            \r\n
            \r\n
            \r\n
              \r\n
            \r\n
            \r\n
            `);\r\n\r\n\t\t\tfor (const [_key2, elem] of Object.entries(value)) {\r\n\t\t\t\tconst convertedName = elem.recipientName.replace(/[^a-zA-Z0-9]/g, \"\");\r\n\r\n\t\t\t\t$(\r\n\t\t\t\t\t`#SelectRecipientTable #${groupName} .list-group`\r\n\t\t\t\t).append(`
            \r\n \r\n
            \r\n \r\n \r\n
            \r\n
            `);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tSelectThisRecipient();\r\n\tSearchRecipient();\r\n}\r\n\r\nexport function getHubRecipients() {\r\n\tif (!currentUserId || currentUserId === \"0\") return;\r\n\r\n\tif (sessionStorage.getItem(\"Recipients\") == null) {\r\n\t\tgetRecipientsFromHub();\r\n\t}\r\n}\r\n\r\nexport function getRecipientsFromHub(\r\n\tincludeSiteRecipients = true\r\n): Promise {\r\n\treturn new Promise((resolve) =>\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetRecipients?includeSiteRecipients=${includeSiteRecipients}`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: true,\r\n\t\t\tsuccess: (data: VarioEmployee[]) => {\r\n\t\t\t\tif (includeSiteRecipients)\r\n\t\t\t\t\tsessionStorage.setItem(\"Recipients\", JSON.stringify(data));\r\n\r\n\t\t\t\tresolve(data);\r\n\t\t\t\treturn data;\r\n\t\t\t},\r\n\t\t})\r\n\t);\r\n}\r\n\r\nexport function getAutoCompleteRecipientsData(\r\n\tscope: AddressingScope | AddressingScope[] = [],\r\n\tfilter = \"\",\r\n\tskip = 0,\r\n\ttake = 100000\r\n) {\r\n\tif (!currentUserId || currentUserId === \"0\") return;\r\n\r\n\tif (scope && !Array.isArray(scope)) scope = [scope];\r\n\r\n\tlet value = 0;\r\n\tif (scope?.length) {\r\n\t\tfor (const x of scope) {\r\n\t\t\tvalue |= x;\r\n\t\t}\r\n\t}\r\n\tif (value === 0) value = AddressingScope.AllAddressable;\r\n\r\n\treturn $.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetAutoCompleteRecipientsData?Scope=${value}&searchValue=${filter}&skip=${skip}&take=${take}`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: true,\r\n\t\tsuccess: (data: VarioEmployee[]) => {\r\n\t\t\tif (debug) console.log(data);\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport async function checkIfNeedsRequeryRecipients(\r\n\tdata: RetrievedChatUsers[]\r\n) {\r\n\tlet recipients: VarioEmployee[] = JSON.parse(\r\n\t\tsessionStorage.getItem(\"Recipients\") ?? \"null\"\r\n\t);\r\n\tlet requery = false;\r\n\tdata?.some((rec) => {\r\n\t\tif (\r\n\t\t\t!recipients?.find((x) =>\r\n\t\t\t\tx?.recipientKey?.includes(rec?.userID.toString())\r\n\t\t\t) &&\r\n\t\t\t!requeriedUsers[rec?.userID]\r\n\t\t) {\r\n\t\t\trequery = true;\r\n\t\t\trequeriedUsers[rec.userID] = true;\r\n\t\t\treturn requery;\r\n\t\t}\r\n\t});\r\n\r\n\tif (requery) {\r\n\t\tsessionStorage.removeItem(\"Recipients\");\r\n\t\trecipients = await getRecipientsFromHub();\r\n\t\tsessionStorage.setItem(\"Recipients\", JSON.stringify(recipients));\r\n\t}\r\n}\r\n", "import \"../types/dx.all.d.ts\";\r\nimport \"../types/dx.richedit.d.ts\";\r\nimport { RequestStatus, type VarioFile } from \"../types/models/vario-types\";\r\nimport { reloadGridPanel } from \"./data-grid-side-panel.ts\";\r\nimport { getRowFromGrid } from \"./devextreme-table-functions.ts\";\r\nimport { UndoItem } from \"./editor\";\r\nimport { GetBaseUrl } from \"./page-navigation\";\r\nimport { refreshManager } from \"./refresh-manager.ts\";\r\nimport {\r\n\tChangeSaveBtnsStatus,\r\n\tHideLoadingPanel,\r\n\tShowLoadingPanel,\r\n\tcheckInCheckOut,\r\n\tcheckOutDoc,\r\n\tcheckWhereIsUser,\r\n\tshowDxToast,\r\n\tstringIsNullOrEmpty,\r\n} from \"./site\";\r\nimport { submitSpreadsheet } from \"./spreadsheet\";\r\n\r\ndeclare global {\r\n\tvar ignoreUnsavedDocFlag: boolean;\r\n\tvar richEdit: any;\r\n\tvar checkOutNeed: boolean;\r\n\tvar checkOutDuring: boolean;\r\n\tvar firstCheckOutClick: boolean;\r\n\tvar docDirty: boolean;\r\n}\r\n\r\nglobalThis.richEdit = null;\r\nglobalThis.ignoreUnsavedDocFlag = false;\r\nglobalThis.checkOutNeed = false;\r\nglobalThis.checkOutDuring = false;\r\nglobalThis.firstCheckOutClick = false;\r\nglobalThis.docDirty = false;\r\n\r\nlet richEditSavePromise: {\r\n\tpromise?: Promise | null;\r\n\tresolve?: (value: any | PromiseLike) => void;\r\n\treject?: (reason?: any) => void;\r\n} = {\r\n\tpromise: null,\r\n};\r\n\r\n//funkcja sprawdzajaca czy sa zmiany dla richedit/spreadsheet\r\nexport const isDirtyDoc = () => {\r\n\tif (ignoreUnsavedDocFlag === undefined) return false;\r\n\tconst hasUnsavedChanges =\r\n\t\ttypeof richEdit !== \"undefined\" && richEdit\r\n\t\t\t? (richEdit.hasUnsavedChanges ?? docDirty)\r\n\t\t\t: typeof globalThis.spreadsheet !== \"undefined\" && globalThis.spreadsheet\r\n\t\t\t\t? globalThis.spreadsheet.hasUnsavedChanges()\r\n\t\t\t\t: false;\r\n\r\n\t//ma zmiany i nie ma ignorowania zmian\r\n\tif (hasUnsavedChanges && ignoreUnsavedDocFlag === false) {\r\n\t\treturn true;\r\n\t}\r\n\r\n\t//zwrocenie pozycji jesli wlaczylismy edycje i wychodzimy bez zmian\r\n\tif (firstCheckOutClick === true && ignoreUnsavedDocFlag === false) {\r\n\t\tcheckInDoc();\r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn false;\r\n};\r\n\r\n//funkcja przygotowujaca nowego richedita\r\nexport function createRichEdit(\r\n\telementId: string,\r\n\ttitle: string,\r\n\tdata: VarioFile,\r\n\twidth: string,\r\n\theight: string,\r\n\treadOnly: boolean,\r\n\titemId: string\r\n) {\r\n\tfirstCheckOutClick = false;\r\n\trichEditSavePromise = {};\r\n\tif (!$(`#${elementId}`).is(\":empty\")) return;\r\n\r\n\tif (!stringIsNullOrEmpty(itemId) && checkWhereIsUser() === \"varioObject\")\r\n\t\titemId = modelId;\r\n\r\n\tconst editItem = readOnly\r\n\t\t? {}\r\n\t\t: {\r\n\t\t\t\tprefixIcon: \"e-edit icon\",\r\n\t\t\t\ttooltipText: \"Edytuj\",\r\n\t\t\t\ttext: \"Edytuj\",\r\n\t\t\t\tid: \"editMode\",\r\n\t\t\t};\r\n\r\n\tconst fullScreenItem = {\r\n\t\tprefixIcon: \"dx-icon dx-icon-fullscreen\",\r\n\t\ttooltipText: \"Pe\u0142ny ekran\",\r\n\t\ttext: \"Pe\u0142ny ekran\",\r\n\t\tid: \"fullscreenMode\",\r\n\t};\r\n\r\n\tconst defaultToolbar = [\r\n\t\t\"Undo\",\r\n\t\t\"Redo\",\r\n\t\t\"Separator\",\r\n\t\t\"Image\",\r\n\t\t\"Table\",\r\n\t\t\"Hyperlink\",\r\n\t\t\"Bookmark\",\r\n\t\t\"TableOfContents\",\r\n\t\t\"Separator\",\r\n\t\t\"Header\",\r\n\t\t\"Footer\",\r\n\t\t\"PageSetup\",\r\n\t\t\"PageNumber\",\r\n\t\t\"Break\",\r\n\t\t\"InsertFootnote\",\r\n\t\t\"InsertEndnote\",\r\n\t\t\"Separator\",\r\n\t\t\"Find\",\r\n\t\t\"Separator\",\r\n\t\t\"Comments\",\r\n\t\t\"TrackChanges\",\r\n\t\t\"Separator\",\r\n\t\t\"LocalClipboard\",\r\n\t\t\"RestrictEditing\",\r\n\t\t\"Separator\",\r\n\t\t\"FormFields\",\r\n\t\t\"UpdateFields\",\r\n\t\t\"ContentControl\",\r\n\t];\r\n\r\n\t//Documenteditor control rendering starts\r\n\tconst hostUrl =\r\n\t\t\"https://services.syncfusion.com/js/production/api/documenteditor/\";\r\n\tconst container = new globalThis.ej.documenteditor.DocumentEditorContainer({\r\n\t\tserviceUrl: hostUrl,\r\n\t\theight: height,\r\n\t\twidth: width,\r\n\t\tlocale: \"pl\",\r\n\t\ttoolbarItems: [editItem, fullScreenItem, ...defaultToolbar],\r\n\t\tshowPropertiesPane: false,\r\n\t\tcurrentUser: currentUserName,\r\n\t});\r\n\r\n\trichEdit = container;\r\n\r\n\tcontainer.appendTo(`#${elementId}`);\r\n\r\n\tcontainer.documentEditor.isReadOnly = true;\r\n\r\n\tcontainer.contentChange = () => {\r\n\t\tdocDirty = true;\r\n\t};\r\n\r\n\tcontainer.toolbarClick = (args) => {\r\n\t\trichEdit.titleVario = title;\r\n\t\trichEdit.contentFileType = contentFileType;\r\n\t\trichEdit.itemId = itemId;\r\n\t\tonCustomCommandExecuted(args, elementId);\r\n\t};\r\n\r\n\tif (data) container.documentEditor.open(data);\r\n}\r\n\r\nexport function onDocumentChanged(\r\n\ts: DevExpress.RichEdit.RichEdit,\r\n\t_ev: DevExpress.RichEdit.EventArgs,\r\n\titemId: string\r\n) {\r\n\tif (s.document.modified === true && s.readOnly === false) {\r\n\t\t//console.log(richEdit._native.lastRibbonSettings.tabs[0].items[0]);\r\n\t\t//console.log(richEdit.getCommandState('editMode'));\r\n\t\tif (checkOutNeed && checkOutDuring === false) {\r\n\t\t\tcheckOutDuring = true;\r\n\t\t\tcheckOutDoc(itemId, (response) => {\r\n\t\t\t\tcheckoutRichEdit(response);\r\n\t\t\t});\r\n\t\t}\r\n\t\tChangeSaveBtnsStatus(true);\r\n\t}\r\n\tignoreUnsavedDocFlag = false;\r\n}\r\n\r\n//funkcja do zapisywania richedit lub spreadsheet\r\nexport function saveDoc(close = false) {\r\n\tShowLoadingPanel(\"Zapisywanie dokumentu...\");\r\n\tfirstCheckOutClick = false;\r\n\tif (close) {\r\n\t\tignoreUnsavedDocFlag = true;\r\n\t}\r\n\r\n\tif (typeof globalThis.spreadsheet !== \"undefined\") {\r\n\t\treturn submitSpreadsheet();\r\n\t}\r\n\tif (typeof richEdit !== \"undefined\") {\r\n\t\tonCustomCommandExecuted({ item: { id: \"save\" } }, \"\");\r\n\r\n\t\trichEditSavePromise.promise = new Promise((resolve, reject) => {\r\n\t\t\trichEditSavePromise.resolve = resolve;\r\n\t\t\trichEditSavePromise.reject = reject;\r\n\t\t});\r\n\r\n\t\treturn richEditSavePromise.promise;\r\n\t}\r\n}\r\n\r\n//funkcja do cofania zmian richedit\r\nexport function ignoreUnsavedDoc(close: boolean) {\r\n\tUndoItem(close, true);\r\n\tignoreUnsavedDocFlag = true;\r\n\tif (!inputIsDirty) {\r\n\t\tChangeSaveBtnsStatus(false);\r\n\t}\r\n}\r\n\r\nexport async function onCustomCommandExecuted(args, elementId: string) {\r\n\tswitch (args.item.id) {\r\n\t\tcase \"save\": {\r\n\t\t\t//Save the document\r\n\t\t\tShowLoadingPanel(\"Zapisywanie dokumentu...\");\r\n\r\n\t\t\tif (richEditSavePromise && !(\"promise\" in richEditSavePromise))\r\n\t\t\t\trichEditSavePromise.promise = new Promise((resolve, reject) => {\r\n\t\t\t\t\trichEditSavePromise.resolve = resolve;\r\n\t\t\t\t\trichEditSavePromise.reject = reject;\r\n\t\t\t\t});\r\n\r\n\t\t\t$.ajax({\r\n\t\t\t\turl: `${GetBaseUrl()}/Vario/ExportUpdatedRichTextDocumentFromVarioObjectEditor`,\r\n\t\t\t\ttype: \"Post\",\r\n\t\t\t\tcache: false,\r\n\t\t\t\tdata: {\r\n\t\t\t\t\tdata: richEdit.documentEditor.serialize(),\r\n\t\t\t\t\titemKey: richEdit.itemId,\r\n\t\t\t\t\tfileExt: richEdit.contentFileType,\r\n\t\t\t\t\titemName: richEdit.titleVario,\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: (response: RequestStatus | 500) => {\r\n\t\t\t\t\tif (!inputIsDirty) {\r\n\t\t\t\t\t\tChangeSaveBtnsStatus(false);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (response !== RequestStatus.success) {\r\n\t\t\t\t\t\tshowDxToast(\"Wyst\u0105pi\u0142 problem z zapisem dokumentu\", \"error\", 3000);\r\n\t\t\t\t\t\tif (richEditSavePromise?.reject) richEditSavePromise?.reject(false);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tshowDxToast(\"Dokument zosta\u0142 zapisany\", \"success\", 2000);\r\n\t\t\t\t\t\tricheditEditButtonToggle(false);\r\n\t\t\t\t\t\tif (!checkOutDuring) {\r\n\t\t\t\t\t\t\tcheckOutNeed = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tfirstCheckOutClick = false;\r\n\t\t\t\t\t\tif (richEditSavePromise?.resolve)\r\n\t\t\t\t\t\t\trichEditSavePromise?.resolve(true);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t},\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase \"editMode\":\r\n\t\t\tcheckOutDoc(richEdit.itemId, (response) => {\r\n\t\t\t\tcheckoutRichEdit(response);\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase \"cancel\": {\r\n\t\t\tignoreUnsavedDocFlag = true;\r\n\t\t\tif (richEdit) richEdit.readOnly = true;\r\n\t\t\tricheditEditButtonToggle(false);\r\n\t\t\tawait checkInDoc(args.itemId);\r\n\t\t\tif (checkWhereIsUser() === \"varioObject\") {\r\n\t\t\t\trefreshManager.needRefresh = new Set([\r\n\t\t\t\t\trefreshManager?.refreshArea?.filePreview,\r\n\t\t\t\t]);\r\n\t\t\t\trefreshManager.refresh(modelId);\r\n\t\t\t} else {\r\n\t\t\t\treloadGridPanel(lastSelectedRow);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase \"fullscreenMode\": {\r\n\t\t\tconst isInFullScreenMode = $(`#${elementId}`).prev(\"#main\").length > 0;\r\n\t\t\t//fullscreen musi byc wyciagniety do glownego diva zeby nie psuly sie zindexy itp\r\n\t\t\tif (!isInFullScreenMode) {\r\n\t\t\t\t$(`#${elementId}`).insertAfter(\"#main\");\r\n\t\t\t} else {\r\n\t\t\t\t$(`#${elementId}`).appendTo(\"#emailEmbed\");\r\n\t\t\t}\r\n\t\t\trichEdit.resize();\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function clearRichEditProps() {\r\n\tif (typeof richEdit !== \"undefined\" && richEdit) {\r\n\t\trichEdit.readOnly = true;\r\n\t\tricheditEditButtonToggle(false);\r\n\t\tcheckOutDuring = false;\r\n\t\tcheckOutNeed = false;\r\n\t\tignoreUnsavedDocFlag = false;\r\n\t}\r\n}\r\n\r\nexport function checkoutRichEdit(data: boolean) {\r\n\tif (data != null && data === true) {\r\n\t\tif (richEdit) richEdit.documentEditor.isReadOnly = false;\r\n\t\tricheditEditButtonToggle(true);\r\n\t\tcheckOutDuring = false;\r\n\t\tcheckOutNeed = false;\r\n\t\tfirstCheckOutClick = true;\r\n\t\tdocDirty = false;\r\n\t} else {\r\n\t\tshowDxToast(\"Plik nie mo\u017Ce zosta\u0107 pobrany do opracowania\", \"warning\");\r\n\t\tcheckOutDuring = false;\r\n\t\tcheckOutNeed = true;\r\n\t}\r\n}\r\n\r\nexport function richeditEditButtonToggle(enabled: boolean) {\r\n\tif (!richEdit) return;\r\n\r\n\tconst saveItem = {\r\n\t\tprefixIcon: \"e-save icon\",\r\n\t\ttooltipText: \"Zapisz\",\r\n\t\ttext: \"Zapisz\",\r\n\t\tid: \"save\",\r\n\t};\r\n\r\n\tconst undoItem = {\r\n\t\tprefixIcon: \"e-undo icon\",\r\n\t\ttooltipText: \"Anuluj\",\r\n\t\ttext: \"Anuluj\",\r\n\t\tid: \"cancel\",\r\n\t};\r\n\r\n\tconst editItem = {\r\n\t\tprefixIcon: \"e-edit icon\",\r\n\t\ttooltipText: \"Edytuj\",\r\n\t\ttext: \"Edytuj\",\r\n\t\tid: \"editMode\",\r\n\t};\r\n\r\n\trichEdit.toolbarItems = richEdit.toolbarItems.filter(\r\n\t\t(x) => x?.id !== \"save\" && x?.id !== \"cancel\" && x?.id !== \"editMode\"\r\n\t);\r\n\r\n\tif (enabled) {\r\n\t\trichEdit.toolbarItems.unshift(undoItem);\r\n\t\trichEdit.toolbarItems.unshift(saveItem);\r\n\t} else {\r\n\t\tdocDirty = false;\r\n\t\tif (richEdit) richEdit.documentEditor.isReadOnly = true;\r\n\t\trichEdit.toolbarItems.unshift(editItem);\r\n\t}\r\n}\r\n\r\nexport function checkInDoc(\r\n\tid = (checkWhereIsUser() === \"varioObject\"\r\n\t\t? modelId\r\n\t\t: ($(\"#subelementsSidePanel\").attr(\"data-id\") ??\r\n\t\t\tgetRowFromGrid(undefined, subElementsModel.True.currentFocusedRowIndex)\r\n\t\t\t\t?.data?.ItemID)) ?? \"\"\r\n) {\r\n\tif (id) return checkInCheckOut(id, false);\r\n}\r\n", "import \"../types/dx.all.d.ts\";\r\nimport type {\r\n\tLogonRequired,\r\n\tVarioObjectViewModel,\r\n} from \"../types/models/vario-types\";\r\nimport { CancelRequests, refreshDxGrid } from \"./devextreme-table-functions\";\r\nimport { ChangeCorrespondenceActionButtonsStatus } from \"./emails\";\r\nimport { GetBaseUrl } from \"./page-navigation\";\r\nimport { boolToString } from \"./signature\";\r\nimport {\r\n\tHideLoadingPanel,\r\n\tcapitalizeKeys,\r\n\tfixStringToPreventJSErrors,\r\n\tstringIsNullOrEmpty,\r\n\tsupportedContent,\r\n\ttranslator,\r\n\tvarioObjectLoaded,\r\n} from \"./site\";\r\nimport {\r\n\tappendSidePanel,\r\n\tonVarioObjectReady,\r\n\tprepareVarioObjectView,\r\n\trefreshVarioObjectGridTabs,\r\n\tsetEverythingAsDisabledInVarioObject,\r\n} from \"./vario-object\";\r\n\r\ntype RefreshArea = {\r\n\tvarioObjectForm: \"varioObjectForm\";\r\n\tfilePreview: \"filePreview\";\r\n\tworkflowDiagram: \"workflowDiagram\";\r\n\tgridData: \"gridData\";\r\n};\r\n\r\nconst refreshArea: RefreshArea = {\r\n\tvarioObjectForm: \"varioObjectForm\",\r\n\tfilePreview: \"filePreview\",\r\n\tworkflowDiagram: \"workflowDiagram\",\r\n\tgridData: \"gridData\",\r\n};\r\n\r\nexport const refreshManager = new (class RefreshManager {\r\n\trefreshArea = refreshArea;\r\n\r\n\tneedRefresh: Set = new Set();\r\n\r\n\trefreshObjectPromise: JQuery.jqXHR | null = null;\r\n\r\n\trefresh(id: string) {\r\n\t\treturn new Promise(async (resolve, reject) => {\r\n\t\t\ttry {\r\n\t\t\t\tif (!this.needRefresh.size) {\r\n\t\t\t\t\tfor (const item of Object.values(this.refreshArea)) {\r\n\t\t\t\t\t\tthis.needRefresh.add(item);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tCancelRequests();\r\n\r\n\t\t\t\t//obejscie na podwojny refresh preview\r\n\t\t\t\tconst includesBothPreviewAndForm =\r\n\t\t\t\t\tthis.needRefresh.has(this.refreshArea.varioObjectForm) &&\r\n\t\t\t\t\tthis.needRefresh.has(this.refreshArea.filePreview);\r\n\r\n\t\t\t\tconst promises: (JQuery.jqXHR | undefined)[] = [];\r\n\t\t\t\tfor (const itemToRefresh of this.needRefresh) {\r\n\t\t\t\t\tif (debug) console.log(itemToRefresh);\r\n\r\n\t\t\t\t\tswitch (itemToRefresh) {\r\n\t\t\t\t\t\tcase \"varioObjectForm\": {\r\n\t\t\t\t\t\t\tconst promise = this.getVarioObjectModel(id, (response) => {\r\n\t\t\t\t\t\t\t\t//download vario object view from controller, find form and replace it, also extract model and replace it\r\n\t\t\t\t\t\t\t\tif (response) {\r\n\t\t\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\t\t\tconst scriptWithData = $(\r\n\t\t\t\t\t\t\t\t\t\t\t$(response)\r\n\t\t\t\t\t\t\t\t\t\t\t\t.toArray()\r\n\t\t\t\t\t\t\t\t\t\t\t\t.find((x) => $(x).text().includes(\"modelId = \"))\r\n\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t\tlet model = scriptWithData\r\n\t\t\t\t\t\t\t\t\t\t\t.text()\r\n\t\t\t\t\t\t\t\t\t\t\t?.split(\"savedRefreshedVarioObjectModel = \");\r\n\t\t\t\t\t\t\t\t\t\tmodel =\r\n\t\t\t\t\t\t\t\t\t\t\tmodel\r\n\t\t\t\t\t\t\t\t\t\t\t\t?.find((x) =>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tx.includes(\"//finish extracting from here\")\r\n\t\t\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t\t\t\t?.split(\"//finish extracting from here\") ?? [];\r\n\t\t\t\t\t\t\t\t\t\tconst finalModel =\r\n\t\t\t\t\t\t\t\t\t\t\tmodel?.find((x) => x.includes('\"key\":'))?.trim() ??\r\n\t\t\t\t\t\t\t\t\t\t\t\"null\";\r\n\t\t\t\t\t\t\t\t\t\tconst parsedModel: VarioObjectViewModel | null =\r\n\t\t\t\t\t\t\t\t\t\t\tJSON.parse(finalModel);\r\n\r\n\t\t\t\t\t\t\t\t\t\tif (parsedModel?.key === modelId) {\r\n\t\t\t\t\t\t\t\t\t\t\tsavedRefreshedVarioObjectModel = parsedModel;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tconst newHTML = $(\r\n\t\t\t\t\t\t\t\t\t\t\t\t$(response)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.toArray()\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.find((x) => $(x).html()?.includes(\"varioObjectForm\"))\r\n\t\t\t\t\t\t\t\t\t\t\t)?.find(\"#varioObjectForm\");\r\n\t\t\t\t\t\t\t\t\t\t\t$(\"#varioObjectForm\").replaceWith(newHTML);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tthis.handleVarioObjectProperties(\r\n\t\t\t\t\t\t\t\t\t\t\t\tparsedModel,\r\n\t\t\t\t\t\t\t\t\t\t\t\tincludesBothPreviewAndForm\r\n\t\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\treject(response);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t} catch (err) {\r\n\t\t\t\t\t\t\t\t\t\tconsole.error(err, response);\r\n\t\t\t\t\t\t\t\t\t\treject(false);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\treject(false);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\tpromises.push(promise);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcase \"gridData\":\r\n\t\t\t\t\t\t\tpromises.push(this.handleDataGrid());\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"filePreview\":\r\n\t\t\t\t\t\t\tif (!includesBothPreviewAndForm)\r\n\t\t\t\t\t\t\t\tpromises.push(this.handleFilePreview());\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"workflowDiagram\":\r\n\t\t\t\t\t\t\tpromises.push(this.handleDiagram());\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tawait Promise.all(promises);\r\n\r\n\t\t\t\t//clear after completing\r\n\t\t\t\tthis.needRefresh.clear();\r\n\t\t\t\tresolve(true);\r\n\t\t\t} catch (ex) {\r\n\t\t\t\treject(ex);\r\n\t\t\t} finally {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tgetVarioObjectModel(id: string, callback: (response: any) => void) {\r\n\t\tconst innerCall = !window?.location?.href\r\n\t\t\t?.toLowerCase()\r\n\t\t\t?.includes(\"innercall=false\");\r\n\r\n\t\tthis.refreshObjectPromise = $.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/VarioObject?id=${id}&justModel=true&innerCall=${innerCall}`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: (response: string & LogonRequired) => {\r\n\t\t\t\tif (\r\n\t\t\t\t\tresponse != null &&\r\n\t\t\t\t\tresponse.logonRequired !== undefined &&\r\n\t\t\t\t\tresponse.logonRequired === true\r\n\t\t\t\t) {\r\n\t\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcallback(response);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: (err) => {\r\n\t\t\t\tconsole.log(err);\r\n\t\t\t},\r\n\t\t});\r\n\r\n\t\treturn this.refreshObjectPromise;\r\n\t}\r\n\r\n\thandleVarioObjectProperties(model, includesBothPreviewAndForm = false) {\r\n\t\ttry {\r\n\t\t\tmodelId = model?.key ?? modelId;\r\n\t\t\thashId = model?.hashKey ?? hashId;\r\n\t\t\ttitle = model?.title ?? title;\r\n\t\t\tmodelDefinitionKey = model?.definitionKey ?? modelDefinitionKey;\r\n\t\t\tprocessedVarioObjectTitle =\r\n\t\t\t\tfixStringToPreventJSErrors(model?.title) === \"\"\r\n\t\t\t\t\t? processedVarioObjectTitle\r\n\t\t\t\t\t: fixStringToPreventJSErrors(model?.title);\r\n\t\t\tcontainerKey = model?.containerKey ?? containerKey;\r\n\t\t\tisWorkflowMedium =\r\n\t\t\t\tmodel?.isWorkflowMedium != null\r\n\t\t\t\t\t? boolToString(model?.isWorkflowMedium)\r\n\t\t\t\t\t: isWorkflowMedium;\r\n\t\t\tcanShowWorkflowOptions =\r\n\t\t\t\tmodel?.canShowWorkflowOptions != null\r\n\t\t\t\t\t? boolToString(model?.canShowWorkflowOptions)\r\n\t\t\t\t\t: canShowWorkflowOptions;\r\n\r\n\t\t\tcanWriteVarioObject =\r\n\t\t\t\tmodel?.canWrite != null\r\n\t\t\t\t\t? boolToString(model?.canWrite)\r\n\t\t\t\t\t: canWriteVarioObject;\r\n\t\t\tisCorrespondence = modelId.includes(\"Correspondence\") ? \"\" : \"hidden\";\r\n\t\t\tmodelOperations = JSON.stringify(model?.operations);\r\n\t\t\tshowItemOnlyVarioObject =\r\n\t\t\t\tmodel?.showItemOnly != null\r\n\t\t\t\t\t? boolToString(model?.showItemOnly)\r\n\t\t\t\t\t: showItemOnlyVarioObject;\r\n\t\t\tmodelSubElementsOnly =\r\n\t\t\t\tmodel?.subElementsOnly != null\r\n\t\t\t\t\t? boolToString(model?.subElementsOnly)\r\n\t\t\t\t\t: modelSubElementsOnly;\r\n\t\t\tcardViewWithSubElements = boolToString(\r\n\t\t\t\tmodel?.subElementTypes?.length &&\r\n\t\t\t\t\tshowItemOnlyVarioObject === \"False\" &&\r\n\t\t\t\t\tmodelSubElementsOnly === \"False\"\r\n\t\t\t);\r\n\t\t\tcanDecreeVarioObject = boolToString(\r\n\t\t\t\tisCorrespondence === \"\" &&\r\n\t\t\t\t\t!stringIsNullOrEmpty(model?.objectType?.key) &&\r\n\t\t\t\t\t!containerKey?.includes(\"SentItems\")\r\n\t\t\t);\r\n\t\t\tcontentFileType = model?.contentFileType ?? contentFileType;\r\n\t\t\thasChildSources = boolToString(model?.childSources?.length > 0);\r\n\t\t\tmultipleChildSourcesList =\r\n\t\t\t\tmodel?.childSources != null\r\n\t\t\t\t\t? JSON.stringify(model.childSources.map(capitalizeKeys))\r\n\t\t\t\t\t: multipleChildSourcesList;\r\n\t\t\tcurrentChildSource = model?.childSourceDefault ?? currentChildSource;\r\n\t\t\tactualVersion =\r\n\t\t\t\tmodel?.actualVersion != null\r\n\t\t\t\t\t? boolToString(model?.actualVersion)\r\n\t\t\t\t\t: actualVersion;\r\n\t\t\tvarioObjectLayoutKey =\r\n\t\t\t\ttranslator(model?.layout?.layoutKey) === \"\"\r\n\t\t\t\t\t? varioObjectLayoutKey\r\n\t\t\t\t\t: translator(model?.layout?.layoutKey);\r\n\t\t\thasRequestReadReceiptVarioObject =\r\n\t\t\t\tmodel?.hasRequestReadReceipt ?? hasRequestReadReceiptVarioObject;\r\n\r\n\t\t\tconst tempDisplayPreview = boolToString(\r\n\t\t\t\t!!supportedContent.checkIfSupported(model?.contentFileType)\r\n\t\t\t);\r\n\t\t\tconst tempContainPDF = boolToString(\r\n\t\t\t\tsupportedContent\r\n\t\t\t\t\t.checkWhichTypeOfFile(model?.contentFileType)\r\n\t\t\t\t\t?.toLowerCase()\r\n\t\t\t\t\t?.includes(\"pdf\")\r\n\t\t\t);\r\n\t\t\tconst tempContainWord = boolToString(\r\n\t\t\t\tmodel?.contentFileType?.includes(\"doc\")\r\n\t\t\t);\r\n\t\t\tconst tempMD5 = model?.mD5;\r\n\t\t\tconst changedMD5 = tempMD5 !== varioObjectMD5;\r\n\r\n\t\t\tif (\r\n\t\t\t\ttempDisplayPreview !== displayPreview ||\r\n\t\t\t\ttempContainWord !== containWord ||\r\n\t\t\t\ttempContainPDF !== containPDF ||\r\n\t\t\t\t(includesBothPreviewAndForm && changedMD5) ||\r\n\t\t\t\tchangedMD5\r\n\t\t\t) {\r\n\t\t\t\tcontainPDF = tempContainPDF;\r\n\t\t\t\tcontainWord = tempContainWord;\r\n\t\t\t\tdisplayPreview = tempDisplayPreview;\r\n\t\t\t\tvarioObjectMD5 = tempMD5;\r\n\t\t\t\tsessionStorage.removeItem(\"lastClickedSidePanelID\");\r\n\r\n\t\t\t\tthis.handleFilePreview();\r\n\t\t\t}\r\n\r\n\t\t\tsessionStorage.setItem(\"dontShowWorkflowMessage\", \"true\");\r\n\t\t\tprepareVarioObjectView(true);\r\n\t\t\tonVarioObjectReady();\r\n\t\t\t//true zeby nie przeladowywal grida\r\n\t\t\tvarioObjectLoaded(true, modelId);\r\n\t\t\tsetEverythingAsDisabledInVarioObject(false);\r\n\t\t\tChangeCorrespondenceActionButtonsStatus(true);\r\n\t\t} catch (err) {\r\n\t\t\tconsole.error(err);\r\n\t\t}\r\n\t}\r\n\r\n\thandleDataGrid() {\r\n\t\tif (\r\n\t\t\tmodelSubElementsOnly === \"False\" &&\r\n\t\t\t!this.needRefresh.has(this.refreshArea.varioObjectForm)\r\n\t\t) {\r\n\t\t\trefreshVarioObjectGridTabs();\r\n\t\t}\r\n\r\n\t\trefreshDxGrid();\r\n\r\n\t\treturn undefined;\r\n\t}\r\n\r\n\thandleDiagram() {\r\n\t\tconst diagramBtn = $(\"#varioObjectDiagram-button\");\r\n\t\tif (diagramBtn.hasClass(\"active\")) diagramBtn.trigger(\"click\");\r\n\r\n\t\tconst diagramProgBtn = $(\"#varioObjectProgDiagram-button\");\r\n\t\tif (diagramProgBtn.hasClass(\"active\")) diagramProgBtn.trigger(\"click\");\r\n\r\n\t\treturn undefined;\r\n\t}\r\n\r\n\thandleFilePreview() {\r\n\t\tfilePreviewPromise?.abort();\r\n\t\tappendSidePanel();\r\n\r\n\t\treturn undefined;\r\n\t}\r\n})();\r\n", "import \"../types/dx.all.d.ts\";\r\nimport { SignEnumerations } from \"../types/models/Enums/signEnumerations\";\r\nimport type { SignResponse } from \"../types/models/SignModel/SignResponse\";\r\nimport type { ParametersForCardNumberResult } from \"../types/models/SignModel/parametersForCardNumberResult\";\r\nimport type { SignResponseObject } from \"../types/models/SignModel/signResponseObject\";\r\nimport type { SignatureParametersDTO } from \"../types/models/SignModel/signatureParametersDTO\";\r\nimport {\r\n\ttype CertificateFromSignatureFull,\r\n\ttype DisplayDocumentToSignModel,\r\n\tRequestStatus,\r\n\ttype ServiceResponse,\r\n} from \"../types/models/vario-types\";\r\nimport {\r\n\tgetVisibleRows,\r\n\treloadDxGridDataSource,\r\n} from \"./devextreme-table-functions\";\r\nimport { GetBaseUrl, refreshCurrentPage } from \"./page-navigation\";\r\nimport { refreshManager } from \"./refresh-manager\";\r\nimport {\r\n\tCloseAdditionalDialog,\r\n\tCloseBigDialog,\r\n\tCloseDialog,\r\n\tCloseExtraDialog,\r\n\tHideLoadingPanel,\r\n\tShowLoadingPanel,\r\n\taddSkeletonLoading,\r\n\tcalcMinPopup,\r\n\tfixScrollInDx,\r\n\tgetOS,\r\n\tisRunningOnMobile,\r\n\tremoveSkeletonLoading,\r\n\tshowDxToast,\r\n\tstringIsNullOrEmpty,\r\n\twaitForElm,\r\n} from \"./site\";\r\n\r\n//je\u015Bli instalk\u0119 trzeba podmieni\u0107 ju\u017C po instalacji, to w\u0142a\u015Bciwy numer nale\u017Cy poda\u0107 w appsettings.json (ustawienie z konfiga jest wa\u017Cniejsze)\r\nconst CurrentVarioSigningHostVersion = 102;\r\n\r\nlet signatureFor: string;\r\n\r\ndeclare global {\r\n\tvar currentSignDocumentPage: number;\r\n\tvar currentSignDocumentPageCount: number;\r\n\tvar itemsToSign: string[];\r\n\tvar choosenSignatureName: string;\r\n\tvar signatureIsCompanyStamp: boolean;\r\n}\r\n\r\ncurrentSignDocumentPage = 0;\r\ncurrentSignDocumentPageCount = -1;\r\n\r\nlet StartX: number | null | undefined;\r\nlet StartY: number | null | undefined;\r\nlet EndX: number | null | undefined;\r\nlet EndY: number | null | undefined;\r\n\r\nlet originalHeight: number;\r\nlet originalWidth: number;\r\nlet originalRotation: number;\r\n\r\nlet displayHeight: number;\r\nlet displayWidth: number;\r\n\r\nlet calculatedStartX: number;\r\nlet calculatedStartY: number;\r\nlet calculatedWidth: number;\r\nlet calculatedHeight: number;\r\n\r\nlet checkPosition: boolean;\r\nlet finishedSelecting: boolean;\r\n\r\nlet selectedAreas: string[] = [];\r\n\r\nlet signatureCountFromEnd = false;\r\nlet addSignatureOnAllPages = false;\r\nlet showMultiDocSigDialog = true;\r\n\r\nlet choosenSignature: number;\r\nlet signatureIsLocal = false;\r\nsignatureIsCompanyStamp = false;\r\nlet signatureIsQualified = false;\r\nlet signatureIssuer: string;\r\nlet signatureExpireDate: string;\r\nlet signatureSerialNumber: string;\r\nlet signatureAsInitialing = false;\r\nlet signatureIsBrowserSide: boolean;\r\nlet signatureFullPfx: string;\r\nlet initialAllPagesArea: string | null = null;\r\n\r\nlet facsimileImageDataUrl: string;\r\n\r\nlet lastMD5 = \"\";\r\n\r\nlet signatureExist = false;\r\n\r\nlet redirectUri = \"\";\r\n\r\nlet wsSigner: { readyState: number; send: (arg0: string) => void };\r\n\r\nlet funcOnReply: (arg0: boolean, arg1?: string) => void;\r\n\r\nlet checkIfSignAcceptedIntervalId: number | null = null;\r\nlet countdownIntervalId: number | null = null;\r\nconst signTimeMinutes = 5;\r\nlet timeSign = signTimeMinutes * 60;\r\n\r\nlet wsTimer: number | null;\r\n\r\nexport function GetTokenAsseco() {\r\n\tCheckTokenActive();\r\n\tTakeMeToAsseco();\r\n}\r\n\r\nexport function AddNewSignature() {\r\n\tsignatureExist = false;\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minHeight\", calcMinPopup(170, true));\r\n\t$(\"#Dialog\").empty();\r\n\t$(\"#Dialog\").append(\r\n\t\t'
            Nowy podpis kwalifikowany
            '\r\n\t);\r\n\t$(\"#Dialog\").append(\r\n\t\t'
            Numer karty:
            '\r\n\t);\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(\r\n\t\t\t'
            '\r\n\t\t);\r\n\tpopup.repaint();\r\n}\r\n\r\nexport function ChooseSignature(itemId?: string | string[]) {\r\n\tif (!itemId) {\r\n\t\titemId = globalItemsSelectedByUser ?? [];\r\n\t} else if (!Array.isArray(itemId)) {\r\n\t\tglobalItemsSelectedByUser = [];\r\n\t\tglobalItemsSelectedByUser.push(itemId);\r\n\t}\r\n\r\n\tShowLoadingPanel(\"\u0141adowanie certyfikat\u00F3w...\");\r\n\r\n\t//Zapytanie do backedndu o list\u0119 dost\u0119pnych podpis\u00F3w\r\n\t//selectOptions = ``;\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/api/Sign/GetSignatureParameters`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (data: SignatureParametersDTO) => {\r\n\t\t\tHideLoadingPanel();\r\n\r\n\t\t\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\t\t\tpopup.option(\"minWidth\", calcMinPopup(400));\r\n\t\t\tpopup.option(\"minHeight\", calcMinPopup(150, true));\r\n\t\t\tpopup.option(\"showTitle\", false);\r\n\t\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\t\t\tpopup.show();\r\n\r\n\t\t\t$(\"#Dialog\").empty();\r\n\t\t\t$(\"#Dialog\").addClass(\"choose-signature-dialog\");\r\n\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t'
            Podpisz/Parafuj
            '\r\n\t\t\t);\r\n\r\n\t\t\tlet selectOptions = \"\";\r\n\t\t\tdata.certificates.forEach((certificate, index) => {\r\n\t\t\t\tif (index === 0) {\r\n\t\t\t\t\tchoosenSignature = Number.parseInt(\r\n\t\t\t\t\t\tcertificate.certificateId.toString(),\r\n\t\t\t\t\t\t10\r\n\t\t\t\t\t);\r\n\t\t\t\t\tchoosenSignatureName = certificate.displayName;\r\n\t\t\t\t\tsignatureIsLocal = certificate.local;\r\n\t\t\t\t\tsignatureIsCompanyStamp = certificate.companyStamp;\r\n\t\t\t\t\tsignatureIsQualified = certificate.qualified;\r\n\t\t\t\t\tsignatureIssuer = certificate.issuer;\r\n\t\t\t\t\tsignatureExpireDate = certificate.expireDate;\r\n\t\t\t\t\tsignatureIsBrowserSide = false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet subject = \"\";\r\n\t\t\t\tlet issuer = \"\";\r\n\t\t\t\tlet expireDate = \"\";\r\n\t\t\t\tlet serialNumber = \"\";\r\n\r\n\t\t\t\tif (certificate.companyStamp) {\r\n\t\t\t\t\tsubject = certificate.subject;\r\n\t\t\t\t\tissuer = certificate.issuer;\r\n\t\t\t\t\texpireDate = certificate.expireDate;\r\n\t\t\t\t\tserialNumber = certificate.serialNumber;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tselectOptions += buildSelectOption(\r\n\t\t\t\t\tcertificate.default,\r\n\t\t\t\t\tcertificate.local,\r\n\t\t\t\t\tcertificate.companyStamp,\r\n\t\t\t\t\tcertificate.qualified,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tsubject,\r\n\t\t\t\t\tissuer,\r\n\t\t\t\t\texpireDate,\r\n\t\t\t\t\tserialNumber,\r\n\t\t\t\t\tcertificate.certificateId,\r\n\t\t\t\t\tcertificate.displayName,\r\n\t\t\t\t\tundefined,\r\n\t\t\t\t\tcertificate.description\r\n\t\t\t\t);\r\n\t\t\t});\r\n\r\n\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t``\r\n\t\t\t);\r\n\t\t\tlet disabled = \"\";\r\n\t\t\tif (data.certificates.length === 0) {\r\n\t\t\t\tdisabled = \"disabled\";\r\n\t\t\t}\r\n\r\n\t\t\tsignatureAsInitialing = false;\r\n\t\t\tinitialAllPagesArea = null;\r\n\t\t\tif (globalItemsSelectedByUser)\r\n\t\t\t\titemsToSign = [...globalItemsSelectedByUser];\r\n\t\t\tsignatureFor = currentUserName;\r\n\t\t\tshowMultiDocSigDialog = true;\r\n\t\t\t$(\"#Dialog\").append(`\r\n\t\t\t\t\t
            \r\n\t\t\t\t\t\t
            \r\n\t\t\t\t\t\t\t
            \r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t
            \r\n\t\t\t\t\t\t\t
            \r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t
            \r\n\t\t\t\t\t\t
            \r\n\r\n\t\t\t\t\t\t
            \r\n\t\t\t\t\t\t\t
            \r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t
            \r\n\r\n\t\t\t\t\t\t\t
            \r\n\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t
            \r\n\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t
            \r\n\r\n\t\t\t\t\t\t\t
            \r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t
            \r\n\t\t\t\t\t\t
            \r\n\t\t\t\t\t
            `);\r\n\r\n\t\t\tpopup\r\n\t\t\t\t.content()\r\n\t\t\t\t.find(\".DialogFooter\")\r\n\t\t\t\t.empty()\r\n\t\t\t\t.append(\r\n\t\t\t\t\t`
            `\r\n\t\t\t\t);\r\n\r\n\t\t\tif (\r\n\t\t\t\tdata.addBrowserSideCerts &&\r\n\t\t\t\t!isRunningOnMobile() &&\r\n\t\t\t\tgetOS() === \"windows\"\r\n\t\t\t) {\r\n\t\t\t\t$(\"#Dialog\").append(`
            \r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t
            \r\n\t\t\t\t\t\t\t${!wsSigner ? \"Skonfiguruj lokalny czytnik podpisu\" : \"Wczytywanie lokalnego czytnika podpisu...\"} \r\n\t\t\t\t\t\t\tZainstaluj aplikacj\u0119 Vario Signing Host, aby podpisywa\u0107 certyfikatem z karty\r\n\t\t\t\t\t\t
            \r\n\t\t\t\t\t
            `);\r\n\r\n\t\t\t\t$(\"#signHostLink #signHostLinkText\").on(\"click\", () => {\r\n\t\t\t\t\t$(\"#signHostLink #signHostLinkInfo\").toggleClass(\"hidden\");\r\n\t\t\t\t});\r\n\r\n\t\t\t\tsendToSigner(\r\n\t\t\t\t\t{ action: \"getcertificates\" },\r\n\t\t\t\t\t(\r\n\t\t\t\t\t\tsuccess: any,\r\n\t\t\t\t\t\tresponse: {\r\n\t\t\t\t\t\t\tversion: string;\r\n\t\t\t\t\t\t\tcertificates: CertificateFromSignatureFull[];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t) => {\r\n\t\t\t\t\t\tif (!success) {\r\n\t\t\t\t\t\t\t$(\"#signHostLink #signHostLinkText\").text(\r\n\t\t\t\t\t\t\t\t\"Skonfiguruj lokalny czytnik podpisu\"\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t} else if (success) {\r\n\t\t\t\t\t\t\tconst vshVer = VarioSigningHostVersion\r\n\t\t\t\t\t\t\t\t? VarioSigningHostVersion\r\n\t\t\t\t\t\t\t\t: CurrentVarioSigningHostVersion;\r\n\t\t\t\t\t\t\tif (response.version && response.version !== vshVer) {\r\n\t\t\t\t\t\t\t\t$(\"#signHostLink div\")\r\n\t\t\t\t\t\t\t\t\t.empty()\r\n\t\t\t\t\t\t\t\t\t.append(`\r\n\t\t\t\t\t\t\t\t\tCzytnik lokalny: dost\u0119pna aktualizacja\r\n\t\t\t\t\t\t\t\t\tZaaktualizuj aplikacj\u0119 Vario Signing Host, aby podpisywa\u0107 certyfikatem z karty\r\n\t\t\t\t\t\t\t\t`);\r\n\t\t\t\t\t\t\t} else if (response.certificates.length === 0) {\r\n\t\t\t\t\t\t\t\t$(\"#signHostLink div\")\r\n\t\t\t\t\t\t\t\t\t.empty()\r\n\t\t\t\t\t\t\t\t\t.append(`\r\n\t\t\t\t\t\t\t\t\tCzytnik lokalny: pod\u0142\u0105czony\r\n\t\t\t\t\t\t\t\t`);\r\n\r\n\t\t\t\t\t\t\t\t$(\"#signHostLinkText\").on(\"click\", () => {\r\n\t\t\t\t\t\t\t\t\tChooseSignature(itemId);\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t} else if (response.certificates.length > 0) {\r\n\t\t\t\t\t\t\t\t$(\"#signHostLink div\")\r\n\t\t\t\t\t\t\t\t\t.empty()\r\n\t\t\t\t\t\t\t\t\t.append(`\r\n\t\t\t\t\t\t\t\t\tCzytnik lokalny: aktywny\r\n\t\t\t\t\t\t\t\t`);\r\n\r\n\t\t\t\t\t\t\t\tlet selOptions = \"\";\r\n\r\n\t\t\t\t\t\t\t\tresponse.certificates.forEach((certificate, index) => {\r\n\t\t\t\t\t\t\t\t\tselOptions += buildSelectOption(\r\n\t\t\t\t\t\t\t\t\t\tindex === 0,\r\n\t\t\t\t\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\t\t\t\t\tcertificate.qualified,\r\n\t\t\t\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\t\t\t\tcertificate.displayName,\r\n\t\t\t\t\t\t\t\t\t\tcertificate.issuer,\r\n\t\t\t\t\t\t\t\t\t\tcertificate.expireDate.toString(),\r\n\t\t\t\t\t\t\t\t\t\tcertificate.serialNumber,\r\n\t\t\t\t\t\t\t\t\t\tcertificate.id,\r\n\t\t\t\t\t\t\t\t\t\tcertificate.displayName,\r\n\t\t\t\t\t\t\t\t\t\tcertificate.fullPfx\r\n\t\t\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t\t\t\tif (index === 0) {\r\n\t\t\t\t\t\t\t\t\t\tchoosenSignature = Number.parseInt(\r\n\t\t\t\t\t\t\t\t\t\t\tcertificate.id.toString(),\r\n\t\t\t\t\t\t\t\t\t\t\t10\r\n\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t\tchoosenSignatureName = certificate.displayName;\r\n\t\t\t\t\t\t\t\t\t\tsignatureIsLocal = false;\r\n\t\t\t\t\t\t\t\t\t\tsignatureIsCompanyStamp = false;\r\n\t\t\t\t\t\t\t\t\t\tsignatureIsQualified = certificate.qualified;\r\n\t\t\t\t\t\t\t\t\t\tsignatureIssuer = certificate.issuer;\r\n\t\t\t\t\t\t\t\t\t\tsignatureExpireDate = certificate.expireDate.toString();\r\n\t\t\t\t\t\t\t\t\t\tsignatureIsBrowserSide = true;\r\n\t\t\t\t\t\t\t\t\t\tsignatureSerialNumber = certificate.serialNumber;\r\n\t\t\t\t\t\t\t\t\t\tsignatureFullPfx = certificate.fullPfx;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\t\tif (selOptions) {\r\n\t\t\t\t\t\t\t\t\tconst sel = document.getElementById(\"selectSignature\");\r\n\t\t\t\t\t\t\t\t\tif (sel) sel.innerHTML += selOptions;\r\n\r\n\t\t\t\t\t\t\t\t\tconst btn = document.getElementById(\"SignButton\");\r\n\t\t\t\t\t\t\t\t\tif (btn) {\r\n\t\t\t\t\t\t\t\t\t\tbtn.removeAttribute(\"disabled\");\r\n\t\t\t\t\t\t\t\t\t\tbtn.classList.remove(\"disabled\");\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\tpopup.repaint();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tpopup.repaint();\r\n\r\n\t\t\t$(\"#signatureAsInitialingBtn\").on(\"change\", function () {\r\n\t\t\t\tif (signatureIsCompanyStamp) {\r\n\t\t\t\t\tsignatureAsInitialing = (this as HTMLInputElement).checked;\r\n\t\t\t\t\t$(\"#signatureAsInitialingAllPagesContainer\").toggleClass(\r\n\t\t\t\t\t\t\"hidden\",\r\n\t\t\t\t\t\t!(this as HTMLInputElement).checked\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\tdata.certificates?.find((x) => x.companyStamp)\r\n\t\t\t\t\t\t\t? \"Parafowanie dokumentu nie jest dost\u0119pne dla wybranej opcji. Wybierz ePodpis.\"\r\n\t\t\t\t\t\t\t: \"Opcja niedost\u0119pna.\",\r\n\t\t\t\t\t\t\"warning\"\r\n\t\t\t\t\t);\r\n\t\t\t\t\t$(\"#signatureAsInitialingAllPagesContainer\").toggleClass(\r\n\t\t\t\t\t\t\"hidden\",\r\n\t\t\t\t\t\ttrue\r\n\t\t\t\t\t);\r\n\t\t\t\t\t$(\"#signatureAsInitialingBtn\").prop(\"checked\", false);\r\n\t\t\t\t\t$(\"#initialAllPagesBtn\").prop(\"checked\", false).trigger(\"change\");\r\n\t\t\t\t\tsignatureAsInitialing = false;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t$(\"#initialAllPagesBtn\").on(\"change\", function () {\r\n\t\t\t\tinitialAllPagesArea = (this as HTMLInputElement).checked\r\n\t\t\t\t\t? ($('input[name=\"initialArea\"]:checked')\r\n\t\t\t\t\t\t\t.val()\r\n\t\t\t\t\t\t\t?.valueOf()\r\n\t\t\t\t\t\t\t.toString() ?? \"\")\r\n\t\t\t\t\t: null;\r\n\t\t\t\t$(\"#initialAreaSelector\").toggleClass(\r\n\t\t\t\t\t\"hidden\",\r\n\t\t\t\t\t!(this as HTMLInputElement).checked\r\n\t\t\t\t);\r\n\t\t\t});\r\n\r\n\t\t\t$('input[name=\"initialArea\"]').on(\"change\", function () {\r\n\t\t\t\tif ((this as HTMLInputElement).checked)\r\n\t\t\t\t\tinitialAllPagesArea = (this as HTMLInputElement).value ?? \"\";\r\n\t\t\t});\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tshowDxToast(\"B\u0142\u0105d pobierania certyfikat\u00F3w.\", \"error\");\r\n\t\t\tconsole.error(err);\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function buildSelectOption(\r\n\tisDefault: boolean,\r\n\tisLocal: boolean,\r\n\tisCompanyStamp: boolean,\r\n\tisQualified: boolean,\r\n\tisBrowserSide: boolean,\r\n\t_subject: string,\r\n\tissuer: string,\r\n\texpireDate: string,\r\n\tserialNumber: string,\r\n\tcertificateId: number,\r\n\tdisplayName: string,\r\n\tfullPfx?: string,\r\n\tdescription?: string\r\n) {\r\n\tlet result = \"\";\r\n\r\n\treturn result;\r\n}\r\n\r\nexport function boolToString(v?: boolean) {\r\n\treturn v ? \"True\" : \"False\";\r\n}\r\n\r\nexport function ChangeSignatureOptions() {\r\n\tconst clientCardNumber = (\r\n\t\tdocument.getElementById(\"clientCardNumber\") as HTMLInputElement\r\n\t).value;\r\n\r\n\tif (!clientCardNumber) {\r\n\t\tshowDxToast(\"Wszystkie pola musz\u0105 by\u0107 wype\u0142nione\", \"error\");\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\r\n\tif (signatureExist === true) {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/api/Sign/EditSignClient`,\r\n\t\t\ttype: \"Put\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: {\r\n\t\t\t\tclientCardNumber: clientCardNumber,\r\n\t\t\t\tcertificateId: choosenSignature,\r\n\t\t\t},\r\n\t\t\tsuccess: (data: SignEnumerations.SignClientResponseCode | 500) => {\r\n\t\t\t\tif (data === SignEnumerations.SignClientResponseCode.Success) {\r\n\t\t\t\t\tChooseSignature();\r\n\t\t\t\t\tshowDxToast(\"Pomy\u015Blnie edytowano dane podpisu\", \"success\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tdata === SignEnumerations.SignClientResponseCode.ClientIdReserved\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Niepowodzenie przy edycji podpisu: Identyfikator klienta jest ju\u017C wykorzystywany\",\r\n\t\t\t\t\t\t\t\"error\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\tdata === SignEnumerations.SignClientResponseCode.UserIdReserved\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Niepowodzenie przy edycji podpisu: Identyfikator u\u017Cytkownika jest ju\u017C wykorzystywany\",\r\n\t\t\t\t\t\t\t\"error\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\tdata === SignEnumerations.SignClientResponseCode.CardNumberReserved\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Niepowodzenie przy edycji podpisu: Numer karty jest ju\u017C wykorzystywany\",\r\n\t\t\t\t\t\t\t\"error\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\tdata === SignEnumerations.SignClientResponseCode.UserNotFound\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Niepowodzenie przy edycji podpisu: U\u017Cytkownik nie istnieje\",\r\n\t\t\t\t\t\t\t\"error\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Niepowodzenie przy edycji podpisu: B\u0142\u0105d nierozpoznany\",\r\n\t\t\t\t\t\t\t\"error\"\r\n\t\t\t\t\t\t);\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} else {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/api/Sign/CreateSignClient`,\r\n\t\t\ttype: \"Post\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: { clientCardNumber: clientCardNumber },\r\n\t\t\tsuccess: (data: SignEnumerations.SignClientResponseCode) => {\r\n\t\t\t\tif (data === SignEnumerations.SignClientResponseCode.Success) {\r\n\t\t\t\t\tChooseSignature();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tdata === SignEnumerations.SignClientResponseCode.ClientIdReserved\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Niepowodzenie przy dodawaniu podpisu: Identyfikator klienta jest ju\u017C wykorzystywany\",\r\n\t\t\t\t\t\t\t\"error\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\tdata === SignEnumerations.SignClientResponseCode.UserIdReserved\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Niepowodzenie przy dodawaniu podpisu: Identyfikator u\u017Cytkownika jest ju\u017C wykorzystywany\",\r\n\t\t\t\t\t\t\t\"error\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\tdata === SignEnumerations.SignClientResponseCode.CardNumberReserved\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Niepowodzenie przy dodawaniu podpisu: Numer karty jest ju\u017C wykorzystywany\",\r\n\t\t\t\t\t\t\t\"error\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\tdata === SignEnumerations.SignClientResponseCode.UserNotFound\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Niepowodzenie przy dodawaniu podpisu: U\u017Cytkownik nie istnieje\",\r\n\t\t\t\t\t\t\t\"error\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Niepowodzenie przy dodawaniu podpisu: B\u0142\u0105d nierozpoznany\",\r\n\t\t\t\t\t\t\t\"error\"\r\n\t\t\t\t\t\t);\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\tpopup.repaint();\r\n\t}\r\n}\r\n\r\nexport function editThisSignature() {\r\n\tsignatureExist = true;\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minHeight\", calcMinPopup(150, true));\r\n\t$(\"#Dialog\").empty();\r\n\tpopup.content().find(\".DialogFooter\").empty();\r\n\t$(\"#Dialog\").append(\r\n\t\t`
            Edytuj podpis${signatureIsQualified ? \" kwalifikowany\" : \"\"}
            `\r\n\t);\r\n\t$(\"#Dialog\").append(\r\n\t\t`

            ${choosenSignatureName}

            `\r\n\t);\r\n\tif (signatureIsCompanyStamp) {\r\n\t\t$(\"#Dialog\").append('
            Faksymile:
            ');\r\n\t\t$(\"#Dialog\").append(\r\n\t\t\t'
            '\r\n\t\t);\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t.find(\".DialogFooter\")\r\n\t\t\t.append(\r\n\t\t\t\t'
            '\r\n\t\t\t);\r\n\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/api/Sign/GetUserFacsimile`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: (data: string) => {\r\n\t\t\t\tconst img = document.getElementById(\r\n\t\t\t\t\t\"facsimileImage\"\r\n\t\t\t\t) as HTMLImageElement;\r\n\t\t\t\tif (img) img.src = data;\r\n\t\t\t},\r\n\t\t});\r\n\t} else {\r\n\t\t$(\"#Dialog\").append(\r\n\t\t\t'
            Numer karty:
            '\r\n\t\t);\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t.find(\".DialogFooter\")\r\n\t\t\t.append(\r\n\t\t\t\t'
            '\r\n\t\t\t);\r\n\t}\r\n\tpopup.repaint();\r\n}\r\n\r\nexport function changeFacsimile() {\r\n\tconst input = document.createElement(\"input\");\r\n\tinput.type = \"file\";\r\n\tinput.accept = \".png, .jpeg, .jpg\";\r\n\tinput.onchange = (_) => {\r\n\t\t// you can use this method to get file and perform respective operations\r\n\t\tconst reader = new FileReader();\r\n\t\treader.addEventListener(\"load\", (event) => {\r\n\t\t\tfacsimileImageDataUrl = (event.target?.result as string) ?? \"\";\r\n\t\t\t$.ajax({\r\n\t\t\t\turl: `${GetBaseUrl()}/api/Sign/SetUserFacsimile`,\r\n\t\t\t\ttype: \"Put\",\r\n\t\t\t\tcache: false,\r\n\t\t\t\tdataType: \"json\",\r\n\t\t\t\tdata: { DataUrl: facsimileImageDataUrl },\r\n\t\t\t\tsuccess: (data: SignEnumerations.UserFacsimileResponseCode) => {\r\n\t\t\t\t\tif (data === SignEnumerations.UserFacsimileResponseCode.Success) {\r\n\t\t\t\t\t\tconst img = document.getElementById(\r\n\t\t\t\t\t\t\t\"facsimileImage\"\r\n\t\t\t\t\t\t) as HTMLImageElement;\r\n\t\t\t\t\t\tif (img) img.src = facsimileImageDataUrl as string;\r\n\t\t\t\t\t\tshowDxToast(\"Faksymile poprawnie ustawione\", \"success\");\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\tdata === SignEnumerations.UserFacsimileResponseCode.BadFormat\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tshowDxToast(\"Nieprawid\u0142owy format obrazka\", \"error\");\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\tdata === SignEnumerations.UserFacsimileResponseCode.TooBig\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tshowDxToast(\"Obrazek za du\u017Cy (700x100)\", \"error\");\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\tdata === SignEnumerations.UserFacsimileResponseCode.BadRatio\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tshowDxToast(\"Niepoprawne proporcje obrazka (7-3.5x1)\", \"error\");\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\tdata === SignEnumerations.UserFacsimileResponseCode.UserNotFound\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tshowDxToast(\"Nieznany u\u017Cytkownik\", \"error\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tshowDxToast(\"Nieznany b\u0142\u0105d\", \"error\");\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\terror: (_jqXHR, textStatus, errorThrown) => {\r\n\t\t\t\t\tlet message = \"B\u0142\u0105d: \";\r\n\t\t\t\t\tif (textStatus !== undefined) message += `${textStatus}, `;\r\n\t\t\t\t\tif (errorThrown !== undefined) message += errorThrown;\r\n\t\t\t\t\tshowDxToast(message, \"error\");\r\n\t\t\t\t},\r\n\t\t\t});\r\n\t\t});\r\n\t\tif (input.files) reader.readAsDataURL(input.files[0]);\r\n\t};\r\n\r\n\t$(input).trigger(\"click\");\r\n}\r\n\r\nexport function letSign() {\r\n\tconst cardPIN = document.getElementById(\"cardPIN\") as HTMLInputElement;\r\n\tconst SignDocument = document.getElementById(\r\n\t\t\"SignDocument\"\r\n\t) as HTMLInputElement;\r\n\r\n\tif (cardPIN?.value?.length === 0) {\r\n\t\tSignDocument.setAttribute(\"disabled\", \"true\");\r\n\t} else {\r\n\t\tSignDocument.removeAttribute(\"disabled\");\r\n\t}\r\n}\r\n\r\nexport function TakeMeToAsseco() {\r\n\tconst signatureFor = currentUserName;\r\n\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minHeight\", calcMinPopup(170, true));\r\n\r\n\t$(\"#Dialog\").empty();\r\n\t$(\"#Dialog\").append(\r\n\t\t`
            Podpis kwalifikowany dla ${signatureFor}
            `\r\n\t);\r\n\t$(\"#Dialog\").append(\r\n\t\t`

            ${choosenSignatureName}

            Oczekiwanie na autoryzacj\u0119

            `\r\n\t);\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(\r\n\t\t\t'
            '\r\n\t\t);\r\n\tpopup.repaint();\r\n\tOpenAssecoPage(redirectUri);\r\n}\r\n\r\nexport function useThisSignature() {\r\n\t//Wybranie podpisu ma przekaza\u0107 id podpisu\r\n\tif (signatureIsLocal === false && signatureIsBrowserSide === false) {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/api/Sign/GetParametersForCardNumber`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: { clientId: choosenSignature },\r\n\t\t\tsuccess: (data: ParametersForCardNumberResult | 500) => {\r\n\t\t\t\tif (data === 500) {\r\n\t\t\t\t\tshowDxToast(\"B\u0142a\u0328d serwera\", \"error\");\r\n\t\t\t\t} else if (data.redirectToAsseco === true) {\r\n\t\t\t\t\tredirectUri = data.redirectUri;\r\n\t\t\t\t\tGetTokenAsseco();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconst popup = prepareSignDialog();\r\n\r\n\t\t\t\t\t$(\"#Dialog\").empty();\r\n\t\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t\t`
            Podpis kwalifikowany dla ${signatureFor}
            `\r\n\t\t\t\t\t);\r\n\t\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t\t`

            ${data.signClientDTO.assecoCertificate.issuer}

            `\r\n\t\t\t\t\t);\r\n\t\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t\t``\r\n\t\t\t\t\t);\r\n\t\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t\t`

            ${data.signClientDTO.assecoCertificate.expirationDate}

            `\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (data?.signClientDTO?.assecoCertificate?.serialNumber)\r\n\t\t\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t\t\t`

            ${data?.signClientDTO?.assecoCertificate?.serialNumber}

            `\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t\t`

            ${data.signClientDTO.clientCardNumber}

            `\r\n\t\t\t\t\t);\r\n\t\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t\t'
            '\r\n\t\t\t\t\t);\r\n\t\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t\t'
            '\r\n\t\t\t\t\t);\r\n\t\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t\t'
            '\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tpopup\r\n\t\t\t\t\t\t.content()\r\n\t\t\t\t\t\t.find(\".DialogFooter\")\r\n\t\t\t\t\t\t.empty()\r\n\t\t\t\t\t\t.append(\r\n\t\t\t\t\t\t\t'
            '\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\tfinalizeSignDialog();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t});\r\n\t} else {\r\n\t\tconst qual = signatureIsCompanyStamp\r\n\t\t\t? \"\"\r\n\t\t\t: ` ${signatureIsQualified ? \"kwalifikowany\" : \"niekwalifikowany\"}`;\r\n\t\tconst title = signatureAsInitialing\r\n\t\t\t? \"Parafowanie dokumentu przez \"\r\n\t\t\t: `Podpis ${qual} dla `;\r\n\t\tconst reason = signatureAsInitialing\r\n\t\t\t? \"Pow\u00F3d parafowania\"\r\n\t\t\t: \"Pow\u00F3d podpisu\";\r\n\r\n\t\tconst popup = prepareSignDialog();\r\n\r\n\t\t$(\"#Dialog\").empty();\r\n\t\t$(\"#Dialog\").append(\r\n\t\t\t`
            ${title}${signatureFor}
            `\r\n\t\t);\r\n\t\t$(\"#Dialog\").append(\r\n\t\t\t`

            ${choosenSignatureName}

            `\r\n\t\t);\r\n\t\tif (signatureIsCompanyStamp || signatureIsBrowserSide) {\r\n\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t`

            ${signatureIssuer}

            `\r\n\t\t\t);\r\n\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t`

            ${signatureExpireDate}

            `\r\n\t\t\t);\r\n\t\t\tif (signatureSerialNumber)\r\n\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t`

            ${signatureSerialNumber}

            `\r\n\t\t\t\t);\r\n\t\t}\r\n\t\tif (signatureIsCompanyStamp) {\r\n\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t`

            ${currentUserLogin1}

            `\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\t$(\"#Dialog\").append(\r\n\t\t\t`
            `\r\n\t\t);\r\n\r\n\t\t$(\"#Dialog\").append(\r\n\t\t\t`
            `\r\n\t\t);\r\n\r\n\t\tif (!signatureIsCompanyStamp)\r\n\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t'
            '\r\n\t\t\t);\r\n\r\n\t\tpopup\r\n\t\t\t.content()\r\n\t\t\t.find(\".DialogFooter\")\r\n\t\t\t.empty()\r\n\t\t\t.append(\r\n\t\t\t\t`
            `\r\n\t\t\t);\r\n\r\n\t\tfinalizeSignDialog();\r\n\t}\r\n}\r\n\r\nexport function prepareSignDialog() {\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(200));\r\n\tpopup.option(\"minHeight\", calcMinPopup(150, true));\r\n\t$(\"#Dialog\").empty();\r\n\tpopup.content().find(\".DialogFooter\").empty();\r\n\r\n\tif (!addSignatureOnAllPages) {\r\n\t\tpopup.option(\"showTitle\", false);\r\n\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\t\tpopup.show();\r\n\t}\r\n\r\n\treturn popup;\r\n}\r\n\r\nexport function finalizeSignDialog() {\r\n\twaitForElm(\".SignatureInfo\").then(() => {\r\n\t\t$(\".SignatureInfo input\").each((_i, obj) => {\r\n\t\t\t$(obj).on(\"keydown\", (event) => {\r\n\t\t\t\tif (\r\n\t\t\t\t\t!$(\"#SignDocument\").is(\":disabled\") &&\r\n\t\t\t\t\tevent.originalEvent?.key === \"Enter\"\r\n\t\t\t\t) {\r\n\t\t\t\t\t$(\"#SignDocument\").trigger(\"click\");\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\t});\r\n\r\n\tif (initialAllPagesArea) {\r\n\t\t//dodawanie parafowania na wszystkich stronach\r\n\r\n\t\tStartX = null;\r\n\t\tEndX = null;\r\n\t\tStartY = null;\r\n\t\tEndY = null;\r\n\r\n\t\thidePDF();\r\n\r\n\t\toriginalHeight = -1;\r\n\t\toriginalWidth = -1;\r\n\t\tcurrentSignDocumentPage = 0;\r\n\t\toriginalRotation = -1;\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\tcreatePdfSigView();\r\n}\r\n\r\nexport function createPdfSigView(universal = false) {\r\n\tif (!universal) {\r\n\t\tconst imagePopup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\t\timagePopup.option(\"height\", \"100%\");\r\n\t\timagePopup.option(\"width\", \"100%\");\r\n\r\n\t\tif (isRunningOnMobile()) {\r\n\t\t\timagePopup.option(\"maxWidth\", \"95vw\");\r\n\t\t\timagePopup.option(\"maxHeight\", \"90vh\");\r\n\t\t} else {\r\n\t\t\timagePopup.option(\"maxWidth\", 600);\r\n\t\t\timagePopup.option(\"maxHeight\", \"85vh\");\r\n\t\t}\r\n\r\n\t\timagePopup.option(\"showTitle\", false);\r\n\t\timagePopup.option(\"hideOnOutsideClick\", false);\r\n\t\timagePopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\t\timagePopup.show();\r\n\t}\r\n\r\n\t$(\"#BigDialog\").empty();\r\n\t$(\"#DialogFooter\").empty();\r\n\t$(\"#BigDialog\").append(\r\n\t\t'
            '\r\n\t);\r\n\t$(\"#pdf\").append('
            ');\r\n\t$(\"#imgContainer\").append(\r\n\t\t'
            '\r\n\t);\r\n\tselectedAreas = [];\r\n\tfor (let i = 1; i < 17; i++) {\r\n\t\tconst top = `${(i - 1) * 6 + 3}%`;\r\n\t\tfor (let j = 0; j < 8; j++) {\r\n\t\t\tconst left = `${j * 12.5 + 1.5}%`;\r\n\t\t\t$(\"#SignHereOverlay\").append(\r\n\t\t\t\t`
            `\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\t$(\"#imgContainer\").append(\r\n\t\t'\"DocumentPage\"'\r\n\t);\r\n\t$(\"#BigDialog\").append(\r\n\t\t'
            '\r\n\t);\r\n\tif (!universal)\r\n\t\t$(\"#SignatureImageButtons\").append(\r\n\t\t\t''\r\n\t\t);\r\n\t$(\"#SignatureImageButtons\").append(\r\n\t\t``\r\n\t);\r\n\t$(\"#SignatureImageButtons\").append(\r\n\t\t``\r\n\t);\r\n\t$(\"#SignatureImageButtons\").append(\r\n\t\t``\r\n\t);\r\n\t$(\"#SignatureImageButtons\").append(\r\n\t\t``\r\n\t);\r\n\tif (!universal)\r\n\t\t$(\"#SignatureImageButtons\").append(\r\n\t\t\t''\r\n\t\t);\r\n\r\n\t$(\"#signatureOk\").on(\"click\", function () {\r\n\t\tif (!checkIfSigExists() && $(this).attr(\"data-acceptNoSig\") !== \"true\") {\r\n\t\t\tnoSignaturePopup();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\thidePDF();\r\n\t});\r\n\r\n\tconst signatureOk = document.getElementById(\"signatureOk\");\r\n\r\n\t//piecz\u0119\u0107 mo\u017Cna z\u0142o\u017Cy\u0107 bez graficznej reprezentacji, nie trzeba wskazywa\u0107 koordynat\r\n\tif (signatureIsCompanyStamp) signatureOk?.removeAttribute(\"disabled\");\r\n\r\n\tStartX = undefined;\r\n\tEndX = undefined;\r\n\tStartY = undefined;\r\n\tEndY = undefined;\r\n\r\n\tconst SignHereImage = document.getElementById(\r\n\t\t\"SignHereImage\"\r\n\t) as HTMLImageElement;\r\n\tdisplayHeight = SignHereImage?.offsetHeight;\r\n\tdisplayWidth = SignHereImage?.offsetWidth;\r\n\r\n\tChangeSignDocumentPage(0, universal);\r\n\tcurrentSignDocumentPage = 0;\r\n\r\n\tfunction finishSelecting(\r\n\t\tevent: JQuery.TriggeredEvent<\r\n\t\t\tHTMLElement,\r\n\t\t\tundefined,\r\n\t\t\tHTMLElement,\r\n\t\t\tHTMLElement\r\n\t\t>\r\n\t) {\r\n\t\tEndX = event.offsetX;\r\n\t\tEndY = event.offsetY;\r\n\r\n\t\tconst element = document.getElementById(\"myCanvas\") as HTMLCanvasElement;\r\n\t\tif (!element) return;\r\n\r\n\t\tconst positionInfo = element?.getBoundingClientRect();\r\n\t\telement.height = positionInfo?.height;\r\n\t\telement.width = positionInfo?.width;\r\n\r\n\t\tconst ctx = element.getContext(\"2d\");\r\n\t\tif (ctx) ctx.fillStyle = \"rgba(0,128,0,0.3)\";\r\n\t\t// Swap X values if StartX is greater than EndX\r\n\t\tif (Number(StartX) > Number(EndX)) {\r\n\t\t\t[StartX, EndX] = [EndX, StartX];\r\n\t\t}\r\n\r\n\t\t// Swap Y values if StartY is greater than EndY\r\n\t\tif (Number(StartY) > Number(EndY)) {\r\n\t\t\t[StartY, EndY] = [EndY, StartY];\r\n\t\t}\r\n\r\n\t\tctx?.fillRect(\r\n\t\t\tNumber(StartX),\r\n\t\t\tNumber(StartY),\r\n\t\t\tNumber(EndX) - Number(StartX),\r\n\t\t\tNumber(EndY) - Number(StartY)\r\n\t\t);\r\n\r\n\t\tsignatureOk?.removeAttribute(\"disabled\");\r\n\t\tif (universal) enableUniversalSignButton();\r\n\t}\r\n\r\n\t$(\"#SignHereOverlay\").on(\"pointerdown\", (event) => {\r\n\t\tif (checkPosition) return;\r\n\r\n\t\tStartX = event.offsetX;\r\n\t\tStartY = event.offsetY;\r\n\t\tcheckPosition = true;\r\n\t\tfinishedSelecting = false;\r\n\r\n\t\tconst myCanvas: JQuery = $(\"#myCanvas\");\r\n\t\tconst ctx = myCanvas[0].getContext(\"2d\");\r\n\t\tctx?.clearRect(0, 0, 2000, 2000);\r\n\t});\r\n\r\n\t$(\"#SignHereOverlay\").on(\"pointermove\", (event) => {\r\n\t\tif (!checkPosition) return;\r\n\r\n\t\tconst currentX = event.offsetX ?? -1;\r\n\t\tconst currentY = event.offsetY ?? -1;\r\n\r\n\t\tconst element = document.getElementById(\"myCanvas\") as HTMLCanvasElement;\r\n\t\tif (!element) return;\r\n\t\tconst positionInfo = element.getBoundingClientRect();\r\n\t\telement.height = positionInfo.height;\r\n\t\telement.width = positionInfo.width;\r\n\r\n\t\tconst ctx = element.getContext(\"2d\");\r\n\t\tif (!ctx) return;\r\n\t\tctx.fillStyle = \"rgba(0,128,0,0.3)\";\r\n\t\tctx.fillRect(\r\n\t\t\tNumber(StartX),\r\n\t\t\tNumber(StartY),\r\n\t\t\tcurrentX - Number(StartX),\r\n\t\t\tcurrentY - Number(StartY)\r\n\t\t);\r\n\t});\r\n\r\n\t$(\"#SignHereOverlay\").on(\"pointerup\", (event) => {\r\n\t\tif (checkPosition === true) {\r\n\t\t\tcheckPosition = false;\r\n\t\t\tfinishedSelecting = true;\r\n\r\n\t\t\tfinishSelecting(event);\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#SignHereOverlay\").on(\"mouseenter\", () => {\r\n\t\tif (!finishedSelecting && StartX) checkPosition = true;\r\n\t});\r\n\r\n\t$(\"#SignHereOverlay\").on(\"mouseleave\", (event) => {\r\n\t\tif (!finishedSelecting && checkPosition) {\r\n\t\t\tfinishSelecting(event);\r\n\t\t}\r\n\r\n\t\tcheckPosition = false;\r\n\t});\r\n\r\n\tif (!universal) {\r\n\t\twindow.addEventListener(\r\n\t\t\t\"orientationchange\",\r\n\t\t\t() => {\r\n\t\t\t\tconst imagePopup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\r\n\t\t\t\timagePopup?.repaint();\r\n\t\t\t},\r\n\t\t\tfalse\r\n\t\t);\r\n\r\n\t\tfixScrollInDx(\"#BigDialog\");\r\n\t}\r\n}\r\n\r\nexport function OpenAssecoPage(AssecoUri?: string | URL) {\r\n\tif (\r\n\t\t/^((?!chrome|android).)*safari/i.test(navigator.userAgent) ||\r\n\t\tisRunningOnMobile()\r\n\t) {\r\n\t\twindow.open(AssecoUri, \"_blank\");\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst popup = $(\"#devex-dialog-additional\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(\"80vw\"));\r\n\tpopup.option(\"minHeight\", calcMinPopup(\"90vh\", true));\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"title\", \"Autoryzacja\");\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog-Additional\"));\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t$(\"#Dialog-Additional\").empty();\r\n\t$(\"#Dialog-Additional\").append(\r\n\t\t``\r\n\t);\r\n\r\n\tsetTimeout(() => {\r\n\t\tpopup.show();\r\n\t\tpopup.repaint();\r\n\t}, 10);\r\n\r\n\tlet cnt = 0;\r\n\tconst timerId = setInterval(() => {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/api/Sign/CheckTokenActive`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: false,\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tsuccess: (data: boolean | 500) => {\r\n\t\t\t\tif (data === true) {\r\n\t\t\t\t\tpopup.hide();\r\n\t\t\t\t\tclearInterval(timerId);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t});\r\n\t\tcnt++;\r\n\t\tif (cnt > 100) clearInterval(timerId);\r\n\t}, 5000);\r\n}\r\n\r\nexport function OpenSignatureOptions() {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/api/Sign/GetSignatureParameters`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (data: SignatureParametersDTO | 500) => {\r\n\t\t\tif (data === 500) {\r\n\t\t\t\tshowDxToast(\"Nie uda\u0142o sie pobra\u0107 danych\", \"error\");\r\n\t\t\t} else if (data != null) {\r\n\t\t\t\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\t\t\t\tpopup.option(\"minHeight\", calcMinPopup(180, true));\r\n\t\t\t\t$(\"#Dialog\").empty();\r\n\t\t\t\tpopup.content().find(\".DialogFooter\").empty();\r\n\r\n\t\t\t\tlet selectOptions = \"\";\r\n\t\t\t\tdata.certificates.forEach((certificate, index) => {\r\n\t\t\t\t\tif (certificate.local) {\r\n\t\t\t\t\t\t// na razie wy\u0142\u0105czamy mo\u017Cliwo\u015B\u0107 ustawiania w\u0142asnego faksymile do piecz\u0119ci\r\n\t\t\t\t\t\t/*\r\n if (certificate.companyStamp) {\r\n selectOptions += '';\r\n }\r\n */\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (index === 0) {\r\n\t\t\t\t\t\t\tchoosenSignature = Number.parseInt(\r\n\t\t\t\t\t\t\t\tcertificate.certificateId.toString(),\r\n\t\t\t\t\t\t\t\t10\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\tchoosenSignatureName = certificate.displayName;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tselectOptions += `\";\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t'
            Opcje podpisu
            '\r\n\t\t\t\t);\r\n\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t'
            Edytuj podpis lub dodaj nowy:
            '\r\n\t\t\t\t);\r\n\t\t\t\t$(\"#Dialog\").append(\r\n\t\t\t\t\t``\r\n\t\t\t\t);\r\n\t\t\t\tlet disabled = \"\";\r\n\t\t\t\tif ($(\"#selectSignatureOptions > option\").length === 0) {\r\n\t\t\t\t\tdisabled = \"disabled\";\r\n\t\t\t\t}\r\n\t\t\t\tpopup\r\n\t\t\t\t\t.content()\r\n\t\t\t\t\t.find(\".DialogFooter\")\r\n\t\t\t\t\t.append(\r\n\t\t\t\t\t\t`
            `\r\n\t\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tshowDxToast(\"B\u0142\u0105d pobierania certyfikat\u00F3w.\", \"error\");\r\n\t\t\tconsole.error(err);\r\n\t\t},\r\n\t\tcomplete: () => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function changeSelectedSignature(edition: boolean) {\r\n\tif (edition) {\r\n\t\tchoosenSignature = Number.parseInt(\r\n\t\t\t(document.getElementById(\"selectSignatureOptions\") as HTMLInputElement)\r\n\t\t\t\t.value,\r\n\t\t\t10\r\n\t\t);\r\n\t\tchoosenSignatureName =\r\n\t\t\t$(\"#selectSignatureOptions\")\r\n\t\t\t\t.find(\"option:selected\")\r\n\t\t\t\t.attr(\"displayName\") ?? \"\";\r\n\t\tsignatureIsLocal =\r\n\t\t\t$(\"#selectSignatureOptions\").find(\"option:selected\").attr(\"isLocal\") ===\r\n\t\t\t\"true\";\r\n\t\tsignatureIsCompanyStamp =\r\n\t\t\t$(\"#selectSignatureOptions\")\r\n\t\t\t\t.find(\"option:selected\")\r\n\t\t\t\t.attr(\"isCompanyStamp\") === \"true\";\r\n\t\tsignatureIsQualified =\r\n\t\t\t$(\"#selectSignatureOptions\")\r\n\t\t\t\t.find(\"option:selected\")\r\n\t\t\t\t.attr(\"isQualified\") === \"true\";\r\n\t} else {\r\n\t\tchoosenSignature = Number.parseInt(\r\n\t\t\t(document.getElementById(\"selectSignature\") as HTMLInputElement).value,\r\n\t\t\t10\r\n\t\t);\r\n\t\tchoosenSignatureName =\r\n\t\t\t$(\"#selectSignature\").find(\"option:selected\").attr(\"displayName\") ?? \"\";\r\n\t\tsignatureIsLocal =\r\n\t\t\t$(\"#selectSignature\").find(\"option:selected\").attr(\"isLocal\") === \"true\";\r\n\t\tsignatureIsCompanyStamp =\r\n\t\t\t$(\"#selectSignature\").find(\"option:selected\").attr(\"isCompanyStamp\") ===\r\n\t\t\t\"true\";\r\n\t\tsignatureIsQualified =\r\n\t\t\t$(\"#selectSignature\").find(\"option:selected\").attr(\"isQualified\") ===\r\n\t\t\t\"true\";\r\n\t\tsignatureIsBrowserSide =\r\n\t\t\t$(\"#selectSignature\").find(\"option:selected\").attr(\"isBrowserSide\") ===\r\n\t\t\t\"true\";\r\n\t\tif (signatureIsCompanyStamp || signatureIsBrowserSide) {\r\n\t\t\tsignatureIssuer =\r\n\t\t\t\t$(\"#selectSignature\").find(\"option:selected\").attr(\"issuer\") ?? \"\";\r\n\t\t\tsignatureExpireDate =\r\n\t\t\t\t$(\"#selectSignature\").find(\"option:selected\").attr(\"expireDate\") ?? \"\";\r\n\t\t\tsignatureSerialNumber =\r\n\t\t\t\t$(\"#selectSignature\").find(\"option:selected\").attr(\"serialNumber\") ??\r\n\t\t\t\t\"\";\r\n\t\t}\r\n\t\tif (signatureIsBrowserSide)\r\n\t\t\tsignatureFullPfx =\r\n\t\t\t\t$(\"#selectSignature\").find(\"option:selected\").attr(\"fullPfx\") ?? \"\";\r\n\t}\r\n\r\n\tif ($(\"#signatureAsInitialingBtn\").prop(\"checked\") !== false)\r\n\t\t$(\"#signatureAsInitialingBtn\").prop(\"checked\", false).trigger(\"change\");\r\n}\r\n\r\nexport function SignDocument(\r\n\tcompanyStamp: string,\r\n\tuniversal = false,\r\n\tinitialing = false,\r\n\tasyncMode: string | null = null,\r\n\tasyncStates = null\r\n) {\r\n\tif (asyncMode !== \"complete\")\r\n\t\tShowLoadingPanel(\r\n\t\t\tsignatureAsInitialing ? \"Trwa parafowanie...\" : \"Trwa podpisywanie...\"\r\n\t\t);\r\n\r\n\tif (asyncMode == null && signatureIsBrowserSide) asyncMode = \"init\";\r\n\r\n\tlet certificateDescription = choosenSignatureName;\r\n\tif (asyncMode === \"complete\" || asyncMode === \"init\")\r\n\t\tcertificateDescription = `BROWSER_SIDE|${signatureFullPfx}`;\r\n\r\n\tconst password = (document.getElementById(\"cardPIN\") as HTMLInputElement)\r\n\t\t?.value;\r\n\tconst reason = (document.getElementById(\"signReason\") as HTMLInputElement)\r\n\t\t?.value;\r\n\r\n\tconst rotation = originalRotation;\r\n\r\n\tconst location = companyStamp\r\n\t\t? \"\"\r\n\t\t: (document.getElementById(\"signLocation\") as HTMLInputElement)?.value;\r\n\r\n\toriginalHeight = Number.parseInt(originalHeight.toString());\r\n\toriginalWidth = Number.parseInt(originalWidth.toString());\r\n\r\n\tif (initialAllPagesArea) addSignatureOnAllPages = true;\r\n\r\n\tlet itemIds: string[] = [];\r\n\tif (!addSignatureOnAllPages) {\r\n\t\titemIds = [];\r\n\t\titemIds.push(itemsToSign[0]);\r\n\t} else if (globalItemsSelectedByUser) {\r\n\t\titemIds = [...globalItemsSelectedByUser];\r\n\t}\r\n\r\n\tlet page = currentSignDocumentPage + 1;\r\n\r\n\tif (signatureCountFromEnd) {\r\n\t\tpage = currentSignDocumentPageCount - currentSignDocumentPage;\r\n\t}\r\n\r\n\tconst area = new Array(\r\n\t\tpage,\r\n\t\tcalculatedStartX,\r\n\t\tcalculatedStartY,\r\n\t\tcalculatedWidth,\r\n\t\tcalculatedHeight,\r\n\t\toriginalHeight,\r\n\t\toriginalWidth,\r\n\t\trotation\r\n\t);\r\n\tconst data = {\r\n\t\titemId: itemIds,\r\n\t\tlocation: location,\r\n\t\treason: reason,\r\n\t\tpassword: password,\r\n\t\tcertificateDescription: certificateDescription,\r\n\t\tarea: area,\r\n\t\tsignatureCountFromEnd: signatureCountFromEnd,\r\n\t\tuserLogin: universal ? $(\"#personData\").val() : currentUserLogin1,\r\n\t\tlastMD5: lastMD5,\r\n\t\tinitialing: initialing,\r\n\t\tasyncMode: asyncMode,\r\n\t\tasyncStates: asyncStates,\r\n\t\tinitialAllPagesArea: initialAllPagesArea,\r\n\t\ttermsOfService:\r\n\t\t\tuniversal && $(\"#termsOfService\").is(\":checked\")\r\n\t\t\t\t? $(\"label[for='termsOfService']\").text()\r\n\t\t\t\t: \"\",\r\n\t};\r\n\r\n\tconsole.log(`wysy\u0142am: ${JSON.stringify(data)}`);\r\n\r\n\t$.ajax({\r\n\t\turl:\r\n\t\t\tGetBaseUrl() +\r\n\t\t\t(universal ? \"/Vario/SignDocumentFromShare\" : \"/Vario/SignDocument\"),\r\n\t\ttype: \"Post\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: data,\r\n\t\tsuccess: (data: SignResponseObject) => {\r\n\t\t\tif (data?.status === RequestStatus.success) {\r\n\t\t\t\tif (asyncMode === \"init\") {\r\n\t\t\t\t\tconst asyncStates = [...data.asyncStates];\r\n\r\n\t\t\t\t\tconst request = {\r\n\t\t\t\t\t\taction: \"sign\",\r\n\t\t\t\t\t\tcertificateSerialID: signatureSerialNumber,\r\n\t\t\t\t\t\tsignAsyncStates: asyncStates,\r\n\t\t\t\t\t\tpin: password,\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t\tsendToSigner(\r\n\t\t\t\t\t\trequest,\r\n\t\t\t\t\t\t(success: any, response: { signAsyncStates: null | undefined }) => {\r\n\t\t\t\t\t\t\tif (success) {\r\n\t\t\t\t\t\t\t\tconsole.log(\"podpisany!\");\r\n\t\t\t\t\t\t\t\tSignDocument(\r\n\t\t\t\t\t\t\t\t\tcompanyStamp,\r\n\t\t\t\t\t\t\t\t\tuniversal,\r\n\t\t\t\t\t\t\t\t\tinitialing,\r\n\t\t\t\t\t\t\t\t\t\"complete\",\r\n\t\t\t\t\t\t\t\t\tresponse.signAsyncStates\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t} else showDxToast(\"Wyst\u0105pi\u0142 b\u0142\u0105d przy podpisie\", \"error\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t\tOnDocumentSigned(universal, data, itemIds);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tif (data?.status === RequestStatus.inProgress) {\r\n\t\t\t\t\tif (itemIds?.length > 1) {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\t\"Dokument zosta\u0142 zmodyfikowany od czasu jego wy\u015Bwietlenia i nie zosta\u0142 podpisany.\\r\\n\\r\\nPozosta\u0142e podpisano pomy\u015Blnie.\",\r\n\t\t\t\t\t\t\t\"warning\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\tCloseDialog();\r\n\t\t\t\t\t\treloadDxGridDataSource();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tdocumentModifiedForSignaturePopup(data?.message, universal);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\tdata?.message ??\r\n\t\t\t\t\t\t\t\"Aktualny stan dokumentu uniemo\u017Cliwia z\u0142o\u017Cenie podpisu\",\r\n\t\t\t\t\t\t\"error\"\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\terror: (err) => {\r\n\t\t\tconsole.error(err);\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tshowDxToast(\r\n\t\t\t\t\"Aktualny stan dokumentu uniemo\u017Cliwia z\u0142o\u017Cenie podpisu\",\r\n\t\t\t\t\"error\"\r\n\t\t\t);\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function OnDocumentSigned(\r\n\tuniversal: boolean,\r\n\tdata: { message: any },\r\n\titemIds: string[]\r\n) {\r\n\t$(\"#SignDocument, #universalSigButton\")\r\n\t\t.addClass(\"disabled\")\r\n\t\t.attr(\"disabled\", \"disabled\");\r\n\tif (!universal) forceCloseUnsavedPopup = true;\r\n\r\n\tCloseDialog();\r\n\tif (universal) successSignedPdf(false);\r\n\telse {\r\n\t\tshowDxToast(data.message, \"success\");\r\n\r\n\t\t//usuniecie podpisanego dobrze pdfa zeby wybral nastepny\r\n\t\tif (!addSignatureOnAllPages) itemsToSign.splice(0, 1);\r\n\r\n\t\tif (!addSignatureOnAllPages && itemsToSign.length > 0) {\r\n\t\t\tuseThisSignature();\r\n\t\t} else {\r\n\t\t\tif (modelSubElementsOnly === \"False\" && modelId === itemIds[0]) {\r\n\t\t\t\trefreshManager.needRefresh = new Set([\r\n\t\t\t\t\trefreshManager?.refreshArea?.varioObjectForm,\r\n\t\t\t\t\trefreshManager?.refreshArea?.gridData,\r\n\t\t\t\t\trefreshManager?.refreshArea?.filePreview,\r\n\t\t\t\t]);\r\n\t\t\t\trefreshCurrentPage();\r\n\t\t\t} else {\r\n\t\t\t\treloadDxGridDataSource();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function SignDocumentAsseco() {\r\n\t$(\"#SignDocument\")\r\n\t\t.unbind(\"click\")\r\n\t\t.bind(\"click\", () => {});\r\n\tShowLoadingPanel(\"Trwa podpisywanie...\");\r\n\r\n\tconst cardPIN = (document.getElementById(\"cardPIN\") as HTMLInputElement)\r\n\t\t?.value;\r\n\tconst reason = (document.getElementById(\"signReason\") as HTMLInputElement)\r\n\t\t?.value;\r\n\tconst location = (document.getElementById(\"signLocation\") as HTMLInputElement)\r\n\t\t?.value;\r\n\tconst signatureOwner = document.getElementById(\"owner\")?.innerText;\r\n\r\n\tlet itemIds: string[] = [];\r\n\tif (!addSignatureOnAllPages) {\r\n\t\titemIds = [];\r\n\t\titemIds.push(itemsToSign[0]);\r\n\t} else if (globalItemsSelectedByUser) {\r\n\t\titemIds = [...globalItemsSelectedByUser];\r\n\t}\r\n\r\n\tlet page = currentSignDocumentPage + 1;\r\n\r\n\tif (signatureCountFromEnd) {\r\n\t\tpage = currentSignDocumentPageCount - currentSignDocumentPage;\r\n\t}\r\n\r\n\toriginalHeight = Number.parseInt(originalHeight.toString());\r\n\toriginalWidth = Number.parseInt(originalWidth.toString());\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/api/Sign/SignDocuments`,\r\n\t\ttype: \"Post\",\r\n\t\tcache: false,\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdataType: \"json\",\r\n\t\tdata: JSON.stringify({\r\n\t\t\titemIds: itemIds,\r\n\t\t\tcardPIN: cardPIN,\r\n\t\t\tlocation: location,\r\n\t\t\treason: reason,\r\n\t\t\tpage: page,\r\n\t\t\tarea: new Array(\r\n\t\t\t\tcalculatedStartX,\r\n\t\t\t\tcalculatedStartY,\r\n\t\t\t\tcalculatedWidth,\r\n\t\t\t\tcalculatedHeight,\r\n\t\t\t\toriginalRotation,\r\n\t\t\t\toriginalWidth,\r\n\t\t\t\toriginalHeight\r\n\t\t\t),\r\n\t\t\tclientCardNumber: choosenSignatureName,\r\n\t\t\tsignatureOwner: signatureOwner,\r\n\t\t\tsignatureCountFromEnd: signatureCountFromEnd,\r\n\t\t}),\r\n\t\tsuccess: (data: SignResponse) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tif (data?.status === 401) {\r\n\t\t\t\tOpenAssecoPage(data.redirectUri);\r\n\t\t\t} else {\r\n\t\t\t\tconst details = data.detail.split(\"|\");\r\n\t\t\t\tconst fullDetailList: string[] = [];\r\n\t\t\t\tlet numberOfSuccessful = 0;\r\n\t\t\t\tfor (const detail of details) {\r\n\t\t\t\t\tif (detail === \"success\") {\r\n\t\t\t\t\t\tnumberOfSuccessful += 1;\r\n\t\t\t\t\t\tfullDetailList.push(\"Podpisano dokument\");\r\n\t\t\t\t\t} else if (detail === \"error\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Wyst\u0105pi\u0142 b\u0142\u0105d wewn\u0119trzny serwera\");\r\n\t\t\t\t\t} else if (detail === \"pin.empty\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"PIN nie mo\u017Ce by\u0107 pusty\");\r\n\t\t\t\t\t} else if (detail === \"pin.incorrect\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Niepoprawny PIN\");\r\n\t\t\t\t\t} else if (detail === \"pin.locked\") {\r\n\t\t\t\t\t\tfullDetailList.push(\r\n\t\t\t\t\t\t\t\"PIN zablokowany, odblokuj przy pomocy kodu PUK\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else if (detail === \"card.expired\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Karta wygas\u0142a\");\r\n\t\t\t\t\t} else if (detail === \"card.not.found\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Karty nie odnaleziono\");\r\n\t\t\t\t\t} else if (detail === \"pin.policy.invalid\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"PIN nie spe\u0142nia wymaga\u0144 polityki\");\r\n\t\t\t\t\t} else if (detail === \"file.invalid\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Plik musi by\u0107 PDF'em i nie mo\u017Ce by\u0107 otwarty\");\r\n\t\t\t\t\t} else if (detail === \"file.protected\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Plik chroniony, brak uprawnie\u0144 do odczytu\");\r\n\t\t\t\t\t} else if (detail === \"certificate.incorrect\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Niepoprawny certyfikat\");\r\n\t\t\t\t\t} else if (detail === \"certificate.not.valid\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Niepoprawny certyfikat lub certyfikat wygas\u0142\");\r\n\t\t\t\t\t} else if (detail === \"engine.template.deserialization.error\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"B\u0142\u0105d przy deserializacji szablonu\");\r\n\t\t\t\t\t} else if (detail === \"engine.template.serialization.error\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"B\u0142\u0105d przy serializacji podpisu\");\r\n\t\t\t\t\t} else if (detail === \"resource.not.found\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Nie odnaleziono zasobu o takim ID\");\r\n\t\t\t\t\t} else if (detail === \"task.not.found\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Nie odnaleziono zadania o takim ID\");\r\n\t\t\t\t\t} else if (detail === \"atom.processing.error\") {\r\n\t\t\t\t\t\tfullDetailList.push('B\u0142\u0105d w czasie wykonywania zapytania \"atom\"');\r\n\t\t\t\t\t} else if (detail === \"pades.basic.already.attached\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Dokument jest ju\u017C podpisany\");\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\tdetail === \"ltv.no.signature.found\" ||\r\n\t\t\t\t\t\tdetail === \"ltv.no.strategy.provided\"\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tfullDetailList.push(\"Brak wybranego podpisu\");\r\n\t\t\t\t\t} else if (detail === \"no_permissions\") {\r\n\t\t\t\t\t\tfullDetailList.push(\r\n\t\t\t\t\t\t\t\"Nie mo\u017Cna podpisa\u0107 dokumentu, poniewa\u017C nie posiadasz uprawnie\u0144 do jego edycji\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else if (detail === \"cant_get_content\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Nie mo\u017Cna pobra\u0107 pliku do podpisu\");\r\n\t\t\t\t\t} else if (detail === \"cant_check_out_content\") {\r\n\t\t\t\t\t\tfullDetailList.push(\r\n\t\t\t\t\t\t\t\"Nie mo\u017Cna pobra\u0107 do opracowania pliku do podpisu (by\u0107 mo\u017Ce kto\u015B inny w\u0142a\u015Bnie podpisuje ten dokument)\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else if (detail === \"no_permission_to_read_content\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Brak uprawnie\u0144 do odczytu pliku\");\r\n\t\t\t\t\t} else if (detail === \"not.accepted\") {\r\n\t\t\t\t\t\tfullDetailList.push(\r\n\t\t\t\t\t\t\t\"Us\u0142ugodawca nie zaakceptowa\u0142 zlecenia podpisu dokumentu\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else if (detail === \"bad.area\") {\r\n\t\t\t\t\t\tfullDetailList.push(\"Zaznaczono nieprawid\u0142owe koordynaty \");\r\n\t\t\t\t\t} else if (detail === \"too_few_pages\") {\r\n\t\t\t\t\t\tfullDetailList.push(\r\n\t\t\t\t\t\t\t\"Nie mo\u017Cna z\u0142o\u017Cy\u0107 podpisu na wskazanej stronie - dokument nie ma takiej strony\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tfullDetailList.push(\r\n\t\t\t\t\t\t\t`Us\u0142uga dostawcy podpisu zwr\u00F3ci\u0142a kod ${detail}`\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\tconsole.log(\r\n\t\t\t\t\t\t\t`B\u0142\u0105d podczas podpisywania, skontaktuj si\u0119 z administratorem => ${detail}`\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst isSuccessful = numberOfSuccessful === fullDetailList.length;\r\n\r\n\t\t\t\tlet msg = `Podpisano poprawnie ${numberOfSuccessful} dokument/\u00F3w`;\r\n\r\n\t\t\t\tif (isSuccessful) {\r\n\t\t\t\t\t//usuniecie podpisanego dobrze pdfa zeby wybral nastepny\r\n\t\t\t\t\tif (!addSignatureOnAllPages) itemsToSign.splice(0, 1);\r\n\t\t\t\t\tif (!addSignatureOnAllPages && itemsToSign.length > 0) {\r\n\t\t\t\t\t\tuseThisSignature();\r\n\t\t\t\t\t} else if (\r\n\t\t\t\t\t\taddSignatureOnAllPages ||\r\n\t\t\t\t\t\t(!addSignatureOnAllPages && itemsToSign.length === 0)\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\t$(\"#SignDocument\")\r\n\t\t\t\t\t\t\t.addClass(\"disabled\")\r\n\t\t\t\t\t\t\t.attr(\"disabled\", \"disabled\");\r\n\t\t\t\t\t\tforceCloseUnsavedPopup = true;\r\n\r\n\t\t\t\t\t\tCloseDialog();\r\n\r\n\t\t\t\t\t\tif (modelSubElementsOnly === \"False\" && modelId === itemIds[0]) {\r\n\t\t\t\t\t\t\trefreshManager.needRefresh = new Set([\r\n\t\t\t\t\t\t\t\trefreshManager?.refreshArea?.varioObjectForm,\r\n\t\t\t\t\t\t\t\trefreshManager?.refreshArea?.filePreview,\r\n\t\t\t\t\t\t\t]);\r\n\t\t\t\t\t\t\trefreshCurrentPage();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\treloadDxGridDataSource();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tshowDxToast(msg, \"success\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (numberOfSuccessful === 0)\r\n\t\t\t\t\t\tmsg =\r\n\t\t\t\t\t\t\t\"Nie uda\u0142o si\u0119 podpisa\u0107 dokument\u00F3w poprawnie, wyst\u0105pi\u0142y nast\u0119puj\u0105ce b\u0142\u0119dy:\";\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tmsg = `Podpisano poprawnie ${numberOfSuccessful} dokument\u00F3w, a w ${fullDetailList.length - numberOfSuccessful} wyst\u0105pi\u0142y nast\u0119puj\u0105ce b\u0142\u0119dy:`;\r\n\r\n\t\t\t\t\tfullDetailList.forEach((detail, index) => {\r\n\t\t\t\t\t\tif (detail !== \"Podpisano dokument\") {\r\n\t\t\t\t\t\t\tlet documentCaption = null;\r\n\t\t\t\t\t\t\tif ($(\"#Tabela\").length > 0) {\r\n\t\t\t\t\t\t\t\tgetVisibleRows().some(\r\n\t\t\t\t\t\t\t\t\t(row: { data: { ItemID: any; Caption: null } }) => {\r\n\t\t\t\t\t\t\t\t\t\tif (row.data.ItemID === itemIds[index]) {\r\n\t\t\t\t\t\t\t\t\t\t\tdocumentCaption = row.data.Caption;\r\n\t\t\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tmsg += `\\r\\n\\r\\n- ${documentCaption}\\r\\n${detail}`;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tshowDxToast(msg, \"error\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function CheckTokenActive() {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/api/Sign/CheckTokenActive`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tsuccess: (data: boolean | 500) => {\r\n\t\t\tCheckTokenActiveData(data);\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function CheckTokenActiveData(data: boolean | 500) {\r\n\tif (data === true) {\r\n\t\tuseThisSignature();\r\n\t} else {\r\n\t\tsetTimeout(() => {\r\n\t\t\tCheckTokenActive();\r\n\t\t}, 3000);\r\n\t}\r\n}\r\n\r\nexport function chooseThisPosition(id: string) {\r\n\tconst element = document.getElementById(id);\r\n\t$(\"#SignHereOverlay\").off(\"pointerdown\");\r\n\t$(\"#SignHereOverlay\").off(\"pointerup\");\r\n\r\n\tconst index = selectedAreas.indexOf(id);\r\n\tif (index > -1) {\r\n\t\tselectedAreas.splice(index, 1);\r\n\t\tif (element) element.style.backgroundColor = \"rgb(8, 152, 214, 0.3)\";\r\n\t} else {\r\n\t\tselectedAreas.push(id);\r\n\t\tif (element) element.style.backgroundColor = \"rgb(0, 128, 0, 0.3)\";\r\n\t}\r\n\r\n\tselectedAreas.forEach((item, index) => {\r\n\t\tconst elem = (document.getElementById(item)?.attributes as any).style\r\n\t\t\t?.ownerElement;\r\n\r\n\t\tif (elem.offsetLeft < Number(StartX) || index === 0) {\r\n\t\t\tStartX = elem.offsetLeft;\r\n\t\t}\r\n\r\n\t\tif (elem.offsetTop < Number(StartY) || index === 0) {\r\n\t\t\tStartY = elem.offsetTop;\r\n\t\t}\r\n\r\n\t\tif (elem.offsetLeft + elem.clientWidth > Number(EndX) || index === 0) {\r\n\t\t\tEndX = elem.offsetLeft + elem.clientWidth;\r\n\t\t}\r\n\r\n\t\tif (elem.offsetTop + elem.clientHeight > Number(EndY) || index === 0) {\r\n\t\t\tEndY = elem.offsetTop + elem.clientHeight;\r\n\t\t}\r\n\t});\r\n\r\n\tconst signatureOk = document.getElementById(\"signatureOk\");\r\n\tif (selectedAreas.length !== 0) {\r\n\t\t$(\".positionChoice\").each((_index, item) => {\r\n\t\t\tconst asInt = Number.parseInt(item.id).toString();\r\n\t\t\tconst itemEl = (item.attributes as any).style.ownerElement;\r\n\t\t\tif (\r\n\t\t\t\titemEl.offsetLeft >= Number(StartX) &&\r\n\t\t\t\titemEl.offsetLeft + itemEl.clientWidth <= Number(EndX) &&\r\n\t\t\t\titemEl.offsetTop >= Number(StartY) &&\r\n\t\t\t\titemEl.offsetTop + itemEl.clientHeight <= Number(EndY) &&\r\n\t\t\t\t!selectedAreas.includes(asInt)\r\n\t\t\t) {\r\n\t\t\t\titem.style.backgroundColor = \"rgb(180, 180, 0, 0.3)\";\r\n\t\t\t} else if (!selectedAreas.includes(asInt)) {\r\n\t\t\t\titem.style.backgroundColor = \"rgb(8, 152, 214, 0.3)\";\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tsignatureOk?.removeAttribute(\"disabled\");\r\n\t} else {\r\n\t\tsignatureOk?.setAttribute(\"disabled\", \"true\");\r\n\t}\r\n}\r\n\r\nexport function setSignatureMultiPageParams(addSignature: boolean) {\r\n\tshowMultiDocSigDialog = false;\r\n\taddSignatureOnAllPages = addSignature;\r\n\tif (addSignatureOnAllPages) {\r\n\t\tif ($(\"#signCountFromBeginning\").is(\":checked\")) {\r\n\t\t\tsignatureCountFromEnd = false;\r\n\t\t} else if ($(\"#signCountFromEnd\").is(\":checked\")) {\r\n\t\t\tsignatureCountFromEnd = true;\r\n\t\t}\r\n\t}\r\n\tCloseAdditionalDialog();\r\n\t$(\"#cardPIN\").focus();\r\n}\r\n\r\nexport function hidePDF() {\r\n\tlet okWithCoors = false;\r\n\tlet withVisible = false;\r\n\r\n\tif (StartX == null || EndX == null || StartY == null || EndY == null) {\r\n\t\t// bez podania koordynat, nie b\u0119dzie reprezentacji graficznej\r\n\r\n\t\tcalculatedStartX = -1;\r\n\t\tcalculatedStartY = -1;\r\n\t\tcalculatedWidth = -1;\r\n\t\tcalculatedHeight = -1;\r\n\r\n\t\tokWithCoors = true;\r\n\t} else {\r\n\t\tconst rotationPDF = Number.parseInt(originalRotation.toString());\r\n\t\tlet scaleX = 1;\r\n\t\tlet scaleY = 1;\r\n\t\tif (rotationPDF === 90 || rotationPDF === 270) {\r\n\t\t\tscaleX = displayWidth / Number(originalHeight);\r\n\t\t\tscaleY = displayHeight / Number(originalWidth);\r\n\t\t\tconst temp = originalHeight;\r\n\t\t\toriginalHeight = originalWidth;\r\n\t\t\toriginalWidth = temp;\r\n\t\t} else {\r\n\t\t\tscaleX = displayWidth / Number(originalWidth);\r\n\t\t\tscaleY = displayHeight / Number(originalHeight);\r\n\t\t}\r\n\r\n\t\tcalculatedStartX = Number.parseInt((StartX / scaleX).toString());\r\n\t\tcalculatedStartY = Number.parseInt((StartY / scaleY).toString());\r\n\t\tcalculatedWidth = Number.parseInt(((EndX - StartX) / scaleX).toString());\r\n\t\tcalculatedHeight = Number.parseInt(((EndY - StartY) / scaleY).toString());\r\n\r\n\t\tif (calculatedStartX < 0) {\r\n\t\t\t//lewo\r\n\t\t\tcalculatedStartX = 10;\r\n\t\t}\r\n\r\n\t\tif (calculatedStartY < 0) {\r\n\t\t\t//g\u00F3ra\r\n\t\t\tcalculatedStartY = 10;\r\n\t\t}\r\n\r\n\t\tif (calculatedStartX + calculatedWidth > originalWidth) {\r\n\t\t\t//prawo\r\n\t\t\tcalculatedStartX = Number.parseInt(\r\n\t\t\t\t(originalWidth - calculatedWidth - 10).toString()\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (calculatedStartY + calculatedHeight > originalHeight) {\r\n\t\t\t//d\u00F3\u0142\r\n\t\t\tcalculatedStartY = Number.parseInt(\r\n\t\t\t\t(originalHeight - calculatedHeight - 10).toString()\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tcalculatedStartX < 0 ||\r\n\t\t\tcalculatedStartY < 0 ||\r\n\t\t\tcalculatedWidth < 0 ||\r\n\t\t\tcalculatedHeight < 0\r\n\t\t) {\r\n\t\t\tconst area = `${calculatedStartX}, ${calculatedStartY}, ${calculatedWidth}, ${calculatedHeight}`;\r\n\t\t\tshowDxToast(\r\n\t\t\t\t`Zaznaczono nieprawid\u0142owe koordynaty [${area}]. Spr\u00F3buj ponownie.`,\r\n\t\t\t\t\"warning\"\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\tokWithCoors = true;\r\n\t\t\twithVisible = true;\r\n\t\t}\r\n\t}\r\n\r\n\tif (okWithCoors) {\r\n\t\tif (\r\n\t\t\t(globalItemsSelectedByUser?.length ?? 0) > 1 &&\r\n\t\t\tshowMultiDocSigDialog &&\r\n\t\t\twithVisible\r\n\t\t) {\r\n\t\t\tconst popup = $(\"#devex-dialog-additional\").dxPopup(\"instance\");\r\n\t\t\tpopup.option(\"minWidth\", calcMinPopup(700));\r\n\t\t\tpopup.option(\"minHeight\", calcMinPopup(200, true));\r\n\t\t\tpopup.option(\"title\", \"Wybra\u0142e\u015B wi\u0119cej dokument\u00F3w\");\r\n\t\t\tpopup.option(\"showTitle\", true);\r\n\t\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog-Additional\"));\r\n\t\t\tpopup.show();\r\n\t\t\tpopup\r\n\t\t\t\t.content()\r\n\t\t\t\t?.parent()\r\n\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t\t$(\"#Dialog-Additional\").empty();\r\n\t\t\t$(\"#Dialog-Additional\").append(`
            \r\n

            Czy chcesz doda\u0107 podpis w tym samym miejscu na ka\u017Cdym dokumencie?

            \r\n

            Podpis zostanie z\u0142o\u017Cony na tej samej stronie, licz\u0105c od:

            \r\n
            \r\n
            \r\n
            \r\n \r\n \r\n
            \r\n
            \r\n \r\n \r\n
            \r\n
            \r\n
            \r\n
            `);\r\n\r\n\t\t\tpopup\r\n\t\t\t\t.content()\r\n\t\t\t\t.find(\".DialogFooter\")\r\n\t\t\t\t.empty()\r\n\t\t\t\t.append(`\r\n\t\t\t\t
            \r\n \r\n \r\n
            \r\n\t\t\t`);\r\n\r\n\t\t\tpopup.repaint();\r\n\t\t\tpopup.show();\r\n\t\t} else {\r\n\t\t\t$(\"#cardPIN\").focus();\r\n\t\t}\r\n\r\n\t\tCloseBigDialog();\r\n\t}\r\n}\r\n\r\nexport function ChangeSignDocumentPage(\r\n\tpage: number,\r\n\tuniversal: boolean,\r\n\twhere = $(\"#SignHereImage\"),\r\n\tid = itemsToSign[0]\r\n) {\r\n\tconst parentDiv = where.parent().parent();\r\n\tconst pdfPreview = where.attr(\"id\") === \"pdfImage\";\r\n\taddSkeletonLoading(parentDiv);\r\n\r\n\t$.ajax({\r\n\t\turl:\r\n\t\t\tGetBaseUrl() +\r\n\t\t\t(universal ? \"/Vario/GetPDFasImagesShareSign\" : \"/Vario/GetPDFasImages\"),\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tdata: { id: id, page: page, pdfPreview: pdfPreview },\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tlastMD5 = response?.data?.mD5;\r\n\t\t\t\tconst SignHereImage = where[0] as HTMLImageElement;\r\n\t\t\t\tif (!SignHereImage) return;\r\n\t\t\t\tSignHereImage.classList.remove(\"hidden\");\r\n\t\t\t\tconst img = new Image();\r\n\r\n\t\t\t\tif (where.attr(\"id\") === \"SignHereImage\") {\r\n\t\t\t\t\timg.addEventListener(\r\n\t\t\t\t\t\t\"load\",\r\n\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\toriginalHeight = response.data.height;\r\n\t\t\t\t\t\t\toriginalWidth = response.data.width;\r\n\t\t\t\t\t\t\tcurrentSignDocumentPage = page;\r\n\t\t\t\t\t\t\tcurrentSignDocumentPageCount = response.data.pagesCount;\r\n\t\t\t\t\t\t\tdisplayHeight = SignHereImage.offsetHeight;\r\n\t\t\t\t\t\t\tdisplayWidth = SignHereImage.offsetWidth;\r\n\t\t\t\t\t\t\toriginalRotation = response.data.rotation;\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tfalse\r\n\t\t\t\t\t);\r\n\t\t\t\t} else if (pdfPreview) {\r\n\t\t\t\t\tcurrentPDFImagePage = page;\r\n\t\t\t\t\tcurrentPDFImagePageCount = response.data.pagesCount;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$(\r\n\t\t\t\t\t\"#nextSignDocPage, #nextPDFDocPage, #lastPDFDocPage, #lastSignDocPage\"\r\n\t\t\t\t)\r\n\t\t\t\t\t.toggleClass(\"disabled\", response.data.pagesCount <= page + 1)\r\n\t\t\t\t\t.attr(\r\n\t\t\t\t\t\t\"disabled\",\r\n\t\t\t\t\t\tresponse.data.pagesCount <= page + 1 ? \"disabled\" : null\r\n\t\t\t\t\t);\r\n\t\t\t\t$(\r\n\t\t\t\t\t\"#prevSignDocPage, #prevPDFDocPage, #firstPDFDocPage, #firstSignDocPage\"\r\n\t\t\t\t)\r\n\t\t\t\t\t.toggleClass(\"disabled\", page <= 0)\r\n\t\t\t\t\t.attr(\"disabled\", page <= 0 ? \"disabled\" : null);\r\n\r\n\t\t\t\timg.src = response.data.image;\r\n\t\t\t\tSignHereImage.src = img.src;\r\n\t\t\t} else {\r\n\t\t\t\tif (response?.message?.includes(\"Index was out of range\")) {\r\n\t\t\t\t\tshowDxToast(\"Strona nie istnieje\", \"error\");\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tif (response?.message === \"NoPermissions\")\r\n\t\t\t\t\tresponse.message = \"Brak uprawnie\u0144\";\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\tresponse?.message ?? \"B\u0142\u0105d podczas \u0142adowania obrazu\",\r\n\t\t\t\t\t\"error\"\r\n\t\t\t\t);\r\n\r\n\t\t\t\tif (where.attr(\"id\") === \"SignHereImage\") {\r\n\t\t\t\t\tCloseBigDialog();\r\n\t\t\t\t\tCloseAdditionalDialog();\r\n\t\t\t\t\tCloseDialog();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (err) => {\r\n\t\t\tconsole.log(err);\r\n\t\t\tconst SignHereImage = where[0];\r\n\t\t\tSignHereImage.classList.remove(\"hidden\");\r\n\t\t\tif (err?.responseText?.includes(\"NoPermissions\")) {\r\n\t\t\t\tshowDxToast(\"Brak uprawnie\u0144\", \"error\");\r\n\t\t\t\tif (where.attr(\"id\") === \"SignHereImage\") {\r\n\t\t\t\t\tCloseBigDialog();\r\n\t\t\t\t\tCloseAdditionalDialog();\r\n\t\t\t\t\tCloseDialog();\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"Strona nie istnieje\", \"error\");\r\n\t\t\t}\r\n\t\t},\r\n\t\tcomplete: () => {\r\n\t\t\tremoveSkeletonLoading(parentDiv);\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function enableUniversalSignButton() {\r\n\tconst enable =\r\n\t\t!stringIsNullOrEmpty($(\"#personData\").val()?.valueOf().toString().trim()) &&\r\n\t\t(!$(\"#termsOfService\").length || $(\"#termsOfService\").is(\":checked\"));\r\n\r\n\t$(\"#universalSigButton\")\r\n\t\t.toggleClass(\"disabled\", !enable)\r\n\t\t.attr(\"disabled\", enable ? null : \"disabled\");\r\n}\r\n\r\nexport function successSignedPdf(rejected: boolean) {\r\n\tconst infoText = rejected\r\n\t\t? \"Podpisanie dokumentu zosta\u0142o odrzucone.\"\r\n\t\t: \"Zako\u0144czono podpisywanie dokumentu.
            Podpisany dokument zostanie wys\u0142any na tw\u00F3j adres email.\";\r\n\r\n\t$(\".universalSigContainer\").empty();\r\n\t$(\".universalSigContainer\").append(`\r\n \r\n
            \r\n
            \r\n\r\n
            \r\n
            \r\n
            \r\n

            ${infoText}

            \r\n

            Dzi\u0119kujemy.

            \r\n
            \r\n
            \r\n `);\r\n}\r\n\r\nexport function noSignaturePopup() {\r\n\tconst popup = $(\"#devex-extra-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(400));\r\n\tpopup.option(\"minHeight\", calcMinPopup(120, true));\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\r\n\t\t\"title\",\r\n\t\tsignatureAsInitialing ? \"Parafowanie...\" : \"Podpisywanie...\"\r\n\t);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevExtraDialog\"));\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t$(\"#ExtraDialog\").empty();\r\n\t$(\"#ExtraDialog\").append(`
            \r\n

            Zaznacz miejsce dla ${signatureAsInitialing ? \"parafki\" : \"podpisu\"}.
            Kontynuuj\u0105c, ${signatureAsInitialing ? \"sparafujesz\" : \"podpiszesz\"} dokument bez widocznego znaku graficznego.

            \r\n

            Czy kontynuowa\u0107?

            \r\n `);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(`\r\n\t
            \r\n \r\n
            \r\n
            `);\r\n\r\n\t$(\"#acceptNoSigBtn\").on(\"click\", () => {\r\n\t\tCloseExtraDialog();\r\n\r\n\t\t$(\"#universalSigButton\").attr(\"data-acceptNoSig\", \"true\");\r\n\t\t$(\"#universalSigButton\").trigger(\"click\");\r\n\t\t$(\"#signatureOk\").attr(\"data-acceptNoSig\", \"true\");\r\n\t\t$(\"#signatureOk\").trigger(\"click\");\r\n\t});\r\n}\r\n\r\nexport function rejectSignPopup() {\r\n\tconst popup = $(\"#devex-extra-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(350));\r\n\tpopup.option(\"minHeight\", calcMinPopup(200, true));\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"title\", \"Odrzucenie podpisu\");\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevExtraDialog\"));\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t$(\"#ExtraDialog\").empty();\r\n\t$(\"#ExtraDialog\").append(`
            \r\n\t\t

            Odrzucenie spowoduje odes\u0142anie do zlecaj\u0105cego podpis powiadomienia o odrzuceniu wraz z infromacj\u0105 kt\u00F3r\u0105 mo\u017Cesz wpisa\u0107 poni\u017Cej:

            \r\n \r\n
            \r\n
            `);\r\n\r\n\tif (sendMailViaMailBridge === \"True\") {\r\n\t\t$(\".supportMessage .carbonCopyContainer\").append(\r\n\t\t\t`\r\n \r\n\t\t\t`\r\n\t\t);\r\n\r\n\t\tif (currentUserEmail?.length) {\r\n\t\t\t$(\"#emailInputCopySupport\").val(currentUserEmail);\r\n\t\t}\r\n\t\tconst checkbox = document.getElementById(\"carboncopy\");\r\n\t\tcheckbox?.addEventListener(\"change\", (event) => {\r\n\t\t\tif ((event?.currentTarget as HTMLInputElement)?.checked) {\r\n\t\t\t\t$(\"#emailInputCopySupport\").removeClass(\"disabled\");\r\n\t\t\t\t$(\"#emailInputCopySupport\").removeClass(\"cursorDisabled\");\r\n\t\t\t\t$(\"#emailInputCopySupport\").attr(\"disabled\", null);\r\n\t\t\t} else {\r\n\t\t\t\t$(\"#emailInputCopySupport\").addClass(\"disabled\");\r\n\t\t\t\t$(\"#emailInputCopySupport\").addClass(\"cursorDisabled\");\r\n\t\t\t\t$(\"#emailInputCopySupport\").attr(\"disabled\", \"disabled\");\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.append(\r\n\t\t\t``\r\n\t\t);\r\n}\r\n\r\nexport function sendMessageToSupport() {\r\n\tconst body = $(\"#supportMessage\").val()?.valueOf().toString() ?? \"\";\r\n\tconst subject = $(\"#supportTitle\").val()?.valueOf().toString() ?? \"\";\r\n\r\n\tlet recipient = supportEmail;\r\n\r\n\tconst sendCopy = (document.querySelector(\"#carboncopy\") as HTMLInputElement)\r\n\t\t?.checked;\r\n\tif (\r\n\t\tsendCopy &&\r\n\t\t(document.getElementById(\"emailInputCopySupport\") as HTMLInputElement)\r\n\t\t\t?.value?.length > 0\r\n\t) {\r\n\t\trecipient += `,${(document.getElementById(\"emailInputCopySupport\") as HTMLInputElement)?.value}`;\r\n\t}\r\n\r\n\tif (sendMailViaMailBridge === \"True\") {\r\n\t\t$(\"#sendMessageToSupport\").attr(\"disabled\", \"disabled\");\r\n\t\t$(\"#sendMessageToSupport\").addClass(\"disabled\");\r\n\t\tShowLoadingPanel(\"Wysy\u0142anie wiadomo\u015Bci...\");\r\n\t\ttry {\r\n\t\t\t$.ajax({\r\n\t\t\t\turl: `${GetBaseUrl()}/Vario/SendMailViaMailBridge`,\r\n\t\t\t\ttype: \"Post\",\r\n\t\t\t\tdataType: \"json\",\r\n\t\t\t\tcache: false,\r\n\t\t\t\tdata: {\r\n\t\t\t\t\trecipients: recipient,\r\n\t\t\t\t\trecipientsOS: \"\",\r\n\t\t\t\t\temailReason: \"supportEmail\",\r\n\t\t\t\t\tshareLink: \"\",\r\n\t\t\t\t\ttitle: subject,\r\n\t\t\t\t\tbody: body,\r\n\t\t\t\t\tdescItem: \"\",\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\t\t\tif (response.success === true) {\r\n\t\t\t\t\t\tshowDxToast(\"Zlecono wys\u0142anie wiadomo\u015Bci.\", \"success\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tshowDxToast(\"Nie uda\u0142o si\u0119 wys\u0142a\u0107 wiadomo\u015Bci\", \"error\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t\tCloseDialog();\r\n\t\t\t\t\t$(\"#sendMessageToSupport\").attr(\"disabled\", null);\r\n\t\t\t\t\t$(\"#sendMessageToSupport\").removeClass(\"disabled\");\r\n\t\t\t\t},\r\n\t\t\t\terror: (error) => {\r\n\t\t\t\t\tconsole.log(error);\r\n\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t\t$(\"#sendMessageToSupport\").attr(\"disabled\", null);\r\n\t\t\t\t\t$(\"#sendMessageToSupport\").removeClass(\"disabled\");\r\n\t\t\t\t},\r\n\t\t\t});\r\n\t\t} catch (e) {\r\n\t\t\tconsole.log(e);\r\n\t\t\tHideLoadingPanel();\r\n\t\t\t$(\"#sendMessageToSupport\").attr(\"disabled\", null);\r\n\t\t\t$(\"#sendMessageToSupport\").removeClass(\"disabled\");\r\n\t\t}\r\n\t} else {\r\n\t\tconst mailToLink = `mailto:${recipient}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;\r\n\t\tlet $a = $(\"#reply\");\r\n\t\tif ($a.length === 0) {\r\n\t\t\t$a = $(``);\r\n\t\t}\r\n\t\t$a[0].click();\r\n\t}\r\n}\r\n\r\nexport function showCurrentUserOptions() {\r\n\tmanageUserPopup(\r\n\t\tcurrentUserId,\r\n\t\tcurrentUserName,\r\n\t\tisSiteAdmin,\r\n\t\tcurrentUserEmail\r\n\t);\r\n}\r\n\r\nexport function changeUserPassword() {\r\n\tshowChangeUserPasswordPopup(currentUserEmail);\r\n}\r\n\r\nexport function showChangeUserPasswordPopup(currentUserEmail: string) {\r\n\tconst popup = $(\"#devex-dialog-additional\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(550));\r\n\tpopup.option(\"minHeight\", calcMinPopup(220, true));\r\n\tpopup.option(\"title\", \"Zmiana has\u0142a\");\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog-Additional\"));\r\n\tpopup.option(\"onHiding\", () => {\r\n\t\t$(\".focusInPopup\").removeClass(\"focusInPopup\");\r\n\t});\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\tpopup.content().find(\".DialogFooter\").empty();\r\n\r\n\t$(\"#Dialog-Additional\").empty();\r\n\t$(\"#Dialog-Additional\").append(`\r\n
            \r\n
            \r\n\t\t\t\t\t\t\r\n\t\t\t\t\t
            \r\n \r\n \r\n
            \r\n
            \r\n \r\n \r\n
            \r\n
            \r\n \r\n \r\n
            \r\n
            \r\n\t\t\t\t

            \r\n
            `);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.append(`
            \r\n \r\n
            `);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\"#changePasswordContainer input\")\r\n\t\t.on(\"keyup\", () => {\r\n\t\t\tconst inputUserCurrentPassword = $(\"#inputUserCurrentPassword\").val();\r\n\t\t\tconst inputUserNewPassword = $(\"#inputUserNewPassword\").val();\r\n\t\t\tconst inputRepeatNewPassword = $(\"#inputRepeatNewPassword\").val();\r\n\r\n\t\t\tconst canSubmit =\r\n\t\t\t\tinputUserCurrentPassword &&\r\n\t\t\t\tinputUserNewPassword &&\r\n\t\t\t\tinputRepeatNewPassword;\r\n\t\t\t$(\"#updateUserPassword\")\r\n\t\t\t\t.toggleClass(\"disabled\", !canSubmit)\r\n\t\t\t\t.attr(\"disabled\", canSubmit ? null : \"disabled\");\r\n\t\t});\r\n\r\n\tpopup.repaint();\r\n}\r\n\r\nexport function updateUserPassword(currentUserEmail: string) {\r\n\tconst currentPassword = $(\"#inputUserCurrentPassword\").val();\r\n\tconst newPassword = $(\"#inputUserNewPassword\").val();\r\n\tconst newPasswordRepeat = $(\"#inputRepeatNewPassword\").val();\r\n\r\n\tif (newPassword !== newPasswordRepeat) {\r\n\t\tshowDxToast(\"Wprowadzone has\u0142a nie s\u0105 identyczne!\", \"error\");\r\n\t\treturn;\r\n\t}\r\n\r\n\tShowLoadingPanel(\"Trwa zmienianie has\u0142a...\");\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/VarioAdmin/UpdatePassword`,\r\n\t\ttype: \"Post\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: false,\r\n\t\tdata: {\r\n\t\t\temail: currentUserEmail,\r\n\t\t\tcurrentPassword: currentPassword,\r\n\t\t\tnewPassword: newPassword,\r\n\t\t},\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (\r\n\t\t\t\tresponse != null &&\r\n\t\t\t\tresponse.success != null &&\r\n\t\t\t\tresponse.success === true\r\n\t\t\t) {\r\n\t\t\t\tshowDxToast(\"Has\u0142o zosta\u0142o zmienione\", \"success\");\r\n\t\t\t\tCloseAdditionalDialog();\r\n\t\t\t} else {\r\n\t\t\t\t$(\"#changePasswordErrSummary\").empty();\r\n\t\t\t\tif (response?.code !== 401) {\r\n\t\t\t\t\tshowDxToast(response?.message ?? \"B\u0142\u0105d zmiany has\u0142a\", \"error\");\r\n\t\t\t\t} else if (response?.code === 401) {\r\n\t\t\t\t\t$(\"#changePasswordErrSummary\").append(response?.message ?? \"\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshowDxToast(\"B\u0142\u0105d zmiany has\u0142a\", \"error\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_, __, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t},\r\n\t\tcomplete: () => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function manageSiteParameters(reload?: boolean) {\r\n\tif (!reload && $(\"#siteParameters\").children().length) return;\r\n\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\ttry {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetAllSiteParameters`,\r\n\t\t\ttype: \"GET\",\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tconsole.log(response);\r\n\t\t\t\tif (response?.success === true) {\r\n\t\t\t\t\t$(\"#siteParameters\").empty();\r\n\r\n\t\t\t\t\tif ((isAdmin || isSiteAdmin) && $(\"#addParameterBtn\").length === 0) {\r\n\t\t\t\t\t\t$(\"#siteParametersContainer .panel-body\").append(`\r\n `);\r\n\r\n\t\t\t\t\t\t$(\"#addParameterBtn\").on(\"click\", () => {\r\n\t\t\t\t\t\t\tsiteParameterPopup();\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (response.data.length > 0) {\r\n\t\t\t\t\t\t$(\"#siteParameters\").append(`
            `);\r\n\r\n\t\t\t\t\t\tfor (const param of response.data) {\r\n\t\t\t\t\t\t\tconst paramDiv =\r\n\t\t\t\t\t\t\t\t$(`
            \r\n\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t
            `).appendTo(\"#all-parameters\");\r\n\r\n\t\t\t\t\t\t\tparamDiv.on(\"click\", () => {\r\n\t\t\t\t\t\t\t\tsiteParameterPopup(param);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tshowDxToast(\"B\u0142\u0105d pobierania danych\", \"error\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: (_, __, error) => {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t\tshowDxToast(\"B\u0142\u0105d pobierania danych\", \"error\");\r\n\t\t\t},\r\n\t\t});\r\n\t} catch (_) {\r\n\t\tHideLoadingPanel();\r\n\t}\r\n}\r\n\r\nexport function siteParameterPopup(param?: SiteParameter) {\r\n\tconst popup = $(\"#devex-dialog-additional\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(500));\r\n\tpopup.option(\"minHeight\", calcMinPopup(220, true));\r\n\tpopup.option(\"title\", param ? \"Edytuj parametr\" : \"Dodaj parametr\");\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog-Additional\"));\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\tpopup.content().find(\".DialogFooter\").empty();\r\n\r\n\t$(\"#Dialog-Additional\").empty();\r\n\t$(\"#Dialog-Additional\").append(`\r\n
            \r\n
            \r\n \r\n \r\n
            \r\n
            \r\n \r\n \r\n
            \r\n\r\n
            \r\n
            `);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.append(`
            \r\n
            `);\r\n\r\n\t$(\"#deleteParamBtn\").on(\"click\", () => {\r\n\t\tdeleteSiteParameter(param?.key ?? \"\");\r\n\t});\r\n\r\n\t$(\"#saveParamBtn\").on(\"click\", () => {\r\n\t\tlet keyObj = \"\";\r\n\t\tif (param?.key) {\r\n\t\t\tkeyObj = param.key;\r\n\t\t} else {\r\n\t\t\tkeyObj = $(\"#siteKeyInput\").val()?.toString() ?? \"\";\r\n\t\t}\r\n\r\n\t\tconst value = $(\"#siteValueInput\").val()?.toString() ?? \"\";\r\n\r\n\t\tupdateSiteParametetr(keyObj, value);\r\n\t});\r\n\r\n\tif (!param?.key) $(\"#deleteParamBtn\").remove();\r\n}\r\n\r\nexport function updateSiteParametetr(key: string, value: string) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\ttry {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/UpdateSiteParameter`,\r\n\t\t\ttype: \"Post\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: { key: key, value: value },\r\n\t\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tif (debug) console.log(response);\r\n\t\t\t\tif (response?.success === true) {\r\n\t\t\t\t\tCloseAdditionalDialog();\r\n\t\t\t\t\tmanageSiteParameters(true);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshowDxToast(\"B\u0142\u0105d aktualizacji danych\", \"error\");\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: (_, __, error) => {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t\tshowDxToast(\"B\u0142\u0105d aktualizacji danych\", \"error\");\r\n\t\t\t},\r\n\t\t});\r\n\t} catch (_) {\r\n\t\tHideLoadingPanel();\r\n\t}\r\n}\r\n\r\nexport function deleteSiteParameter(key: string) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\ttry {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/DeleteSiteParameter`,\r\n\t\t\ttype: \"Post\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: { key: key },\r\n\t\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tif (debug) console.log(response);\r\n\t\t\t\tif (response?.success === true) {\r\n\t\t\t\t\tCloseAdditionalDialog();\r\n\t\t\t\t\tmanageSiteParameters(true);\r\n\t\t\t\t\tshowDxToast(\"Usuni\u0119to pomy\u015Blnie\", \"success\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshowDxToast(\"B\u0142\u0105d usuwania danych\", \"error\");\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: (_, __, error) => {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t\tshowDxToast(\"B\u0142\u0105d usuwania danych\", \"error\");\r\n\t\t\t},\r\n\t\t});\r\n\t} catch (_) {\r\n\t\tHideLoadingPanel();\r\n\t}\r\n}\r\n", "import \"../types/dx.all.d.ts\";\r\nimport type {\r\n\tAbstractDiagramLayout,\r\n\tLogonRequired,\r\n\tVirtualNode,\r\n\tworkflowDiagramLayout,\r\n} from \"../types/models/vario-types\";\r\nimport { GetBaseUrl, changeCurrentItem } from \"./page-navigation\";\r\nimport {\r\n\tCloseDialog,\r\n\tHideLoadingPanel,\r\n\taddSkeletonLoading,\r\n\tfixScrollInDx,\r\n\tisRunningOnMobile,\r\n\tremoveSkeletonLoading,\r\n\tshowDxToast,\r\n\twaitForElm,\r\n} from \"./site\";\r\nimport { fitPreviewHeightToScreenAddListener } from \"./vario-object-side-panel\";\r\n\r\nlet traveledLinks: any[] = [];\r\nlet traveledNodes: any[] = [];\r\nlet currentState = \"\";\r\nlet nodesData: any[] = [];\r\nlet linksData: any[] = [];\r\n\r\nconst diagramFullscreenObserver = new MutationObserver((mutations) => {\r\n\tfor (const mutation of mutations) {\r\n\t\tif (mutation.attributeName === \"class\") {\r\n\t\t\tsetDiagramScrollToBottom(\"varioObjectProgDiagram\");\r\n\t\t}\r\n\t}\r\n});\r\n\r\nexport function itemTypeExpr(obj) {\r\n\tif (obj.Shape == null) {\r\n\t\treturn \"ellipse\";\r\n\t}\r\n\r\n\tif (obj.Shape[\"@Style\"] === \"AlternateProcess\") {\r\n\t\treturn \"rectangle\";\r\n\t}\r\n\tif (obj.Shape[\"@Style\"] === \"Decision\") {\r\n\t\treturn \"diamond\";\r\n\t}\r\n}\r\nexport function itemTypeExprProgressive(obj) {\r\n\t//Node udaj\u0105cy opis na strza\u0142ce\r\n\t//if (obj.shape == null) {\r\n\t// return \"rectangle\";\r\n\t//}\r\n\r\n\t//Node udaj\u0105cy opis na strza\u0142ce z liczb\u0105 lini mniej ni\u017C 4 wi\u0119c nie trzeba dok\u0142ada\u0107 3 kropek\r\n\tif (obj.shape == null && obj.text) {\r\n\t\tlet textToCount = obj.text;\r\n\t\ttextToCount = textToCount.trim();\r\n\t\tconst lineCount = textToCount.split(/\\r?\\n/).length;\r\n\t\t//Chcemy pokazywa\u0107 max 4 linie\r\n\t\tif (lineCount < 4) return \"rectangle\";\r\n\t}\r\n\r\n\t//Dummy node robi\u0105cy margin\r\n\tif (obj?.tag === \"DummyMargin\") {\r\n\t\treturn \"rectangle\";\r\n\t}\r\n\r\n\treturn `customShape${obj.id}`;\r\n}\r\n\r\nexport function widthNodeExpr(obj) {\r\n\treturn obj[\"@Width\"] / 100;\r\n}\r\nexport function heightNodeExpr(obj) {\r\n\treturn obj[\"@Height\"] / 100;\r\n}\r\nexport function widthNodeExprProgressive(obj) {\r\n\t//Node udaj\u0105cy opis na strza\u0142ce\r\n\tif (obj.width === 0) {\r\n\t\tobj.width = 340;\r\n\t}\r\n\r\n\tif (obj.autoSize !== \"NodeToText\") {\r\n\t\treturn obj.width / 100;\r\n\t}\r\n}\r\nexport function heightNodeExprProgressive(obj) {\r\n\t//Node udaj\u0105cy opis na strza\u0142ce\r\n\tif (obj.height === 0 && obj.text != null) {\r\n\t\tconst strToDisplay = obj.text.trim();\r\n\t\tlet lineCount = strToDisplay.split(/\\r\\n|\\r|\\n/).length;\r\n\r\n\t\tobj.height = (lineCount + 2) * 12;\r\n\r\n\t\t//Chcemy pokazywa\u0107 max 4 linie\r\n\t\tif (lineCount >= 4) {\r\n\t\t\tlineCount = 4;\r\n\r\n\t\t\tobj.height = (lineCount + 3) * 12;\r\n\t\t}\r\n\t}\r\n\r\n\tif (obj.autoSize !== \"NodeToText\") {\r\n\t\treturn obj.height / 100;\r\n\t}\r\n}\r\nexport function leftNodeExpr(obj) {\r\n\treturn obj[\"@Left\"] / 100;\r\n}\r\nexport function topNodeExpr(obj) {\r\n\treturn obj[\"@Top\"] / 100;\r\n}\r\nexport function pointsLinksExpr(obj) {\r\n\tif (obj.Point != null) {\r\n\t\tif (Array.isArray(obj.Point)) {\r\n\t\t\t//Pobieramy Org i Dst dla danego edga\r\n\r\n\t\t\tif (nodesData == null || nodesData.length <= 0) return;\r\n\r\n\t\t\tconst org = nodesData.find(({ id }) => id === obj[\"@Org\"]);\r\n\t\t\tconst dst = nodesData.find(({ id }) => id === obj[\"@Dst\"]);\r\n\r\n\t\t\tif (!org || !dst) return;\r\n\r\n\t\t\tconst orgLeft = Number.parseFloat(org[\"@Left\"]);\r\n\t\t\tconst orgWidth = Number.parseFloat(org[\"@Width\"]);\r\n\t\t\tconst orgTop = Number.parseFloat(org[\"@Top\"]);\r\n\t\t\tconst orgHeight = Number.parseFloat(org[\"@Height\"]);\r\n\r\n\t\t\tconst dstLeft = Number.parseFloat(dst[\"@Left\"]);\r\n\t\t\tconst dstWidth = Number.parseFloat(dst[\"@Width\"]);\r\n\t\t\tconst dstTop = Number.parseFloat(dst[\"@Top\"]);\r\n\t\t\tconst dstHeight = Number.parseFloat(dst[\"@Height\"]);\r\n\r\n\t\t\t//Je\u017Celi jaki\u015B punkt znajduje si\u0119 w \u015Brodku lub na kraw\u0119dzi noda, usuwamy go\r\n\t\t\tfor (const element of obj.Point) {\r\n\t\t\t\tconst elX = Number.parseFloat(element[\"@X\"]);\r\n\t\t\t\tconst elY = Number.parseFloat(element[\"@Y\"]);\r\n\t\t\t\tif (\r\n\t\t\t\t\telX >= orgLeft &&\r\n\t\t\t\t\telX <= orgLeft + orgWidth &&\r\n\t\t\t\t\telY >= orgTop &&\r\n\t\t\t\t\telY <= orgTop + orgHeight\r\n\t\t\t\t) {\r\n\t\t\t\t\tobj.Point = obj.Point.filter((item) => item !== element);\r\n\t\t\t\t}\r\n\t\t\t\tif (\r\n\t\t\t\t\telX >= dstLeft &&\r\n\t\t\t\t\telX <= dstLeft + dstWidth &&\r\n\t\t\t\t\telY >= dstTop &&\r\n\t\t\t\t\telY <= dstTop + dstHeight\r\n\t\t\t\t) {\r\n\t\t\t\t\tobj.Point = obj.Point.filter((item) => item !== element);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tconst objSmall = [{ x: 0, y: 0 }];\r\n\t\t\tfor (const element of obj.Point) {\r\n\t\t\t\tobjSmall.push({\r\n\t\t\t\t\tx: element[\"@X\"] / 100,\r\n\t\t\t\t\ty: element[\"@Y\"] / 100,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tobjSmall.push({ x: 0, y: 0 });\r\n\t\t\treturn objSmall;\r\n\t\t}\r\n\t\tconst objSmall = [\r\n\t\t\t{ x: 0, y: 0 },\r\n\t\t\t{ x: obj.Point[\"@X\"] / 100, y: obj.Point[\"@Y\"] / 100 },\r\n\t\t\t{ x: 0, y: 0 },\r\n\t\t];\r\n\t\treturn objSmall;\r\n\t}\r\n}\r\n\r\nexport function linkTypeExpr() {\r\n\treturn \"straight\";\r\n}\r\n\r\nexport function styleNodeText() {\r\n\tconst result = \"font-size: 7pt; font-weight: bold; fill: rgb(10, 60, 102);\";\r\n\treturn result;\r\n}\r\n\r\nexport function styleNodeTextProgressive(obj) {\r\n\tlet result = \"font-size: 9pt; font-weight: bold; fill: rgb(10, 60, 102);\";\r\n\r\n\t//Node udaj\u0105cy strzalke\r\n\tif (obj.tag === \"NonVisible\") {\r\n\t\tresult = \"font-size: 9pt; font-weight: bold; fill: rgb(10, 60, 102);\";\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nexport function styleNode(obj) {\r\n\tlet result = \"stroke-width: 1px;\";\r\n\tif (traveledNodes.includes(obj.id)) {\r\n\t\t//Aktualny stan\r\n\t\tif (obj.Text === currentState) {\r\n\t\t\tresult += \"fill: rgb(255, 215, 200); stroke:rgb(255, 179, 150);\";\r\n\t\t}\r\n\t\t//Stany kt\u00F3re obieg przeby\u0142\r\n\t\telse {\r\n\t\t\tresult += \"fill: rgb(217, 237, 247); stroke:rgb(188, 232, 241)\";\r\n\t\t}\r\n\t}\r\n\t//Reszta stan\u00F3w\r\n\telse {\r\n\t\tresult += \"stroke: rgb(188, 193, 188); fill: rgb(232, 232, 232)\";\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nexport function styleNodeProgressive(obj) {\r\n\tlet result = \"\";\r\n\r\n\t//Dummy node na samym dole kt\u00F3ry ma dodac margin\r\n\tif (obj?.tag === \"DummyMargin\") {\r\n\t\tresult = \"stroke-width: 0px; fill: transparent;\";\r\n\t\treturn result;\r\n\t}\r\n\r\n\tif (!obj.drawWidth || obj.drawWidth === 0) {\r\n\t\tresult = \"stroke-width: 1px;\";\r\n\t} else {\r\n\t\tconst width = obj.drawWidth;\r\n\t\tresult = `stroke-width: ${width} px;`;\r\n\t}\r\n\r\n\t//Stan nieaktualny kt\u00F3ry nic nie zrobi\u0142\r\n\tif (obj.color === \"LightGray\") {\r\n\t\tresult += \"stroke: rgb(188, 193, 188);\";\r\n\t\tresult += \"fill: rgb(232, 232, 232)\";\r\n\t}\r\n\t//Stan kt\u00F3ry co\u015B zrobi\u0142\r\n\telse if (obj.color === \"DeepSkyBlue\") {\r\n\t\tresult += \"stroke: rgb(188, 232, 241);\";\r\n\t\tresult += \"fill: rgb(217, 237, 247);\";\r\n\t}\r\n\t//Stan aktualny lub ostatni\r\n\telse if (obj.color === \"OrangeRed\") {\r\n\t\tif (!obj.drawWidth || obj.drawWidth === 0) {\r\n\t\t\tresult += \"stroke: rgb(255, 179, 150);\";\r\n\t\t} else {\r\n\t\t\tresult += \"stroke: black;\";\r\n\t\t}\r\n\t\tresult += \"fill: rgb(255, 215, 200);\";\r\n\t} else if (obj.fillColor === \"Black\") {\r\n\t\tresult += \"fill: rgb(0, 0, 0)\";\r\n\t}\r\n\r\n\tif (obj.tag === \"NonVisible\") {\r\n\t\tresult = \"stroke-width: 0px;\";\r\n\t}\r\n\r\n\treturn result;\r\n}\r\n\r\nexport function styleEdgeText() {\r\n\tconst result = \"font-size: 8pt;font-weight: bold; fill: rgb(10, 60, 102);\";\r\n\treturn result;\r\n}\r\n\r\nexport function styleEdgeTextProgressive() {\r\n\tconst result =\r\n\t\t\"font-size: 9pt; font-weight: bold; fill: rgb(10, 60, 102); filter: unset;\";\r\n\treturn result;\r\n}\r\n\r\nexport function styleEdge(obj) {\r\n\tlet result = \"\";\r\n\tif (traveledLinks.includes(obj.id)) {\r\n\t\tresult += \"stroke: rgb(10, 60, 102); stroke-width: 2px;\";\r\n\t} else {\r\n\t\tresult += \"stroke: rgb(188, 193, 188); stroke-width: 1px;\";\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nexport function styleEdgeProgressive(obj) {\r\n\tlet result = \"\";\r\n\t//Dummy edge na samym dole kt\u00F3ry \u0142\u0105czy z dummy nodem\r\n\tif (obj?.tag === \"DummyMargin\") {\r\n\t\tresult = \"stroke-width: 0px; fill: transparent;\";\r\n\t\treturn result;\r\n\t}\r\n\r\n\tresult += \"stroke: rgb(10, 60, 102);stroke-width: 1px;\";\r\n\treturn result;\r\n}\r\n\r\nexport function toLineEndExprLink(obj) {\r\n\tif (traveledLinks.includes(obj.id)) {\r\n\t\treturn \"filledTriangle\";\r\n\t}\r\n\treturn \"outlinedTriangle\";\r\n}\r\n\r\nexport function toLineEndExprLinkProgressive(obj) {\r\n\tif (obj.tag === \"NoArrow\") {\r\n\t\treturn \"none\";\r\n\t}\r\n\treturn \"filledTriangle\";\r\n}\r\n\r\nexport function zIndexNode() {\r\n\treturn 200;\r\n}\r\n\r\nexport function textNode(obj) {\r\n\tconst title = obj.Text;\r\n\t//if (title.length > 13)\r\n\t// return title.substring(0, title.length / 2) + \"\\n\" + title.substring(title.length / 2, title.length);\r\n\t//else\r\n\t// return title;\r\n\r\n\t//return title.replace(/(.{13})/g, \"$1\\n\");\r\n\r\n\tif (obj.Shape == null) {\r\n\t\t//ellipse;\r\n\t\treturn title.replace(/(.{13})/g, \"$1\\n\");\r\n\t}\r\n\r\n\tif (obj.Shape[\"@Style\"] === \"AlternateProcess\") {\r\n\t\t//rectangle\r\n\t\treturn title.replace(/(.{13})/g, \"$1\\n\");\r\n\t}\r\n\tif (obj.Shape[\"@Style\"] === \"Decision\") {\r\n\t\t//diamond\r\n\t\treturn title.replace(/(.{10})/g, \"$1\\n\");\r\n\t}\r\n}\r\n\r\nexport function textNodeProgressive(obj) {\r\n\t//Node udaj\u0105cy opis na strza\u0142ce\r\n\tif (obj && obj.shape == null && obj.text) {\r\n\t\tlet strRes = obj.text.trim();\r\n\t\tconst splitted = strRes.split(/\\r?\\n/);\r\n\r\n\t\tif (splitted != null && splitted.length > 3) {\r\n\t\t\tsplitted.length = 4;\r\n\r\n\t\t\tstrRes = splitted.join(\"\\r\\n\");\r\n\t\t}\r\n\t\treturn strRes;\r\n\t}\r\n\r\n\tif (obj?.text) {\r\n\t\tconst title = obj.text.trim();\r\n\t\treturn title;\r\n\t}\r\n}\r\n\r\n\r\nexport function workflowReport(itemID: string, where = \"Dialog\") {\r\n\tif (where === \"Dialog\") {\r\n\t\tCloseDialog();\r\n\t}\r\n\r\n\tchangeCurrentItem({\r\n\t\titemId: 'Specific:WORKFLOW_REPORT',\r\n\t\tinnerCall: false,\r\n\t\tcontextKey: itemID,\r\n\t})\r\n}\r\n\r\n\r\nexport function workflowDiagramProgressive(itemID: string, where = \"Dialog\") {\r\n\tif (where === \"Dialog\") {\r\n\t\tCloseDialog();\r\n\t}\r\n\r\n\ttraveledLinks = [];\r\n\ttraveledNodes = [];\r\n\tnodesData = [];\r\n\tlinksData = [];\r\n\tcurrentState = \"\";\r\n\tlet mobileViewDiagram = false;\r\n\tlet emptyDiagram = false;\r\n\tif (\r\n\t\t/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(\r\n\t\t\tnavigator.userAgent\r\n\t\t) &&\r\n\t\twhere === \"Dialog\"\r\n\t) {\r\n\t\tmobileViewDiagram = true;\r\n\t}\r\n\tif (itemID) {\r\n\t\tif (where === \"Dialog\") {\r\n\t\t\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\t\t\tpopup.option(\"width\", \"100%\");\r\n\t\t\tpopup.option(\"height\", \"100%\");\r\n\t\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\t\t\tpopup.option(\"title\", \"Diagram progresywny\");\r\n\t\t\tpopup.option(\"showTitle\", true);\r\n\t\t\tpopup.show();\r\n\t\t\tpopup\r\n\t\t\t\t.content()\r\n\t\t\t\t?.parent()\r\n\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t?.addClass(\"popupTitleAccent\");\r\n\t\t}\r\n\t\tif (\r\n\t\t\t(!$(\"#varioObjectProgDiagram-button\").hasClass(\"active\") &&\r\n\t\t\t\t!$(\"#varioObjectDiagram-button\").hasClass(\"active\") &&\r\n\t\t\t\twhere === \"Dialog\") ||\r\n\t\t\twhere !== \"Dialog\"\r\n\t\t) {\r\n\t\t\t$(\".dxDiagramContainer\").empty();\r\n\t\t}\r\n\r\n\t\t$(`#${where}`).empty();\r\n\t\taddSkeletonLoading(`#${where}`);\r\n\r\n\t\tif (mobileViewDiagram) {\r\n\t\t\t//CloseDialog();\r\n\t\t}\r\n\r\n\t\t$(`#${where}`).append(\r\n\t\t\t'
            '\r\n\t\t);\r\n\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetWorkflowProgressiveDiagram`,\r\n\t\t\ttype: \"GET\",\r\n\t\t\tdataType: \"JSON\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: { itemFullID: itemID },\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tsuccess: (data: AbstractDiagramLayout & LogonRequired) => {\r\n\t\t\t\tif (data && data.canRead === false) {\r\n\t\t\t\t\tCloseDialog();\r\n\t\t\t\t\tshowDxToast(\"Brak uprawnie\u0144 do odczytu!\", \"error\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (data && data.nodes.length > 0) {\r\n\t\t\t\t\temptyDiagram = false;\r\n\t\t\t\t\tconsole.log(data);\r\n\r\n\t\t\t\t\tconst toolbar = {\r\n\t\t\t\t\t\tcommands: [\r\n\t\t\t\t\t\t\t{ name: \"zoomLevel\", text: \"Poziom przybli\u017Cenia\" },\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tname: \"export\",\r\n\t\t\t\t\t\t\t\ticon: \"export\",\r\n\t\t\t\t\t\t\t\ttext: \"Eksport do pliku\",\r\n\t\t\t\t\t\t\t\titems: [\r\n\t\t\t\t\t\t\t\t\t{ name: \"exportSvg\", text: \"Eksport do SVG\" },\r\n\t\t\t\t\t\t\t\t\t{ name: \"exportPng\", text: \"Eksport do PNG\" },\r\n\t\t\t\t\t\t\t\t\t{ name: \"exportJpg\", text: \"Eksport do JPG\" },\r\n\t\t\t\t\t\t\t\t],\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t],\r\n\t\t\t\t\t};\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\twhere === \"varioObjectProgDiagram\" &&\r\n\t\t\t\t\t\t($(window).height() ?? 0) > 800\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\ttoolbar.commands.push({ name: \"fullScreen\", text: \"Pe\u0142en ekran\" });\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t$(`#${where} #diagram`).dxDiagram({\r\n\t\t\t\t\t\tnodes: {\r\n\t\t\t\t\t\t\tdataSource: new DevExpress.data.ArrayStore({\r\n\t\t\t\t\t\t\t\tkey: \"idNode\",\r\n\t\t\t\t\t\t\t\tdata: data.nodes,\r\n\t\t\t\t\t\t\t}),\r\n\t\t\t\t\t\t\ttextExpr: textNodeProgressive, //\"text\",\r\n\t\t\t\t\t\t\ttypeExpr: itemTypeExprProgressive,\r\n\t\t\t\t\t\t\theightExpr: heightNodeExprProgressive,\r\n\t\t\t\t\t\t\twidthExpr: widthNodeExprProgressive,\r\n\t\t\t\t\t\t\ttextStyleExpr: styleNodeTextProgressive,\r\n\t\t\t\t\t\t\tstyleExpr: styleNodeProgressive,\r\n\t\t\t\t\t\t\tautoLayout: {\r\n\t\t\t\t\t\t\t\ttype: \"layered\",\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\tzIndexExpr: zIndexNode,\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tedges: {\r\n\t\t\t\t\t\t\tdataSource: new DevExpress.data.ArrayStore({\r\n\t\t\t\t\t\t\t\tkey: \"idLink\",\r\n\t\t\t\t\t\t\t\tdata: data.links,\r\n\t\t\t\t\t\t\t}),\r\n\t\t\t\t\t\t\ttextExpr: \"text\",\r\n\t\t\t\t\t\t\tfromExpr: \"orgId\",\r\n\t\t\t\t\t\t\ttoExpr: \"dstId\",\r\n\t\t\t\t\t\t\tlineTypeExpr: linkTypeExpr,\r\n\t\t\t\t\t\t\ttextStyleExpr: styleEdgeTextProgressive,\r\n\t\t\t\t\t\t\tstyleExpr: styleEdgeProgressive,\r\n\t\t\t\t\t\t\ttoLineEndExpr: toLineEndExprLinkProgressive,\r\n\t\t\t\t\t\t\t//fromPointIndexExpr: \"0\",\r\n\t\t\t\t\t\t\t//toPointIndexExpr: \"0\",\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tcustomShapes: data.nodes.map((emp) => ({\r\n\t\t\t\t\t\t\ttype: `customShape${emp.id}`,\r\n\t\t\t\t\t\t\tbaseType:\r\n\t\t\t\t\t\t\t\temp.shape == null\r\n\t\t\t\t\t\t\t\t\t? \"rectnagle\"\r\n\t\t\t\t\t\t\t\t\t: emp.shape === \"Ellipse\"\r\n\t\t\t\t\t\t\t\t\t\t? \"ellipse\"\r\n\t\t\t\t\t\t\t\t\t\t: \"terminator\",\r\n\t\t\t\t\t\t\tdefaultWidth: 1.5,\r\n\t\t\t\t\t\t\tdefaultHeight: 1,\r\n\t\t\t\t\t\t\tallowEditText: false,\r\n\t\t\t\t\t\t\tallowResize: false,\r\n\t\t\t\t\t\t})),\r\n\t\t\t\t\t\tcustomShapeTemplate(item, $container) {\r\n\t\t\t\t\t\t\tconst itemProps = (item as any).dataItem as VirtualNode;\r\n\t\t\t\t\t\t\tconst $content = $(\r\n\t\t\t\t\t\t\t\t`${\"\"}...`\r\n\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t\t$($container).append($content);\r\n\t\t\t\t\t\t\t$content\r\n\t\t\t\t\t\t\t\t.find(\".detailsWorkflowProgressiveBtn\")\r\n\t\t\t\t\t\t\t\t.on(\"click\", () => {\r\n\t\t\t\t\t\t\t\t\tshowInfo(itemProps);\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tshowGrid: false,\r\n\t\t\t\t\t\treadOnly: true,\r\n\r\n\t\t\t\t\t\tsimpleView: true,\r\n\t\t\t\t\t\tfullScreen: false,\r\n\t\t\t\t\t\tautoZoomMode: \"fitWidth\",\r\n\t\t\t\t\t\tviewToolbar: toolbar as any,\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tremoveSkeletonLoading(`#${where}`);\r\n\r\n\t\t\t\t\tif (where === \"Dialog\") {\r\n\t\t\t\t\t\twaitForElm(\"#Dialog #diagram .dxdi-main\").then(() => {\r\n\t\t\t\t\t\t\t$(`#${where} #diagram`)?.dxDiagram(\"instance\")?.repaint();\r\n\t\t\t\t\t\t\tsetDiagramScrollToBottom(where);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t} else if (where === \"varioObjectProgDiagram\") {\r\n\t\t\t\t\t\t//zeby diagram byl na gorze diva\r\n\t\t\t\t\t\twaitForElm(\"#varioObjectProgDiagram .dxdi-main\").then(() => {\r\n\t\t\t\t\t\t\tif (isRunningOnMobile()) {\r\n\t\t\t\t\t\t\t\t$(\"#varioObjectProgDiagram #diagram\").css(\r\n\t\t\t\t\t\t\t\t\t\"min-height\",\r\n\t\t\t\t\t\t\t\t\t$(\r\n\t\t\t\t\t\t\t\t\t\t\"#varioObjectProgDiagram .dx-scrollable-content\"\r\n\t\t\t\t\t\t\t\t\t).height() ?? 0\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tfitPreviewHeightToScreenAddListener(\"#varioObjectProgDiagram\");\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t$(`#${where} #diagram`).dxDiagram(\"instance\")?.repaint();\r\n\r\n\t\t\t\t\t\t\tconst diagramDiv = document.querySelector(\r\n\t\t\t\t\t\t\t\t\"#varioObjectProgDiagram #diagram\"\r\n\t\t\t\t\t\t\t) as HTMLElement;\r\n\t\t\t\t\t\t\tif (diagramDiv)\r\n\t\t\t\t\t\t\t\tdiagramFullscreenObserver.observe(diagramDiv, {\r\n\t\t\t\t\t\t\t\t\tattributes: true,\r\n\t\t\t\t\t\t\t\t\tattributeOldValue: true,\r\n\t\t\t\t\t\t\t\t\tattributeFilter: [\"class\"],\r\n\t\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\twaitForElm(\"#varioObjectProgDiagram .dxdi-main\").then((elm2) => {\r\n\t\t\t\t\t\t\t\tconst transform = $(elm2).attr(\"transform\")?.split(\",\");\r\n\t\t\t\t\t\t\t\tif (transform) {\r\n\t\t\t\t\t\t\t\t\tconst transformed = `${transform[0]}, 0)`;\r\n\t\t\t\t\t\t\t\t\t$(elm2).attr(\"transform\", transformed);\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\t\t\t\tsetDiagramScrollToBottom(where);\r\n\t\t\t\t\t\t\t\t}, 10);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\temptyDiagram = true;\r\n\t\t\t\t\tremoveSkeletonLoading(`#${where}`);\r\n\t\t\t\t\tconsole.log(\"Pusty diagram\");\r\n\t\t\t\t\t$(\r\n\t\t\t\t\t\t'

            Brak wykonanych akcji

            '\r\n\t\t\t\t\t).appendTo(`#${where} #diagram`);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (mobileViewDiagram) {\r\n\t\t\t\t\tif (!emptyDiagram) {\r\n\t\t\t\t\t\tCloseDialog();\r\n\t\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\t\texportDiagram();\r\n\t\t\t\t\t\t}, 2000);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t},\r\n\t\t\terror: () => {\r\n\t\t\t\tremoveSkeletonLoading(`#${where}`);\r\n\t\t\t\t$(\r\n\t\t\t\t\t'

            B\u0142\u0105d pobierania diagramu

            '\r\n\t\t\t\t).appendTo(`#${where} #diagram`);\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function setDiagramScrollToBottom(where: string) {\r\n\tlet diagram = `#${where} #diagram`;\r\n\tif (diagram.length === 0) diagram = \"#diagram.dx-diagram-fullscreen\";\r\n\tfixScrollInDx(`${diagram}.dx-scrollable-container`);\r\n\r\n\tconst diagramDiv = $(diagram);\r\n\r\n\tconst allItems = diagramDiv.dxDiagram(\"instance\").getItems();\r\n\tconst itemToScroll = allItems.find((obj) => {\r\n\t\treturn obj.dataItem.tag === \"DummyMargin\";\r\n\t});\r\n\tif (typeof itemToScroll !== \"undefined\" && itemToScroll != null) {\r\n\t\tdiagramDiv.dxDiagram(\"instance\")?.scrollToItem(itemToScroll);\r\n\t}\r\n}\r\n\r\nexport function workflowDiagram(itemID: string, where = \"Dialog\") {\r\n\tif (where === \"Dialog\") {\r\n\t\tCloseDialog();\r\n\t}\r\n\ttraveledLinks = [];\r\n\ttraveledNodes = [];\r\n\tnodesData = [];\r\n\tlinksData = [];\r\n\tcurrentState = \"\";\r\n\tlet mobileViewDiagram = false;\r\n\tlet popupHeight = 800;\r\n\tif (\r\n\t\t/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(\r\n\t\t\tnavigator.userAgent\r\n\t\t) &&\r\n\t\twhere === \"Dialog\"\r\n\t) {\r\n\t\t//mobileViewDiagram = false;\r\n\t\tmobileViewDiagram = true;\r\n\t\t//popupHeight = 800;\r\n\t\tpopupHeight = 0;\r\n\t}\r\n\tif (itemID) {\r\n\t\tlet popup: DevExpress.ui.dxPopup;\r\n\t\tif (where === \"Dialog\") {\r\n\t\t\tpopup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\t\t\tpopup.option(\"width\", 1400);\r\n\t\t\tpopup.option(\"height\", popupHeight);\r\n\t\t\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\t\t\tpopup.option(\"title\", \"Diagram obiegu\");\r\n\t\t\tpopup.option(\"showTitle\", true);\r\n\t\t\tpopup.show();\r\n\t\t\tpopup\r\n\t\t\t\t.content()\r\n\t\t\t\t?.parent()\r\n\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t?.addClass(\"popupTitleAccent\");\r\n\t\t}\r\n\t\t$(`#${where}`).empty();\r\n\t\tif (\r\n\t\t\t(!$(\"#varioObjectProgDiagram-button\").hasClass(\"active\") &&\r\n\t\t\t\t!$(\"#varioObjectDiagram-button\").hasClass(\"active\") &&\r\n\t\t\t\twhere === \"Dialog\") ||\r\n\t\t\twhere !== \"Dialog\"\r\n\t\t) {\r\n\t\t\t$(\".dxDiagramContainer\").empty();\r\n\t\t}\r\n\t\taddSkeletonLoading(`#${where}`);\r\n\r\n\t\tif (mobileViewDiagram) {\r\n\t\t\tCloseDialog();\r\n\t\t}\r\n\r\n\t\t$(`#${where}`).append(\r\n\t\t\t`
            `\r\n\t\t);\r\n\t\t//$(\"#diagramVO\").append('
            ');\r\n\r\n\t\tlet autoZoom = false;\r\n\t\tif (where !== \"Dialog\") {\r\n\t\t\tautoZoom = true;\r\n\t\t}\r\n\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetWorkflowDiagramLayout`,\r\n\t\t\ttype: \"GET\",\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tdataType: \"JSON\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: { itemFullID: itemID },\r\n\t\t\tsuccess: (data: workflowDiagramLayout | LogonRequired | string) => {\r\n\t\t\t\tif ((data as LogonRequired).logonRequired) {\r\n\t\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (data === \"NoPermittions\") {\r\n\t\t\t\t\tshowDxToast(\"Brak uprawnie\u0144 do odczytu!\", \"error\");\r\n\t\t\t\t\tCloseDialog();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (data === \"\") {\r\n\t\t\t\t\tremoveSkeletonLoading(`#${where}`);\r\n\t\t\t\t\t$(\r\n\t\t\t\t\t\t'

            Brak diagramu

            '\r\n\t\t\t\t\t).appendTo(`#${where} #diagram`);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst dataLayout = data as workflowDiagramLayout;\r\n\t\t\t\tcurrentState = dataLayout.currentState;\r\n\r\n\t\t\t\tfor (const element of dataLayout.nodes) {\r\n\t\t\t\t\telement.Node.id = element.Node[\"@Index\"];\r\n\t\t\t\t\tnodesData.push(element.Node);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (const element of dataLayout.links) {\r\n\t\t\t\t\telement.Link.id = element.Link[\"@Index\"];\r\n\t\t\t\t\tlinksData.push(element.Link);\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttraveledLinks = dataLayout.traveledLinks;\r\n\t\t\t\tfor (const element of traveledLinks) {\r\n\t\t\t\t\tconst link = linksData.find(({ id }) => id === element);\r\n\t\t\t\t\tif (link != null) {\r\n\t\t\t\t\t\ttraveledNodes.push(link[\"@Org\"]);\r\n\t\t\t\t\t\ttraveledNodes.push(link[\"@Dst\"]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst toolbar = {\r\n\t\t\t\t\tcommands: [\r\n\t\t\t\t\t\t{ name: \"zoomLevel\", text: \"Poziom przybli\u017Cenia\" },\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tname: \"export\",\r\n\t\t\t\t\t\t\ticon: \"export\",\r\n\t\t\t\t\t\t\ttext: \"Eksport do pliku\",\r\n\t\t\t\t\t\t\titems: [\r\n\t\t\t\t\t\t\t\t{ name: \"exportSvg\", text: \"Eksport do SVG\" },\r\n\t\t\t\t\t\t\t\t{ name: \"exportPng\", text: \"Eksport do PNG\" },\r\n\t\t\t\t\t\t\t\t{ name: \"exportJpg\", text: \"Eksport do JPG\" },\r\n\t\t\t\t\t\t\t],\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t],\r\n\t\t\t\t};\r\n\r\n\t\t\t\tif (where === \"varioObjectDiagram\" && ($(window).height() ?? 0) > 800) {\r\n\t\t\t\t\ttoolbar.commands.push({ name: \"fullScreen\", text: \"Pe\u0142en ekran\" });\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$(`#${where} #diagram`).dxDiagram({\r\n\t\t\t\t\tnodes: {\r\n\t\t\t\t\t\tdataSource: new DevExpress.data.ArrayStore({\r\n\t\t\t\t\t\t\tkey: \"id\",\r\n\t\t\t\t\t\t\tdata: nodesData,\r\n\t\t\t\t\t\t}),\r\n\t\t\t\t\t\ttextExpr: \"Text\", //textNode,\r\n\t\t\t\t\t\ttypeExpr: itemTypeExpr,\r\n\t\t\t\t\t\theightExpr: heightNodeExpr,\r\n\t\t\t\t\t\twidthExpr: widthNodeExpr,\r\n\t\t\t\t\t\ttopExpr: topNodeExpr,\r\n\t\t\t\t\t\tleftExpr: leftNodeExpr,\r\n\t\t\t\t\t\ttextStyleExpr: styleNodeText,\r\n\t\t\t\t\t\tstyleExpr: styleNode,\r\n\t\t\t\t\t\tzIndexExpr: zIndexNode,\r\n\t\t\t\t\t},\r\n\t\t\t\t\tedges: {\r\n\t\t\t\t\t\tdataSource: new DevExpress.data.ArrayStore({\r\n\t\t\t\t\t\t\tkey: \"id\",\r\n\t\t\t\t\t\t\tdata: linksData,\r\n\t\t\t\t\t\t}),\r\n\t\t\t\t\t\ttextExpr: \"Text\",\r\n\t\t\t\t\t\tfromExpr: \"@Org\",\r\n\t\t\t\t\t\ttoExpr: \"@Dst\",\r\n\t\t\t\t\t\tpointsExpr: pointsLinksExpr,\r\n\t\t\t\t\t\tlineTypeExpr: linkTypeExpr,\r\n\t\t\t\t\t\ttextStyleExpr: styleEdgeText,\r\n\t\t\t\t\t\tstyleExpr: styleEdge,\r\n\t\t\t\t\t\ttoLineEndExpr: toLineEndExprLink,\r\n\t\t\t\t\t},\r\n\t\t\t\t\tshowGrid: false,\r\n\t\t\t\t\treadOnly: true,\r\n\r\n\t\t\t\t\tsimpleView: true,\r\n\t\t\t\t\tfullScreen: false,\r\n\t\t\t\t\tautoZoomMode: autoZoom ? \"fitWidth\" : \"disabled\",\r\n\t\t\t\t\tviewToolbar: toolbar as any,\r\n\t\t\t\t});\r\n\r\n\t\t\t\tif (mobileViewDiagram) {\r\n\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\texportDiagram();\r\n\t\t\t\t\t}, 1000);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tremoveSkeletonLoading(`#${where}`);\r\n\r\n\t\t\t\tif (where === \"Dialog\") {\r\n\t\t\t\t\tpopup.repaint();\r\n\t\t\t\t\t$(`#${where} #diagram`)?.dxDiagram(\"instance\")?.repaint();\r\n\t\t\t\t} else if (where === \"varioObjectDiagram\") {\r\n\t\t\t\t\t//zeby diagram byl na gorze diva\r\n\t\t\t\t\twaitForElm(\"#varioObjectDiagram .dxdi-main\").then(() => {\r\n\t\t\t\t\t\tif (isRunningOnMobile()) {\r\n\t\t\t\t\t\t\t$(\"#varioObjectDiagram #diagram\").css(\r\n\t\t\t\t\t\t\t\t\"min-height\",\r\n\t\t\t\t\t\t\t\t$(\"#varioObjectDiagram .dx-scrollable-content\").height() ?? 0\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tfitPreviewHeightToScreenAddListener(\"#varioObjectDiagram\");\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t$(`#${where} #diagram`).dxDiagram(\"instance\")?.repaint();\r\n\r\n\t\t\t\t\t\twaitForElm(\"#varioObjectDiagram .dxdi-main\").then((elm2) => {\r\n\t\t\t\t\t\t\tconst transform = $(elm2).attr(\"transform\")?.split(\",\");\r\n\t\t\t\t\t\t\tif (transform) {\r\n\t\t\t\t\t\t\t\tconst transformed = `${transform[0]}, 0)`;\r\n\t\t\t\t\t\t\t\t$(elm2).attr(\"transform\", transformed);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t},\r\n\t\t\terror: () => {\r\n\t\t\t\tremoveSkeletonLoading(`#${where}`);\r\n\t\t\t\t$(\r\n\t\t\t\t\t'

            B\u0142\u0105d pobierania diagramu

            '\r\n\t\t\t\t).appendTo(`#${where} #diagram`);\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function exportDiagram() {\r\n\tconst diagramInstance = $(\"#diagram\").dxDiagram(\"instance\");\r\n\tdiagramInstance.exportTo(\"png\", (data) => {\r\n\t\tconst image = new Image();\r\n\t\timage.src = data;\r\n\r\n\t\tconst safariWindow = window.open();\r\n\t\tif (!safariWindow) return;\r\n\t\tsafariWindow.location.href = \"\";\r\n\t\tsafariWindow.document.write(image.outerHTML);\r\n\r\n\t\t//var w = window.open(\"\");\r\n\t\t//w.document.title = 'Diagram obiegu';\r\n\t\t//w.document.write(image.outerHTML);\r\n\t});\r\n}\r\n\r\nlet currentNodeData: VirtualNode;\r\nlet popupWorkflowDiagramDescription: DevExpress.ui.dxPopup;\r\nlet popupWorkflowDiagramDescriptionPseudoEdge: DevExpress.ui.dxPopup;\r\nconst popupOptionsNodeNormal = {\r\n\twidth: 400,\r\n\theight: 360,\r\n\tmaxWidth: \"80vw\",\r\n\tmaxHeight: \"80vw\",\r\n\tcontentTemplate() {\r\n\t\treturn $(\r\n\t\t\t'
            '\r\n\t\t).append(\r\n\t\t\t$(\r\n\t\t\t\t`

            Operator: ${currentNodeData.nodeTextProperties.operatorName}

            `\r\n\t\t\t),\r\n\t\t\t$(\r\n\t\t\t\t`

            Zast\u0119pca: ${currentNodeData.nodeTextProperties.substituteOperator == null ? \"\" : currentNodeData.nodeTextProperties.substituteOperator}

            `\r\n\t\t\t),\r\n\t\t\t$(\r\n\t\t\t\t`

            Grupa: ${currentNodeData.nodeTextProperties.group == null ? \"\" : currentNodeData.nodeTextProperties.group}

            `\r\n\t\t\t),\r\n\t\t\t$(\r\n\t\t\t\t`

            Stanowisko: ${currentNodeData.nodeTextProperties.position == null ? \"\" : currentNodeData.nodeTextProperties.position}

            `\r\n\t\t\t),\r\n\t\t\t$(\r\n\t\t\t\t`

            Stan: ${currentNodeData.nodeTextProperties.stateName == null ? \"\" : currentNodeData.nodeTextProperties.stateName.replace(\"Stan: \", \"\")}

            `\r\n\t\t\t),\r\n\t\t\t$(\r\n\t\t\t\t`

            Akcja: ${currentNodeData.nodeTextProperties.actionResult == null ? \"\" : currentNodeData.nodeTextProperties.actionResult}

            `\r\n\t\t\t),\r\n\t\t\t$(\r\n\t\t\t\t`

            Otrzymano: ${currentNodeData.nodeTextProperties.receivedDate == null ? \"\" : currentNodeData.nodeTextProperties.receivedDate}

            `\r\n\t\t\t),\r\n\t\t\t$(\r\n\t\t\t\t`

            Zako\u0144czono: ${currentNodeData.nodeTextProperties.dateOfRealization == null ? \"\" : currentNodeData.nodeTextProperties.dateOfRealization}

            `\r\n\t\t\t),\r\n\t\t\t$(\r\n\t\t\t\t`

            Czas realizacji: ${currentNodeData.nodeTextProperties.duration == null ? \"\" : currentNodeData.nodeTextProperties.duration}

            `\r\n\t\t\t)\r\n\t\t);\r\n\t},\r\n\tshowTitle: true,\r\n\ttitle: \"Szczeg\u00F3\u0142y\",\r\n\tvisible: false,\r\n\tdragEnabled: false,\r\n\thideOnOutsideClick: true,\r\n};\r\n\r\nconst popupOptionsNodePseudoEdge = {\r\n\twidth: 400,\r\n\theight: 500,\r\n\tmaxWidth: \"80vw\",\r\n\tmaxHeight: \"80vw\",\r\n\tcontentTemplate() {\r\n\t\treturn $('
            ').append(\r\n\t\t\t$(`${currentNodeData.text}`)\r\n\t\t);\r\n\t},\r\n\tshowTitle: true,\r\n\ttitle: \"Szczeg\u00F3\u0142y\",\r\n\tvisible: false,\r\n\tdragEnabled: false,\r\n\thideOnOutsideClick: true,\r\n};\r\n\r\nconst showInfo = function (this: any, data: VirtualNode) {\r\n\tcurrentNodeData = data;\r\n\tif (currentNodeData.nodeTextProperties == null) {\r\n\t\t//Klikni\u0119cie w 3 kropki na nodzie udaj\u0105cym opis na strza\u0142ce\r\n\t\tif (popupWorkflowDiagramDescriptionPseudoEdge) {\r\n\t\t\tpopupWorkflowDiagramDescriptionPseudoEdge.option(\r\n\t\t\t\t\"contentTemplate\",\r\n\t\t\t\tpopupOptionsNodePseudoEdge.contentTemplate.bind(this)\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\tpopupWorkflowDiagramDescriptionPseudoEdge = $(\"#popupDiagramDetails\")\r\n\t\t\t\t.dxPopup(popupOptionsNodePseudoEdge)\r\n\t\t\t\t.dxPopup(\"instance\");\r\n\t\t}\r\n\t\t(popupWorkflowDiagramDescriptionPseudoEdge as any)._customClass =\r\n\t\t\t\"padCustomOhNo\";\r\n\t\tpopupWorkflowDiagramDescriptionPseudoEdge.show();\r\n\t\t(popupWorkflowDiagramDescriptionPseudoEdge as any)._$title.addClass(\r\n\t\t\t\"popupTitleAccent\"\r\n\t\t);\r\n\t} else {\r\n\t\t//Klikni\u0119cie w 3 kropki na nodzie\r\n\t\tif (popupWorkflowDiagramDescription) {\r\n\t\t\tpopupWorkflowDiagramDescription.option(\r\n\t\t\t\t\"contentTemplate\",\r\n\t\t\t\tpopupOptionsNodeNormal.contentTemplate.bind(this)\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\tpopupWorkflowDiagramDescription = $(\"#popupDiagramDetails\")\r\n\t\t\t\t.dxPopup(popupOptionsNodeNormal)\r\n\t\t\t\t.dxPopup(\"instance\");\r\n\t\t}\r\n\t\t(popupWorkflowDiagramDescription as any)._customClass = \"padCustomOhNo\";\r\n\t\tpopupWorkflowDiagramDescription.show();\r\n\t\t(popupWorkflowDiagramDescription as any)._$title.addClass(\r\n\t\t\t\"popupTitleAccent\"\r\n\t\t);\r\n\t}\r\n\r\n\tfixScrollInDx(\".popupOptionsNodePseudoEdge\");\r\n};\r\n", "\uFEFFimport \"../types/dx.all.d.ts\";\r\nimport {\r\n\tRequestStatus,\r\n\ttype ResponseObject,\r\n} from \"../types/models/vario-types\";\r\nimport {\r\n\tUnselectAndUnfocusDxTable,\r\n\trefreshDxGrid,\r\n} from \"./devextreme-table-functions\";\r\nimport { GetBaseUrl } from \"./page-navigation\";\r\nimport { HideLoadingPanel, ShowLoadingPanel, showDxToast } from \"./site\";\r\n\r\nclass GlobalCopyBuffer {\r\n\toperation: \"COPY\" | \"COPYASLINK\" | \"COPYASCOPY\" | \"CUT\";\r\n\titemsId: string[];\r\n\tcontainerId: string | null;\r\n\r\n\tconstructor(\r\n\t\toperation: \"COPY\" | \"COPYASLINK\" | \"COPYASCOPY\" | \"CUT\",\r\n\t\titemsId: string[],\r\n\t\tcontainerId: string | null\r\n\t) {\r\n\t\tthis.operation = operation;\r\n\t\tthis.itemsId = itemsId;\r\n\t\tthis.containerId = containerId;\r\n\t}\r\n}\r\n\r\nexport function editCut(itemId: string | string[], containerId: string) {\r\n\tsetToBuffer(\"CUT\", itemId, containerId);\r\n}\r\n\r\nexport function editCopy(itemId: string | string[], containerId: string) {\r\n\tsetToBuffer(\"COPY\", itemId, containerId);\r\n}\r\n\r\nexport function setToBuffer(\r\n\toperation: \"COPY\" | \"COPYASLINK\" | \"COPYASCOPY\" | \"CUT\",\r\n\titemId: string[] | string,\r\n\tcontainerId: string\r\n) {\r\n\tconst globalCopyBuffer = new GlobalCopyBuffer(operation, new Array(), null);\r\n\tif (Array.isArray(itemId)) {\r\n\t\tglobalCopyBuffer.itemsId = itemId;\r\n\t} else {\r\n\t\tglobalCopyBuffer.itemsId.push(itemId);\r\n\t}\r\n\r\n\tglobalCopyBuffer.containerId = containerId;\r\n\tlocalStorage.setItem(\"GlobalCopyBuffer\", JSON.stringify(globalCopyBuffer));\r\n}\r\n\r\nexport function clearGlobalBufferSession() {\r\n\tlocalStorage.removeItem(\"GlobalCopyBuffer\");\r\n}\r\n\r\nexport function editPaste(targetContainerId: string) {\r\n\teditPasteAjax(targetContainerId, \"COPY\");\r\n}\r\n\r\nexport function editPasteAsCopy(targetContainerId: string) {\r\n\teditPasteAjax(targetContainerId, \"COPYASCOPY\");\r\n}\r\n\r\nexport function editPasteAsLink(targetContainerId: string) {\r\n\teditPasteAjax(targetContainerId, \"COPYASLINK\");\r\n}\r\n\r\nexport function editPasteAjax(\r\n\ttargetContainerId: string,\r\n\teditAction: \"COPY\" | \"COPYASLINK\" | \"COPYASCOPY\"\r\n) {\r\n\tconst GlobalCopyBuffer: GlobalCopyBuffer = JSON.parse(\r\n\t\tlocalStorage.GlobalCopyBuffer\r\n\t);\r\n\r\n\ttry {\r\n\t\tif (editAction === \"COPY\") {\r\n\t\t\tShowLoadingPanel(\"Trwa przenoszenie...\");\r\n\t\t}\r\n\r\n\t\tif (editAction === \"COPYASCOPY\") {\r\n\t\t\tShowLoadingPanel(\"Trwa wklejanie kopii...\");\r\n\t\t}\r\n\r\n\t\tif (editAction === \"COPYASLINK\") {\r\n\t\t\tShowLoadingPanel(\"Trwa wklejanie...\");\r\n\t\t}\r\n\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/EditPaste`,\r\n\t\t\ttype: \"Post\",\r\n\t\t\tcache: false,\r\n\t\t\tdata: {\r\n\t\t\t\tsourceItemIDs: GlobalCopyBuffer?.itemsId,\r\n\t\t\t\tsourceContainerId: GlobalCopyBuffer?.containerId,\r\n\t\t\t\ttargetContainerId: targetContainerId,\r\n\t\t\t\teditOperation: targetContainerId,\r\n\t\t\t\teditAction: editAction,\r\n\t\t\t},\r\n\t\t\tsuccess: (data: ResponseObject) => {\r\n\t\t\t\tif (data?.status === RequestStatus.success) {\r\n\t\t\t\t\tif (editAction === \"COPY\") {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\tGlobalCopyBuffer.itemsId.length > 1\r\n\t\t\t\t\t\t\t\t? \"Pozycje zosta\u0142y przeniesione\"\r\n\t\t\t\t\t\t\t\t: \"Pozycja zosta\u0142a przeniesiona\",\r\n\t\t\t\t\t\t\t\"success\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (editAction === \"COPYASCOPY\") {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\tGlobalCopyBuffer.itemsId.length > 1\r\n\t\t\t\t\t\t\t\t? \"Pozycje zosta\u0142y wklejone jako kopie\"\r\n\t\t\t\t\t\t\t\t: \"Pozycja zosta\u0142a wklejona jako kopia\",\r\n\t\t\t\t\t\t\t\"success\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (editAction === \"COPYASLINK\") {\r\n\t\t\t\t\t\tshowDxToast(\r\n\t\t\t\t\t\t\tGlobalCopyBuffer.itemsId.length > 1\r\n\t\t\t\t\t\t\t\t? \"Pozycje zosta\u0142y wklejone\"\r\n\t\t\t\t\t\t\t\t: \"Pozycja zosta\u0142a wklejona\",\r\n\t\t\t\t\t\t\t\"success\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tclearGlobalBufferSession();\r\n\t\t\t\t\tUnselectAndUnfocusDxTable();\r\n\t\t\t\t\trefreshDxGrid();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshowDxToast(data?.message ?? \"Operacja nie powiod\u0142a si\u0119.\", \"error\");\r\n\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: (error) => {\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t\tshowDxToast(\"Operacja nie powiod\u0142a si\u0119.\", \"error\");\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t},\r\n\t\t});\r\n\t} catch (ex) {\r\n\t\tconsole.log(ex);\r\n\t}\r\n}\r\n", "import \"../types/dx.all.d.ts\";\r\nimport type { LayoutColumnsFromJSON } from \"../types/models/LayoutModels/layoutColumn\";\r\nimport type {\r\n\tServiceResponse,\r\n\tVarioCategory,\r\n\tVarioCategory4Edit,\r\n\tVarioObjectField,\r\n\tVarioProperties,\r\n} from \"../types/models/vario-types\";\r\nimport {\r\n\trefreshDxGrid,\r\n\treloadDxGridDataSource,\r\n} from \"./devextreme-table-functions\";\r\nimport { GetBaseUrl, refreshCurrentPage } from \"./page-navigation\";\r\nimport { refreshManager } from \"./refresh-manager\";\r\nimport {\r\n\tCloseBigDialog,\r\n\tCloseDialog,\r\n\tHideLoadingPanel,\r\n\tShowLoadingPanel,\r\n\tcalcMinPopup,\r\n\tcheckWhereIsUser,\r\n\tfixScrollInDx,\r\n\tisRunningOnMobile,\r\n\tshowDxToast,\r\n} from \"./site\";\r\n\r\nlet itemPropertiesIsDirty = false;\r\nlet itemAdditionalPropertiesIsDirty = false;\r\nlet additionalParamsEdited = {};\r\n\r\nexport function GetItemProperties(modelId: string) {\r\n\tShowLoadingPanel(\"Wczytywanie w\u0142a\u015Bciwo\u015Bci...\");\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetItemProperties`,\r\n\t\ttype: \"GET\",\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdata: {\r\n\t\t\tmodelId: modelId,\r\n\t\t},\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\titemPropertiesIsDirty = false;\r\n\t\t\tbtnPropertySaveDisableChange();\r\n\t\t\tif (debug) console.log(response);\r\n\r\n\t\t\tif (response.success === true) {\r\n\t\t\t\tif (response?.data?.type === \"0\") response.data.type = \"\";\r\n\r\n\t\t\t\tHideLoadingPanel();\r\n\r\n\t\t\t\t$(\"#BigDialog\").empty();\r\n\t\t\t\t$(\"#DialogFooter\").empty();\r\n\r\n\t\t\t\tconst popup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\t\t\t\tpopup.option(\"height\", \"100%\");\r\n\t\t\t\tpopup.option(\"width\", \"100%\");\r\n\t\t\t\tif (isRunningOnMobile()) {\r\n\t\t\t\t\tpopup.option(\"maxWidth\", 500);\r\n\t\t\t\t\tpopup.option(\"maxHeight\", 540);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpopup.option(\"maxWidth\", 700);\r\n\t\t\t\t\tpopup.option(\"maxHeight\", 740);\r\n\t\t\t\t}\r\n\t\t\t\tpopup.option(\"title\", `W\u0142a\u015Bciwo\u015Bci: ${response.data.caption}`);\r\n\t\t\t\tpopup.option(\"showTitle\", true);\r\n\t\t\t\tpopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\t\t\t\tpopup.show();\r\n\t\t\t\tpopup\r\n\t\t\t\t\t.content()\r\n\t\t\t\t\t?.parent()\r\n\t\t\t\t\t?.find(\".dx-popup-title\")\r\n\t\t\t\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t\t\t\tlet defIconUrl = \"\";\r\n\t\t\t\tif (response.data?.definitionId?.length) {\r\n\t\t\t\t\tdefIconUrl = `${GetBaseUrl()}/Vario/GetImageForDefinition/?definitionVerID=${\r\n\t\t\t\t\t\tresponse.data.definitionId\r\n\t\t\t\t\t}&imageSize=small`;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$(\"#BigDialog\").append(`\r\n
            \r\n\r\n
            \r\n
            \r\n
            \r\n W\u0142a\u015Bciwo\u015Bci\r\n
            \r\n \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n\r\n\r\n
            \r\n
            \r\n
            \r\n Dane dodatkowe\r\n
            \r\n \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            `);\r\n\r\n\t\t\t\tpopup\r\n\t\t\t\t\t.content()\r\n\t\t\t\t\t.find(\".DialogFooter\")\r\n\t\t\t\t\t.empty()\r\n\t\t\t\t\t.append(`\r\n \r\n `);\r\n\r\n\t\t\t\t$(\"#saveProperties\").on(\"click\", () => {\r\n\t\t\t\t\tsaveCategories(\r\n\t\t\t\t\t\tmodelId,\r\n\t\t\t\t\t\tresponse.data,\r\n\t\t\t\t\t\tresponse.data.categories,\r\n\t\t\t\t\t\t\"#treeBox\"\r\n\t\t\t\t\t);\r\n\t\t\t\t\tsaveAdditionalProperties(response.data.fullId);\r\n\r\n\t\t\t\t\tconst selectedDefID =\r\n\t\t\t\t\t\t$(\"#definitionSelector\").val()?.valueOf()?.toString() ?? \"\";\r\n\t\t\t\t\tif (selectedDefID !== response.data.definitionId)\r\n\t\t\t\t\t\tChangeDefinitionType(response.data.fullId, selectedDefID, false);\r\n\t\t\t\t});\r\n\r\n\t\t\t\t$(\"#propertiesContainer\").append(`\r\n
            \r\n
            \r\n
            \r\n
            \r\n
            Data ostatniej zmiany:
            \r\n
            ${\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresponse.data.lastCheckOutDate\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            Zmiana wykonana przez:
            \r\n
            ${\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresponse.data.lastCheckOutBy\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            Wa\u017Cny od:
            \r\n
            ${\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresponse.data.validFrom\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            Wa\u017Cny do:
            \r\n
            ${\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresponse.data.validTo\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            Status:
            \r\n
            ${\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresponse.data.statusIcon?.length\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? ``\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: \"\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} ${response.data.status}
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            Status pobrania:
            \r\n
            ${\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresponse.data.checkOutStatusIcon !=\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull &&\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresponse.data.checkOutStatusIcon.length >\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t0\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? ``\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: \"\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} ${response.data.checkOutStatus}
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            W\u0142asno\u015B\u0107 miejsca:
            \r\n
            ${\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresponse.data.ownerSite\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            Autor:
            \r\n
            ${\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresponse.data.createdBy\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            Typ:
            \r\n
            \r\n
            \r\n ${\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdefIconUrl.length > 0\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? ``\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: \"\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            W\u0142a\u015Bciciel:
            \r\n
            ${\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresponse.data?.ownerIcon?.length\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? ``\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: \"\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} ${response.data.owner}
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            Stronicowanie wy\u0142\u0105czone:
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            Utajniony:
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            Kategoria:
            \r\n
            \r\n
            \u0141adowanie kategorii...
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n \r\n \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            \r\n
            `);\r\n\r\n\t\t\t\tif (debug) {\r\n\t\t\t\t\t$(\"#propertiesContainer\")\r\n\t\t\t\t\t\t.find(\".row:first\")\r\n\t\t\t\t\t\t.prepend(`
            \r\n
            \r\n
            Identyfikator:
            \r\n
            ${response.data.fullId}
            \r\n
            \r\n
            `);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (response.data.definitions?.length > 0) {\r\n\t\t\t\t\tfor (const def of response.data.definitions) {\r\n\t\t\t\t\t\tconst defProcessed = def.split(\";\");\r\n\t\t\t\t\t\tlet selected = \"\";\r\n\t\t\t\t\t\tif (defProcessed[0] === response.data.definitionId)\r\n\t\t\t\t\t\t\tselected = \"selected='selected'\";\r\n\t\t\t\t\t\t$(\"#definitionSelector\").append(\r\n\t\t\t\t\t\t\t``\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (!response.data.definitionId)\r\n\t\t\t\t\t$(\"#definitionSelector\").append(\r\n\t\t\t\t\t\t``\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t$(\"#definitionSelector, #requiredCategoriesCheckbox\").on(\r\n\t\t\t\t\t\"change\",\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\titemPropertiesIsDirty = true;\r\n\t\t\t\t\t\tbtnPropertySaveDisableChange();\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\r\n\t\t\t\tif (response.data.moreGeneralDefinitionId) {\r\n\t\t\t\t\t$(\"#propertiesTypeContainer\").append(`\r\n
            \r\n \r\n
            `);\r\n\r\n\t\t\t\t\t$(\"#changeDefinitionBtn\").on(\"click\", () => {\r\n\t\t\t\t\t\taskIfChangeDefinitionType(\r\n\t\t\t\t\t\t\tresponse.data.type,\r\n\t\t\t\t\t\t\tresponse.data.moreGeneralType,\r\n\t\t\t\t\t\t\tresponse.data.fullId,\r\n\t\t\t\t\t\t\tresponse.data.moreGeneralDefinitionId\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfixScrollInDx(\"#propertiesContainer\");\r\n\t\t\t\tloadCategoriesPicker(modelId, \"#treeBox\");\r\n\t\t\t} else {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tshowDxToast(\r\n\t\t\t\t\tresponse?.message\r\n\t\t\t\t\t\t? response.message\r\n\t\t\t\t\t\t: \"B\u0142\u0105d przy pobieraniu w\u0142a\u015Bciwo\u015Bci.\",\r\n\t\t\t\t\t\"error\",\r\n\t\t\t\t\t5000\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d przy pobieraniu w\u0142a\u015Bciwo\u015Bci\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function syncTreeViewSelection(\r\n\ttreeView: DevExpress.ui.dxTreeView,\r\n\tvalue: string\r\n) {\r\n\tif (!value) {\r\n\t\ttreeView.unselectAll();\r\n\t\treturn;\r\n\t}\r\n\r\n\tfor (const key of value) {\r\n\t\ttreeView.selectItem(key);\r\n\t}\r\n}\r\n\r\nexport function loadCategoriesPicker(modelId: string, containerHTML: string) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetItemCategories`,\r\n\t\ttype: \"GET\",\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdata: {\r\n\t\t\tmodelId: modelId,\r\n\t\t},\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (debug) console.log(response);\r\n\t\t\t$(containerHTML).empty();\r\n\t\t\tif (response.success === true) {\r\n\t\t\t\tlet filteredList: VarioCategory[] = [];\r\n\r\n\t\t\t\tif (response?.data?.categories?.length > 0) {\r\n\t\t\t\t\tfilteredList = [\r\n\t\t\t\t\t\t...new Map(\r\n\t\t\t\t\t\t\tresponse.data.categories.map((obj) => [\r\n\t\t\t\t\t\t\t\t`${obj.categoryID}:${obj.categoryCode}`,\r\n\t\t\t\t\t\t\t\tobj,\r\n\t\t\t\t\t\t\t])\r\n\t\t\t\t\t\t).values(),\r\n\t\t\t\t\t];\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$(containerHTML).dxDropDownBox({\r\n\t\t\t\t\tvalue: response.data.selectedCategoriesID,\r\n\t\t\t\t\tvalueExpr: \"categoryID\",\r\n\t\t\t\t\tdisplayExpr: \"name\",\r\n\t\t\t\t\tplaceholder: filteredList.length\r\n\t\t\t\t\t\t? \"Wybierz kategori\u0119...\"\r\n\t\t\t\t\t\t: \"Brak kategorii\",\r\n\t\t\t\t\tdisabled:\r\n\t\t\t\t\t\tfilteredList.length === 0 ||\r\n\t\t\t\t\t\tresponse.data?.canManageCategories === false,\r\n\t\t\t\t\tshowClearButton: true,\r\n\t\t\t\t\tdataSource: filteredList,\r\n\t\t\t\t\tcontentTemplate(e) {\r\n\t\t\t\t\t\tconst v = e.component.option(\"value\");\r\n\t\t\t\t\t\tconst $treeView = $('
            ').dxTreeView({\r\n\t\t\t\t\t\t\tdataSource: e.component.getDataSource(),\r\n\t\t\t\t\t\t\tdataStructure: \"plain\",\r\n\t\t\t\t\t\t\tkeyExpr: \"categoryID\",\r\n\t\t\t\t\t\t\tparentIdExpr: \"parentID\",\r\n\t\t\t\t\t\t\tselectionMode: \"multiple\",\r\n\t\t\t\t\t\t\tdisplayExpr: \"name\",\r\n\t\t\t\t\t\t\tselectByClick: true,\r\n\t\t\t\t\t\t\tonContentReady(args: DevExpress.ui.dxTreeView.ContentReadyEvent) {\r\n\t\t\t\t\t\t\t\tsyncTreeViewSelection(args.component, v);\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\tselectNodesRecursive: false,\r\n\t\t\t\t\t\t\tshowCheckBoxesMode: \"normal\",\r\n\t\t\t\t\t\t\tonItemSelectionChanged(args) {\r\n\t\t\t\t\t\t\t\tconst selectedKeys = args.component.getSelectedNodeKeys();\r\n\t\t\t\t\t\t\t\te.component.option(\"value\", selectedKeys);\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\te.component.on(\"valueChanged\", (args) => {\r\n\t\t\t\t\t\t\tconsole.log(args);\r\n\t\t\t\t\t\t\tconst { value } = args;\r\n\t\t\t\t\t\t\tsyncTreeViewSelection($treeView.dxTreeView(\"instance\"), value);\r\n\t\t\t\t\t\t\tif (containerHTML === \"#treeBox\") {\r\n\t\t\t\t\t\t\t\titemPropertiesIsDirty = true;\r\n\t\t\t\t\t\t\t\tbtnPropertySaveDisableChange();\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t\t\targs?.event?.currentTarget?.classList?.contains(\r\n\t\t\t\t\t\t\t\t\t\t\"dx-clear-button-area\"\r\n\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\tsaveCategories(\r\n\t\t\t\t\t\t\t\t\tmodelId,\r\n\t\t\t\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\t\t\t\tresponse.data.selectedCategoriesID,\r\n\t\t\t\t\t\t\t\t\tcontainerHTML\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\treturn $treeView;\r\n\t\t\t\t\t},\r\n\t\t\t\t});\r\n\r\n\t\t\t\t$(`${containerHTML} .dx-icon.dx-icon-clear`).on(\"click\", () => {\r\n\t\t\t\t\tif (containerHTML === \"#treeBox\") {\r\n\t\t\t\t\t\titemPropertiesIsDirty = true;\r\n\t\t\t\t\t\tbtnPropertySaveDisableChange();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\t\tsaveCategories(modelId, null, [], containerHTML);\r\n\t\t\t\t\t\t}, 100);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(\"B\u0142\u0105d przy pobieraniu kategorii\", \"error\");\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d przy pobieraniu kategorii\", \"error\");\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function saveCategories(\r\n\tmodelId: string,\r\n\tdata: VarioProperties | null,\r\n\talreadySelectedCategories: string[],\r\n\tcontainerHTML: string\r\n) {\r\n\tconsole.log(alreadySelectedCategories);\r\n\tconst callFromIemProperties = data != null;\r\n\r\n\tif (callFromIemProperties && !itemPropertiesIsDirty) {\r\n\t\treturn;\r\n\t}\r\n\tShowLoadingPanel(\"Zapisywanie danych...\");\r\n\r\n\tconst required = callFromIemProperties\r\n\t\t? $(\"#requiredCategoriesCheckbox\").is(\":checked\")\r\n\t\t: null;\r\n\r\n\tlet treeInstance: DevExpress.ui.dxDropDownBox | null = null;\r\n\t//pobieranie listy zaznaczony pol w treeview\r\n\ttry {\r\n\t\ttreeInstance = $(containerHTML).dxDropDownBox(\"instance\");\r\n\t} catch (_) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (!treeInstance) return;\r\n\r\n\tconst treeDataSource = treeInstance.option().dataSource as VarioCategory[];\r\n\r\n\t//po wybraniu w data source dodaje sie parametr selected\r\n\tlet selected = treeDataSource?.reduce((filtered: string[], option) => {\r\n\t\tif ((option as any).selected) {\r\n\t\t\tfiltered.push(option.categoryCode);\r\n\t\t}\r\n\t\treturn filtered;\r\n\t}, []);\r\n\r\n\tconst foundInDataSource: string[] = [];\r\n\tfor (const c of alreadySelectedCategories) {\r\n\t\tfoundInDataSource.push(\r\n\t\t\ttreeDataSource?.find((x) => x.categoryID === c)?.categoryCode ?? \"\"\r\n\t\t);\r\n\t}\r\n\r\n\t//jesli nie robimy nic w treeview ale zaznaczamy jako wymagane to pobieram z kategorii ktore przyszly bo sie treeview nie zaladowal jeszcze i nie ma param selected\r\n\t//+ sprawdzanie czy jest value bo jak nie jest to znaczy ze kliklismy odznacz wszystko bez wlaczania treeview\r\n\r\n\tif (\r\n\t\tselected.length === 0 &&\r\n\t\talreadySelectedCategories.length > 0 &&\r\n\t\ttreeInstance.option().value\r\n\t) {\r\n\t\tselected = foundInDataSource;\r\n\t}\r\n\r\n\tif (\r\n\t\tcallFromIemProperties &&\r\n\t\tJSON.stringify(foundInDataSource) === JSON.stringify(selected) &&\r\n\t\trequired === data.categoryRequired\r\n\t)\r\n\t\treturn;\r\n\r\n\tconsole.log(treeDataSource, foundInDataSource, selected);\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/SetItemCategories`,\r\n\t\ttype: \"POST\",\r\n\t\tdataType: \"json\",\r\n\t\tdata: {\r\n\t\t\tmodelId: modelId,\r\n\t\t\tisRequired: required,\r\n\t\t\tcategoryKeys: selected,\r\n\t\t},\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tconsole.log(response);\r\n\t\t\tif (response?.success === true) {\r\n\t\t\t\tif (callFromIemProperties) {\r\n\t\t\t\t\titemPropertiesIsDirty = false;\r\n\t\t\t\t\t$(\"#saveProperties\").addClass(\"disabled\");\r\n\t\t\t\t\t$(\"#saveProperties\").attr(\"disabled\", \"disabled\");\r\n\r\n\t\t\t\t\tif (checkWhereIsUser() === \"subElements\") {\r\n\t\t\t\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\t\t\t\t\trefreshDxGrid();\r\n\t\t\t\t\t} else if (checkWhereIsUser() === \"varioObject\") {\r\n\t\t\t\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\t\t\t\t\trefreshManager.needRefresh = new Set([\r\n\t\t\t\t\t\t\trefreshManager?.refreshArea?.varioObjectForm,\r\n\t\t\t\t\t\t]);\r\n\t\t\t\t\t\trefreshCurrentPage();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tCloseBigDialog();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tshowDxToast(\"Kategoria zosta\u0142a zapisana\", \"success\");\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(response?.message ?? \"\", \"error\");\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function addColumnAdditionalProperties(containerId: string) {\r\n\tconst propName = (\r\n\t\tdocument.getElementById(\"nameAdditionalProperties\") as HTMLInputElement\r\n\t)?.value;\r\n\tconst autoCompleteChecked = false;\r\n\tconst columnType = (\r\n\t\tdocument.getElementById(\"colTypeAdditionalProperties\") as HTMLInputElement\r\n\t)?.value;\r\n\r\n\tif (\r\n\t\tpropName.length <= 0 ||\r\n\t\tpropName.includes(\"?\") ||\r\n\t\tpropName.includes(\"*\")\r\n\t) {\r\n\t\tshowDxToast(\r\n\t\t\t\"Nie wprowadzono nazwy lub nazwa zawiera niedozwolone znaki\",\r\n\t\t\t\"warning\",\r\n\t\t\t3000\r\n\t\t);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst defaultValueToUse = \"\";\r\n\r\n\tCloseDialog();\r\n\tCloseBigDialog();\r\n\tShowLoadingPanel(\"Dodawanie kolumny...\");\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/AddColumnAdditionalProperties`,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tdata: {\r\n\t\t\tcontainerId: containerId,\r\n\t\t\tpropertyName: propName,\r\n\t\t\tdefaultValue: defaultValueToUse,\r\n\t\t\tautoComplete: autoCompleteChecked,\r\n\t\t\tcolumnType: columnType,\r\n\t\t},\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (response.success === true) {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tshowDxToast(\"Kolumna dodatkowa zosta\u0142a dodana\", \"success\");\r\n\t\t\t\trefreshCurrentPage(false, true);\r\n\t\t\t} else {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tif (response.message?.length) {\r\n\t\t\t\t\tshowDxToast(response.message, \"error\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshowDxToast(\"B\u0142\u0105d przy dodawaniu kolumny dodatkowej\", \"error\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d przy dodawaniu kolumny dodatkowej\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function getAdditionalParams(id: string) {\r\n\tif ($(\"#additionalColumnsContainer\").is(\":empty\")) {\r\n\t\t$(\"#additionalColumnsContainer\").empty();\r\n\t\tadditionalParamsEdited = {};\r\n\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\t\tlet arrayAdditionalColumns: LayoutColumnsFromJSON[] = [];\r\n\t\tif (\r\n\t\t\ttypeof subElementsModel[modelSubElementsOnly].additionalColumns !==\r\n\t\t\t\t\"undefined\" &&\r\n\t\t\tsubElementsModel[modelSubElementsOnly].additionalColumns?.length\r\n\t\t) {\r\n\t\t\tarrayAdditionalColumns = JSON.parse(\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].additionalColumns ?? \"null\"\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < arrayAdditionalColumns.length; i++) {\r\n\t\t\tlet inputType = \"text\";\r\n\t\t\tlet classNamesForInput = \"form-control fieldValueElement\";\r\n\t\t\tlet currencySpan = \"\";\r\n\t\t\tlet additionalParam = \"\";\r\n\t\t\tconst formatString = arrayAdditionalColumns[i].FormatString;\r\n\t\t\tconst convertedName = arrayAdditionalColumns[i].DisplayName.replace(\r\n\t\t\t\t/[^a-zA-Z0-9]/g,\r\n\t\t\t\t\"\"\r\n\t\t\t);\r\n\t\t\tswitch (arrayAdditionalColumns[i].ValueType) {\r\n\t\t\t\tcase 3:\r\n\t\t\t\t\tinputType = \"datetime-local\";\r\n\t\t\t\t\tif (arrayAdditionalColumns[i].EditType === 7) {\r\n\t\t\t\t\t\tinputType = \"date\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 1:\r\n\t\t\t\t\tinputType = \"number\";\r\n\t\t\t\t\tif (formatString === \"C\")\r\n\t\t\t\t\t\tcurrencySpan = 'z\u0142';\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tformatString === \"C\" ||\r\n\t\t\t\t\t\tformatString === \"N\" ||\r\n\t\t\t\t\t\tformatString === \"N2\"\r\n\t\t\t\t\t)\r\n\t\t\t\t\t\tadditionalParam = 'min=\"0.00\" step=\"0.01\"';\r\n\t\t\t\t\tif (formatString === \"F0\") additionalParam = 'min=\"1\" step=\"1\"';\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 4:\r\n\t\t\t\t\tinputType = \"checkbox\";\r\n\t\t\t\t\tclassNamesForInput = \"\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tinputType = \"text\";\r\n\t\t\t}\r\n\t\t\t$(\"#additionalColumnsContainer\").append(`\r\n
            \r\n
            \r\n
            ${arrayAdditionalColumns[i].DisplayName}
            \r\n
            \r\n \r\n ${currencySpan}\r\n
            \r\n
            \r\n
            \r\n `);\r\n\t\t}\r\n\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/GetAdditionalParams`,\r\n\t\t\ttype: \"GET\",\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tdata: {\r\n\t\t\t\tmodelId: id,\r\n\t\t\t},\r\n\t\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\t\tif (response.success === true) {\r\n\t\t\t\t\tHideLoadingPanel();\r\n\r\n\t\t\t\t\tfor (let i = 0; i < response.data.length; i++) {\r\n\t\t\t\t\t\tconst convertedName = response.data[i].displayName.replace(\r\n\t\t\t\t\t\t\t/[^a-zA-Z0-9]/g,\r\n\t\t\t\t\t\t\t\"\"\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\tconst input = document.getElementById(\r\n\t\t\t\t\t\t\t`input${convertedName}`\r\n\t\t\t\t\t\t) as HTMLInputElement;\r\n\t\t\t\t\t\tif (input) {\r\n\t\t\t\t\t\t\tconst inputType = input.type;\r\n\t\t\t\t\t\t\tif (inputType === \"checkbox\") {\r\n\t\t\t\t\t\t\t\tinput.checked = response.data[i].value === \"True\";\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tinput.value = prepareValueToDisplay(\r\n\t\t\t\t\t\t\t\t\tconvertedName,\r\n\t\t\t\t\t\t\t\t\tresponse.data[i].value,\r\n\t\t\t\t\t\t\t\t\tinputType,\r\n\t\t\t\t\t\t\t\t\t$(`#input${convertedName}`).attr(\"data-format\") ?? \"\"\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t$(\"#additionalColumnsContainer\").append(`\r\n
            \r\n
            \r\n
            ${response.data[i].displayName}
            \r\n \r\n
            \r\n
            \r\n `);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ($(\"#additionalColumnsContainer\").is(\":empty\")) {\r\n\t\t\t\t\t\t$(\"#additionalColumnsContainer\").append(`\r\n
            \r\n

            Brak kolumn / danych dodatkowych

            \r\n
            `);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tHideLoadingPanel();\r\n\t\t\t\t\tshowDxToast(\"B\u0142\u0105d przy pobieraniu danych dodatkowych\", \"error\");\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: (_request, _status, error) => {\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t\tshowDxToast(\"B\u0142\u0105d przy pobieraniu danych dodatkowych\", \"error\");\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function prepareValueToDisplay(\r\n\tkey: string,\r\n\tobj: string,\r\n\ttype: string,\r\n\tformatString: string\r\n) {\r\n\tlet valRet = \"\";\r\n\tswitch (type) {\r\n\t\tcase \"date\": {\r\n\t\t\tconst todayTime = obj;\r\n\t\t\tconst month = todayTime.substring(0, 2);\r\n\t\t\tconst day = todayTime.substring(3, 5);\r\n\t\t\tconst year = todayTime.substring(6, 10);\r\n\t\t\tvalRet = `${year}-${month}-${day}`;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase \"datetime-local\": {\r\n\t\t\tconst todayTimeLocal = obj;\r\n\t\t\tconst monthLocal = todayTimeLocal.substring(0, 2);\r\n\t\t\tconst dayLocal = todayTimeLocal.substring(3, 5);\r\n\t\t\tconst yearLocal = todayTimeLocal.substring(6, 10);\r\n\t\t\tconst hourLocal = todayTimeLocal.substring(11, 13);\r\n\t\t\tconst minuteLocal = todayTimeLocal.substring(14, 16);\r\n\t\t\tvalRet = `${yearLocal}-${monthLocal}-${dayLocal}T${hourLocal}:${minuteLocal}`;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase \"number\":\r\n\t\t\tif (formatString !== \"F0\") {\r\n\t\t\t\t$(`#input${key}`).val(Number.parseFloat(obj).toFixed(2));\r\n\t\t\t\tvalRet = Number.parseFloat(obj).toFixed(2);\r\n\t\t\t} else {\r\n\t\t\t\t$(`#input${key}`).val(Number.parseInt(obj));\r\n\t\t\t\tvalRet = Number.parseInt(obj).toString();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tvalRet = obj;\r\n\t}\r\n\treturn valRet;\r\n}\r\n\r\nexport function prepareValueToSave(\r\n\tkey: string,\r\n\tobj: string,\r\n\ttype: string,\r\n\tformatString: string\r\n) {\r\n\tlet valRet = \"\";\r\n\tswitch (type) {\r\n\t\tcase \"date\": {\r\n\t\t\tconst todayTime = obj;\r\n\t\t\tconst month = todayTime.substring(5, 7);\r\n\t\t\tconst day = todayTime.substring(8, 10);\r\n\t\t\tconst year = todayTime.substring(0, 4);\r\n\t\t\tvalRet = `${month}/${day}/${year} 00:00:00`;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase \"datetime-local\": {\r\n\t\t\tconst todayTimeLocal = obj;\r\n\t\t\tconst monthLocal = todayTimeLocal.substring(5, 7);\r\n\t\t\tconst dayLocal = todayTimeLocal.substring(8, 10);\r\n\t\t\tconst yearLocal = todayTimeLocal.substring(0, 4);\r\n\t\t\tconst hourLocal = todayTimeLocal.substring(11, 13);\r\n\t\t\tconst minuteLocal = todayTimeLocal.substring(14, 16);\r\n\t\t\tvalRet = `${monthLocal}/${dayLocal}/${yearLocal} ${hourLocal}:${minuteLocal}:00`;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase \"number\":\r\n\t\t\tif (formatString !== \"F0\") {\r\n\t\t\t\t$(`#input${key}`).val(Number.parseFloat(obj).toFixed(2));\r\n\t\t\t\tvalRet = Number.parseFloat(obj).toFixed(2);\r\n\t\t\t} else {\r\n\t\t\t\t$(`#input${key}`).val(Number.parseInt(obj));\r\n\t\t\t\tvalRet = Number.parseInt(obj).toString();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tvalRet = obj;\r\n\t}\r\n\treturn valRet;\r\n}\r\n\r\nexport function onAdditionalParamsChange(\r\n\tkeyOrigin: string,\r\n\tkey: string,\r\n\ttype: string,\r\n\tvalue: string,\r\n\tformatString: string\r\n) {\r\n\tif (type === \"checkbox\") {\r\n\t\tlet value = \"False\";\r\n\t\tif ((document.getElementById(`input${key}`) as HTMLInputElement)?.checked) {\r\n\t\t\tvalue = \"True\";\r\n\t\t}\r\n\t\tadditionalParamsEdited[keyOrigin] = value;\r\n\t} else {\r\n\t\tadditionalParamsEdited[keyOrigin] = prepareValueToSave(\r\n\t\t\tkey,\r\n\t\t\tvalue,\r\n\t\t\ttype,\r\n\t\t\tformatString\r\n\t\t);\r\n\t}\r\n\titemAdditionalPropertiesIsDirty = true;\r\n\tbtnPropertySaveDisableChange();\r\n}\r\n\r\nexport function saveAdditionalProperties(modelId: string) {\r\n\tif (\r\n\t\t!itemAdditionalPropertiesIsDirty ||\r\n\t\tadditionalParamsEdited == null ||\r\n\t\tObject.keys(additionalParamsEdited).length <= 0\r\n\t) {\r\n\t\treturn;\r\n\t}\r\n\tShowLoadingPanel(\"Zapisywanie danych...\");\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/SetAdditionalParams`,\r\n\t\ttype: \"GET\",\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdata: {\r\n\t\t\tmodelId: modelId,\r\n\t\t\tproperties: JSON.stringify(additionalParamsEdited),\r\n\t\t},\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (response.success === true) {\r\n\t\t\t\titemAdditionalPropertiesIsDirty = false;\r\n\t\t\t\tbtnPropertySaveDisableChange();\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tshowDxToast(\"Dane dodatkowe zosta\u0142y zapisane\", \"success\");\r\n\t\t\t\tadditionalParamsEdited = {};\r\n\r\n\t\t\t\tif ($(\"#Tabela\").length > 0) {\r\n\t\t\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\t\t\t\treloadDxGridDataSource();\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t\tshowDxToast(\"B\u0142\u0105d przy zapisywaniu danych dodatkowych\", \"error\");\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d przy zapisywaniu danych dodatkowych\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function askIfChangeDefinitionType(\r\n\toldType: string,\r\n\tnewType: string,\r\n\tdocumentId: string,\r\n\tdefinitionId: string\r\n) {\r\n\tconst popup = $(\"#devex-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(450));\r\n\tpopup.option(\"minHeight\", calcMinPopup(80, true));\r\n\tpopup.option(\"showTitle\", false);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevDialog\"));\r\n\tpopup.show();\r\n\r\n\t$(\"#Dialog\").empty();\r\n\t$(\"#Dialog\").append(`

            \r\n Zmieniasz typ pozycji z '${oldType}'\r\n na bardziej og\u00F3lny typ '${newType}'.

            \r\n Niekt\u00F3re atrybuty pozycji zostan\u0105 utracone!

            \r\n Kontynuowa\u0107?

            \r\n `);\r\n\r\n\tpopup\r\n\t\t.content()\r\n\t\t.find(\".DialogFooter\")\r\n\t\t.empty()\r\n\t\t.append(`\r\n
            \r\n \r\n \r\n
            \r\n `);\r\n\r\n\t$(document).one(\"keypress\", (event) => {\r\n\t\tif (\r\n\t\t\t$(\"#changeTypeBtn\").length > 0 &&\r\n\t\t\tevent.originalEvent?.key === \"Enter\"\r\n\t\t) {\r\n\t\t\t$(\"#changeTypeBtn\").trigger(\"click\");\r\n\t\t}\r\n\t});\r\n\r\n\t$(\"#changeTypeBtn\").on(\"click\", () => {\r\n\t\tShowLoadingPanel(\"Zapisywanie...\");\r\n\t\tChangeDefinitionType(documentId, definitionId, true);\r\n\t\tCloseDialog();\r\n\t});\r\n\r\n\tsetTimeout(HideLoadingPanel, 100);\r\n}\r\n\r\nexport function ChangeDefinitionType(\r\n\tdocumentId: string,\r\n\tdefinitionId: string,\r\n\tgeneralize: boolean\r\n) {\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/ChangeDefinitionType`,\r\n\t\ttype: \"GET\",\r\n\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\tdata: {\r\n\t\t\tdocumentId: documentId,\r\n\t\t\tdefinitionId: definitionId,\r\n\t\t\tgeneralize: generalize,\r\n\t\t},\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\titemPropertiesIsDirty = false;\r\n\t\t\tbtnPropertySaveDisableChange();\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tif (response.success === true) {\r\n\t\t\t\tshowDxToast(\"Typ zosta\u0142 zmieniony\", \"success\");\r\n\t\t\t\tCloseBigDialog();\r\n\t\t\t\tif (checkWhereIsUser() === \"subElements\") {\r\n\t\t\t\t\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\t\t\t\t\treloadDxGridDataSource();\r\n\t\t\t\t} else refreshCurrentPage();\r\n\t\t\t} else {\r\n\t\t\t\tshowDxToast(response.message ?? \"B\u0142\u0105d zmiany typu\", \"error\");\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_request, _status, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d zmiany typu\", \"error\");\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function btnPropertySaveDisableChange() {\r\n\tif (itemPropertiesIsDirty || itemAdditionalPropertiesIsDirty) {\r\n\t\t$(\"#saveProperties\").removeClass(\"disabled\");\r\n\t\t$(\"#saveProperties\").attr(\"disabled\", null);\r\n\t} else {\r\n\t\t$(\"#saveProperties\").addClass(\"disabled\");\r\n\t\t$(\"#saveProperties\").attr(\"disabled\", \"disabled\");\r\n\t}\r\n}\r\n\r\nexport function setItemAdditionalPropertiesIsDirty() {\r\n\titemAdditionalPropertiesIsDirty = true;\r\n\tbtnPropertySaveDisableChange();\r\n}\r\n", "import \"../types/dx.all.d.ts\";\r\nimport type { SaveLayoutOptionsModel } from \"../types/models/LayoutModels/saveLayoutOptionsModel\";\r\nimport type { LogonRequired } from \"../types/models/vario-types\";\r\nimport type { ServiceResponse } from \"../types/models/vario-types\";\r\nimport {\r\n\tcheckIfGridInEditMode,\r\n\tprocessDataColumns,\r\n\tstartDoubleRetrieve,\r\n} from \"./devextreme-table-functions\";\r\nimport { GetBaseUrl, refreshCurrentPage } from \"./page-navigation\";\r\nimport {\r\n\tCloseBigDialog,\r\n\tHideLoadingPanel,\r\n\tShowLoadingPanel,\r\n\tcalcMinPopup,\r\n\tcheckWhereIsUser,\r\n\tshowDxToast,\r\n\ttranslator,\r\n} from \"./site\";\r\n\r\ndeclare global {\r\n\tvar lastTempLayout: string | null;\r\n\tvar lastTempLayout4Id: string | null;\r\n\tvar changedLayout: boolean;\r\n}\r\n\r\nglobalThis.lastTempLayout = null;\r\nglobalThis.lastTempLayout4Id = null;\r\nglobalThis.changedLayout = false;\r\n\r\nexport function getSaveLayoutOptions(layoutFor: string) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\tlet layoutKey = \"\";\r\n\tlet defKeyValue = \"\";\r\n\r\n\tif (layoutFor === \"Inner\") {\r\n\t\tlayoutKey = varioObjectLayoutKey;\r\n\t} else if (layoutFor === \"SubView\" || layoutFor === \"Outer\") {\r\n\t\tlayoutKey = subElementsModel[modelSubElementsOnly].layoutKey;\r\n\t\tdefKeyValue =\r\n\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId ?? \"\";\r\n\t\tdefKeyValue = encodeURIComponent(translator(defKeyValue));\r\n\t}\r\n\r\n\tlayoutKey = encodeURIComponent(translator(layoutKey));\r\n\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetSaveLayoutOptionsModel?itemID=${modelId}&layoutKey=${layoutKey}&layoutFor=${layoutFor}&defKeyValue=${defKeyValue}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tconsole.log(response);\r\n\t\t\t\tshowSaveLayoutOptions(response, layoutFor);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_, __, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d pobierania danych\", \"error\");\r\n\t\t},\r\n\t\tcomplete: () => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function showSaveLayoutOptions(\r\n\tresponse: ServiceResponse,\r\n\tlayoutFor: string\r\n) {\r\n\tconst popup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(500));\r\n\tpopup.option(\"minHeight\", calcMinPopup(430, true));\r\n\tpopup.option(\"title\", \"Opcje zapisu widoku\");\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t$(\"#BigDialog\").empty();\r\n\t$(\"#DialogFooter\").empty();\r\n\r\n\tlet simpleSaveMode = false;\r\n\tif (\r\n\t\tsubElementsModel[modelSubElementsOnly].layoutKey === \"Widok wbudowany [WEB]\"\r\n\t) {\r\n\t\tsimpleSaveMode = true;\r\n\t}\r\n\r\n\t$(\"#BigDialog\").append(`\r\n
            \r\n
            \r\n\r\n
            \r\n \r\n \r\n
            \r\n\r\n
            \r\n \r\n \r\n
            \r\n
            \r\n\r\n \r\n \r\n\r\n
            \r\n \r\n
            \r\n
            \r\n\r\n
            \r\n \r\n \r\n
            \r\n
            `);\r\n\r\n\t$(\"#DialogFooter\").append(`\r\n
            \r\n \r\n \r\n
            `);\r\n\r\n\tfor (const element of response.data.operators.operatorOptions) {\r\n\t\t$(\"#layoutOperators\").append(\r\n\t\t\t``\r\n\t\t);\r\n\t}\r\n\r\n\t$(\"#layoutOperators\").prop(\"selectedIndex\", response.data.operators.selIndex);\r\n\r\n\tfor (const element of response.data.scopes.scopeOptions) {\r\n\t\tconst key = !element.key ? element.typeID : element.key;\r\n\t\t$(\"#layoutScopes\").append(\r\n\t\t\t``\r\n\t\t);\r\n\t}\r\n\t$(\"#layoutScopes\").prop(\"selectedIndex\", response.data.scopes.selIndex);\r\n\r\n\tif (\r\n\t\tsubElementsModel[modelSubElementsOnly].layoutForWeb === \"False\" &&\r\n\t\tsimpleSaveMode\r\n\t) {\r\n\t\t$(\"#useCurrentLayoutRadio\").attr(\"disabled\", \"disabled\");\r\n\t\t$(\"#useCurrentLayoutRadio\").css(\"backgroundColor\", \"grey\");\r\n\t}\r\n\r\n\t$(() => {\r\n\t\t$('input:radio[name=\"layoutRadio\"]').on(\"change\", function () {\r\n\t\t\tif ($(this).val() === \"current\") {\r\n\t\t\t\t$(\"#inputNewLayoutName\").attr(\"disabled\", \"disabled\");\r\n\t\t\t\t//$(\"#defaultWebView\").attr(\"disabled\", \"disabled\");\r\n\t\t\t\t$(\"#layoutOperators\").prop(\r\n\t\t\t\t\t\"selectedIndex\",\r\n\t\t\t\t\tresponse.data.operators.currentIndex\r\n\t\t\t\t);\r\n\t\t\t\t$(\"#layoutScopes\").prop(\r\n\t\t\t\t\t\"selectedIndex\",\r\n\t\t\t\t\tresponse.data.scopes.currentIndex\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\t$(\"#inputNewLayoutName\").removeAttr(\"disabled\");\r\n\t\t\t\t//$(\"#defaultWebView\").removeAttr(\"disabled\");\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\r\n\t$(\".layoutSelect\").on(\"change\", () => {\r\n\t\t$(\"#newLayoutRadio\").prop(\"checked\", true);\r\n\t\t$(\"#newLayoutRadio\").change();\r\n\t});\r\n}\r\n\r\nexport function temporaryLayoutSave(state) {\r\n\tif (\r\n\t\tcheckIfGridInEditMode($(\"#Tabela\").dxDataGrid(\"instance\")) ||\r\n\t\tdeleteOnUndo\r\n\t)\r\n\t\treturn;\r\n\r\n\tlet tempLayout = state\r\n\t\t? state?.columns\r\n\t\t: ($(\"#Tabela\").dxDataGrid(\"instance\").state()?.columns ?? []);\r\n\tconst tempLayoutTemporary = tempLayout?.map((obj) => {\r\n\t\treturn {\r\n\t\t\tdataField: obj.dataField,\r\n\t\t\tname: obj.name,\r\n\t\t\tvisible: obj.visible,\r\n\t\t\tvisibleIndex: obj.visibleIndex,\r\n\t\t\twidth: obj.width,\r\n\t\t\tgroupIndex: obj.groupIndex,\r\n\t\t\tsortOrder: obj.sortOrder,\r\n\t\t};\r\n\t});\r\n\r\n\tif (!tempLayoutTemporary?.length) return;\r\n\r\n\ttempLayout = JSON.stringify(tempLayoutTemporary);\r\n\r\n\tif (\r\n\t\tcheckWhereIsUser(true) === \"varioObjectWithSubElements\" &&\r\n\t\tmodelId !== lastTempLayout4Id\r\n\t) {\r\n\t\tlastTempLayout4Id = modelId;\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (!lastTempLayout || modelId !== lastTempLayout4Id) {\r\n\t\tlastTempLayout = tempLayout;\r\n\t\tlastTempLayout4Id = modelId;\r\n\t\treturn;\r\n\t}\r\n\r\n\tchangedLayout =\r\n\t\tlastTempLayout !== tempLayout && modelId === lastTempLayout4Id;\r\n\r\n\tif (changedLayout) {\r\n\t\tconst getAddedColumns = (oldCols, newCols) => {\r\n\t\t\tconst oldDataFields = oldCols\r\n\t\t\t\t.filter((x) => x.visible)\r\n\t\t\t\t.map((x) => x.dataField);\r\n\t\t\treturn newCols.filter(\r\n\t\t\t\t(x) => x.visible && !oldDataFields.includes(x.dataField)\r\n\t\t\t);\r\n\t\t};\r\n\t\tconst addedColumns = getAddedColumns(\r\n\t\t\tJSON.parse(lastTempLayout),\r\n\t\t\tJSON.parse(tempLayout)\r\n\t\t);\r\n\t\tif (addedColumns?.length > 0) {\r\n\t\t\t//added columns require the data source reloading\r\n\t\t\t//visible columns must be passed as the SelectColumn parameter\r\n\t\t\tconst columnList = JSON.parse(\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].columnListAsJson ?? \"\"\r\n\t\t\t);\r\n\t\t\tcolumnList.push(...addedColumns.map((x) => x.dataField));\r\n\t\t\tsubElementsModel[modelSubElementsOnly].columnListAsJson =\r\n\t\t\t\tJSON.stringify(columnList);\r\n\t\t\tsubElementsModel[modelSubElementsOnly].allowUnrefreshedData = true;\r\n\t\t\tstartDoubleRetrieve();\r\n\t\t}\r\n\r\n\t\tlastTempLayout = tempLayout;\r\n\r\n\t\tif (!$(\".fastLayoutSaveBtn\").length) {\r\n\t\t\tshowTemporaryLayoutSavePopup();\r\n\r\n\t\t\t$(``).insertAfter(\".layout-button\");\r\n\r\n\t\t\t$(\"#dropdown-menu .fastLayoutSaveBtn\").addClass(\"dropdown-item\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function showTemporaryLayoutSavePopup() {\r\n\tconst whereAreWe = checkWhereIsUser();\r\n\tlet layoutFor = \"\";\r\n\r\n\tif (whereAreWe === \"varioObject\") {\r\n\t\tlayoutFor = \"SubView\";\r\n\t} else if (whereAreWe === \"subElements\") {\r\n\t\tlayoutFor = \"Outer\";\r\n\t}\r\n\r\n\tconst contentTemplate = `
            Widok zosta\u0142 zmodyfikowany.\r\n Mo\u017Cesz go\r\n \r\n lub\r\n \r\n
            `;\r\n\r\n\tshowDxToast(\r\n\t\t\"Widok zosta\u0142 zmodyfikowany\",\r\n\t\t\"info\",\r\n\t\t5000,\r\n\t\tcontentTemplate,\r\n\t\t\"saveLayout\"\r\n\t);\r\n}\r\n\r\nexport function sendLayoutStorageRequest(layoutFor: string) {\r\n\tShowLoadingPanel(\"Zapisywanie..\");\r\n\ttry {\r\n\t\tconst data = $(\"#Tabela\")?.dxDataGrid(\"instance\")?.state();\r\n\t\tconst itemID = modelId;\r\n\r\n\t\tconst newView = $(\"#newLayoutRadio\").is(\":checked\");\r\n\t\tconst defaultWebView = $(\"#defaultWebView\").is(\":checked\");\r\n\t\tconst newViewName = $(\"#inputNewLayoutName\").val();\r\n\t\tconst operator = $(\"#layoutOperators\").find(\"option:selected\").val();\r\n\t\tconst scope = $(\"#layoutScopes\").find(\"option:selected\").val();\r\n\r\n\t\tlet columns = \"\";\r\n\t\tif (layoutFor !== \"Inner\") {\r\n\t\t\tdata.columns = processDataColumns(data.columns);\r\n\t\t\tcolumns = data.columns;\r\n\t\t}\r\n\r\n\t\tconst scopeLevel = $(\"#layoutScopes\")\r\n\t\t\t.find(\"option:selected\")\r\n\t\t\t.attr(\"data-scope\");\r\n\t\tconst scopeDetail = $(\"#layoutScopes\")\r\n\t\t\t.find(\"option:selected\")\r\n\t\t\t.attr(\"data-detail\");\r\n\r\n\t\tlet currentLayoutKey = \"\";\r\n\t\tif (layoutFor === \"Inner\") {\r\n\t\t\tcurrentLayoutKey = varioObjectLayoutKey;\r\n\t\t} else if (layoutFor === \"Outer\" || layoutFor === \"SubView\") {\r\n\t\t\tcurrentLayoutKey = subElementsModel[modelSubElementsOnly].layoutKey;\r\n\t\t}\r\n\r\n\t\tconst updateRequest = {\r\n\t\t\tItemID: itemID,\r\n\t\t\tColumns: columns,\r\n\t\t\tNewView: newView,\r\n\t\t\tDefaultWebView: defaultWebView,\r\n\t\t\tNewViewName: newViewName,\r\n\t\t\tLayoutOperator: operator,\r\n\t\t\tLayoutScope: scope,\r\n\t\t\tScopeLevel: scopeLevel,\r\n\t\t\tScopeDetail: scopeDetail,\r\n\t\t\tFastSaveMode: false,\r\n\t\t\tCurrentLayoutKey: currentLayoutKey,\r\n\t\t\tLayoutFor: layoutFor,\r\n\t\t};\r\n\r\n\t\tconsole.log(updateRequest);\r\n\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/Vario/UpdateLayout?itemID=${itemID}`,\r\n\t\t\ttype: \"POST\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tdata: updateRequest,\r\n\t\t\tsuccess: (response: ServiceResponse) => {\r\n\t\t\t\tif (response?.success) {\r\n\t\t\t\t\tshowDxToast(\"Widok zosta\u0142 zapisany\", \"success\");\r\n\t\t\t\t\tCloseBigDialog();\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tsubElementsModel[modelSubElementsOnly].layoutKey ===\r\n\t\t\t\t\t\t\"Widok wbudowany [WEB]\"\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tsubElementsModel[modelSubElementsOnly].layoutKey =\r\n\t\t\t\t\t\t\tresponse.message ?? \"\";\r\n\t\t\t\t\t\trefreshCurrentPage(false, true);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (!response?.success) {\r\n\t\t\t\t\tshowDxToast(response.message ?? \"Wyst\u0105pi\u0142 b\u0142\u0105d\", \"error\");\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: () => {\r\n\t\t\t\tconsole.log(\"Error\");\r\n\t\t\t},\r\n\t\t\tcomplete: () => {\r\n\t\t\t\tHideLoadingPanel();\r\n\t\t\t},\r\n\t\t});\r\n\t} catch (e) {\r\n\t\tconsole.error(e);\r\n\t}\r\n}\r\n\r\nexport function saveLayoutDialog(layoutFor: string) {\r\n\tsendLayoutStorageRequest(layoutFor);\r\n}\r\n\r\nexport function getAvailableLayouts(layoutFor: string) {\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\tlet defKeyValue = \"\";\r\n\r\n\tif (layoutFor === \"SubelementsCheck\") {\r\n\t\tconst whereAreWe = checkWhereIsUser();\r\n\t\tif (whereAreWe === \"subElements\") {\r\n\t\t\tlayoutFor = \"Outer\";\r\n\t\t} else if (whereAreWe === \"varioObject\") {\r\n\t\t\tlayoutFor = \"SubView\";\r\n\t\t\tdefKeyValue =\r\n\t\t\t\tsubElementsModel[modelSubElementsOnly].globalSelectedDefinitionId ?? \"\";\r\n\t\t\tdefKeyValue = encodeURIComponent(translator(defKeyValue));\r\n\t\t}\r\n\t}\r\n\r\n\tconsole.log(layoutFor);\r\n\t$.ajax({\r\n\t\turl: `${GetBaseUrl()}/Vario/GetAvailableLayouts?itemID=${modelId}&layoutFor=${layoutFor}&defKeyValue=${defKeyValue}`,\r\n\t\ttype: \"GET\",\r\n\t\tdataType: \"json\",\r\n\t\tcache: true,\r\n\t\tsuccess: (response: ServiceResponse>) => {\r\n\t\t\tif (response?.success) {\r\n\t\t\t\tconsole.log(response);\r\n\t\t\t\tshowLayoutToChoose(response, layoutFor);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (_, __, error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t\tshowDxToast(\"B\u0142\u0105d pobierania danych\", \"error\");\r\n\t\t},\r\n\t\tcomplete: () => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function showLayoutToChoose(\r\n\tresponse: ServiceResponse>,\r\n\tlayoutFor: string\r\n) {\r\n\tconst popup = $(\"#devex-big-dialog\").dxPopup(\"instance\");\r\n\tpopup.option(\"minWidth\", calcMinPopup(500));\r\n\tpopup.option(\"minHeight\", calcMinPopup(150, true));\r\n\tpopup.option(\"title\", \"Widoki\");\r\n\tpopup.option(\"showTitle\", true);\r\n\tpopup.option(\"contentTemplate\", $(\"#MainDevBigDialog\"));\r\n\tpopup.show();\r\n\tpopup\r\n\t\t.content()\r\n\t\t?.parent()\r\n\t\t?.find(\".dx-popup-title\")\r\n\t\t?.addClass(\"popupTitleAccent\");\r\n\r\n\t$(\"#BigDialog\").empty();\r\n\t$(\"#DialogFooter\").empty();\r\n\r\n\t$(\"#BigDialog\").append(`\r\n
            \r\n
            `\r\n\t).insertAfter(\"#dialogTriggerContainer\");\r\n\r\n\tpopup.content().find(\".DialogFooter\").append(`
            ${buttons}
            `);\r\n\t(document.getElementById(\"inputBoxTextArea\") as HTMLInputElement).value =\r\n\t\tdefaultResult;\r\n\tpopup.repaint();\r\n\r\n\tif (!stringIsNullOrEmpty(executingObjCaption)) {\r\n\t\taddItemInfoToPopup(\"#DialogTriggerFooter\", undefined, undefined, data);\r\n\t}\r\n}\r\n", "import \"../types/dx.all.d.ts\";\r\nimport {\r\n\ttype LogonRequired,\r\n\tSearchByUserEnum,\r\n\ttype SearchParams,\r\n} from \"../types/models/vario-types\";\r\nimport { DragObject } from \"./devextreme-table-functions.ts\";\r\nimport { isDirty } from \"./editor\";\r\nimport { clearFloatingButton } from \"./floating-buttons\";\r\nimport { GetBaseUrl, closeNav, saveUrlInHistory } from \"./page-navigation\";\r\nimport { isDirtyDoc } from \"./richedit\";\r\nimport {\r\n\tHideLoadingPanel,\r\n\tShowLoadingPanel,\r\n\tShowPopupWarningUnsaved,\r\n\tShowPopupWarningUnsavedRichEditDoc,\r\n\tcleanUp,\r\n\tshowDxToast,\r\n\tstringIsNullOrEmpty,\r\n} from \"./site\";\r\n\r\nexport function showSearchSettingsPanel() {\r\n\ttry {\r\n\t\tconst show = $(\"#searchSettingsPanel\").data(\"show\");\r\n\t\tif (show === \"1\") {\r\n\t\t\t$(\"#searchSettingsPanel\").data(\"show\", \"0\");\r\n\t\t} else {\r\n\t\t\t$(\"#searchSettingsPanel\").data(\"show\", \"1\");\r\n\t\t}\r\n\t} catch (exception) {\r\n\t\tconsole.log(exception);\r\n\t}\r\n}\r\n\r\nexport function searchByValueChanged() {\r\n\ttry {\r\n\t\tconst searchBySelect = document.getElementById(\r\n\t\t\t\"SearchBySelect\"\r\n\t\t) as HTMLInputElement;\r\n\t\tconst seachByUser = document.getElementById(\r\n\t\t\t\"seachByUser\"\r\n\t\t) as HTMLInputElement;\r\n\t\tif (searchBySelect && Number(searchBySelect.value) < 4) {\r\n\t\t\tif (seachByUser) {\r\n\t\t\t\tseachByUser.disabled = true;\r\n\t\t\t\tseachByUser.value = \"\";\r\n\t\t\t\t$(seachByUser).addClass(\"hide\");\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tseachByUser.disabled = false;\r\n\t\t\t$(seachByUser).removeClass(\"hide\");\r\n\t\t}\r\n\t} catch (exception) {\r\n\t\tconsole.log(exception);\r\n\t}\r\n}\r\n\r\nexport function checkIfDateCorrect(\r\n\tformContainer: string,\r\n\tdateFrom: Date,\r\n\tdateTo: Date\r\n) {\r\n\tif (!dateFrom)\r\n\t\tdateFrom = new Date(\r\n\t\t\t$($(`#${formContainer} input[type='date']`)[0])\r\n\t\t\t\t.val()\r\n\t\t\t\t?.valueOf()\r\n\t\t\t\t.toString() ?? \"\"\r\n\t\t);\r\n\tif (!dateTo)\r\n\t\tdateTo = new Date(\r\n\t\t\t$($(`#${formContainer} input[type='date']`)[1])\r\n\t\t\t\t.val()\r\n\t\t\t\t?.valueOf()\r\n\t\t\t\t.toString() ?? \"\"\r\n\t\t);\r\n\r\n\tif (Number.isNaN(dateFrom) || Number.isNaN(dateTo)) {\r\n\t\treturn true;\r\n\t}\r\n\r\n\tif (dateFrom > dateTo) {\r\n\t\tshowDxToast('Data \"od\" nie mo\u017Ce by\u0107 starsza od daty \"do\".', \"error\");\r\n\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nexport async function loadSearchPanel(\r\n\t{\r\n\t\tsearchText = \"\",\r\n\t\tremovePrevPage = false,\r\n\t\titemType = \"\",\r\n\t\tfileType = \"\",\r\n\t\tsearchBy = SearchByUserEnum.None,\r\n\t\tsearchByName = \"\",\r\n\t\tcreationDateFrom = null,\r\n\t\tcreationDateTo = null,\r\n\t\tpage = 1,\r\n\t\tasPartialView = true,\r\n\t}: SearchParams = {\r\n\t\tsearchText: \"\",\r\n\t\tremovePrevPage: false,\r\n\t\titemType: \"\",\r\n\t\tfileType: \"\",\r\n\t\tsearchBy: SearchByUserEnum.None,\r\n\t\tsearchByName: \"\",\r\n\t\tcreationDateFrom: null,\r\n\t\tcreationDateTo: null,\r\n\t\tpage: 1,\r\n\t\tasPartialView: true,\r\n\t}\r\n) {\r\n\tif (isDirtyDoc()) {\r\n\t\tconst res = await ShowPopupWarningUnsavedRichEditDoc().catch(() => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\r\n\tif (isDirty()) {\r\n\t\tconst res = await ShowPopupWarningUnsaved().catch(() => {});\r\n\t\tif (!res) return;\r\n\t}\r\n\r\n\tShowLoadingPanel(\"Wczytywanie danych...\");\r\n\r\n\tcleanUp();\r\n\tclearFloatingButton();\r\n\tsessionStorage.removeItem(\"selectedRow\");\r\n\tglobalThis.containerId = \"\";\r\n\r\n\t$(\".sidenavButton\").removeClass(\"active\");\r\n\t$(\"#accordionN .panel .collapse.in\").removeClass(\"in\");\r\n\r\n\tconst searchInput = document.getElementById(\r\n\t\t\"searchTextInput\"\r\n\t) as HTMLInputElement;\r\n\tif (stringIsNullOrEmpty(searchText) && searchInput) {\r\n\t\tsearchText = searchInput.value;\r\n\t}\r\n\r\n\tconst searchItemType = document.getElementById(\r\n\t\t\"seachItemType\"\r\n\t) as HTMLInputElement;\r\n\tif (stringIsNullOrEmpty(itemType) && searchItemType) {\r\n\t\titemType = searchItemType.value;\r\n\t}\r\n\r\n\tconst searchFileType = document.getElementById(\r\n\t\t\"seachFileType\"\r\n\t) as HTMLInputElement;\r\n\tif (stringIsNullOrEmpty(fileType) && searchFileType) {\r\n\t\tfileType = searchFileType.value?.replaceAll(\".\", \"\");\r\n\t}\r\n\r\n\tconst SearchBySelect = document.getElementById(\r\n\t\t\"SearchBySelect\"\r\n\t) as HTMLSelectElement;\r\n\tif (!searchBy && SearchBySelect) {\r\n\t\tsearchBy = Number(SearchBySelect.value);\r\n\t}\r\n\r\n\tconst seachByUser = document.getElementById(\r\n\t\t\"seachByUser\"\r\n\t) as HTMLInputElement;\r\n\tif (\r\n\t\tseachByUser &&\r\n\t\t!stringIsNullOrEmpty(seachByUser.value) &&\r\n\t\tsearchBy >= SearchByUserEnum.CreatedBy\r\n\t) {\r\n\t\tsearchByName = seachByUser.value;\r\n\t}\r\n\r\n\tconst seachCreatedFrom = document.getElementById(\r\n\t\t\"seachCreatedFrom\"\r\n\t) as HTMLInputElement;\r\n\tif (\r\n\t\tstringIsNullOrEmpty(creationDateFrom) &&\r\n\t\tseachCreatedFrom &&\r\n\t\t!stringIsNullOrEmpty(seachCreatedFrom.value)\r\n\t) {\r\n\t\tcreationDateFrom = new Date(seachCreatedFrom.value);\r\n\t}\r\n\r\n\tconst seachCreatedTo = document.getElementById(\r\n\t\t\"seachCreatedTo\"\r\n\t) as HTMLInputElement;\r\n\tif (\r\n\t\tstringIsNullOrEmpty(creationDateTo) &&\r\n\t\tseachCreatedTo &&\r\n\t\t!stringIsNullOrEmpty(seachCreatedTo.value)\r\n\t) {\r\n\t\tcreationDateTo = new Date(seachCreatedTo.value);\r\n\t}\r\n\r\n\tconst data = {\r\n\t\tsearchText: searchText,\r\n\t\titemType: itemType,\r\n\t\tfileType: fileType,\r\n\t\tsearchBy: searchBy,\r\n\t\tsearchByName: searchByName,\r\n\t\tcreatedFrom: creationDateFrom,\r\n\t\tcreatedTo: creationDateTo,\r\n\t\tpage: page,\r\n\t\tremovePreviousPages: removePrevPage,\r\n\t\tasPartialView: asPartialView,\r\n\t\tbrowserTabGuid: sessionStorage.getItem(\"browserTabGuid\"),\r\n\t\tid: null,\r\n\t};\r\n\r\n\tsaveUrlInHistory(\"search\", data);\r\n\r\n\tconst url = `${GetBaseUrl()}/Vario/SearchResult`;\r\n\r\n\t$.ajax({\r\n\t\turl: url,\r\n\t\ttype: \"Get\",\r\n\t\tcache: false,\r\n\t\tdata: data,\r\n\t\tsuccess: (data: string & LogonRequired) => {\r\n\t\t\tHideLoadingPanel();\r\n\t\t\tif (\r\n\t\t\t\tdata != null &&\r\n\t\t\t\tdata.logonRequired !== undefined &&\r\n\t\t\t\tdata.logonRequired === true\r\n\t\t\t) {\r\n\t\t\t\twindow.location.href = `${GetBaseUrl()}/Account/LogIn`;\r\n\t\t\t} else {\r\n\t\t\t\tcloseNav();\r\n\t\t\t\t$(\"#bodyElement\").empty();\r\n\t\t\t\t$(\"#bodyElement\").append(data);\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\t$(\".styled-table\").length === 0 &&\r\n\t\t\t\t\t(searchText !== \"\" ||\r\n\t\t\t\t\t\titemType !== \"\" ||\r\n\t\t\t\t\t\tfileType !== \"\" ||\r\n\t\t\t\t\t\tsearchBy !== SearchByUserEnum.None ||\r\n\t\t\t\t\t\tsearchByName !== \"\" ||\r\n\t\t\t\t\t\tcreationDateFrom ||\r\n\t\t\t\t\t\tcreationDateTo) &&\r\n\t\t\t\t\t$(\"#searchError\").is(\":empty\")\r\n\t\t\t\t) {\r\n\t\t\t\t\t$(\"#searchError\").append(\"Nie znaleziono pozycji.\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: (error) => {\r\n\t\t\tconsole.log(error);\r\n\t\t},\r\n\t});\r\n}\r\n\r\nexport function submitSearch(event: KeyboardEvent) {\r\n\tif (event.key === \"Enter\" && $(\"#searchFormButton\").length > 0) {\r\n\t\t$(\"#searchFormButton\").trigger(\"click\");\r\n\t}\r\n}\r\n\r\nexport function addSearchDrag() {\r\n\t$(\".styled-table .searchImg\").each((_index, el) => {\r\n\t\t$(el).off(\"dragstart\");\r\n\t\tconst caption = $(el).attr(\"data-name\");\r\n\t\tif (caption === \"Brak uprawnie\u0144\") return;\r\n\r\n\t\t$(el as HTMLImageElement).on(\"dragstart\", (evt) => {\r\n\t\t\tconst dragObject = new DragObject(\r\n\t\t\t\tfalse,\r\n\t\t\t\tcaption,\r\n\t\t\t\t$(evt.target).attr(\"data-id\"),\r\n\t\t\t\ttrue,\r\n\t\t\t\tevt.target.src\r\n\t\t\t);\r\n\r\n\t\t\tevt?.originalEvent?.dataTransfer?.setData(\r\n\t\t\t\t\"text/plain\",\r\n\t\t\t\tJSON.stringify([dragObject])\r\n\t\t\t);\r\n\t\t});\r\n\t});\r\n}\r\n", "\uFEFFimport * as signalR from \"@microsoft/signalr\";\r\nimport type { VarioHubModels } from \"../types/models/vario-types\";\r\nimport { OnReceiveMessageChatHandler, updateOnlineStatusCircle } from \"./chat\";\r\nimport { GetBaseUrl } from \"./page-navigation\";\r\nimport { SendMessageWindow } from \"./site\";\r\nimport \"../types/dx.all.d.ts\";\r\n\r\nlet hubConnection: signalR.HubConnection;\r\n\r\nexport function connectToVarioHubProxy(\r\n\tcurrentUserId: string,\r\n\tcurrentUserName: string\r\n) {\r\n\ttry {\r\n\t\tif (!VarioWebAppUrlDomainName?.length) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\thubConnection == null ||\r\n\t\t\t(hubConnection.state !== signalR.HubConnectionState.Connecting &&\r\n\t\t\t\thubConnection.state !== signalR.HubConnectionState.Connected)\r\n\t\t) {\r\n\t\t\thubConnection = new signalR.HubConnectionBuilder()\r\n\t\t\t\t.withUrl(\r\n\t\t\t\t\t`${VarioWebAppUrlDomainName}messageHubProxyClient?UserName=${currentUserName}&UserId=${currentUserId}&ApplicationType=VarioWeb`\r\n\t\t\t\t)\r\n\t\t\t\t.configureLogging(signalR.LogLevel.Information)\r\n\t\t\t\t.withAutomaticReconnect()\r\n\t\t\t\t.build();\r\n\r\n\t\t\thubConnection.on(\r\n\t\t\t\t\"OnReceiveMessage\",\r\n\t\t\t\t(ResponseMessage: VarioHubModels.ResponseMessage) => {\r\n\t\t\t\t\tOnReceiveMessage(ResponseMessage);\r\n\t\t\t\t}\r\n\t\t\t);\r\n\r\n\t\t\thubConnection.on(\r\n\t\t\t\t\"OnItemRequery\",\r\n\t\t\t\t(RequeryItemModel: VarioHubModels.RequeryItemModel) => {\r\n\t\t\t\t\tOnItemRequery(RequeryItemModel);\r\n\t\t\t\t}\r\n\t\t\t);\r\n\r\n\t\t\thubConnection.on(\r\n\t\t\t\t\"OnUserConnected\",\r\n\t\t\t\t(\r\n\t\t\t\t\tHubClients: VarioHubModels.HubClient[],\r\n\t\t\t\t\tCaller: VarioHubModels.HubClient\r\n\t\t\t\t) => {\r\n\t\t\t\t\tOnUserConnected(HubClients, Caller);\r\n\t\t\t\t}\r\n\t\t\t);\r\n\r\n\t\t\thubConnection.on(\r\n\t\t\t\t\"OnUserDisconnected\",\r\n\t\t\t\t(HubClients: VarioHubModels.HubClient[]) => {\r\n\t\t\t\t\tOnUserDisconnected(HubClients);\r\n\t\t\t\t}\r\n\t\t\t);\r\n\r\n\t\t\thubConnection.onreconnecting((error) => {\r\n\t\t\t\tconsole.log(\"Reconnecting interval\", error);\r\n\t\t\t});\r\n\r\n\t\t\thubConnection\r\n\t\t\t\t.start()\r\n\t\t\t\t.then(() => {\r\n\t\t\t\t\tconsole.log(\"connected to VarioHubProxyClient!\");\r\n\t\t\t\t})\r\n\t\t\t\t.catch(console.error);\r\n\r\n\t\t\tconsole.log(hubConnection);\r\n\t\t}\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t}\r\n}\r\n\r\n//Otrzymano wiadomo\u015B\u0107\r\nexport function OnReceiveMessage(\r\n\tResponseMessage: VarioHubModels.ResponseMessage\r\n) {\r\n\ttry {\r\n\t\tif (ResponseMessage) {\r\n\t\t\tOnReceiveMessageChatHandler(ResponseMessage);\r\n\t\t}\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t}\r\n}\r\n\r\nexport function OnItemRequery(\r\n\tRequeryItemModel: VarioHubModels.RequeryItemModel\r\n) {\r\n\ttry {\r\n\t\tconsole.log(RequeryItemModel);\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t}\r\n}\r\n\r\nexport function OnUserConnected(\r\n\tHubClients: VarioHubModels.HubClient[],\r\n\tCaller: VarioHubModels.HubClient\r\n) {\r\n\tsessionStorage.setItem(\"connectedWebClients\", JSON.stringify(HubClients));\r\n\t//Je\u017Celi aktualny user to ten kt\u00F3ry si\u0119 w\u0142a\u015Bnie pod\u0142\u0105czy\u0142 wy\u015Blij 1 raz list\u0119 user\u00F3w webowych do vario hub.\r\n\tif (Caller?.userId?.toString() === currentUserId) {\r\n\t\tUpdateHubProxyClients(HubClients);\r\n\t}\r\n\tupdateOnlineStatusCircle();\r\n}\r\n\r\nexport function OnUserDisconnected(HubClients: VarioHubModels.HubClient[]) {\r\n\tsessionStorage.setItem(\"connectedWebClients\", JSON.stringify(HubClients));\r\n\tupdateOnlineStatusCircle();\r\n}\r\n\r\n//Zmienili si\u0119 pod\u0142\u0105czeni u\u017Cytkownicy przegl\u0105darkowi. Wy\u015Blij aktualn\u0105 list\u0119 do VarioHub\r\nexport function UpdateHubProxyClients(_HubClients: VarioHubModels.HubClient[]) {\r\n\ttry {\r\n\t\t$.ajax({\r\n\t\t\turl: `${GetBaseUrl()}/HubProxy/UpdateHubProxyClients`,\r\n\t\t\ttype: \"Get\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: (_: boolean) => {},\r\n\t\t\terror: (error) => {\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t},\r\n\t\t});\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t}\r\n}\r\n\r\n//funkcja otwierajaca okienko odpowiedz po kliknieciu na dx toasta\r\nexport function SendMessageWindowPrepare(\r\n\tmsg: VarioHubModels.ResponseMessageExtra\r\n) {\r\n\tSendMessageWindow(\r\n\t\tmsg.messageSenderName,\r\n\t\tmsg.message,\r\n\t\tmsg.creationDate ?? \"\",\r\n\t\tmsg.messageSenderId.toString()\r\n\t);\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { HttpTransportType } from \"./ITransport\";\r\n\r\n/** Error thrown when an HTTP request fails. */\r\nexport class HttpError extends Error {\r\n // @ts-ignore: Intentionally unused.\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private __proto__: Error;\r\n\r\n /** The HTTP status code represented by this error. */\r\n public statusCode: number;\r\n\r\n /** Constructs a new instance of {@link @microsoft/signalr.HttpError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n * @param {number} statusCode The HTTP status code represented by this error.\r\n */\r\n constructor(errorMessage: string, statusCode: number) {\r\n const trueProto = new.target.prototype;\r\n super(`${errorMessage}: Status code '${statusCode}'`);\r\n this.statusCode = statusCode;\r\n\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n\r\n/** Error thrown when a timeout elapses. */\r\nexport class TimeoutError extends Error {\r\n // @ts-ignore: Intentionally unused.\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private __proto__: Error;\r\n\r\n /** Constructs a new instance of {@link @microsoft/signalr.TimeoutError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\r\n constructor(errorMessage: string = \"A timeout occurred.\") {\r\n const trueProto = new.target.prototype;\r\n super(errorMessage);\r\n\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n\r\n/** Error thrown when an action is aborted. */\r\nexport class AbortError extends Error {\r\n // @ts-ignore: Intentionally unused.\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private __proto__: Error;\r\n\r\n /** Constructs a new instance of {@link AbortError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\r\n constructor(errorMessage: string = \"An abort occurred.\") {\r\n const trueProto = new.target.prototype;\r\n super(errorMessage);\r\n\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n\r\n/** Error thrown when the selected transport is unsupported by the browser. */\r\n/** @private */\r\nexport class UnsupportedTransportError extends Error {\r\n // @ts-ignore: Intentionally unused.\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private __proto__: Error;\r\n\r\n /** The {@link @microsoft/signalr.HttpTransportType} this error occurred on. */\r\n public transport: HttpTransportType;\r\n\r\n /** The type name of this error. */\r\n public errorType: string;\r\n\r\n /** Constructs a new instance of {@link @microsoft/signalr.UnsupportedTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\r\n constructor(message: string, transport: HttpTransportType) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.transport = transport;\r\n this.errorType = 'UnsupportedTransportError';\r\n\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n\r\n/** Error thrown when the selected transport is disabled by the browser. */\r\n/** @private */\r\nexport class DisabledTransportError extends Error {\r\n // @ts-ignore: Intentionally unused.\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private __proto__: Error;\r\n\r\n /** The {@link @microsoft/signalr.HttpTransportType} this error occurred on. */\r\n public transport: HttpTransportType;\r\n\r\n /** The type name of this error. */\r\n public errorType: string;\r\n\r\n /** Constructs a new instance of {@link @microsoft/signalr.DisabledTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\r\n constructor(message: string, transport: HttpTransportType) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.transport = transport;\r\n this.errorType = 'DisabledTransportError';\r\n\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n\r\n/** Error thrown when the selected transport cannot be started. */\r\n/** @private */\r\nexport class FailedToStartTransportError extends Error {\r\n // @ts-ignore: Intentionally unused.\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private __proto__: Error;\r\n\r\n /** The {@link @microsoft/signalr.HttpTransportType} this error occurred on. */\r\n public transport: HttpTransportType;\r\n\r\n /** The type name of this error. */\r\n public errorType: string;\r\n\r\n /** Constructs a new instance of {@link @microsoft/signalr.FailedToStartTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\r\n constructor(message: string, transport: HttpTransportType) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.transport = transport;\r\n this.errorType = 'FailedToStartTransportError';\r\n\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n\r\n/** Error thrown when the negotiation with the server failed to complete. */\r\n/** @private */\r\nexport class FailedToNegotiateWithServerError extends Error {\r\n // @ts-ignore: Intentionally unused.\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private __proto__: Error;\r\n\r\n /** The type name of this error. */\r\n public errorType: string;\r\n\r\n /** Constructs a new instance of {@link @microsoft/signalr.FailedToNegotiateWithServerError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n */\r\n constructor(message: string) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.errorType = 'FailedToNegotiateWithServerError';\r\n\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n\r\n/** Error thrown when multiple errors have occurred. */\r\n/** @private */\r\nexport class AggregateErrors extends Error {\r\n // @ts-ignore: Intentionally unused.\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private __proto__: Error;\r\n\r\n /** The collection of errors this error is aggregating. */\r\n public innerErrors: Error[];\r\n\r\n /** Constructs a new instance of {@link @microsoft/signalr.AggregateErrors}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {Error[]} innerErrors The collection of errors this error is aggregating.\r\n */\r\n constructor(message: string, innerErrors: Error[]) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n\r\n this.innerErrors = innerErrors;\r\n\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { AbortSignal } from \"./AbortController\";\r\nimport { MessageHeaders } from \"./IHubProtocol\";\r\n\r\n/** Represents an HTTP request. */\r\nexport interface HttpRequest {\r\n /** The HTTP method to use for the request. */\r\n method?: string;\r\n\r\n /** The URL for the request. */\r\n url?: string;\r\n\r\n /** The body content for the request. May be a string or an ArrayBuffer (for binary data). */\r\n content?: string | ArrayBuffer;\r\n\r\n /** An object describing headers to apply to the request. */\r\n headers?: MessageHeaders;\r\n\r\n /** The XMLHttpRequestResponseType to apply to the request. */\r\n responseType?: XMLHttpRequestResponseType;\r\n\r\n /** An AbortSignal that can be monitored for cancellation. */\r\n abortSignal?: AbortSignal;\r\n\r\n /** The time to wait for the request to complete before throwing a TimeoutError. Measured in milliseconds. */\r\n timeout?: number;\r\n\r\n /** This controls whether credentials such as cookies are sent in cross-site requests. */\r\n withCredentials?: boolean;\r\n}\r\n\r\n/** Represents an HTTP response. */\r\nexport class HttpResponse {\r\n /** Constructs a new instance of {@link @microsoft/signalr.HttpResponse} with the specified status code.\r\n *\r\n * @param {number} statusCode The status code of the response.\r\n */\r\n constructor(statusCode: number);\r\n\r\n /** Constructs a new instance of {@link @microsoft/signalr.HttpResponse} with the specified status code and message.\r\n *\r\n * @param {number} statusCode The status code of the response.\r\n * @param {string} statusText The status message of the response.\r\n */\r\n constructor(statusCode: number, statusText: string);\r\n\r\n /** Constructs a new instance of {@link @microsoft/signalr.HttpResponse} with the specified status code, message and string content.\r\n *\r\n * @param {number} statusCode The status code of the response.\r\n * @param {string} statusText The status message of the response.\r\n * @param {string} content The content of the response.\r\n */\r\n constructor(statusCode: number, statusText: string, content: string);\r\n\r\n /** Constructs a new instance of {@link @microsoft/signalr.HttpResponse} with the specified status code, message and binary content.\r\n *\r\n * @param {number} statusCode The status code of the response.\r\n * @param {string} statusText The status message of the response.\r\n * @param {ArrayBuffer} content The content of the response.\r\n */\r\n constructor(statusCode: number, statusText: string, content: ArrayBuffer);\r\n\r\n /** Constructs a new instance of {@link @microsoft/signalr.HttpResponse} with the specified status code, message and binary content.\r\n *\r\n * @param {number} statusCode The status code of the response.\r\n * @param {string} statusText The status message of the response.\r\n * @param {string | ArrayBuffer} content The content of the response.\r\n */\r\n constructor(statusCode: number, statusText: string, content: string | ArrayBuffer);\r\n constructor(\r\n public readonly statusCode: number,\r\n public readonly statusText?: string,\r\n public readonly content?: string | ArrayBuffer) {\r\n }\r\n}\r\n\r\n/** Abstraction over an HTTP client.\r\n *\r\n * This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms.\r\n */\r\nexport abstract class HttpClient {\r\n /** Issues an HTTP GET request to the specified URL, returning a Promise that resolves with an {@link @microsoft/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {string} url The URL for the request.\r\n * @returns {Promise} A Promise that resolves with an {@link @microsoft/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public get(url: string): Promise;\r\n\r\n /** Issues an HTTP GET request to the specified URL, returning a Promise that resolves with an {@link @microsoft/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {string} url The URL for the request.\r\n * @param {HttpRequest} options Additional options to configure the request. The 'url' field in this object will be overridden by the url parameter.\r\n * @returns {Promise} A Promise that resolves with an {@link @microsoft/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public get(url: string, options: HttpRequest): Promise;\r\n public get(url: string, options?: HttpRequest): Promise {\r\n return this.send({\r\n ...options,\r\n method: \"GET\",\r\n url,\r\n });\r\n }\r\n\r\n /** Issues an HTTP POST request to the specified URL, returning a Promise that resolves with an {@link @microsoft/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {string} url The URL for the request.\r\n * @returns {Promise} A Promise that resolves with an {@link @microsoft/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public post(url: string): Promise;\r\n\r\n /** Issues an HTTP POST request to the specified URL, returning a Promise that resolves with an {@link @microsoft/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {string} url The URL for the request.\r\n * @param {HttpRequest} options Additional options to configure the request. The 'url' field in this object will be overridden by the url parameter.\r\n * @returns {Promise} A Promise that resolves with an {@link @microsoft/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public post(url: string, options: HttpRequest): Promise;\r\n public post(url: string, options?: HttpRequest): Promise {\r\n return this.send({\r\n ...options,\r\n method: \"POST\",\r\n url,\r\n });\r\n }\r\n\r\n /** Issues an HTTP DELETE request to the specified URL, returning a Promise that resolves with an {@link @microsoft/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {string} url The URL for the request.\r\n * @returns {Promise} A Promise that resolves with an {@link @microsoft/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public delete(url: string): Promise;\r\n\r\n /** Issues an HTTP DELETE request to the specified URL, returning a Promise that resolves with an {@link @microsoft/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {string} url The URL for the request.\r\n * @param {HttpRequest} options Additional options to configure the request. The 'url' field in this object will be overridden by the url parameter.\r\n * @returns {Promise} A Promise that resolves with an {@link @microsoft/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public delete(url: string, options: HttpRequest): Promise;\r\n public delete(url: string, options?: HttpRequest): Promise {\r\n return this.send({\r\n ...options,\r\n method: \"DELETE\",\r\n url,\r\n });\r\n }\r\n\r\n /** Issues an HTTP request to the specified URL, returning a {@link Promise} that resolves with an {@link @microsoft/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {HttpRequest} request An {@link @microsoft/signalr.HttpRequest} describing the request to send.\r\n * @returns {Promise} A Promise that resolves with an HttpResponse describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public abstract send(request: HttpRequest): Promise;\r\n\r\n /** Gets all cookies that apply to the specified URL.\r\n *\r\n * @param url The URL that the cookies are valid for.\r\n * @returns {string} A string containing all the key-value cookie pairs for the specified URL.\r\n */\r\n // @ts-ignore\r\n public getCookieString(url: string): string {\r\n return \"\";\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\n// These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.\r\n/** Indicates the severity of a log message.\r\n *\r\n * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.\r\n */\r\nexport enum LogLevel {\r\n /** Log level for very low severity diagnostic messages. */\r\n Trace = 0,\r\n /** Log level for low severity diagnostic messages. */\r\n Debug = 1,\r\n /** Log level for informational diagnostic messages. */\r\n Information = 2,\r\n /** Log level for diagnostic messages that indicate a non-fatal problem. */\r\n Warning = 3,\r\n /** Log level for diagnostic messages that indicate a failure in the current operation. */\r\n Error = 4,\r\n /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */\r\n Critical = 5,\r\n /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */\r\n None = 6,\r\n}\r\n\r\n/** An abstraction that provides a sink for diagnostic messages. */\r\nexport interface ILogger {\r\n /** Called by the framework to emit a diagnostic message.\r\n *\r\n * @param {LogLevel} logLevel The severity level of the message.\r\n * @param {string} message The message.\r\n */\r\n log(logLevel: LogLevel, message: string): void;\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\n\r\n/** A logger that does nothing when log messages are sent to it. */\r\nexport class NullLogger implements ILogger {\r\n /** The singleton instance of the {@link @microsoft/signalr.NullLogger}. */\r\n public static instance: ILogger = new NullLogger();\r\n\r\n private constructor() {}\r\n\r\n /** @inheritDoc */\r\n // eslint-disable-next-line\r\n public log(_logLevel: LogLevel, _message: string): void {\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { HttpClient } from \"./HttpClient\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { NullLogger } from \"./Loggers\";\r\nimport { IStreamSubscriber, ISubscription } from \"./Stream\";\r\nimport { Subject } from \"./Subject\";\r\nimport { IHttpConnectionOptions } from \"./IHttpConnectionOptions\";\r\n\r\n// Version token that will be replaced by the prepack command\r\n/** The version of the SignalR client. */\r\n\r\nexport const VERSION: string = \"0.0.0-DEV_BUILD\";\r\n/** @private */\r\nexport class Arg {\r\n public static isRequired(val: any, name: string): void {\r\n if (val === null || val === undefined) {\r\n throw new Error(`The '${name}' argument is required.`);\r\n }\r\n }\r\n public static isNotEmpty(val: string, name: string): void {\r\n if (!val || val.match(/^\\s*$/)) {\r\n throw new Error(`The '${name}' argument should not be empty.`);\r\n }\r\n }\r\n\r\n public static isIn(val: any, values: any, name: string): void {\r\n // TypeScript enums have keys for **both** the name and the value of each enum member on the type itself.\r\n if (!(val in values)) {\r\n throw new Error(`Unknown ${name} value: ${val}.`);\r\n }\r\n }\r\n}\r\n\r\n/** @private */\r\nexport class Platform {\r\n // react-native has a window but no document so we should check both\r\n public static get isBrowser(): boolean {\r\n return typeof window === \"object\" && typeof window.document === \"object\";\r\n }\r\n\r\n // WebWorkers don't have a window object so the isBrowser check would fail\r\n public static get isWebWorker(): boolean {\r\n return typeof self === \"object\" && \"importScripts\" in self;\r\n }\r\n\r\n // react-native has a window but no document\r\n static get isReactNative(): boolean {\r\n return typeof window === \"object\" && typeof window.document === \"undefined\";\r\n }\r\n\r\n // Node apps shouldn't have a window object, but WebWorkers don't either\r\n // so we need to check for both WebWorker and window\r\n public static get isNode(): boolean {\r\n return !this.isBrowser && !this.isWebWorker && !this.isReactNative;\r\n }\r\n}\r\n\r\n/** @private */\r\nexport function getDataDetail(data: any, includeContent: boolean): string {\r\n let detail = \"\";\r\n if (isArrayBuffer(data)) {\r\n detail = `Binary data of length ${data.byteLength}`;\r\n if (includeContent) {\r\n detail += `. Content: '${formatArrayBuffer(data)}'`;\r\n }\r\n } else if (typeof data === \"string\") {\r\n detail = `String data of length ${data.length}`;\r\n if (includeContent) {\r\n detail += `. Content: '${data}'`;\r\n }\r\n }\r\n return detail;\r\n}\r\n\r\n/** @private */\r\nexport function formatArrayBuffer(data: ArrayBuffer): string {\r\n const view = new Uint8Array(data);\r\n\r\n // Uint8Array.map only supports returning another Uint8Array?\r\n let str = \"\";\r\n view.forEach((num) => {\r\n const pad = num < 16 ? \"0\" : \"\";\r\n str += `0x${pad}${num.toString(16)} `;\r\n });\r\n\r\n // Trim of trailing space.\r\n return str.substr(0, str.length - 1);\r\n}\r\n\r\n// Also in signalr-protocol-msgpack/Utils.ts\r\n/** @private */\r\nexport function isArrayBuffer(val: any): val is ArrayBuffer {\r\n return val && typeof ArrayBuffer !== \"undefined\" &&\r\n (val instanceof ArrayBuffer ||\r\n // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof\r\n (val.constructor && val.constructor.name === \"ArrayBuffer\"));\r\n}\r\n\r\n/** @private */\r\nexport async function sendMessage(logger: ILogger, transportName: string, httpClient: HttpClient, url: string,\r\n content: string | ArrayBuffer, options: IHttpConnectionOptions): Promise {\r\n const headers: {[k: string]: string} = {};\r\n\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n\r\n logger.log(LogLevel.Trace, `(${transportName} transport) sending data. ${getDataDetail(content, options.logMessageContent!)}.`);\r\n\r\n const responseType = isArrayBuffer(content) ? \"arraybuffer\" : \"text\";\r\n const response = await httpClient.post(url, {\r\n content,\r\n headers: { ...headers, ...options.headers},\r\n responseType,\r\n timeout: options.timeout,\r\n withCredentials: options.withCredentials,\r\n });\r\n\r\n logger.log(LogLevel.Trace, `(${transportName} transport) request complete. Response status: ${response.statusCode}.`);\r\n}\r\n\r\n/** @private */\r\nexport function createLogger(logger?: ILogger | LogLevel): ILogger {\r\n if (logger === undefined) {\r\n return new ConsoleLogger(LogLevel.Information);\r\n }\r\n\r\n if (logger === null) {\r\n return NullLogger.instance;\r\n }\r\n\r\n if ((logger as ILogger).log !== undefined) {\r\n return logger as ILogger;\r\n }\r\n\r\n return new ConsoleLogger(logger as LogLevel);\r\n}\r\n\r\n/** @private */\r\nexport class SubjectSubscription implements ISubscription {\r\n private _subject: Subject;\r\n private _observer: IStreamSubscriber;\r\n\r\n constructor(subject: Subject, observer: IStreamSubscriber) {\r\n this._subject = subject;\r\n this._observer = observer;\r\n }\r\n\r\n public dispose(): void {\r\n const index: number = this._subject.observers.indexOf(this._observer);\r\n if (index > -1) {\r\n this._subject.observers.splice(index, 1);\r\n }\r\n\r\n if (this._subject.observers.length === 0 && this._subject.cancelCallback) {\r\n this._subject.cancelCallback().catch((_) => { });\r\n }\r\n }\r\n}\r\n\r\n/** @private */\r\nexport class ConsoleLogger implements ILogger {\r\n private readonly _minLevel: LogLevel;\r\n\r\n // Public for testing purposes.\r\n public out: {\r\n error(message: any): void,\r\n warn(message: any): void,\r\n info(message: any): void,\r\n log(message: any): void,\r\n };\r\n\r\n constructor(minimumLogLevel: LogLevel) {\r\n this._minLevel = minimumLogLevel;\r\n this.out = console;\r\n }\r\n\r\n public log(logLevel: LogLevel, message: string): void {\r\n if (logLevel >= this._minLevel) {\r\n const msg = `[${new Date().toISOString()}] ${LogLevel[logLevel]}: ${message}`;\r\n switch (logLevel) {\r\n case LogLevel.Critical:\r\n case LogLevel.Error:\r\n this.out.error(msg);\r\n break;\r\n case LogLevel.Warning:\r\n this.out.warn(msg);\r\n break;\r\n case LogLevel.Information:\r\n this.out.info(msg);\r\n break;\r\n default:\r\n // console.debug only goes to attached debuggers in Node, so we use console.log for Trace and Debug\r\n this.out.log(msg);\r\n break;\r\n }\r\n }\r\n }\r\n}\r\n\r\n/** @private */\r\nexport function getUserAgentHeader(): [string, string] {\r\n let userAgentHeaderName = \"X-SignalR-User-Agent\";\r\n if (Platform.isNode) {\r\n userAgentHeaderName = \"User-Agent\";\r\n }\r\n return [ userAgentHeaderName, constructUserAgent(VERSION, getOsName(), getRuntime(), getRuntimeVersion()) ];\r\n}\r\n\r\n/** @private */\r\nexport function constructUserAgent(version: string, os: string, runtime: string, runtimeVersion: string | undefined): string {\r\n // Microsoft SignalR/[Version] ([Detailed Version]; [Operating System]; [Runtime]; [Runtime Version])\r\n let userAgent: string = \"Microsoft SignalR/\";\r\n\r\n const majorAndMinor = version.split(\".\");\r\n userAgent += `${majorAndMinor[0]}.${majorAndMinor[1]}`;\r\n userAgent += ` (${version}; `;\r\n\r\n if (os && os !== \"\") {\r\n userAgent += `${os}; `;\r\n } else {\r\n userAgent += \"Unknown OS; \";\r\n }\r\n\r\n userAgent += `${runtime}`;\r\n\r\n if (runtimeVersion) {\r\n userAgent += `; ${runtimeVersion}`;\r\n } else {\r\n userAgent += \"; Unknown Runtime Version\";\r\n }\r\n\r\n userAgent += \")\";\r\n return userAgent;\r\n}\r\n\r\n// eslint-disable-next-line spaced-comment\r\n/*#__PURE__*/ function getOsName(): string {\r\n if (Platform.isNode) {\r\n switch (process.platform) {\r\n case \"win32\":\r\n return \"Windows NT\";\r\n case \"darwin\":\r\n return \"macOS\";\r\n case \"linux\":\r\n return \"Linux\";\r\n default:\r\n return process.platform;\r\n }\r\n } else {\r\n return \"\";\r\n }\r\n}\r\n\r\n// eslint-disable-next-line spaced-comment\r\n/*#__PURE__*/ function getRuntimeVersion(): string | undefined {\r\n if (Platform.isNode) {\r\n return process.versions.node;\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getRuntime(): string {\r\n if (Platform.isNode) {\r\n return \"NodeJS\";\r\n } else {\r\n return \"Browser\";\r\n }\r\n}\r\n\r\n/** @private */\r\nexport function getErrorString(e: any): string {\r\n if (e.stack) {\r\n return e.stack;\r\n } else if (e.message) {\r\n return e.message;\r\n }\r\n return `${e}`;\r\n}\r\n\r\n/** @private */\r\nexport function getGlobalThis(): unknown {\r\n // globalThis is semi-new and not available in Node until v12\r\n if (typeof globalThis !== \"undefined\") {\r\n return globalThis;\r\n }\r\n if (typeof self !== \"undefined\") {\r\n return self;\r\n }\r\n if (typeof window !== \"undefined\") {\r\n return window;\r\n }\r\n if (typeof global !== \"undefined\") {\r\n return global;\r\n }\r\n throw new Error(\"could not find global\");\r\n}", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\n// @ts-ignore: This will be removed from built files and is here to make the types available during dev work\r\nimport { CookieJar } from \"@types/tough-cookie\";\r\n\r\nimport { AbortError, HttpError, TimeoutError } from \"./Errors\";\r\nimport { HttpClient, HttpRequest, HttpResponse } from \"./HttpClient\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { Platform, getGlobalThis, isArrayBuffer } from \"./Utils\";\r\n\r\nexport class FetchHttpClient extends HttpClient {\r\n private readonly _abortControllerType: { prototype: AbortController, new(): AbortController };\r\n private readonly _fetchType: (input: RequestInfo, init?: RequestInit) => Promise;\r\n private readonly _jar?: CookieJar;\r\n\r\n private readonly _logger: ILogger;\r\n\r\n public constructor(logger: ILogger) {\r\n super();\r\n this._logger = logger;\r\n\r\n if (typeof fetch === \"undefined\") {\r\n // In order to ignore the dynamic require in webpack builds we need to do this magic\r\n // @ts-ignore: TS doesn't know about these names\r\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\r\n\r\n // Cookies aren't automatically handled in Node so we need to add a CookieJar to preserve cookies across requests\r\n this._jar = new (requireFunc(\"tough-cookie\")).CookieJar();\r\n this._fetchType = requireFunc(\"node-fetch\");\r\n\r\n // node-fetch doesn't have a nice API for getting and setting cookies\r\n // fetch-cookie will wrap a fetch implementation with a default CookieJar or a provided one\r\n this._fetchType = requireFunc(\"fetch-cookie\")(this._fetchType, this._jar);\r\n } else {\r\n this._fetchType = fetch.bind(getGlobalThis());\r\n }\r\n if (typeof AbortController === \"undefined\") {\r\n // In order to ignore the dynamic require in webpack builds we need to do this magic\r\n // @ts-ignore: TS doesn't know about these names\r\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\r\n\r\n // Node needs EventListener methods on AbortController which our custom polyfill doesn't provide\r\n this._abortControllerType = requireFunc(\"abort-controller\");\r\n } else {\r\n this._abortControllerType = AbortController;\r\n }\r\n }\r\n\r\n /** @inheritDoc */\r\n public async send(request: HttpRequest): Promise {\r\n // Check that abort was not signaled before calling send\r\n if (request.abortSignal && request.abortSignal.aborted) {\r\n throw new AbortError();\r\n }\r\n\r\n if (!request.method) {\r\n throw new Error(\"No method defined.\");\r\n }\r\n if (!request.url) {\r\n throw new Error(\"No url defined.\");\r\n }\r\n\r\n const abortController = new this._abortControllerType();\r\n\r\n let error: any;\r\n // Hook our abortSignal into the abort controller\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = () => {\r\n abortController.abort();\r\n error = new AbortError();\r\n };\r\n }\r\n\r\n // If a timeout has been passed in, setup a timeout to call abort\r\n // Type needs to be any to fit window.setTimeout and NodeJS.setTimeout\r\n let timeoutId: any = null;\r\n if (request.timeout) {\r\n const msTimeout = request.timeout!;\r\n timeoutId = setTimeout(() => {\r\n abortController.abort();\r\n this._logger.log(LogLevel.Warning, `Timeout from HTTP request.`);\r\n error = new TimeoutError();\r\n }, msTimeout);\r\n }\r\n\r\n if (request.content === \"\") {\r\n request.content = undefined;\r\n }\r\n if (request.content) {\r\n // Explicitly setting the Content-Type header for React Native on Android platform.\r\n request.headers = request.headers || {};\r\n if (isArrayBuffer(request.content)) {\r\n request.headers[\"Content-Type\"] = \"application/octet-stream\";\r\n } else {\r\n request.headers[\"Content-Type\"] = \"text/plain;charset=UTF-8\";\r\n }\r\n }\r\n\r\n let response: Response;\r\n try {\r\n response = await this._fetchType(request.url!, {\r\n body: request.content,\r\n cache: \"no-cache\",\r\n credentials: request.withCredentials === true ? \"include\" : \"same-origin\",\r\n headers: {\r\n \"X-Requested-With\": \"XMLHttpRequest\",\r\n ...request.headers,\r\n },\r\n method: request.method!,\r\n mode: \"cors\",\r\n redirect: \"follow\",\r\n signal: abortController.signal,\r\n });\r\n } catch (e) {\r\n if (error) {\r\n throw error;\r\n }\r\n this._logger.log(\r\n LogLevel.Warning,\r\n `Error from HTTP request. ${e}.`,\r\n );\r\n throw e;\r\n } finally {\r\n if (timeoutId) {\r\n clearTimeout(timeoutId);\r\n }\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = null;\r\n }\r\n }\r\n\r\n if (!response.ok) {\r\n const errorMessage = await deserializeContent(response, \"text\") as string;\r\n throw new HttpError(errorMessage || response.statusText, response.status);\r\n }\r\n\r\n const content = deserializeContent(response, request.responseType);\r\n const payload = await content;\r\n\r\n return new HttpResponse(\r\n response.status,\r\n response.statusText,\r\n payload,\r\n );\r\n }\r\n\r\n public getCookieString(url: string): string {\r\n let cookies: string = \"\";\r\n if (Platform.isNode && this._jar) {\r\n // @ts-ignore: unused variable\r\n this._jar.getCookies(url, (e, c) => cookies = c.join(\"; \"));\r\n }\r\n return cookies;\r\n }\r\n}\r\n\r\nfunction deserializeContent(response: Response, responseType?: XMLHttpRequestResponseType): Promise {\r\n let content;\r\n switch (responseType) {\r\n case \"arraybuffer\":\r\n content = response.arrayBuffer();\r\n break;\r\n case \"text\":\r\n content = response.text();\r\n break;\r\n case \"blob\":\r\n case \"document\":\r\n case \"json\":\r\n throw new Error(`${responseType} is not supported.`);\r\n default:\r\n content = response.text();\r\n break;\r\n }\r\n\r\n return content;\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { AbortError, HttpError, TimeoutError } from \"./Errors\";\r\nimport { HttpClient, HttpRequest, HttpResponse } from \"./HttpClient\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { isArrayBuffer } from \"./Utils\";\r\n\r\nexport class XhrHttpClient extends HttpClient {\r\n private readonly _logger: ILogger;\r\n\r\n public constructor(logger: ILogger) {\r\n super();\r\n this._logger = logger;\r\n }\r\n\r\n /** @inheritDoc */\r\n public send(request: HttpRequest): Promise {\r\n // Check that abort was not signaled before calling send\r\n if (request.abortSignal && request.abortSignal.aborted) {\r\n return Promise.reject(new AbortError());\r\n }\r\n\r\n if (!request.method) {\r\n return Promise.reject(new Error(\"No method defined.\"));\r\n }\r\n if (!request.url) {\r\n return Promise.reject(new Error(\"No url defined.\"));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const xhr = new XMLHttpRequest();\r\n\r\n xhr.open(request.method!, request.url!, true);\r\n xhr.withCredentials = request.withCredentials === undefined ? true : request.withCredentials;\r\n xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\r\n if (request.content === \"\") {\r\n request.content = undefined;\r\n }\r\n if (request.content) {\r\n // Explicitly setting the Content-Type header for React Native on Android platform.\r\n if (isArrayBuffer(request.content)) {\r\n xhr.setRequestHeader(\"Content-Type\", \"application/octet-stream\");\r\n } else {\r\n xhr.setRequestHeader(\"Content-Type\", \"text/plain;charset=UTF-8\");\r\n }\r\n }\r\n\r\n const headers = request.headers;\r\n if (headers) {\r\n Object.keys(headers)\r\n .forEach((header) => {\r\n xhr.setRequestHeader(header, headers[header]);\r\n });\r\n }\r\n\r\n if (request.responseType) {\r\n xhr.responseType = request.responseType;\r\n }\r\n\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = () => {\r\n xhr.abort();\r\n reject(new AbortError());\r\n };\r\n }\r\n\r\n if (request.timeout) {\r\n xhr.timeout = request.timeout;\r\n }\r\n\r\n xhr.onload = () => {\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = null;\r\n }\r\n\r\n if (xhr.status >= 200 && xhr.status < 300) {\r\n resolve(new HttpResponse(xhr.status, xhr.statusText, xhr.response || xhr.responseText));\r\n } else {\r\n reject(new HttpError(xhr.response || xhr.responseText || xhr.statusText, xhr.status));\r\n }\r\n };\r\n\r\n xhr.onerror = () => {\r\n this._logger.log(LogLevel.Warning, `Error from HTTP request. ${xhr.status}: ${xhr.statusText}.`);\r\n reject(new HttpError(xhr.statusText, xhr.status));\r\n };\r\n\r\n xhr.ontimeout = () => {\r\n this._logger.log(LogLevel.Warning, `Timeout from HTTP request.`);\r\n reject(new TimeoutError());\r\n };\r\n\r\n xhr.send(request.content);\r\n });\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { AbortError } from \"./Errors\";\r\nimport { FetchHttpClient } from \"./FetchHttpClient\";\r\nimport { HttpClient, HttpRequest, HttpResponse } from \"./HttpClient\";\r\nimport { ILogger } from \"./ILogger\";\r\nimport { Platform } from \"./Utils\";\r\nimport { XhrHttpClient } from \"./XhrHttpClient\";\r\n\r\n/** Default implementation of {@link @microsoft/signalr.HttpClient}. */\r\nexport class DefaultHttpClient extends HttpClient {\r\n private readonly _httpClient: HttpClient;\r\n\r\n /** Creates a new instance of the {@link @microsoft/signalr.DefaultHttpClient}, using the provided {@link @microsoft/signalr.ILogger} to log messages. */\r\n public constructor(logger: ILogger) {\r\n super();\r\n\r\n if (typeof fetch !== \"undefined\" || Platform.isNode) {\r\n this._httpClient = new FetchHttpClient(logger);\r\n } else if (typeof XMLHttpRequest !== \"undefined\") {\r\n this._httpClient = new XhrHttpClient(logger);\r\n } else {\r\n throw new Error(\"No usable HttpClient found.\");\r\n }\r\n }\r\n\r\n /** @inheritDoc */\r\n public send(request: HttpRequest): Promise {\r\n // Check that abort was not signaled before calling send\r\n if (request.abortSignal && request.abortSignal.aborted) {\r\n return Promise.reject(new AbortError());\r\n }\r\n\r\n if (!request.method) {\r\n return Promise.reject(new Error(\"No method defined.\"));\r\n }\r\n if (!request.url) {\r\n return Promise.reject(new Error(\"No url defined.\"));\r\n }\r\n\r\n return this._httpClient.send(request);\r\n }\r\n\r\n public getCookieString(url: string): string {\r\n return this._httpClient.getCookieString(url);\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\n// Not exported from index\r\n/** @private */\r\nexport class TextMessageFormat {\r\n public static RecordSeparatorCode = 0x1e;\r\n public static RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);\r\n\r\n public static write(output: string): string {\r\n return `${output}${TextMessageFormat.RecordSeparator}`;\r\n }\r\n\r\n public static parse(input: string): string[] {\r\n if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n\r\n const messages = input.split(TextMessageFormat.RecordSeparator);\r\n messages.pop();\r\n return messages;\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { TextMessageFormat } from \"./TextMessageFormat\";\r\nimport { isArrayBuffer } from \"./Utils\";\r\n\r\n/** @private */\r\nexport interface HandshakeRequestMessage {\r\n readonly protocol: string;\r\n readonly version: number;\r\n}\r\n\r\n/** @private */\r\nexport interface HandshakeResponseMessage {\r\n readonly error: string;\r\n readonly minorVersion: number;\r\n}\r\n\r\n/** @private */\r\nexport class HandshakeProtocol {\r\n // Handshake request is always JSON\r\n public writeHandshakeRequest(handshakeRequest: HandshakeRequestMessage): string {\r\n return TextMessageFormat.write(JSON.stringify(handshakeRequest));\r\n }\r\n\r\n public parseHandshakeResponse(data: any): [any, HandshakeResponseMessage] {\r\n let messageData: string;\r\n let remainingData: any;\r\n\r\n if (isArrayBuffer(data)) {\r\n // Format is binary but still need to read JSON text from handshake response\r\n const binaryData = new Uint8Array(data);\r\n const separatorIndex = binaryData.indexOf(TextMessageFormat.RecordSeparatorCode);\r\n if (separatorIndex === -1) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n\r\n // content before separator is handshake response\r\n // optional content after is additional messages\r\n const responseLength = separatorIndex + 1;\r\n messageData = String.fromCharCode.apply(null, Array.prototype.slice.call(binaryData.slice(0, responseLength)));\r\n remainingData = (binaryData.byteLength > responseLength) ? binaryData.slice(responseLength).buffer : null;\r\n } else {\r\n const textData: string = data;\r\n const separatorIndex = textData.indexOf(TextMessageFormat.RecordSeparator);\r\n if (separatorIndex === -1) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n\r\n // content before separator is handshake response\r\n // optional content after is additional messages\r\n const responseLength = separatorIndex + 1;\r\n messageData = textData.substring(0, responseLength);\r\n remainingData = (textData.length > responseLength) ? textData.substring(responseLength) : null;\r\n }\r\n\r\n // At this point we should have just the single handshake message\r\n const messages = TextMessageFormat.parse(messageData);\r\n const response = JSON.parse(messages[0]);\r\n if (response.type) {\r\n throw new Error(\"Expected a handshake response from the server.\");\r\n }\r\n const responseMessage: HandshakeResponseMessage = response;\r\n\r\n // multiple messages could have arrived with handshake\r\n // return additional data to be parsed as usual, or null if all parsed\r\n return [remainingData, responseMessage];\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { ILogger } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\n\r\n/** Defines the type of a Hub Message. */\r\nexport enum MessageType {\r\n /** Indicates the message is an Invocation message and implements the {@link @microsoft/signalr.InvocationMessage} interface. */\r\n Invocation = 1,\r\n /** Indicates the message is a StreamItem message and implements the {@link @microsoft/signalr.StreamItemMessage} interface. */\r\n StreamItem = 2,\r\n /** Indicates the message is a Completion message and implements the {@link @microsoft/signalr.CompletionMessage} interface. */\r\n Completion = 3,\r\n /** Indicates the message is a Stream Invocation message and implements the {@link @microsoft/signalr.StreamInvocationMessage} interface. */\r\n StreamInvocation = 4,\r\n /** Indicates the message is a Cancel Invocation message and implements the {@link @microsoft/signalr.CancelInvocationMessage} interface. */\r\n CancelInvocation = 5,\r\n /** Indicates the message is a Ping message and implements the {@link @microsoft/signalr.PingMessage} interface. */\r\n Ping = 6,\r\n /** Indicates the message is a Close message and implements the {@link @microsoft/signalr.CloseMessage} interface. */\r\n Close = 7,\r\n}\r\n\r\n/** Defines a dictionary of string keys and string values representing headers attached to a Hub message. */\r\nexport interface MessageHeaders {\r\n /** Gets or sets the header with the specified key. */\r\n [key: string]: string;\r\n}\r\n\r\n/** Union type of all known Hub messages. */\r\nexport type HubMessage =\r\n InvocationMessage |\r\n StreamInvocationMessage |\r\n StreamItemMessage |\r\n CompletionMessage |\r\n CancelInvocationMessage |\r\n PingMessage |\r\n CloseMessage;\r\n\r\n/** Defines properties common to all Hub messages. */\r\nexport interface HubMessageBase {\r\n /** A {@link @microsoft/signalr.MessageType} value indicating the type of this message. */\r\n readonly type: MessageType;\r\n}\r\n\r\n/** Defines properties common to all Hub messages relating to a specific invocation. */\r\nexport interface HubInvocationMessage extends HubMessageBase {\r\n /** A {@link @microsoft/signalr.MessageHeaders} dictionary containing headers attached to the message. */\r\n readonly headers?: MessageHeaders;\r\n /** The ID of the invocation relating to this message.\r\n *\r\n * This is expected to be present for {@link @microsoft/signalr.StreamInvocationMessage} and {@link @microsoft/signalr.CompletionMessage}. It may\r\n * be 'undefined' for an {@link @microsoft/signalr.InvocationMessage} if the sender does not expect a response.\r\n */\r\n readonly invocationId?: string;\r\n}\r\n\r\n/** A hub message representing a non-streaming invocation. */\r\nexport interface InvocationMessage extends HubInvocationMessage {\r\n /** @inheritDoc */\r\n readonly type: MessageType.Invocation;\r\n /** The target method name. */\r\n readonly target: string;\r\n /** The target method arguments. */\r\n readonly arguments: any[];\r\n /** The target methods stream IDs. */\r\n readonly streamIds?: string[];\r\n}\r\n\r\n/** A hub message representing a streaming invocation. */\r\nexport interface StreamInvocationMessage extends HubInvocationMessage {\r\n /** @inheritDoc */\r\n readonly type: MessageType.StreamInvocation;\r\n\r\n /** The invocation ID. */\r\n readonly invocationId: string;\r\n /** The target method name. */\r\n readonly target: string;\r\n /** The target method arguments. */\r\n readonly arguments: any[];\r\n /** The target methods stream IDs. */\r\n readonly streamIds?: string[];\r\n}\r\n\r\n/** A hub message representing a single item produced as part of a result stream. */\r\nexport interface StreamItemMessage extends HubInvocationMessage {\r\n /** @inheritDoc */\r\n readonly type: MessageType.StreamItem;\r\n\r\n /** The invocation ID. */\r\n readonly invocationId: string;\r\n\r\n /** The item produced by the server. */\r\n readonly item?: any;\r\n}\r\n\r\n/** A hub message representing the result of an invocation. */\r\nexport interface CompletionMessage extends HubInvocationMessage {\r\n /** @inheritDoc */\r\n readonly type: MessageType.Completion;\r\n /** The invocation ID. */\r\n readonly invocationId: string;\r\n /** The error produced by the invocation, if any.\r\n *\r\n * Either {@link @microsoft/signalr.CompletionMessage.error} or {@link @microsoft/signalr.CompletionMessage.result} must be defined, but not both.\r\n */\r\n readonly error?: string;\r\n /** The result produced by the invocation, if any.\r\n *\r\n * Either {@link @microsoft/signalr.CompletionMessage.error} or {@link @microsoft/signalr.CompletionMessage.result} must be defined, but not both.\r\n */\r\n readonly result?: any;\r\n}\r\n\r\n/** A hub message indicating that the sender is still active. */\r\nexport interface PingMessage extends HubMessageBase {\r\n /** @inheritDoc */\r\n readonly type: MessageType.Ping;\r\n}\r\n\r\n/** A hub message indicating that the sender is closing the connection.\r\n *\r\n * If {@link @microsoft/signalr.CloseMessage.error} is defined, the sender is closing the connection due to an error.\r\n */\r\nexport interface CloseMessage extends HubMessageBase {\r\n /** @inheritDoc */\r\n readonly type: MessageType.Close;\r\n /** The error that triggered the close, if any.\r\n *\r\n * If this property is undefined, the connection was closed normally and without error.\r\n */\r\n readonly error?: string;\r\n\r\n /** If true, clients with automatic reconnects enabled should attempt to reconnect after receiving the CloseMessage. Otherwise, they should not. */\r\n readonly allowReconnect?: boolean;\r\n}\r\n\r\n/** A hub message sent to request that a streaming invocation be canceled. */\r\nexport interface CancelInvocationMessage extends HubInvocationMessage {\r\n /** @inheritDoc */\r\n readonly type: MessageType.CancelInvocation;\r\n /** The invocation ID. */\r\n readonly invocationId: string;\r\n}\r\n\r\n/** A protocol abstraction for communicating with SignalR Hubs. */\r\nexport interface IHubProtocol {\r\n /** The name of the protocol. This is used by SignalR to resolve the protocol between the client and server. */\r\n readonly name: string;\r\n /** The version of the protocol. */\r\n readonly version: number;\r\n /** The {@link @microsoft/signalr.TransferFormat} of the protocol. */\r\n readonly transferFormat: TransferFormat;\r\n\r\n /** Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.\r\n *\r\n * If {@link @microsoft/signalr.IHubProtocol.transferFormat} is 'Text', the `input` parameter must be a string, otherwise it must be an ArrayBuffer.\r\n *\r\n * @param {string | ArrayBuffer} input A string or ArrayBuffer containing the serialized representation.\r\n * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.\r\n */\r\n parseMessages(input: string | ArrayBuffer, logger: ILogger): HubMessage[];\r\n\r\n /** Writes the specified {@link @microsoft/signalr.HubMessage} to a string or ArrayBuffer and returns it.\r\n *\r\n * If {@link @microsoft/signalr.IHubProtocol.transferFormat} is 'Text', the result of this method will be a string, otherwise it will be an ArrayBuffer.\r\n *\r\n * @param {HubMessage} message The message to write.\r\n * @returns {string | ArrayBuffer} A string or ArrayBuffer containing the serialized representation of the message.\r\n */\r\n writeMessage(message: HubMessage): string | ArrayBuffer;\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { IStreamResult, IStreamSubscriber, ISubscription } from \"./Stream\";\r\nimport { SubjectSubscription } from \"./Utils\";\r\n\r\n/** Stream implementation to stream items to the server. */\r\nexport class Subject implements IStreamResult {\r\n /** @internal */\r\n public observers: IStreamSubscriber[];\r\n\r\n /** @internal */\r\n public cancelCallback?: () => Promise;\r\n\r\n constructor() {\r\n this.observers = [];\r\n }\r\n\r\n public next(item: T): void {\r\n for (const observer of this.observers) {\r\n observer.next(item);\r\n }\r\n }\r\n\r\n public error(err: any): void {\r\n for (const observer of this.observers) {\r\n if (observer.error) {\r\n observer.error(err);\r\n }\r\n }\r\n }\r\n\r\n public complete(): void {\r\n for (const observer of this.observers) {\r\n if (observer.complete) {\r\n observer.complete();\r\n }\r\n }\r\n }\r\n\r\n public subscribe(observer: IStreamSubscriber): ISubscription {\r\n this.observers.push(observer);\r\n return new SubjectSubscription(this, observer);\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { HandshakeProtocol, HandshakeRequestMessage, HandshakeResponseMessage } from \"./HandshakeProtocol\";\r\nimport { IConnection } from \"./IConnection\";\r\nimport { AbortError } from \"./Errors\";\r\nimport { CancelInvocationMessage, CompletionMessage, IHubProtocol, InvocationMessage, MessageType, StreamInvocationMessage, StreamItemMessage } from \"./IHubProtocol\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { IRetryPolicy } from \"./IRetryPolicy\";\r\nimport { IStreamResult } from \"./Stream\";\r\nimport { Subject } from \"./Subject\";\r\nimport { Arg, getErrorString, Platform } from \"./Utils\";\r\n\r\nconst DEFAULT_TIMEOUT_IN_MS: number = 30 * 1000;\r\nconst DEFAULT_PING_INTERVAL_IN_MS: number = 15 * 1000;\r\n\r\n/** Describes the current state of the {@link HubConnection} to the server. */\r\nexport enum HubConnectionState {\r\n /** The hub connection is disconnected. */\r\n Disconnected = \"Disconnected\",\r\n /** The hub connection is connecting. */\r\n Connecting = \"Connecting\",\r\n /** The hub connection is connected. */\r\n Connected = \"Connected\",\r\n /** The hub connection is disconnecting. */\r\n Disconnecting = \"Disconnecting\",\r\n /** The hub connection is reconnecting. */\r\n Reconnecting = \"Reconnecting\",\r\n}\r\n\r\n/** Represents a connection to a SignalR Hub. */\r\nexport class HubConnection {\r\n private readonly _cachedPingMessage: string | ArrayBuffer;\r\n // Needs to not start with _ for tests\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private readonly connection: IConnection;\r\n private readonly _logger: ILogger;\r\n private readonly _reconnectPolicy?: IRetryPolicy;\r\n private _protocol: IHubProtocol;\r\n private _handshakeProtocol: HandshakeProtocol;\r\n private _callbacks: { [invocationId: string]: (invocationEvent: StreamItemMessage | CompletionMessage | null, error?: Error) => void };\r\n private _methods: { [name: string]: (((...args: any[]) => void) | ((...args: any[]) => any))[] };\r\n private _invocationId: number;\r\n\r\n private _closedCallbacks: ((error?: Error) => void)[];\r\n private _reconnectingCallbacks: ((error?: Error) => void)[];\r\n private _reconnectedCallbacks: ((connectionId?: string) => void)[];\r\n\r\n private _receivedHandshakeResponse: boolean;\r\n private _handshakeResolver!: (value?: PromiseLike<{}>) => void;\r\n private _handshakeRejecter!: (reason?: any) => void;\r\n private _stopDuringStartError?: Error;\r\n\r\n private _connectionState: HubConnectionState;\r\n // connectionStarted is tracked independently from connectionState, so we can check if the\r\n // connection ever did successfully transition from connecting to connected before disconnecting.\r\n private _connectionStarted: boolean;\r\n private _startPromise?: Promise;\r\n private _stopPromise?: Promise;\r\n private _nextKeepAlive: number = 0;\r\n\r\n // The type of these a) doesn't matter and b) varies when building in browser and node contexts\r\n // Since we're building the WebPack bundle directly from the TypeScript, this matters (previously\r\n // we built the bundle from the compiled JavaScript).\r\n private _reconnectDelayHandle?: any;\r\n private _timeoutHandle?: any;\r\n private _pingServerHandle?: any;\r\n\r\n private _freezeEventListener = () =>\r\n {\r\n this._logger.log(LogLevel.Warning, \"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep\");\r\n };\r\n\r\n /** The server timeout in milliseconds.\r\n *\r\n * If this timeout elapses without receiving any messages from the server, the connection will be terminated with an error.\r\n * The default timeout value is 30,000 milliseconds (30 seconds).\r\n */\r\n public serverTimeoutInMilliseconds: number;\r\n\r\n /** Default interval at which to ping the server.\r\n *\r\n * The default value is 15,000 milliseconds (15 seconds).\r\n * Allows the server to detect hard disconnects (like when a client unplugs their computer).\r\n * The ping will happen at most as often as the server pings.\r\n * If the server pings every 5 seconds, a value lower than 5 will ping every 5 seconds.\r\n */\r\n public keepAliveIntervalInMilliseconds: number;\r\n\r\n /** @internal */\r\n // Using a public static factory method means we can have a private constructor and an _internal_\r\n // create method that can be used by HubConnectionBuilder. An \"internal\" constructor would just\r\n // be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a\r\n // public parameter-less constructor.\r\n public static create(connection: IConnection, logger: ILogger, protocol: IHubProtocol, reconnectPolicy?: IRetryPolicy): HubConnection {\r\n return new HubConnection(connection, logger, protocol, reconnectPolicy);\r\n }\r\n\r\n private constructor(connection: IConnection, logger: ILogger, protocol: IHubProtocol, reconnectPolicy?: IRetryPolicy) {\r\n Arg.isRequired(connection, \"connection\");\r\n Arg.isRequired(logger, \"logger\");\r\n Arg.isRequired(protocol, \"protocol\");\r\n\r\n this.serverTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MS;\r\n this.keepAliveIntervalInMilliseconds = DEFAULT_PING_INTERVAL_IN_MS;\r\n\r\n this._logger = logger;\r\n this._protocol = protocol;\r\n this.connection = connection;\r\n this._reconnectPolicy = reconnectPolicy;\r\n this._handshakeProtocol = new HandshakeProtocol();\r\n\r\n this.connection.onreceive = (data: any) => this._processIncomingData(data);\r\n this.connection.onclose = (error?: Error) => this._connectionClosed(error);\r\n\r\n this._callbacks = {};\r\n this._methods = {};\r\n this._closedCallbacks = [];\r\n this._reconnectingCallbacks = [];\r\n this._reconnectedCallbacks = [];\r\n this._invocationId = 0;\r\n this._receivedHandshakeResponse = false;\r\n this._connectionState = HubConnectionState.Disconnected;\r\n this._connectionStarted = false;\r\n\r\n this._cachedPingMessage = this._protocol.writeMessage({ type: MessageType.Ping });\r\n }\r\n\r\n /** Indicates the state of the {@link HubConnection} to the server. */\r\n get state(): HubConnectionState {\r\n return this._connectionState;\r\n }\r\n\r\n /** Represents the connection id of the {@link HubConnection} on the server. The connection id will be null when the connection is either\r\n * in the disconnected state or if the negotiation step was skipped.\r\n */\r\n get connectionId(): string | null {\r\n return this.connection ? (this.connection.connectionId || null) : null;\r\n }\r\n\r\n /** Indicates the url of the {@link HubConnection} to the server. */\r\n get baseUrl(): string {\r\n return this.connection.baseUrl || \"\";\r\n }\r\n\r\n /**\r\n * Sets a new url for the HubConnection. Note that the url can only be changed when the connection is in either the Disconnected or\r\n * Reconnecting states.\r\n * @param {string} url The url to connect to.\r\n */\r\n set baseUrl(url: string) {\r\n if (this._connectionState !== HubConnectionState.Disconnected && this._connectionState !== HubConnectionState.Reconnecting) {\r\n throw new Error(\"The HubConnection must be in the Disconnected or Reconnecting state to change the url.\");\r\n }\r\n\r\n if (!url) {\r\n throw new Error(\"The HubConnection url must be a valid url.\");\r\n }\r\n\r\n this.connection.baseUrl = url;\r\n }\r\n\r\n /** Starts the connection.\r\n *\r\n * @returns {Promise} A Promise that resolves when the connection has been successfully established, or rejects with an error.\r\n */\r\n public start(): Promise {\r\n this._startPromise = this._startWithStateTransitions();\r\n return this._startPromise;\r\n }\r\n\r\n private async _startWithStateTransitions(): Promise {\r\n if (this._connectionState !== HubConnectionState.Disconnected) {\r\n return Promise.reject(new Error(\"Cannot start a HubConnection that is not in the 'Disconnected' state.\"));\r\n }\r\n\r\n this._connectionState = HubConnectionState.Connecting;\r\n this._logger.log(LogLevel.Debug, \"Starting HubConnection.\");\r\n\r\n try {\r\n await this._startInternal();\r\n\r\n if (Platform.isBrowser) {\r\n // Log when the browser freezes the tab so users know why their connection unexpectedly stopped working\r\n window.document.addEventListener(\"freeze\", this._freezeEventListener);\r\n }\r\n\r\n this._connectionState = HubConnectionState.Connected;\r\n this._connectionStarted = true;\r\n this._logger.log(LogLevel.Debug, \"HubConnection connected successfully.\");\r\n } catch (e) {\r\n this._connectionState = HubConnectionState.Disconnected;\r\n this._logger.log(LogLevel.Debug, `HubConnection failed to start successfully because of error '${e}'.`);\r\n return Promise.reject(e);\r\n }\r\n }\r\n\r\n private async _startInternal() {\r\n this._stopDuringStartError = undefined;\r\n this._receivedHandshakeResponse = false;\r\n // Set up the promise before any connection is (re)started otherwise it could race with received messages\r\n const handshakePromise = new Promise((resolve, reject) => {\r\n this._handshakeResolver = resolve;\r\n this._handshakeRejecter = reject;\r\n });\r\n\r\n await this.connection.start(this._protocol.transferFormat);\r\n\r\n try {\r\n const handshakeRequest: HandshakeRequestMessage = {\r\n protocol: this._protocol.name,\r\n version: this._protocol.version,\r\n };\r\n\r\n this._logger.log(LogLevel.Debug, \"Sending handshake request.\");\r\n\r\n await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(handshakeRequest));\r\n\r\n this._logger.log(LogLevel.Information, `Using HubProtocol '${this._protocol.name}'.`);\r\n\r\n // defensively cleanup timeout in case we receive a message from the server before we finish start\r\n this._cleanupTimeout();\r\n this._resetTimeoutPeriod();\r\n this._resetKeepAliveInterval();\r\n\r\n await handshakePromise;\r\n\r\n // It's important to check the stopDuringStartError instead of just relying on the handshakePromise\r\n // being rejected on close, because this continuation can run after both the handshake completed successfully\r\n // and the connection was closed.\r\n if (this._stopDuringStartError) {\r\n // It's important to throw instead of returning a rejected promise, because we don't want to allow any state\r\n // transitions to occur between now and the calling code observing the exceptions. Returning a rejected promise\r\n // will cause the calling continuation to get scheduled to run later.\r\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\r\n throw this._stopDuringStartError;\r\n }\r\n\r\n if (!this.connection.features.inherentKeepAlive) {\r\n await this._sendMessage(this._cachedPingMessage);\r\n }\r\n } catch (e) {\r\n this._logger.log(LogLevel.Debug, `Hub handshake failed with error '${e}' during start(). Stopping HubConnection.`);\r\n\r\n this._cleanupTimeout();\r\n this._cleanupPingTimer();\r\n\r\n // HttpConnection.stop() should not complete until after the onclose callback is invoked.\r\n // This will transition the HubConnection to the disconnected state before HttpConnection.stop() completes.\r\n await this.connection.stop(e);\r\n throw e;\r\n }\r\n }\r\n\r\n /** Stops the connection.\r\n *\r\n * @returns {Promise} A Promise that resolves when the connection has been successfully terminated, or rejects with an error.\r\n */\r\n public async stop(): Promise {\r\n // Capture the start promise before the connection might be restarted in an onclose callback.\r\n const startPromise = this._startPromise;\r\n\r\n this._stopPromise = this._stopInternal();\r\n await this._stopPromise;\r\n\r\n try {\r\n // Awaiting undefined continues immediately\r\n await startPromise;\r\n } catch (e) {\r\n // This exception is returned to the user as a rejected Promise from the start method.\r\n }\r\n }\r\n\r\n private _stopInternal(error?: Error): Promise {\r\n if (this._connectionState === HubConnectionState.Disconnected) {\r\n this._logger.log(LogLevel.Debug, `Call to HubConnection.stop(${error}) ignored because it is already in the disconnected state.`);\r\n return Promise.resolve();\r\n }\r\n\r\n if (this._connectionState === HubConnectionState.Disconnecting) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnecting state.`);\r\n return this._stopPromise!;\r\n }\r\n\r\n this._connectionState = HubConnectionState.Disconnecting;\r\n\r\n this._logger.log(LogLevel.Debug, \"Stopping HubConnection.\");\r\n\r\n if (this._reconnectDelayHandle) {\r\n // We're in a reconnect delay which means the underlying connection is currently already stopped.\r\n // Just clear the handle to stop the reconnect loop (which no one is waiting on thankfully) and\r\n // fire the onclose callbacks.\r\n this._logger.log(LogLevel.Debug, \"Connection stopped during reconnect delay. Done reconnecting.\");\r\n\r\n clearTimeout(this._reconnectDelayHandle);\r\n this._reconnectDelayHandle = undefined;\r\n\r\n this._completeClose();\r\n return Promise.resolve();\r\n }\r\n\r\n this._cleanupTimeout();\r\n this._cleanupPingTimer();\r\n this._stopDuringStartError = error || new AbortError(\"The connection was stopped before the hub handshake could complete.\");\r\n\r\n // HttpConnection.stop() should not complete until after either HttpConnection.start() fails\r\n // or the onclose callback is invoked. The onclose callback will transition the HubConnection\r\n // to the disconnected state if need be before HttpConnection.stop() completes.\r\n return this.connection.stop(error);\r\n }\r\n\r\n /** Invokes a streaming hub method on the server using the specified name and arguments.\r\n *\r\n * @typeparam T The type of the items returned by the server.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {IStreamResult} An object that yields results from the server as they are received.\r\n */\r\n public stream(methodName: string, ...args: any[]): IStreamResult {\r\n const [streams, streamIds] = this._replaceStreamingParams(args);\r\n const invocationDescriptor = this._createStreamInvocation(methodName, args, streamIds);\r\n\r\n // eslint-disable-next-line prefer-const\r\n let promiseQueue: Promise;\r\n\r\n const subject = new Subject();\r\n subject.cancelCallback = () => {\r\n const cancelInvocation: CancelInvocationMessage = this._createCancelInvocation(invocationDescriptor.invocationId);\r\n\r\n delete this._callbacks[invocationDescriptor.invocationId];\r\n\r\n return promiseQueue.then(() => {\r\n return this._sendWithProtocol(cancelInvocation);\r\n });\r\n };\r\n\r\n this._callbacks[invocationDescriptor.invocationId] = (invocationEvent: CompletionMessage | StreamItemMessage | null, error?: Error) => {\r\n if (error) {\r\n subject.error(error);\r\n return;\r\n } else if (invocationEvent) {\r\n // invocationEvent will not be null when an error is not passed to the callback\r\n if (invocationEvent.type === MessageType.Completion) {\r\n if (invocationEvent.error) {\r\n subject.error(new Error(invocationEvent.error));\r\n } else {\r\n subject.complete();\r\n }\r\n } else {\r\n subject.next((invocationEvent.item) as T);\r\n }\r\n }\r\n };\r\n\r\n promiseQueue = this._sendWithProtocol(invocationDescriptor)\r\n .catch((e) => {\r\n subject.error(e);\r\n delete this._callbacks[invocationDescriptor.invocationId];\r\n });\r\n\r\n this._launchStreams(streams, promiseQueue);\r\n\r\n return subject;\r\n }\r\n\r\n private _sendMessage(message: any) {\r\n this._resetKeepAliveInterval();\r\n return this.connection.send(message);\r\n }\r\n\r\n /**\r\n * Sends a js object to the server.\r\n * @param message The js object to serialize and send.\r\n */\r\n private _sendWithProtocol(message: any) {\r\n return this._sendMessage(this._protocol.writeMessage(message));\r\n }\r\n\r\n /** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver.\r\n *\r\n * The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still\r\n * be processing the invocation.\r\n *\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise} A Promise that resolves when the invocation has been successfully sent, or rejects with an error.\r\n */\r\n public send(methodName: string, ...args: any[]): Promise {\r\n const [streams, streamIds] = this._replaceStreamingParams(args);\r\n const sendPromise = this._sendWithProtocol(this._createInvocation(methodName, args, true, streamIds));\r\n\r\n this._launchStreams(streams, sendPromise);\r\n\r\n return sendPromise;\r\n }\r\n\r\n /** Invokes a hub method on the server using the specified name and arguments.\r\n *\r\n * The Promise returned by this method resolves when the server indicates it has finished invoking the method. When the promise\r\n * resolves, the server has finished invoking the method. If the server method returns a result, it is produced as the result of\r\n * resolving the Promise.\r\n *\r\n * @typeparam T The expected return type.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise} A Promise that resolves with the result of the server method (if any), or rejects with an error.\r\n */\r\n public invoke(methodName: string, ...args: any[]): Promise {\r\n const [streams, streamIds] = this._replaceStreamingParams(args);\r\n const invocationDescriptor = this._createInvocation(methodName, args, false, streamIds);\r\n\r\n const p = new Promise((resolve, reject) => {\r\n // invocationId will always have a value for a non-blocking invocation\r\n this._callbacks[invocationDescriptor.invocationId!] = (invocationEvent: StreamItemMessage | CompletionMessage | null, error?: Error) => {\r\n if (error) {\r\n reject(error);\r\n return;\r\n } else if (invocationEvent) {\r\n // invocationEvent will not be null when an error is not passed to the callback\r\n if (invocationEvent.type === MessageType.Completion) {\r\n if (invocationEvent.error) {\r\n reject(new Error(invocationEvent.error));\r\n } else {\r\n resolve(invocationEvent.result);\r\n }\r\n } else {\r\n reject(new Error(`Unexpected message type: ${invocationEvent.type}`));\r\n }\r\n }\r\n };\r\n\r\n const promiseQueue = this._sendWithProtocol(invocationDescriptor)\r\n .catch((e) => {\r\n reject(e);\r\n // invocationId will always have a value for a non-blocking invocation\r\n delete this._callbacks[invocationDescriptor.invocationId!];\r\n });\r\n\r\n this._launchStreams(streams, promiseQueue);\r\n });\r\n\r\n return p;\r\n }\r\n\r\n /** Registers a handler that will be invoked when the hub method with the specified method name is invoked.\r\n *\r\n * @param {string} methodName The name of the hub method to define.\r\n * @param {Function} newMethod The handler that will be raised when the hub method is invoked.\r\n */\r\n public on(methodName: string, newMethod: (...args: any[]) => any): void\r\n public on(methodName: string, newMethod: (...args: any[]) => void): void {\r\n if (!methodName || !newMethod) {\r\n return;\r\n }\r\n\r\n methodName = methodName.toLowerCase();\r\n if (!this._methods[methodName]) {\r\n this._methods[methodName] = [];\r\n }\r\n\r\n // Preventing adding the same handler multiple times.\r\n if (this._methods[methodName].indexOf(newMethod) !== -1) {\r\n return;\r\n }\r\n\r\n this._methods[methodName].push(newMethod);\r\n }\r\n\r\n /** Removes all handlers for the specified hub method.\r\n *\r\n * @param {string} methodName The name of the method to remove handlers for.\r\n */\r\n public off(methodName: string): void;\r\n\r\n /** Removes the specified handler for the specified hub method.\r\n *\r\n * You must pass the exact same Function instance as was previously passed to {@link @microsoft/signalr.HubConnection.on}. Passing a different instance (even if the function\r\n * body is the same) will not remove the handler.\r\n *\r\n * @param {string} methodName The name of the method to remove handlers for.\r\n * @param {Function} method The handler to remove. This must be the same Function instance as the one passed to {@link @microsoft/signalr.HubConnection.on}.\r\n */\r\n public off(methodName: string, method: (...args: any[]) => void): void;\r\n public off(methodName: string, method?: (...args: any[]) => void): void {\r\n if (!methodName) {\r\n return;\r\n }\r\n\r\n methodName = methodName.toLowerCase();\r\n const handlers = this._methods[methodName];\r\n if (!handlers) {\r\n return;\r\n }\r\n if (method) {\r\n const removeIdx = handlers.indexOf(method);\r\n if (removeIdx !== -1) {\r\n handlers.splice(removeIdx, 1);\r\n if (handlers.length === 0) {\r\n delete this._methods[methodName];\r\n }\r\n }\r\n } else {\r\n delete this._methods[methodName];\r\n }\r\n\r\n }\r\n\r\n /** Registers a handler that will be invoked when the connection is closed.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).\r\n */\r\n public onclose(callback: (error?: Error) => void): void {\r\n if (callback) {\r\n this._closedCallbacks.push(callback);\r\n }\r\n }\r\n\r\n /** Registers a handler that will be invoked when the connection starts reconnecting.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection starts reconnecting. Optionally receives a single argument containing the error that caused the connection to start reconnecting (if any).\r\n */\r\n public onreconnecting(callback: (error?: Error) => void): void {\r\n if (callback) {\r\n this._reconnectingCallbacks.push(callback);\r\n }\r\n }\r\n\r\n /** Registers a handler that will be invoked when the connection successfully reconnects.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection successfully reconnects.\r\n */\r\n public onreconnected(callback: (connectionId?: string) => void): void {\r\n if (callback) {\r\n this._reconnectedCallbacks.push(callback);\r\n }\r\n }\r\n\r\n private _processIncomingData(data: any) {\r\n this._cleanupTimeout();\r\n\r\n if (!this._receivedHandshakeResponse) {\r\n data = this._processHandshakeResponse(data);\r\n this._receivedHandshakeResponse = true;\r\n }\r\n\r\n // Data may have all been read when processing handshake response\r\n if (data) {\r\n // Parse the messages\r\n const messages = this._protocol.parseMessages(data, this._logger);\r\n\r\n for (const message of messages) {\r\n switch (message.type) {\r\n case MessageType.Invocation:\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._invokeClientMethod(message);\r\n break;\r\n case MessageType.StreamItem:\r\n case MessageType.Completion: {\r\n const callback = this._callbacks[message.invocationId];\r\n if (callback) {\r\n if (message.type === MessageType.Completion) {\r\n delete this._callbacks[message.invocationId];\r\n }\r\n try {\r\n callback(message);\r\n } catch (e) {\r\n this._logger.log(LogLevel.Error, `Stream callback threw error: ${getErrorString(e)}`);\r\n }\r\n }\r\n break;\r\n }\r\n case MessageType.Ping:\r\n // Don't care about pings\r\n break;\r\n case MessageType.Close: {\r\n this._logger.log(LogLevel.Information, \"Close message received from server.\");\r\n\r\n const error = message.error ? new Error(\"Server returned an error on close: \" + message.error) : undefined;\r\n\r\n if (message.allowReconnect === true) {\r\n // It feels wrong not to await connection.stop() here, but processIncomingData is called as part of an onreceive callback which is not async,\r\n // this is already the behavior for serverTimeout(), and HttpConnection.Stop() should catch and log all possible exceptions.\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.connection.stop(error);\r\n } else {\r\n // We cannot await stopInternal() here, but subsequent calls to stop() will await this if stopInternal() is still ongoing.\r\n this._stopPromise = this._stopInternal(error);\r\n }\r\n\r\n break;\r\n }\r\n default:\r\n this._logger.log(LogLevel.Warning, `Invalid message type: ${message.type}.`);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n this._resetTimeoutPeriod();\r\n }\r\n\r\n private _processHandshakeResponse(data: any): any {\r\n let responseMessage: HandshakeResponseMessage;\r\n let remainingData: any;\r\n\r\n try {\r\n [remainingData, responseMessage] = this._handshakeProtocol.parseHandshakeResponse(data);\r\n } catch (e) {\r\n const message = \"Error parsing handshake response: \" + e;\r\n this._logger.log(LogLevel.Error, message);\r\n\r\n const error = new Error(message);\r\n this._handshakeRejecter(error);\r\n throw error;\r\n }\r\n if (responseMessage.error) {\r\n const message = \"Server returned handshake error: \" + responseMessage.error;\r\n this._logger.log(LogLevel.Error, message);\r\n\r\n const error = new Error(message);\r\n this._handshakeRejecter(error);\r\n throw error;\r\n } else {\r\n this._logger.log(LogLevel.Debug, \"Server handshake complete.\");\r\n }\r\n\r\n this._handshakeResolver();\r\n return remainingData;\r\n }\r\n\r\n private _resetKeepAliveInterval() {\r\n if (this.connection.features.inherentKeepAlive) {\r\n return;\r\n }\r\n\r\n // Set the time we want the next keep alive to be sent\r\n // Timer will be setup on next message receive\r\n this._nextKeepAlive = new Date().getTime() + this.keepAliveIntervalInMilliseconds;\r\n\r\n this._cleanupPingTimer();\r\n }\r\n\r\n private _resetTimeoutPeriod() {\r\n if (!this.connection.features || !this.connection.features.inherentKeepAlive) {\r\n // Set the timeout timer\r\n this._timeoutHandle = setTimeout(() => this.serverTimeout(), this.serverTimeoutInMilliseconds);\r\n\r\n // Set keepAlive timer if there isn't one\r\n if (this._pingServerHandle === undefined)\r\n {\r\n let nextPing = this._nextKeepAlive - new Date().getTime();\r\n if (nextPing < 0) {\r\n nextPing = 0;\r\n }\r\n\r\n // The timer needs to be set from a networking callback to avoid Chrome timer throttling from causing timers to run once a minute\r\n this._pingServerHandle = setTimeout(async () => {\r\n if (this._connectionState === HubConnectionState.Connected) {\r\n try {\r\n await this._sendMessage(this._cachedPingMessage);\r\n } catch {\r\n // We don't care about the error. It should be seen elsewhere in the client.\r\n // The connection is probably in a bad or closed state now, cleanup the timer so it stops triggering\r\n this._cleanupPingTimer();\r\n }\r\n }\r\n }, nextPing);\r\n }\r\n }\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private serverTimeout() {\r\n // The server hasn't talked to us in a while. It doesn't like us anymore ... :(\r\n // Terminate the connection, but we don't need to wait on the promise. This could trigger reconnecting.\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.connection.stop(new Error(\"Server timeout elapsed without receiving a message from the server.\"));\r\n }\r\n\r\n private async _invokeClientMethod(invocationMessage: InvocationMessage) {\r\n const methodName = invocationMessage.target.toLowerCase();\r\n const methods = this._methods[methodName];\r\n if (!methods) {\r\n this._logger.log(LogLevel.Warning, `No client method with the name '${methodName}' found.`);\r\n\r\n // No handlers provided by client but the server is expecting a response still, so we send an error\r\n if (invocationMessage.invocationId) {\r\n this._logger.log(LogLevel.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);\r\n await this._sendWithProtocol(this._createCompletionMessage(invocationMessage.invocationId, \"Client didn't provide a result.\", null));\r\n }\r\n return;\r\n }\r\n\r\n // Avoid issues with handlers removing themselves thus modifying the list while iterating through it\r\n const methodsCopy = methods.slice();\r\n\r\n // Server expects a response\r\n const expectsResponse = invocationMessage.invocationId ? true : false;\r\n // We preserve the last result or exception but still call all handlers\r\n let res;\r\n let exception;\r\n let completionMessage;\r\n for (const m of methodsCopy) {\r\n try {\r\n const prevRes = res;\r\n res = await m.apply(this, invocationMessage.arguments);\r\n if (expectsResponse && res && prevRes) {\r\n this._logger.log(LogLevel.Error, `Multiple results provided for '${methodName}'. Sending error to server.`);\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId!, `Client provided multiple results.`, null);\r\n }\r\n // Ignore exception if we got a result after, the exception will be logged\r\n exception = undefined;\r\n } catch (e) {\r\n exception = e;\r\n this._logger.log(LogLevel.Error, `A callback for the method '${methodName}' threw error '${e}'.`);\r\n }\r\n }\r\n if (completionMessage) {\r\n await this._sendWithProtocol(completionMessage);\r\n } else if (expectsResponse) {\r\n // If there is an exception that means either no result was given or a handler after a result threw\r\n if (exception) {\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId!, `${exception}`, null);\r\n } else if (res !== undefined) {\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId!, null, res);\r\n } else {\r\n this._logger.log(LogLevel.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);\r\n // Client didn't provide a result or throw from a handler, server expects a response so we send an error\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId!, \"Client didn't provide a result.\", null);\r\n }\r\n await this._sendWithProtocol(completionMessage);\r\n } else {\r\n if (res) {\r\n this._logger.log(LogLevel.Error, `Result given for '${methodName}' method but server is not expecting a result.`);\r\n }\r\n }\r\n }\r\n\r\n private _connectionClosed(error?: Error) {\r\n this._logger.log(LogLevel.Debug, `HubConnection.connectionClosed(${error}) called while in state ${this._connectionState}.`);\r\n\r\n // Triggering this.handshakeRejecter is insufficient because it could already be resolved without the continuation having run yet.\r\n this._stopDuringStartError = this._stopDuringStartError || error || new AbortError(\"The underlying connection was closed before the hub handshake could complete.\");\r\n\r\n // If the handshake is in progress, start will be waiting for the handshake promise, so we complete it.\r\n // If it has already completed, this should just noop.\r\n if (this._handshakeResolver) {\r\n this._handshakeResolver();\r\n }\r\n\r\n this._cancelCallbacksWithError(error || new Error(\"Invocation canceled due to the underlying connection being closed.\"));\r\n\r\n this._cleanupTimeout();\r\n this._cleanupPingTimer();\r\n\r\n if (this._connectionState === HubConnectionState.Disconnecting) {\r\n this._completeClose(error);\r\n } else if (this._connectionState === HubConnectionState.Connected && this._reconnectPolicy) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._reconnect(error);\r\n } else if (this._connectionState === HubConnectionState.Connected) {\r\n this._completeClose(error);\r\n }\r\n\r\n // If none of the above if conditions were true were called the HubConnection must be in either:\r\n // 1. The Connecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail it.\r\n // 2. The Reconnecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail the current reconnect attempt\r\n // and potentially continue the reconnect() loop.\r\n // 3. The Disconnected state in which case we're already done.\r\n }\r\n\r\n private _completeClose(error?: Error) {\r\n if (this._connectionStarted) {\r\n this._connectionState = HubConnectionState.Disconnected;\r\n this._connectionStarted = false;\r\n\r\n if (Platform.isBrowser) {\r\n window.document.removeEventListener(\"freeze\", this._freezeEventListener);\r\n }\r\n\r\n try {\r\n this._closedCallbacks.forEach((c) => c.apply(this, [error]));\r\n } catch (e) {\r\n this._logger.log(LogLevel.Error, `An onclose callback called with error '${error}' threw error '${e}'.`);\r\n }\r\n }\r\n }\r\n\r\n private async _reconnect(error?: Error) {\r\n const reconnectStartTime = Date.now();\r\n let previousReconnectAttempts = 0;\r\n let retryError = error !== undefined ? error : new Error(\"Attempting to reconnect due to a unknown error.\");\r\n\r\n let nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, 0, retryError);\r\n\r\n if (nextRetryDelay === null) {\r\n this._logger.log(LogLevel.Debug, \"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt.\");\r\n this._completeClose(error);\r\n return;\r\n }\r\n\r\n this._connectionState = HubConnectionState.Reconnecting;\r\n\r\n if (error) {\r\n this._logger.log(LogLevel.Information, `Connection reconnecting because of error '${error}'.`);\r\n } else {\r\n this._logger.log(LogLevel.Information, \"Connection reconnecting.\");\r\n }\r\n\r\n if (this._reconnectingCallbacks.length !== 0) {\r\n try {\r\n this._reconnectingCallbacks.forEach((c) => c.apply(this, [error]));\r\n } catch (e) {\r\n this._logger.log(LogLevel.Error, `An onreconnecting callback called with error '${error}' threw error '${e}'.`);\r\n }\r\n\r\n // Exit early if an onreconnecting callback called connection.stop().\r\n if (this._connectionState !== HubConnectionState.Reconnecting) {\r\n this._logger.log(LogLevel.Debug, \"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.\");\r\n return;\r\n }\r\n }\r\n\r\n while (nextRetryDelay !== null) {\r\n this._logger.log(LogLevel.Information, `Reconnect attempt number ${previousReconnectAttempts} will start in ${nextRetryDelay} ms.`);\r\n\r\n await new Promise((resolve) => {\r\n this._reconnectDelayHandle = setTimeout(resolve, nextRetryDelay!);\r\n });\r\n this._reconnectDelayHandle = undefined;\r\n\r\n if (this._connectionState !== HubConnectionState.Reconnecting) {\r\n this._logger.log(LogLevel.Debug, \"Connection left the reconnecting state during reconnect delay. Done reconnecting.\");\r\n return;\r\n }\r\n\r\n try {\r\n await this._startInternal();\r\n\r\n this._connectionState = HubConnectionState.Connected;\r\n this._logger.log(LogLevel.Information, \"HubConnection reconnected successfully.\");\r\n\r\n if (this._reconnectedCallbacks.length !== 0) {\r\n try {\r\n this._reconnectedCallbacks.forEach((c) => c.apply(this, [this.connection.connectionId]));\r\n } catch (e) {\r\n this._logger.log(LogLevel.Error, `An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`);\r\n }\r\n }\r\n\r\n return;\r\n } catch (e) {\r\n this._logger.log(LogLevel.Information, `Reconnect attempt failed because of error '${e}'.`);\r\n\r\n if (this._connectionState !== HubConnectionState.Reconnecting) {\r\n this._logger.log(LogLevel.Debug, `Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`);\r\n // The TypeScript compiler thinks that connectionState must be Connected here. The TypeScript compiler is wrong.\r\n if (this._connectionState as any === HubConnectionState.Disconnecting) {\r\n this._completeClose();\r\n }\r\n return;\r\n }\r\n\r\n retryError = e instanceof Error ? e : new Error(e.toString());\r\n nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, Date.now() - reconnectStartTime, retryError);\r\n }\r\n }\r\n\r\n this._logger.log(LogLevel.Information, `Reconnect retries have been exhausted after ${Date.now() - reconnectStartTime} ms and ${previousReconnectAttempts} failed attempts. Connection disconnecting.`);\r\n\r\n this._completeClose();\r\n }\r\n\r\n private _getNextRetryDelay(previousRetryCount: number, elapsedMilliseconds: number, retryReason: Error) {\r\n try {\r\n return this._reconnectPolicy!.nextRetryDelayInMilliseconds({\r\n elapsedMilliseconds,\r\n previousRetryCount,\r\n retryReason,\r\n });\r\n } catch (e) {\r\n this._logger.log(LogLevel.Error, `IRetryPolicy.nextRetryDelayInMilliseconds(${previousRetryCount}, ${elapsedMilliseconds}) threw error '${e}'.`);\r\n return null;\r\n }\r\n }\r\n\r\n private _cancelCallbacksWithError(error: Error) {\r\n const callbacks = this._callbacks;\r\n this._callbacks = {};\r\n\r\n Object.keys(callbacks)\r\n .forEach((key) => {\r\n const callback = callbacks[key];\r\n try {\r\n callback(null, error);\r\n } catch (e) {\r\n this._logger.log(LogLevel.Error, `Stream 'error' callback called with '${error}' threw error: ${getErrorString(e)}`);\r\n }\r\n });\r\n }\r\n\r\n private _cleanupPingTimer(): void {\r\n if (this._pingServerHandle) {\r\n clearTimeout(this._pingServerHandle);\r\n this._pingServerHandle = undefined;\r\n }\r\n }\r\n\r\n private _cleanupTimeout(): void {\r\n if (this._timeoutHandle) {\r\n clearTimeout(this._timeoutHandle);\r\n }\r\n }\r\n\r\n private _createInvocation(methodName: string, args: any[], nonblocking: boolean, streamIds: string[]): InvocationMessage {\r\n if (nonblocking) {\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n streamIds,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n } else {\r\n return {\r\n arguments: args,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n } else {\r\n const invocationId = this._invocationId;\r\n this._invocationId++;\r\n\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n streamIds,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n } else {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n }\r\n }\r\n\r\n private _launchStreams(streams: IStreamResult[], promiseQueue: Promise): void {\r\n if (streams.length === 0) {\r\n return;\r\n }\r\n\r\n // Synchronize stream data so they arrive in-order on the server\r\n if (!promiseQueue) {\r\n promiseQueue = Promise.resolve();\r\n }\r\n\r\n // We want to iterate over the keys, since the keys are the stream ids\r\n // eslint-disable-next-line guard-for-in\r\n for (const streamId in streams) {\r\n streams[streamId].subscribe({\r\n complete: () => {\r\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId)));\r\n },\r\n error: (err) => {\r\n let message: string;\r\n if (err instanceof Error) {\r\n message = err.message;\r\n } else if (err && err.toString) {\r\n message = err.toString();\r\n } else {\r\n message = \"Unknown error\";\r\n }\r\n\r\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId, message)));\r\n },\r\n next: (item) => {\r\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createStreamItemMessage(streamId, item)));\r\n },\r\n });\r\n }\r\n }\r\n\r\n private _replaceStreamingParams(args: any[]): [IStreamResult[], string[]] {\r\n const streams: IStreamResult[] = [];\r\n const streamIds: string[] = [];\r\n for (let i = 0; i < args.length; i++) {\r\n const argument = args[i];\r\n if (this._isObservable(argument)) {\r\n const streamId = this._invocationId;\r\n this._invocationId++;\r\n // Store the stream for later use\r\n streams[streamId] = argument;\r\n streamIds.push(streamId.toString());\r\n\r\n // remove stream from args\r\n args.splice(i, 1);\r\n }\r\n }\r\n\r\n return [streams, streamIds];\r\n }\r\n\r\n private _isObservable(arg: any): arg is IStreamResult {\r\n // This allows other stream implementations to just work (like rxjs)\r\n return arg && arg.subscribe && typeof arg.subscribe === \"function\";\r\n }\r\n\r\n private _createStreamInvocation(methodName: string, args: any[], streamIds: string[]): StreamInvocationMessage {\r\n const invocationId = this._invocationId;\r\n this._invocationId++;\r\n\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n streamIds,\r\n target: methodName,\r\n type: MessageType.StreamInvocation,\r\n };\r\n } else {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n target: methodName,\r\n type: MessageType.StreamInvocation,\r\n };\r\n }\r\n }\r\n\r\n private _createCancelInvocation(id: string): CancelInvocationMessage {\r\n return {\r\n invocationId: id,\r\n type: MessageType.CancelInvocation,\r\n };\r\n }\r\n\r\n private _createStreamItemMessage(id: string, item: any): StreamItemMessage {\r\n return {\r\n invocationId: id,\r\n item,\r\n type: MessageType.StreamItem,\r\n };\r\n }\r\n\r\n private _createCompletionMessage(id: string, error?: any, result?: any): CompletionMessage {\r\n if (error) {\r\n return {\r\n error,\r\n invocationId: id,\r\n type: MessageType.Completion,\r\n };\r\n }\r\n\r\n return {\r\n invocationId: id,\r\n result,\r\n type: MessageType.Completion,\r\n };\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { IRetryPolicy, RetryContext } from \"./IRetryPolicy\";\r\n\r\n// 0, 2, 10, 30 second delays before reconnect attempts.\r\nconst DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null];\r\n\r\n/** @private */\r\nexport class DefaultReconnectPolicy implements IRetryPolicy {\r\n private readonly _retryDelays: (number | null)[];\r\n\r\n constructor(retryDelays?: number[]) {\r\n this._retryDelays = retryDelays !== undefined ? [...retryDelays, null] : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;\r\n }\r\n\r\n public nextRetryDelayInMilliseconds(retryContext: RetryContext): number | null {\r\n return this._retryDelays[retryContext.previousRetryCount];\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nexport abstract class HeaderNames {\r\n static readonly Authorization = \"Authorization\";\r\n static readonly Cookie = \"Cookie\";\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { HeaderNames } from \"./HeaderNames\";\r\nimport { HttpClient, HttpRequest, HttpResponse } from \"./HttpClient\";\r\n\r\n/** @private */\r\nexport class AccessTokenHttpClient extends HttpClient {\r\n private _innerClient: HttpClient;\r\n _accessToken: string | undefined;\r\n _accessTokenFactory: (() => string | Promise) | undefined;\r\n\r\n constructor(innerClient: HttpClient, accessTokenFactory: (() => string | Promise) | undefined) {\r\n super();\r\n\r\n this._innerClient = innerClient;\r\n this._accessTokenFactory = accessTokenFactory;\r\n }\r\n\r\n public async send(request: HttpRequest): Promise {\r\n let allowRetry = true;\r\n if (this._accessTokenFactory && (!this._accessToken || (request.url && request.url.indexOf(\"/negotiate?\") > 0))) {\r\n // don't retry if the request is a negotiate or if we just got a potentially new token from the access token factory\r\n allowRetry = false;\r\n this._accessToken = await this._accessTokenFactory();\r\n }\r\n this._setAuthorizationHeader(request);\r\n const response = await this._innerClient.send(request);\r\n\r\n if (allowRetry && response.statusCode === 401 && this._accessTokenFactory) {\r\n this._accessToken = await this._accessTokenFactory();\r\n this._setAuthorizationHeader(request);\r\n return await this._innerClient.send(request);\r\n }\r\n return response;\r\n }\r\n\r\n private _setAuthorizationHeader(request: HttpRequest) {\r\n if (!request.headers) {\r\n request.headers = {};\r\n }\r\n if (this._accessToken) {\r\n request.headers[HeaderNames.Authorization] = `Bearer ${this._accessToken}`\r\n }\r\n // don't remove the header if there isn't an access token factory, the user manually added the header in this case\r\n else if (this._accessTokenFactory) {\r\n if (request.headers[HeaderNames.Authorization]) {\r\n delete request.headers[HeaderNames.Authorization];\r\n }\r\n }\r\n }\r\n\r\n public getCookieString(url: string): string {\r\n return this._innerClient.getCookieString(url);\r\n }\r\n}", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\n// This will be treated as a bit flag in the future, so we keep it using power-of-two values.\r\n/** Specifies a specific HTTP transport type. */\r\nexport enum HttpTransportType {\r\n /** Specifies no transport preference. */\r\n None = 0,\r\n /** Specifies the WebSockets transport. */\r\n WebSockets = 1,\r\n /** Specifies the Server-Sent Events transport. */\r\n ServerSentEvents = 2,\r\n /** Specifies the Long Polling transport. */\r\n LongPolling = 4,\r\n}\r\n\r\n/** Specifies the transfer format for a connection. */\r\nexport enum TransferFormat {\r\n /** Specifies that only text data will be transmitted over the connection. */\r\n Text = 1,\r\n /** Specifies that binary data will be transmitted over the connection. */\r\n Binary = 2,\r\n}\r\n\r\n/** An abstraction over the behavior of transports. This is designed to support the framework and not intended for use by applications. */\r\nexport interface ITransport {\r\n connect(url: string, transferFormat: TransferFormat): Promise;\r\n send(data: any): Promise;\r\n stop(): Promise;\r\n onreceive: ((data: string | ArrayBuffer) => void) | null;\r\n onclose: ((error?: Error) => void) | null;\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\n// Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController\r\n// We don't actually ever use the API being polyfilled, we always use the polyfill because\r\n// it's a very new API right now.\r\n\r\n// Not exported from index.\r\n/** @private */\r\nexport class AbortController implements AbortSignal {\r\n private _isAborted: boolean = false;\r\n public onabort: (() => void) | null = null;\r\n\r\n public abort(): void {\r\n if (!this._isAborted) {\r\n this._isAborted = true;\r\n if (this.onabort) {\r\n this.onabort();\r\n }\r\n }\r\n }\r\n\r\n get signal(): AbortSignal {\r\n return this;\r\n }\r\n\r\n get aborted(): boolean {\r\n return this._isAborted;\r\n }\r\n}\r\n\r\n/** Represents a signal that can be monitored to determine if a request has been aborted. */\r\nexport interface AbortSignal {\r\n /** Indicates if the request has been aborted. */\r\n aborted: boolean;\r\n /** Set this to a handler that will be invoked when the request is aborted. */\r\n onabort: (() => void) | null;\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { AbortController } from \"./AbortController\";\r\nimport { HttpError, TimeoutError } from \"./Errors\";\r\nimport { HttpClient, HttpRequest } from \"./HttpClient\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { ITransport, TransferFormat } from \"./ITransport\";\r\nimport { Arg, getDataDetail, getUserAgentHeader, sendMessage } from \"./Utils\";\r\nimport { IHttpConnectionOptions } from \"./IHttpConnectionOptions\";\r\n\r\n// Not exported from 'index', this type is internal.\r\n/** @private */\r\nexport class LongPollingTransport implements ITransport {\r\n private readonly _httpClient: HttpClient;\r\n private readonly _logger: ILogger;\r\n private readonly _options: IHttpConnectionOptions;\r\n private readonly _pollAbort: AbortController;\r\n\r\n private _url?: string;\r\n private _running: boolean;\r\n private _receiving?: Promise;\r\n private _closeError?: Error;\r\n\r\n public onreceive: ((data: string | ArrayBuffer) => void) | null;\r\n public onclose: ((error?: Error) => void) | null;\r\n\r\n // This is an internal type, not exported from 'index' so this is really just internal.\r\n public get pollAborted(): boolean {\r\n return this._pollAbort.aborted;\r\n }\r\n\r\n constructor(httpClient: HttpClient, logger: ILogger, options: IHttpConnectionOptions) {\r\n this._httpClient = httpClient;\r\n this._logger = logger;\r\n this._pollAbort = new AbortController();\r\n this._options = options;\r\n\r\n this._running = false;\r\n\r\n this.onreceive = null;\r\n this.onclose = null;\r\n }\r\n\r\n public async connect(url: string, transferFormat: TransferFormat): Promise {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isRequired(transferFormat, \"transferFormat\");\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n\r\n this._url = url;\r\n\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Connecting.\");\r\n\r\n // Allow binary format on Node and Browsers that support binary content (indicated by the presence of responseType property)\r\n if (transferFormat === TransferFormat.Binary &&\r\n (typeof XMLHttpRequest !== \"undefined\" && typeof new XMLHttpRequest().responseType !== \"string\")) {\r\n throw new Error(\"Binary protocols over XmlHttpRequest not implementing advanced features are not supported.\");\r\n }\r\n\r\n const [name, value] = getUserAgentHeader();\r\n const headers = { [name]: value, ...this._options.headers };\r\n\r\n const pollOptions: HttpRequest = {\r\n abortSignal: this._pollAbort.signal,\r\n headers,\r\n timeout: 100000,\r\n withCredentials: this._options.withCredentials,\r\n };\r\n\r\n if (transferFormat === TransferFormat.Binary) {\r\n pollOptions.responseType = \"arraybuffer\";\r\n }\r\n\r\n // Make initial long polling request\r\n // Server uses first long polling request to finish initializing connection and it returns without data\r\n const pollUrl = `${url}&_=${Date.now()}`;\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\r\n const response = await this._httpClient.get(pollUrl, pollOptions);\r\n if (response.statusCode !== 200) {\r\n this._logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\r\n\r\n // Mark running as false so that the poll immediately ends and runs the close logic\r\n this._closeError = new HttpError(response.statusText || \"\", response.statusCode);\r\n this._running = false;\r\n } else {\r\n this._running = true;\r\n }\r\n\r\n this._receiving = this._poll(this._url, pollOptions);\r\n }\r\n\r\n private async _poll(url: string, pollOptions: HttpRequest): Promise {\r\n try {\r\n while (this._running) {\r\n try {\r\n const pollUrl = `${url}&_=${Date.now()}`;\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\r\n const response = await this._httpClient.get(pollUrl, pollOptions);\r\n\r\n if (response.statusCode === 204) {\r\n this._logger.log(LogLevel.Information, \"(LongPolling transport) Poll terminated by server.\");\r\n\r\n this._running = false;\r\n } else if (response.statusCode !== 200) {\r\n this._logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\r\n\r\n // Unexpected status code\r\n this._closeError = new HttpError(response.statusText || \"\", response.statusCode);\r\n this._running = false;\r\n } else {\r\n // Process the response\r\n if (response.content) {\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) data received. ${getDataDetail(response.content, this._options.logMessageContent!)}.`);\r\n if (this.onreceive) {\r\n this.onreceive(response.content);\r\n }\r\n } else {\r\n // This is another way timeout manifest.\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\r\n }\r\n }\r\n } catch (e) {\r\n if (!this._running) {\r\n // Log but disregard errors that occur after stopping\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) Poll errored after shutdown: ${e.message}`);\r\n } else {\r\n if (e instanceof TimeoutError) {\r\n // Ignore timeouts and reissue the poll.\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\r\n } else {\r\n // Close the connection with the error as the result.\r\n this._closeError = e;\r\n this._running = false;\r\n }\r\n }\r\n }\r\n }\r\n } finally {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Polling complete.\");\r\n\r\n // We will reach here with pollAborted==false when the server returned a response causing the transport to stop.\r\n // If pollAborted==true then client initiated the stop and the stop method will raise the close event after DELETE is sent.\r\n if (!this.pollAborted) {\r\n this._raiseOnClose();\r\n }\r\n }\r\n }\r\n\r\n public async send(data: any): Promise {\r\n if (!this._running) {\r\n return Promise.reject(new Error(\"Cannot send until the transport is connected\"));\r\n }\r\n return sendMessage(this._logger, \"LongPolling\", this._httpClient, this._url!, data, this._options);\r\n }\r\n\r\n public async stop(): Promise {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Stopping polling.\");\r\n\r\n // Tell receiving loop to stop, abort any current request, and then wait for it to finish\r\n this._running = false;\r\n this._pollAbort.abort();\r\n\r\n try {\r\n await this._receiving;\r\n\r\n // Send DELETE to clean up long polling on the server\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) sending DELETE request to ${this._url}.`);\r\n\r\n const headers: {[k: string]: string} = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n\r\n const deleteOptions: HttpRequest = {\r\n headers: { ...headers, ...this._options.headers },\r\n timeout: this._options.timeout,\r\n withCredentials: this._options.withCredentials,\r\n };\r\n await this._httpClient.delete(this._url!, deleteOptions);\r\n\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) DELETE request sent.\");\r\n } finally {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Stop finished.\");\r\n\r\n // Raise close event here instead of in polling\r\n // It needs to happen after the DELETE request is sent\r\n this._raiseOnClose();\r\n }\r\n }\r\n\r\n private _raiseOnClose() {\r\n if (this.onclose) {\r\n let logMessage = \"(LongPolling transport) Firing onclose event.\";\r\n if (this._closeError) {\r\n logMessage += \" Error: \" + this._closeError;\r\n }\r\n this._logger.log(LogLevel.Trace, logMessage);\r\n this.onclose(this._closeError);\r\n }\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { HttpClient } from \"./HttpClient\";\r\nimport { MessageHeaders } from \"./IHubProtocol\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { ITransport, TransferFormat } from \"./ITransport\";\r\nimport { Arg, getDataDetail, getUserAgentHeader, Platform, sendMessage } from \"./Utils\";\r\nimport { IHttpConnectionOptions } from \"./IHttpConnectionOptions\";\r\n\r\n/** @private */\r\nexport class ServerSentEventsTransport implements ITransport {\r\n private readonly _httpClient: HttpClient;\r\n private readonly _accessToken: string | undefined;\r\n private readonly _logger: ILogger;\r\n private readonly _options: IHttpConnectionOptions;\r\n private _eventSource?: EventSource;\r\n private _url?: string;\r\n\r\n public onreceive: ((data: string | ArrayBuffer) => void) | null;\r\n public onclose: ((error?: Error) => void) | null;\r\n\r\n constructor(httpClient: HttpClient, accessToken: string | undefined, logger: ILogger,\r\n options: IHttpConnectionOptions) {\r\n this._httpClient = httpClient;\r\n this._accessToken = accessToken;\r\n this._logger = logger;\r\n this._options = options;\r\n\r\n this.onreceive = null;\r\n this.onclose = null;\r\n }\r\n\r\n public async connect(url: string, transferFormat: TransferFormat): Promise {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isRequired(transferFormat, \"transferFormat\");\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n\r\n this._logger.log(LogLevel.Trace, \"(SSE transport) Connecting.\");\r\n\r\n // set url before accessTokenFactory because this._url is only for send and we set the auth header instead of the query string for send\r\n this._url = url;\r\n\r\n if (this._accessToken) {\r\n url += (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") + `access_token=${encodeURIComponent(this._accessToken)}`;\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n let opened = false;\r\n if (transferFormat !== TransferFormat.Text) {\r\n reject(new Error(\"The Server-Sent Events transport only supports the 'Text' transfer format\"));\r\n return;\r\n }\r\n\r\n let eventSource: EventSource;\r\n if (Platform.isBrowser || Platform.isWebWorker) {\r\n eventSource = new this._options.EventSource!(url, { withCredentials: this._options.withCredentials });\r\n } else {\r\n // Non-browser passes cookies via the dictionary\r\n const cookies = this._httpClient.getCookieString(url);\r\n const headers: MessageHeaders = {};\r\n headers.Cookie = cookies;\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n\r\n eventSource = new this._options.EventSource!(url, { withCredentials: this._options.withCredentials, headers: { ...headers, ...this._options.headers} } as EventSourceInit);\r\n }\r\n\r\n try {\r\n eventSource.onmessage = (e: MessageEvent) => {\r\n if (this.onreceive) {\r\n try {\r\n this._logger.log(LogLevel.Trace, `(SSE transport) data received. ${getDataDetail(e.data, this._options.logMessageContent!)}.`);\r\n this.onreceive(e.data);\r\n } catch (error) {\r\n this._close(error);\r\n return;\r\n }\r\n }\r\n };\r\n\r\n // @ts-ignore: not using event on purpose\r\n eventSource.onerror = (e: Event) => {\r\n // EventSource doesn't give any useful information about server side closes.\r\n if (opened) {\r\n this._close();\r\n } else {\r\n reject(new Error(\"EventSource failed to connect. The connection could not be found on the server,\"\r\n + \" either the connection ID is not present on the server, or a proxy is refusing/buffering the connection.\"\r\n + \" If you have multiple servers check that sticky sessions are enabled.\"));\r\n }\r\n };\r\n\r\n eventSource.onopen = () => {\r\n this._logger.log(LogLevel.Information, `SSE connected to ${this._url}`);\r\n this._eventSource = eventSource;\r\n opened = true;\r\n resolve();\r\n };\r\n } catch (e) {\r\n reject(e);\r\n return;\r\n }\r\n });\r\n }\r\n\r\n public async send(data: any): Promise {\r\n if (!this._eventSource) {\r\n return Promise.reject(new Error(\"Cannot send until the transport is connected\"));\r\n }\r\n return sendMessage(this._logger, \"SSE\", this._httpClient, this._url!, data, this._options);\r\n }\r\n\r\n public stop(): Promise {\r\n this._close();\r\n return Promise.resolve();\r\n }\r\n\r\n private _close(e?: Error) {\r\n if (this._eventSource) {\r\n this._eventSource.close();\r\n this._eventSource = undefined;\r\n\r\n if (this.onclose) {\r\n this.onclose(e);\r\n }\r\n }\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { HeaderNames } from \"./HeaderNames\";\r\nimport { HttpClient } from \"./HttpClient\";\r\nimport { MessageHeaders } from \"./IHubProtocol\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { ITransport, TransferFormat } from \"./ITransport\";\r\nimport { WebSocketConstructor } from \"./Polyfills\";\r\nimport { Arg, getDataDetail, getUserAgentHeader, Platform } from \"./Utils\";\r\n\r\n/** @private */\r\nexport class WebSocketTransport implements ITransport {\r\n private readonly _logger: ILogger;\r\n private readonly _accessTokenFactory: (() => string | Promise) | undefined;\r\n private readonly _logMessageContent: boolean;\r\n private readonly _webSocketConstructor: WebSocketConstructor;\r\n private readonly _httpClient: HttpClient;\r\n private _webSocket?: WebSocket;\r\n private _headers: MessageHeaders;\r\n\r\n public onreceive: ((data: string | ArrayBuffer) => void) | null;\r\n public onclose: ((error?: Error) => void) | null;\r\n\r\n constructor(httpClient: HttpClient, accessTokenFactory: (() => string | Promise) | undefined, logger: ILogger,\r\n logMessageContent: boolean, webSocketConstructor: WebSocketConstructor, headers: MessageHeaders) {\r\n this._logger = logger;\r\n this._accessTokenFactory = accessTokenFactory;\r\n this._logMessageContent = logMessageContent;\r\n this._webSocketConstructor = webSocketConstructor;\r\n this._httpClient = httpClient;\r\n\r\n this.onreceive = null;\r\n this.onclose = null;\r\n this._headers = headers;\r\n }\r\n\r\n public async connect(url: string, transferFormat: TransferFormat): Promise {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isRequired(transferFormat, \"transferFormat\");\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n this._logger.log(LogLevel.Trace, \"(WebSockets transport) Connecting.\");\r\n\r\n let token: string;\r\n if (this._accessTokenFactory) {\r\n token = await this._accessTokenFactory();\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n url = url.replace(/^http/, \"ws\");\r\n let webSocket: WebSocket | undefined;\r\n const cookies = this._httpClient.getCookieString(url);\r\n let opened = false;\r\n\r\n if (Platform.isNode || Platform.isReactNative) {\r\n const headers: {[k: string]: string} = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n if (token) {\r\n headers[HeaderNames.Authorization] = `Bearer ${token}`;\r\n }\r\n\r\n if (cookies) {\r\n headers[HeaderNames.Cookie] = cookies;\r\n }\r\n\r\n // Only pass headers when in non-browser environments\r\n webSocket = new this._webSocketConstructor(url, undefined, {\r\n headers: { ...headers, ...this._headers },\r\n });\r\n }\r\n else\r\n {\r\n if (token) {\r\n url += (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") + `access_token=${encodeURIComponent(token)}`;\r\n }\r\n }\r\n\r\n if (!webSocket) {\r\n // Chrome is not happy with passing 'undefined' as protocol\r\n webSocket = new this._webSocketConstructor(url);\r\n }\r\n\r\n if (transferFormat === TransferFormat.Binary) {\r\n webSocket.binaryType = \"arraybuffer\";\r\n }\r\n\r\n webSocket.onopen = (_event: Event) => {\r\n this._logger.log(LogLevel.Information, `WebSocket connected to ${url}.`);\r\n this._webSocket = webSocket;\r\n opened = true;\r\n resolve();\r\n };\r\n\r\n webSocket.onerror = (event: Event) => {\r\n let error: any = null;\r\n // ErrorEvent is a browser only type we need to check if the type exists before using it\r\n if (typeof ErrorEvent !== \"undefined\" && event instanceof ErrorEvent) {\r\n error = event.error;\r\n } else {\r\n error = \"There was an error with the transport\";\r\n }\r\n\r\n this._logger.log(LogLevel.Information, `(WebSockets transport) ${error}.`);\r\n };\r\n\r\n webSocket.onmessage = (message: MessageEvent) => {\r\n this._logger.log(LogLevel.Trace, `(WebSockets transport) data received. ${getDataDetail(message.data, this._logMessageContent)}.`);\r\n if (this.onreceive) {\r\n try {\r\n this.onreceive(message.data);\r\n } catch (error) {\r\n this._close(error);\r\n return;\r\n }\r\n }\r\n };\r\n\r\n webSocket.onclose = (event: CloseEvent) => {\r\n // Don't call close handler if connection was never established\r\n // We'll reject the connect call instead\r\n if (opened) {\r\n this._close(event);\r\n } else {\r\n let error: any = null;\r\n // ErrorEvent is a browser only type we need to check if the type exists before using it\r\n if (typeof ErrorEvent !== \"undefined\" && event instanceof ErrorEvent) {\r\n error = event.error;\r\n } else {\r\n error = \"WebSocket failed to connect. The connection could not be found on the server,\"\r\n + \" either the endpoint may not be a SignalR endpoint,\"\r\n + \" the connection ID is not present on the server, or there is a proxy blocking WebSockets.\"\r\n + \" If you have multiple servers check that sticky sessions are enabled.\";\r\n }\r\n\r\n reject(new Error(error));\r\n }\r\n };\r\n });\r\n }\r\n\r\n public send(data: any): Promise {\r\n if (this._webSocket && this._webSocket.readyState === this._webSocketConstructor.OPEN) {\r\n this._logger.log(LogLevel.Trace, `(WebSockets transport) sending data. ${getDataDetail(data, this._logMessageContent)}.`);\r\n this._webSocket.send(data);\r\n return Promise.resolve();\r\n }\r\n\r\n return Promise.reject(\"WebSocket is not in the OPEN state\");\r\n }\r\n\r\n public stop(): Promise {\r\n if (this._webSocket) {\r\n // Manually invoke onclose callback inline so we know the HttpConnection was closed properly before returning\r\n // This also solves an issue where websocket.onclose could take 18+ seconds to trigger during network disconnects\r\n this._close(undefined);\r\n }\r\n\r\n return Promise.resolve();\r\n }\r\n\r\n private _close(event?: CloseEvent | Error): void {\r\n // webSocket will be null if the transport did not start successfully\r\n if (this._webSocket) {\r\n // Clear websocket handlers because we are considering the socket closed now\r\n this._webSocket.onclose = () => {};\r\n this._webSocket.onmessage = () => {};\r\n this._webSocket.onerror = () => {};\r\n this._webSocket.close();\r\n this._webSocket = undefined;\r\n }\r\n\r\n this._logger.log(LogLevel.Trace, \"(WebSockets transport) socket closed.\");\r\n if (this.onclose) {\r\n if (this._isCloseEvent(event) && (event.wasClean === false || event.code !== 1000)) {\r\n this.onclose(new Error(`WebSocket closed with status code: ${event.code} (${event.reason || \"no reason given\"}).`));\r\n } else if (event instanceof Error) {\r\n this.onclose(event);\r\n } else {\r\n this.onclose();\r\n }\r\n }\r\n }\r\n\r\n private _isCloseEvent(event?: any): event is CloseEvent {\r\n return event && typeof event.wasClean === \"boolean\" && typeof event.code === \"number\";\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { AccessTokenHttpClient } from \"./AccessTokenHttpClient\";\r\nimport { DefaultHttpClient } from \"./DefaultHttpClient\";\r\nimport { AggregateErrors, DisabledTransportError, FailedToNegotiateWithServerError, FailedToStartTransportError, HttpError, UnsupportedTransportError, AbortError } from \"./Errors\";\r\nimport { IConnection } from \"./IConnection\";\r\nimport { IHttpConnectionOptions } from \"./IHttpConnectionOptions\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { HttpTransportType, ITransport, TransferFormat } from \"./ITransport\";\r\nimport { LongPollingTransport } from \"./LongPollingTransport\";\r\nimport { ServerSentEventsTransport } from \"./ServerSentEventsTransport\";\r\nimport { Arg, createLogger, getUserAgentHeader, Platform } from \"./Utils\";\r\nimport { WebSocketTransport } from \"./WebSocketTransport\";\r\n\r\n/** @private */\r\nconst enum ConnectionState {\r\n Connecting = \"Connecting\",\r\n Connected = \"Connected\",\r\n Disconnected = \"Disconnected\",\r\n Disconnecting = \"Disconnecting\",\r\n}\r\n\r\n/** @private */\r\nexport interface INegotiateResponse {\r\n connectionId?: string;\r\n connectionToken?: string;\r\n negotiateVersion?: number;\r\n availableTransports?: IAvailableTransport[];\r\n url?: string;\r\n accessToken?: string;\r\n error?: string;\r\n}\r\n\r\n/** @private */\r\nexport interface IAvailableTransport {\r\n transport: keyof typeof HttpTransportType;\r\n transferFormats: (keyof typeof TransferFormat)[];\r\n}\r\n\r\nconst MAX_REDIRECTS = 100;\r\n\r\n/** @private */\r\nexport class HttpConnection implements IConnection {\r\n private _connectionState: ConnectionState;\r\n // connectionStarted is tracked independently from connectionState, so we can check if the\r\n // connection ever did successfully transition from connecting to connected before disconnecting.\r\n private _connectionStarted: boolean;\r\n private readonly _httpClient: AccessTokenHttpClient;\r\n private readonly _logger: ILogger;\r\n private readonly _options: IHttpConnectionOptions;\r\n // Needs to not start with _ to be available for tests\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private transport?: ITransport;\r\n private _startInternalPromise?: Promise;\r\n private _stopPromise?: Promise;\r\n private _stopPromiseResolver: (value?: PromiseLike) => void = () => {};\r\n private _stopError?: Error;\r\n private _accessTokenFactory?: () => string | Promise;\r\n private _sendQueue?: TransportSendQueue;\r\n\r\n public readonly features: any = {};\r\n public baseUrl: string;\r\n public connectionId?: string;\r\n public onreceive: ((data: string | ArrayBuffer) => void) | null;\r\n public onclose: ((e?: Error) => void) | null;\r\n\r\n private readonly _negotiateVersion: number = 1;\r\n\r\n constructor(url: string, options: IHttpConnectionOptions = {}) {\r\n Arg.isRequired(url, \"url\");\r\n\r\n this._logger = createLogger(options.logger);\r\n this.baseUrl = this._resolveUrl(url);\r\n\r\n options = options || {};\r\n options.logMessageContent = options.logMessageContent === undefined ? false : options.logMessageContent;\r\n if (typeof options.withCredentials === \"boolean\" || options.withCredentials === undefined) {\r\n options.withCredentials = options.withCredentials === undefined ? true : options.withCredentials;\r\n } else {\r\n throw new Error(\"withCredentials option was not a 'boolean' or 'undefined' value\");\r\n }\r\n options.timeout = options.timeout === undefined ? 100 * 1000 : options.timeout;\r\n\r\n let webSocketModule: any = null;\r\n let eventSourceModule: any = null;\r\n\r\n if (Platform.isNode && typeof require !== \"undefined\") {\r\n // In order to ignore the dynamic require in webpack builds we need to do this magic\r\n // @ts-ignore: TS doesn't know about these names\r\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\r\n webSocketModule = requireFunc(\"ws\");\r\n eventSourceModule = requireFunc(\"eventsource\");\r\n }\r\n\r\n if (!Platform.isNode && typeof WebSocket !== \"undefined\" && !options.WebSocket) {\r\n options.WebSocket = WebSocket;\r\n } else if (Platform.isNode && !options.WebSocket) {\r\n if (webSocketModule) {\r\n options.WebSocket = webSocketModule;\r\n }\r\n }\r\n\r\n if (!Platform.isNode && typeof EventSource !== \"undefined\" && !options.EventSource) {\r\n options.EventSource = EventSource;\r\n } else if (Platform.isNode && !options.EventSource) {\r\n if (typeof eventSourceModule !== \"undefined\") {\r\n options.EventSource = eventSourceModule;\r\n }\r\n }\r\n\r\n this._httpClient = new AccessTokenHttpClient(options.httpClient || new DefaultHttpClient(this._logger), options.accessTokenFactory);\r\n this._connectionState = ConnectionState.Disconnected;\r\n this._connectionStarted = false;\r\n this._options = options;\r\n\r\n this.onreceive = null;\r\n this.onclose = null;\r\n }\r\n\r\n public start(): Promise;\r\n public start(transferFormat: TransferFormat): Promise;\r\n public async start(transferFormat?: TransferFormat): Promise {\r\n transferFormat = transferFormat || TransferFormat.Binary;\r\n\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n\r\n this._logger.log(LogLevel.Debug, `Starting connection with transfer format '${TransferFormat[transferFormat]}'.`);\r\n\r\n if (this._connectionState !== ConnectionState.Disconnected) {\r\n return Promise.reject(new Error(\"Cannot start an HttpConnection that is not in the 'Disconnected' state.\"));\r\n }\r\n\r\n this._connectionState = ConnectionState.Connecting;\r\n\r\n this._startInternalPromise = this._startInternal(transferFormat);\r\n await this._startInternalPromise;\r\n\r\n // The TypeScript compiler thinks that connectionState must be Connecting here. The TypeScript compiler is wrong.\r\n if (this._connectionState as any === ConnectionState.Disconnecting) {\r\n // stop() was called and transitioned the client into the Disconnecting state.\r\n const message = \"Failed to start the HttpConnection before stop() was called.\";\r\n this._logger.log(LogLevel.Error, message);\r\n\r\n // We cannot await stopPromise inside startInternal since stopInternal awaits the startInternalPromise.\r\n await this._stopPromise;\r\n\r\n return Promise.reject(new AbortError(message));\r\n } else if (this._connectionState as any !== ConnectionState.Connected) {\r\n // stop() was called and transitioned the client into the Disconnecting state.\r\n const message = \"HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!\";\r\n this._logger.log(LogLevel.Error, message);\r\n return Promise.reject(new AbortError(message));\r\n }\r\n\r\n this._connectionStarted = true;\r\n }\r\n\r\n public send(data: string | ArrayBuffer): Promise {\r\n if (this._connectionState !== ConnectionState.Connected) {\r\n return Promise.reject(new Error(\"Cannot send data if the connection is not in the 'Connected' State.\"));\r\n }\r\n\r\n if (!this._sendQueue) {\r\n this._sendQueue = new TransportSendQueue(this.transport!);\r\n }\r\n\r\n // Transport will not be null if state is connected\r\n return this._sendQueue.send(data);\r\n }\r\n\r\n public async stop(error?: Error): Promise {\r\n if (this._connectionState === ConnectionState.Disconnected) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnected state.`);\r\n return Promise.resolve();\r\n }\r\n\r\n if (this._connectionState === ConnectionState.Disconnecting) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnecting state.`);\r\n return this._stopPromise;\r\n }\r\n\r\n this._connectionState = ConnectionState.Disconnecting;\r\n\r\n this._stopPromise = new Promise((resolve) => {\r\n // Don't complete stop() until stopConnection() completes.\r\n this._stopPromiseResolver = resolve;\r\n });\r\n\r\n // stopInternal should never throw so just observe it.\r\n await this._stopInternal(error);\r\n await this._stopPromise;\r\n }\r\n\r\n private async _stopInternal(error?: Error): Promise {\r\n // Set error as soon as possible otherwise there is a race between\r\n // the transport closing and providing an error and the error from a close message\r\n // We would prefer the close message error.\r\n this._stopError = error;\r\n\r\n try {\r\n await this._startInternalPromise;\r\n } catch (e) {\r\n // This exception is returned to the user as a rejected Promise from the start method.\r\n }\r\n\r\n // The transport's onclose will trigger stopConnection which will run our onclose event.\r\n // The transport should always be set if currently connected. If it wasn't set, it's likely because\r\n // stop was called during start() and start() failed.\r\n if (this.transport) {\r\n try {\r\n await this.transport.stop();\r\n } catch (e) {\r\n this._logger.log(LogLevel.Error, `HttpConnection.transport.stop() threw error '${e}'.`);\r\n this._stopConnection();\r\n }\r\n\r\n this.transport = undefined;\r\n } else {\r\n this._logger.log(LogLevel.Debug, \"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.\");\r\n }\r\n }\r\n\r\n private async _startInternal(transferFormat: TransferFormat): Promise {\r\n // Store the original base url and the access token factory since they may change\r\n // as part of negotiating\r\n let url = this.baseUrl;\r\n this._accessTokenFactory = this._options.accessTokenFactory;\r\n this._httpClient._accessTokenFactory = this._accessTokenFactory;\r\n\r\n try {\r\n if (this._options.skipNegotiation) {\r\n if (this._options.transport === HttpTransportType.WebSockets) {\r\n // No need to add a connection ID in this case\r\n this.transport = this._constructTransport(HttpTransportType.WebSockets);\r\n // We should just call connect directly in this case.\r\n // No fallback or negotiate in this case.\r\n await this._startTransport(url, transferFormat);\r\n } else {\r\n throw new Error(\"Negotiation can only be skipped when using the WebSocket transport directly.\");\r\n }\r\n } else {\r\n let negotiateResponse: INegotiateResponse | null = null;\r\n let redirects = 0;\r\n\r\n do {\r\n negotiateResponse = await this._getNegotiationResponse(url);\r\n // the user tries to stop the connection when it is being started\r\n if (this._connectionState === ConnectionState.Disconnecting || this._connectionState === ConnectionState.Disconnected) {\r\n throw new AbortError(\"The connection was stopped during negotiation.\");\r\n }\r\n\r\n if (negotiateResponse.error) {\r\n throw new Error(negotiateResponse.error);\r\n }\r\n\r\n if ((negotiateResponse as any).ProtocolVersion) {\r\n throw new Error(\"Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.\");\r\n }\r\n\r\n if (negotiateResponse.url) {\r\n url = negotiateResponse.url;\r\n }\r\n\r\n if (negotiateResponse.accessToken) {\r\n // Replace the current access token factory with one that uses\r\n // the returned access token\r\n const accessToken = negotiateResponse.accessToken;\r\n this._accessTokenFactory = () => accessToken;\r\n // set the factory to undefined so the AccessTokenHttpClient won't retry with the same token, since we know it won't change until a connection restart\r\n this._httpClient._accessToken = accessToken;\r\n this._httpClient._accessTokenFactory = undefined;\r\n }\r\n\r\n redirects++;\r\n }\r\n while (negotiateResponse.url && redirects < MAX_REDIRECTS);\r\n\r\n if (redirects === MAX_REDIRECTS && negotiateResponse.url) {\r\n throw new Error(\"Negotiate redirection limit exceeded.\");\r\n }\r\n\r\n await this._createTransport(url, this._options.transport, negotiateResponse, transferFormat);\r\n }\r\n\r\n if (this.transport instanceof LongPollingTransport) {\r\n this.features.inherentKeepAlive = true;\r\n }\r\n\r\n if (this._connectionState === ConnectionState.Connecting) {\r\n // Ensure the connection transitions to the connected state prior to completing this.startInternalPromise.\r\n // start() will handle the case when stop was called and startInternal exits still in the disconnecting state.\r\n this._logger.log(LogLevel.Debug, \"The HttpConnection connected successfully.\");\r\n this._connectionState = ConnectionState.Connected;\r\n }\r\n\r\n // stop() is waiting on us via this.startInternalPromise so keep this.transport around so it can clean up.\r\n // This is the only case startInternal can exit in neither the connected nor disconnected state because stopConnection()\r\n // will transition to the disconnected state. start() will wait for the transition using the stopPromise.\r\n } catch (e) {\r\n this._logger.log(LogLevel.Error, \"Failed to start the connection: \" + e);\r\n this._connectionState = ConnectionState.Disconnected;\r\n this.transport = undefined;\r\n\r\n // if start fails, any active calls to stop assume that start will complete the stop promise\r\n this._stopPromiseResolver();\r\n return Promise.reject(e);\r\n }\r\n }\r\n\r\n private async _getNegotiationResponse(url: string): Promise {\r\n const headers: {[k: string]: string} = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n\r\n const negotiateUrl = this._resolveNegotiateUrl(url);\r\n this._logger.log(LogLevel.Debug, `Sending negotiation request: ${negotiateUrl}.`);\r\n try {\r\n const response = await this._httpClient.post(negotiateUrl, {\r\n content: \"\",\r\n headers: { ...headers, ...this._options.headers },\r\n timeout: this._options.timeout,\r\n withCredentials: this._options.withCredentials,\r\n });\r\n\r\n if (response.statusCode !== 200) {\r\n return Promise.reject(new Error(`Unexpected status code returned from negotiate '${response.statusCode}'`));\r\n }\r\n\r\n const negotiateResponse = JSON.parse(response.content as string) as INegotiateResponse;\r\n if (!negotiateResponse.negotiateVersion || negotiateResponse.negotiateVersion < 1) {\r\n // Negotiate version 0 doesn't use connectionToken\r\n // So we set it equal to connectionId so all our logic can use connectionToken without being aware of the negotiate version\r\n negotiateResponse.connectionToken = negotiateResponse.connectionId;\r\n }\r\n return negotiateResponse;\r\n } catch (e) {\r\n let errorMessage = \"Failed to complete negotiation with the server: \" + e;\r\n if (e instanceof HttpError) {\r\n if (e.statusCode === 404) {\r\n errorMessage = errorMessage + \" Either this is not a SignalR endpoint or there is a proxy blocking the connection.\";\r\n }\r\n }\r\n this._logger.log(LogLevel.Error, errorMessage);\r\n\r\n return Promise.reject(new FailedToNegotiateWithServerError(errorMessage));\r\n }\r\n }\r\n\r\n private _createConnectUrl(url: string, connectionToken: string | null | undefined) {\r\n if (!connectionToken) {\r\n return url;\r\n }\r\n\r\n return url + (url.indexOf(\"?\") === -1 ? \"?\" : \"&\") + `id=${connectionToken}`;\r\n }\r\n\r\n private async _createTransport(url: string, requestedTransport: HttpTransportType | ITransport | undefined, negotiateResponse: INegotiateResponse, requestedTransferFormat: TransferFormat): Promise {\r\n let connectUrl = this._createConnectUrl(url, negotiateResponse.connectionToken);\r\n if (this._isITransport(requestedTransport)) {\r\n this._logger.log(LogLevel.Debug, \"Connection was provided an instance of ITransport, using that directly.\");\r\n this.transport = requestedTransport;\r\n await this._startTransport(connectUrl, requestedTransferFormat);\r\n\r\n this.connectionId = negotiateResponse.connectionId;\r\n return;\r\n }\r\n\r\n const transportExceptions: any[] = [];\r\n const transports = negotiateResponse.availableTransports || [];\r\n let negotiate: INegotiateResponse | undefined = negotiateResponse;\r\n for (const endpoint of transports) {\r\n const transportOrError = this._resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat);\r\n if (transportOrError instanceof Error) {\r\n // Store the error and continue, we don't want to cause a re-negotiate in these cases\r\n transportExceptions.push(`${endpoint.transport} failed:`);\r\n transportExceptions.push(transportOrError);\r\n } else if (this._isITransport(transportOrError)) {\r\n this.transport = transportOrError;\r\n if (!negotiate) {\r\n try {\r\n negotiate = await this._getNegotiationResponse(url);\r\n } catch (ex) {\r\n return Promise.reject(ex);\r\n }\r\n connectUrl = this._createConnectUrl(url, negotiate.connectionToken);\r\n }\r\n try {\r\n await this._startTransport(connectUrl, requestedTransferFormat);\r\n this.connectionId = negotiate.connectionId;\r\n return;\r\n } catch (ex) {\r\n this._logger.log(LogLevel.Error, `Failed to start the transport '${endpoint.transport}': ${ex}`);\r\n negotiate = undefined;\r\n transportExceptions.push(new FailedToStartTransportError(`${endpoint.transport} failed: ${ex}`, HttpTransportType[endpoint.transport]));\r\n\r\n if (this._connectionState !== ConnectionState.Connecting) {\r\n const message = \"Failed to select transport before stop() was called.\";\r\n this._logger.log(LogLevel.Debug, message);\r\n return Promise.reject(new AbortError(message));\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (transportExceptions.length > 0) {\r\n return Promise.reject(new AggregateErrors(`Unable to connect to the server with any of the available transports. ${transportExceptions.join(\" \")}`, transportExceptions));\r\n }\r\n return Promise.reject(new Error(\"None of the transports supported by the client are supported by the server.\"));\r\n }\r\n\r\n private _constructTransport(transport: HttpTransportType): ITransport {\r\n switch (transport) {\r\n case HttpTransportType.WebSockets:\r\n if (!this._options.WebSocket) {\r\n throw new Error(\"'WebSocket' is not supported in your environment.\");\r\n }\r\n return new WebSocketTransport(this._httpClient, this._accessTokenFactory, this._logger, this._options.logMessageContent!, this._options.WebSocket, this._options.headers || {});\r\n case HttpTransportType.ServerSentEvents:\r\n if (!this._options.EventSource) {\r\n throw new Error(\"'EventSource' is not supported in your environment.\");\r\n }\r\n return new ServerSentEventsTransport(this._httpClient, this._httpClient._accessToken, this._logger, this._options);\r\n case HttpTransportType.LongPolling:\r\n return new LongPollingTransport(this._httpClient, this._logger, this._options);\r\n default:\r\n throw new Error(`Unknown transport: ${transport}.`);\r\n }\r\n }\r\n\r\n private _startTransport(url: string, transferFormat: TransferFormat): Promise {\r\n this.transport!.onreceive = this.onreceive;\r\n this.transport!.onclose = (e) => this._stopConnection(e);\r\n return this.transport!.connect(url, transferFormat);\r\n }\r\n\r\n private _resolveTransportOrError(endpoint: IAvailableTransport, requestedTransport: HttpTransportType | undefined, requestedTransferFormat: TransferFormat): ITransport | Error {\r\n const transport = HttpTransportType[endpoint.transport];\r\n if (transport === null || transport === undefined) {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${endpoint.transport}' because it is not supported by this client.`);\r\n return new Error(`Skipping transport '${endpoint.transport}' because it is not supported by this client.`);\r\n } else {\r\n if (transportMatches(requestedTransport, transport)) {\r\n const transferFormats = endpoint.transferFormats.map((s) => TransferFormat[s]);\r\n if (transferFormats.indexOf(requestedTransferFormat) >= 0) {\r\n if ((transport === HttpTransportType.WebSockets && !this._options.WebSocket) ||\r\n (transport === HttpTransportType.ServerSentEvents && !this._options.EventSource)) {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it is not supported in your environment.'`);\r\n return new UnsupportedTransportError(`'${HttpTransportType[transport]}' is not supported in your environment.`, transport);\r\n } else {\r\n this._logger.log(LogLevel.Debug, `Selecting transport '${HttpTransportType[transport]}'.`);\r\n try {\r\n return this._constructTransport(transport);\r\n } catch (ex) {\r\n return ex;\r\n }\r\n }\r\n } else {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it does not support the requested transfer format '${TransferFormat[requestedTransferFormat]}'.`);\r\n return new Error(`'${HttpTransportType[transport]}' does not support ${TransferFormat[requestedTransferFormat]}.`);\r\n }\r\n } else {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it was disabled by the client.`);\r\n return new DisabledTransportError(`'${HttpTransportType[transport]}' is disabled by the client.`, transport);\r\n }\r\n }\r\n }\r\n\r\n private _isITransport(transport: any): transport is ITransport {\r\n return transport && typeof (transport) === \"object\" && \"connect\" in transport;\r\n }\r\n\r\n private _stopConnection(error?: Error): void {\r\n this._logger.log(LogLevel.Debug, `HttpConnection.stopConnection(${error}) called while in state ${this._connectionState}.`);\r\n\r\n this.transport = undefined;\r\n\r\n // If we have a stopError, it takes precedence over the error from the transport\r\n error = this._stopError || error;\r\n this._stopError = undefined;\r\n\r\n if (this._connectionState === ConnectionState.Disconnected) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is already in the disconnected state.`);\r\n return;\r\n }\r\n\r\n if (this._connectionState === ConnectionState.Connecting) {\r\n this._logger.log(LogLevel.Warning, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is still in the connecting state.`);\r\n throw new Error(`HttpConnection.stopConnection(${error}) was called while the connection is still in the connecting state.`);\r\n }\r\n\r\n if (this._connectionState === ConnectionState.Disconnecting) {\r\n // A call to stop() induced this call to stopConnection and needs to be completed.\r\n // Any stop() awaiters will be scheduled to continue after the onclose callback fires.\r\n this._stopPromiseResolver();\r\n }\r\n\r\n if (error) {\r\n this._logger.log(LogLevel.Error, `Connection disconnected with error '${error}'.`);\r\n } else {\r\n this._logger.log(LogLevel.Information, \"Connection disconnected.\");\r\n }\r\n\r\n if (this._sendQueue) {\r\n this._sendQueue.stop().catch((e) => {\r\n this._logger.log(LogLevel.Error, `TransportSendQueue.stop() threw error '${e}'.`);\r\n });\r\n this._sendQueue = undefined;\r\n }\r\n\r\n this.connectionId = undefined;\r\n this._connectionState = ConnectionState.Disconnected;\r\n\r\n if (this._connectionStarted) {\r\n this._connectionStarted = false;\r\n try {\r\n if (this.onclose) {\r\n this.onclose(error);\r\n }\r\n } catch (e) {\r\n this._logger.log(LogLevel.Error, `HttpConnection.onclose(${error}) threw error '${e}'.`);\r\n }\r\n }\r\n }\r\n\r\n private _resolveUrl(url: string): string {\r\n // startsWith is not supported in IE\r\n if (url.lastIndexOf(\"https://\", 0) === 0 || url.lastIndexOf(\"http://\", 0) === 0) {\r\n return url;\r\n }\r\n\r\n if (!Platform.isBrowser) {\r\n throw new Error(`Cannot resolve '${url}'.`);\r\n }\r\n\r\n // Setting the url to the href propery of an anchor tag handles normalization\r\n // for us. There are 3 main cases.\r\n // 1. Relative path normalization e.g \"b\" -> \"http://localhost:5000/a/b\"\r\n // 2. Absolute path normalization e.g \"/a/b\" -> \"http://localhost:5000/a/b\"\r\n // 3. Networkpath reference normalization e.g \"//localhost:5000/a/b\" -> \"http://localhost:5000/a/b\"\r\n const aTag = window.document.createElement(\"a\");\r\n aTag.href = url;\r\n\r\n this._logger.log(LogLevel.Information, `Normalizing '${url}' to '${aTag.href}'.`);\r\n return aTag.href;\r\n }\r\n\r\n private _resolveNegotiateUrl(url: string): string {\r\n const index = url.indexOf(\"?\");\r\n let negotiateUrl = url.substring(0, index === -1 ? url.length : index);\r\n if (negotiateUrl[negotiateUrl.length - 1] !== \"/\") {\r\n negotiateUrl += \"/\";\r\n }\r\n negotiateUrl += \"negotiate\";\r\n negotiateUrl += index === -1 ? \"\" : url.substring(index);\r\n\r\n if (negotiateUrl.indexOf(\"negotiateVersion\") === -1) {\r\n negotiateUrl += index === -1 ? \"?\" : \"&\";\r\n negotiateUrl += \"negotiateVersion=\" + this._negotiateVersion;\r\n }\r\n return negotiateUrl;\r\n }\r\n}\r\n\r\nfunction transportMatches(requestedTransport: HttpTransportType | undefined, actualTransport: HttpTransportType) {\r\n return !requestedTransport || ((actualTransport & requestedTransport) !== 0);\r\n}\r\n\r\n/** @private */\r\nexport class TransportSendQueue {\r\n private _buffer: any[] = [];\r\n private _sendBufferedData: PromiseSource;\r\n private _executing: boolean = true;\r\n private _transportResult?: PromiseSource;\r\n private _sendLoopPromise: Promise;\r\n\r\n constructor(private readonly _transport: ITransport) {\r\n this._sendBufferedData = new PromiseSource();\r\n this._transportResult = new PromiseSource();\r\n\r\n this._sendLoopPromise = this._sendLoop();\r\n }\r\n\r\n public send(data: string | ArrayBuffer): Promise {\r\n this._bufferData(data);\r\n if (!this._transportResult) {\r\n this._transportResult = new PromiseSource();\r\n }\r\n return this._transportResult.promise;\r\n }\r\n\r\n public stop(): Promise {\r\n this._executing = false;\r\n this._sendBufferedData.resolve();\r\n return this._sendLoopPromise;\r\n }\r\n\r\n private _bufferData(data: string | ArrayBuffer): void {\r\n if (this._buffer.length && typeof(this._buffer[0]) !== typeof(data)) {\r\n throw new Error(`Expected data to be of type ${typeof(this._buffer)} but was of type ${typeof(data)}`);\r\n }\r\n\r\n this._buffer.push(data);\r\n this._sendBufferedData.resolve();\r\n }\r\n\r\n private async _sendLoop(): Promise {\r\n while (true) {\r\n await this._sendBufferedData.promise;\r\n\r\n if (!this._executing) {\r\n if (this._transportResult) {\r\n this._transportResult.reject(\"Connection stopped.\");\r\n }\r\n\r\n break;\r\n }\r\n\r\n this._sendBufferedData = new PromiseSource();\r\n\r\n const transportResult = this._transportResult!;\r\n this._transportResult = undefined;\r\n\r\n const data = typeof(this._buffer[0]) === \"string\" ?\r\n this._buffer.join(\"\") :\r\n TransportSendQueue._concatBuffers(this._buffer);\r\n\r\n this._buffer.length = 0;\r\n\r\n try {\r\n await this._transport.send(data);\r\n transportResult.resolve();\r\n } catch (error) {\r\n transportResult.reject(error);\r\n }\r\n }\r\n }\r\n\r\n private static _concatBuffers(arrayBuffers: ArrayBuffer[]): ArrayBuffer {\r\n const totalLength = arrayBuffers.map((b) => b.byteLength).reduce((a, b) => a + b);\r\n const result = new Uint8Array(totalLength);\r\n let offset = 0;\r\n for (const item of arrayBuffers) {\r\n result.set(new Uint8Array(item), offset);\r\n offset += item.byteLength;\r\n }\r\n\r\n return result.buffer;\r\n }\r\n}\r\n\r\nclass PromiseSource {\r\n private _resolver?: () => void;\r\n private _rejecter!: (reason?: any) => void;\r\n public promise: Promise;\r\n\r\n constructor() {\r\n this.promise = new Promise((resolve, reject) => [this._resolver, this._rejecter] = [resolve, reject]);\r\n }\r\n\r\n public resolve(): void {\r\n this._resolver!();\r\n }\r\n\r\n public reject(reason?: any): void {\r\n this._rejecter!(reason);\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { CompletionMessage, HubMessage, IHubProtocol, InvocationMessage, MessageType, StreamItemMessage } from \"./IHubProtocol\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { NullLogger } from \"./Loggers\";\r\nimport { TextMessageFormat } from \"./TextMessageFormat\";\r\n\r\nconst JSON_HUB_PROTOCOL_NAME: string = \"json\";\r\n\r\n/** Implements the JSON Hub Protocol. */\r\nexport class JsonHubProtocol implements IHubProtocol {\r\n\r\n /** @inheritDoc */\r\n public readonly name: string = JSON_HUB_PROTOCOL_NAME;\r\n /** @inheritDoc */\r\n public readonly version: number = 1;\r\n\r\n /** @inheritDoc */\r\n public readonly transferFormat: TransferFormat = TransferFormat.Text;\r\n\r\n /** Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.\r\n *\r\n * @param {string} input A string containing the serialized representation.\r\n * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.\r\n */\r\n public parseMessages(input: string, logger: ILogger): HubMessage[] {\r\n // The interface does allow \"ArrayBuffer\" to be passed in, but this implementation does not. So let's throw a useful error.\r\n if (typeof input !== \"string\") {\r\n throw new Error(\"Invalid input for JSON hub protocol. Expected a string.\");\r\n }\r\n\r\n if (!input) {\r\n return [];\r\n }\r\n\r\n if (logger === null) {\r\n logger = NullLogger.instance;\r\n }\r\n\r\n // Parse the messages\r\n const messages = TextMessageFormat.parse(input);\r\n\r\n const hubMessages = [];\r\n for (const message of messages) {\r\n const parsedMessage = JSON.parse(message) as HubMessage;\r\n if (typeof parsedMessage.type !== \"number\") {\r\n throw new Error(\"Invalid payload.\");\r\n }\r\n switch (parsedMessage.type) {\r\n case MessageType.Invocation:\r\n this._isInvocationMessage(parsedMessage);\r\n break;\r\n case MessageType.StreamItem:\r\n this._isStreamItemMessage(parsedMessage);\r\n break;\r\n case MessageType.Completion:\r\n this._isCompletionMessage(parsedMessage);\r\n break;\r\n case MessageType.Ping:\r\n // Single value, no need to validate\r\n break;\r\n case MessageType.Close:\r\n // All optional values, no need to validate\r\n break;\r\n default:\r\n // Future protocol changes can add message types, old clients can ignore them\r\n logger.log(LogLevel.Information, \"Unknown message type '\" + parsedMessage.type + \"' ignored.\");\r\n continue;\r\n }\r\n hubMessages.push(parsedMessage);\r\n }\r\n\r\n return hubMessages;\r\n }\r\n\r\n /** Writes the specified {@link @microsoft/signalr.HubMessage} to a string and returns it.\r\n *\r\n * @param {HubMessage} message The message to write.\r\n * @returns {string} A string containing the serialized representation of the message.\r\n */\r\n public writeMessage(message: HubMessage): string {\r\n return TextMessageFormat.write(JSON.stringify(message));\r\n }\r\n\r\n private _isInvocationMessage(message: InvocationMessage): void {\r\n this._assertNotEmptyString(message.target, \"Invalid payload for Invocation message.\");\r\n\r\n if (message.invocationId !== undefined) {\r\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for Invocation message.\");\r\n }\r\n }\r\n\r\n private _isStreamItemMessage(message: StreamItemMessage): void {\r\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for StreamItem message.\");\r\n\r\n if (message.item === undefined) {\r\n throw new Error(\"Invalid payload for StreamItem message.\");\r\n }\r\n }\r\n\r\n private _isCompletionMessage(message: CompletionMessage): void {\r\n if (message.result && message.error) {\r\n throw new Error(\"Invalid payload for Completion message.\");\r\n }\r\n\r\n if (!message.result && message.error) {\r\n this._assertNotEmptyString(message.error, \"Invalid payload for Completion message.\");\r\n }\r\n\r\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for Completion message.\");\r\n }\r\n\r\n private _assertNotEmptyString(value: any, errorMessage: string): void {\r\n if (typeof value !== \"string\" || value === \"\") {\r\n throw new Error(errorMessage);\r\n }\r\n }\r\n}\r\n", "// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nimport { DefaultReconnectPolicy } from \"./DefaultReconnectPolicy\";\r\nimport { HttpConnection } from \"./HttpConnection\";\r\nimport { HubConnection } from \"./HubConnection\";\r\nimport { IHttpConnectionOptions } from \"./IHttpConnectionOptions\";\r\nimport { IHubProtocol } from \"./IHubProtocol\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { IRetryPolicy } from \"./IRetryPolicy\";\r\nimport { HttpTransportType } from \"./ITransport\";\r\nimport { JsonHubProtocol } from \"./JsonHubProtocol\";\r\nimport { NullLogger } from \"./Loggers\";\r\nimport { Arg, ConsoleLogger } from \"./Utils\";\r\n\r\nconst LogLevelNameMapping: {[k: string]: LogLevel} = {\r\n trace: LogLevel.Trace,\r\n debug: LogLevel.Debug,\r\n info: LogLevel.Information,\r\n information: LogLevel.Information,\r\n warn: LogLevel.Warning,\r\n warning: LogLevel.Warning,\r\n error: LogLevel.Error,\r\n critical: LogLevel.Critical,\r\n none: LogLevel.None,\r\n};\r\n\r\nfunction parseLogLevel(name: string): LogLevel {\r\n // Case-insensitive matching via lower-casing\r\n // Yes, I know case-folding is a complicated problem in Unicode, but we only support\r\n // the ASCII strings defined in LogLevelNameMapping anyway, so it's fine -anurse.\r\n const mapping = LogLevelNameMapping[name.toLowerCase()];\r\n if (typeof mapping !== \"undefined\") {\r\n return mapping;\r\n } else {\r\n throw new Error(`Unknown log level: ${name}`);\r\n }\r\n}\r\n\r\n/** A builder for configuring {@link @microsoft/signalr.HubConnection} instances. */\r\nexport class HubConnectionBuilder {\r\n /** @internal */\r\n public protocol?: IHubProtocol;\r\n /** @internal */\r\n public httpConnectionOptions?: IHttpConnectionOptions;\r\n /** @internal */\r\n public url?: string;\r\n /** @internal */\r\n public logger?: ILogger;\r\n\r\n /** If defined, this indicates the client should automatically attempt to reconnect if the connection is lost. */\r\n /** @internal */\r\n public reconnectPolicy?: IRetryPolicy;\r\n\r\n /** Configures console logging for the {@link @microsoft/signalr.HubConnection}.\r\n *\r\n * @param {LogLevel} logLevel The minimum level of messages to log. Anything at this level, or a more severe level, will be logged.\r\n * @returns The {@link @microsoft/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n public configureLogging(logLevel: LogLevel): HubConnectionBuilder;\r\n\r\n /** Configures custom logging for the {@link @microsoft/signalr.HubConnection}.\r\n *\r\n * @param {ILogger} logger An object implementing the {@link @microsoft/signalr.ILogger} interface, which will be used to write all log messages.\r\n * @returns The {@link @microsoft/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n public configureLogging(logger: ILogger): HubConnectionBuilder;\r\n\r\n /** Configures custom logging for the {@link @microsoft/signalr.HubConnection}.\r\n *\r\n * @param {string} logLevel A string representing a LogLevel setting a minimum level of messages to log.\r\n * See {@link https://docs.microsoft.com/aspnet/core/signalr/configuration#configure-logging|the documentation for client logging configuration} for more details.\r\n */\r\n public configureLogging(logLevel: string): HubConnectionBuilder;\r\n\r\n /** Configures custom logging for the {@link @microsoft/signalr.HubConnection}.\r\n *\r\n * @param {LogLevel | string | ILogger} logging A {@link @microsoft/signalr.LogLevel}, a string representing a LogLevel, or an object implementing the {@link @microsoft/signalr.ILogger} interface.\r\n * See {@link https://docs.microsoft.com/aspnet/core/signalr/configuration#configure-logging|the documentation for client logging configuration} for more details.\r\n * @returns The {@link @microsoft/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n public configureLogging(logging: LogLevel | string | ILogger): HubConnectionBuilder;\r\n public configureLogging(logging: LogLevel | string | ILogger): HubConnectionBuilder {\r\n Arg.isRequired(logging, \"logging\");\r\n\r\n if (isLogger(logging)) {\r\n this.logger = logging;\r\n } else if (typeof logging === \"string\") {\r\n const logLevel = parseLogLevel(logging);\r\n this.logger = new ConsoleLogger(logLevel);\r\n } else {\r\n this.logger = new ConsoleLogger(logging);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** Configures the {@link @microsoft/signalr.HubConnection} to use HTTP-based transports to connect to the specified URL.\r\n *\r\n * The transport will be selected automatically based on what the server and client support.\r\n *\r\n * @param {string} url The URL the connection will use.\r\n * @returns The {@link @microsoft/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n public withUrl(url: string): HubConnectionBuilder;\r\n\r\n /** Configures the {@link @microsoft/signalr.HubConnection} to use the specified HTTP-based transport to connect to the specified URL.\r\n *\r\n * @param {string} url The URL the connection will use.\r\n * @param {HttpTransportType} transportType The specific transport to use.\r\n * @returns The {@link @microsoft/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n public withUrl(url: string, transportType: HttpTransportType): HubConnectionBuilder;\r\n\r\n /** Configures the {@link @microsoft/signalr.HubConnection} to use HTTP-based transports to connect to the specified URL.\r\n *\r\n * @param {string} url The URL the connection will use.\r\n * @param {IHttpConnectionOptions} options An options object used to configure the connection.\r\n * @returns The {@link @microsoft/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n public withUrl(url: string, options: IHttpConnectionOptions): HubConnectionBuilder;\r\n public withUrl(url: string, transportTypeOrOptions?: IHttpConnectionOptions | HttpTransportType): HubConnectionBuilder {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isNotEmpty(url, \"url\");\r\n\r\n this.url = url;\r\n\r\n // Flow-typing knows where it's at. Since HttpTransportType is a number and IHttpConnectionOptions is guaranteed\r\n // to be an object, we know (as does TypeScript) this comparison is all we need to figure out which overload was called.\r\n if (typeof transportTypeOrOptions === \"object\") {\r\n this.httpConnectionOptions = { ...this.httpConnectionOptions, ...transportTypeOrOptions };\r\n } else {\r\n this.httpConnectionOptions = {\r\n ...this.httpConnectionOptions,\r\n transport: transportTypeOrOptions,\r\n };\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** Configures the {@link @microsoft/signalr.HubConnection} to use the specified Hub Protocol.\r\n *\r\n * @param {IHubProtocol} protocol The {@link @microsoft/signalr.IHubProtocol} implementation to use.\r\n */\r\n public withHubProtocol(protocol: IHubProtocol): HubConnectionBuilder {\r\n Arg.isRequired(protocol, \"protocol\");\r\n\r\n this.protocol = protocol;\r\n return this;\r\n }\r\n\r\n /** Configures the {@link @microsoft/signalr.HubConnection} to automatically attempt to reconnect if the connection is lost.\r\n * By default, the client will wait 0, 2, 10 and 30 seconds respectively before trying up to 4 reconnect attempts.\r\n */\r\n public withAutomaticReconnect(): HubConnectionBuilder;\r\n\r\n /** Configures the {@link @microsoft/signalr.HubConnection} to automatically attempt to reconnect if the connection is lost.\r\n *\r\n * @param {number[]} retryDelays An array containing the delays in milliseconds before trying each reconnect attempt.\r\n * The length of the array represents how many failed reconnect attempts it takes before the client will stop attempting to reconnect.\r\n */\r\n public withAutomaticReconnect(retryDelays: number[]): HubConnectionBuilder;\r\n\r\n /** Configures the {@link @microsoft/signalr.HubConnection} to automatically attempt to reconnect if the connection is lost.\r\n *\r\n * @param {IRetryPolicy} reconnectPolicy An {@link @microsoft/signalR.IRetryPolicy} that controls the timing and number of reconnect attempts.\r\n */\r\n public withAutomaticReconnect(reconnectPolicy: IRetryPolicy): HubConnectionBuilder;\r\n public withAutomaticReconnect(retryDelaysOrReconnectPolicy?: number[] | IRetryPolicy): HubConnectionBuilder {\r\n if (this.reconnectPolicy) {\r\n throw new Error(\"A reconnectPolicy has already been set.\");\r\n }\r\n\r\n if (!retryDelaysOrReconnectPolicy) {\r\n this.reconnectPolicy = new DefaultReconnectPolicy();\r\n } else if (Array.isArray(retryDelaysOrReconnectPolicy)) {\r\n this.reconnectPolicy = new DefaultReconnectPolicy(retryDelaysOrReconnectPolicy);\r\n } else {\r\n this.reconnectPolicy = retryDelaysOrReconnectPolicy;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** Creates a {@link @microsoft/signalr.HubConnection} from the configuration options specified in this builder.\r\n *\r\n * @returns {HubConnection} The configured {@link @microsoft/signalr.HubConnection}.\r\n */\r\n public build(): HubConnection {\r\n // If httpConnectionOptions has a logger, use it. Otherwise, override it with the one\r\n // provided to configureLogger\r\n const httpConnectionOptions = this.httpConnectionOptions || {};\r\n\r\n // If it's 'null', the user **explicitly** asked for null, don't mess with it.\r\n if (httpConnectionOptions.logger === undefined) {\r\n // If our logger is undefined or null, that's OK, the HttpConnection constructor will handle it.\r\n httpConnectionOptions.logger = this.logger;\r\n }\r\n\r\n // Now create the connection\r\n if (!this.url) {\r\n throw new Error(\"The 'HubConnectionBuilder.withUrl' method must be called before building the connection.\");\r\n }\r\n const connection = new HttpConnection(this.url, httpConnectionOptions);\r\n\r\n return HubConnection.create(\r\n connection,\r\n this.logger || NullLogger.instance,\r\n this.protocol || new JsonHubProtocol(),\r\n this.reconnectPolicy);\r\n }\r\n}\r\n\r\nfunction isLogger(logger: any): logger is ILogger {\r\n return logger.log !== undefined;\r\n}\r\n", "import { AddressingScope } from \"../types/models/vario-types\";\r\nimport * as analytics from \"./analytics-dashboard\";\r\nimport * as calendar from \"./calendar\";\r\nimport * as chat from \"./chat\";\r\nimport * as dataGridSidePanel from \"./data-grid-side-panel\";\r\nimport * as devextremeTable from \"./devextreme-table-functions\";\r\nimport * as diagrams from \"./diagrams\";\r\nimport * as editOperations from \"./edit-operations\";\r\nimport * as editor from \"./editor\";\r\nimport * as emails from \"./emails\";\r\nimport * as floatingActions from \"./floating-actions\";\r\nimport * as floatingButtons from \"./floating-buttons\";\r\nimport * as initiate from \"./initiate-workflow\";\r\nimport * as itemProperties from \"./item-properties\";\r\nimport * as itemSources from \"./item-sources\";\r\nimport * as layouts from \"./layouts\";\r\nimport * as messageHub from \"./message-hub-proxy-client\";\r\nimport * as notes from \"./notes\";\r\nimport * as notifications from \"./notifications\";\r\nimport * as pageNavigation from \"./page-navigation\";\r\nimport * as print from \"./print\";\r\nimport * as pushNotifications from \"./push-notifications\";\r\nimport * as recipients from \"./recipients\";\r\nimport * as refresh from \"./refresh-manager\";\r\nimport * as richEdit from \"./richedit\";\r\nimport * as search from \"./search\";\r\nimport * as signature from \"./signature\";\r\nimport * as site from \"./site\";\r\nimport * as spreadsheet from \"./spreadsheet\";\r\nimport * as trigger from \"./trigger\";\r\nimport * as userPanel from \"./user-panel\";\r\nimport * as varioObject from \"./vario-object\";\r\nimport * as varioObjectSidePanel from \"./vario-object-side-panel\";\r\n\r\nconst funcs = [\r\n\tanalytics,\r\n\tcalendar,\r\n\tchat,\r\n\tdataGridSidePanel,\r\n\tdevextremeTable,\r\n\tdiagrams,\r\n\teditOperations,\r\n\teditor,\r\n\temails,\r\n\tfloatingActions,\r\n\tfloatingButtons,\r\n\tinitiate,\r\n\titemProperties,\r\n\titemSources,\r\n\tlayouts,\r\n\tmessageHub,\r\n\tnotes,\r\n\tnotifications,\r\n\tpageNavigation,\r\n\tprint,\r\n\tpushNotifications,\r\n\trecipients,\r\n\trefresh,\r\n\tsearch,\r\n\tsignature,\r\n\tsite,\r\n\tspreadsheet,\r\n\ttrigger,\r\n\tuserPanel,\r\n\tvarioObjectSidePanel,\r\n\tvarioObject,\r\n\trichEdit,\r\n];\r\n\r\nglobalThis.AddressingScope = AddressingScope;\r\nglobalThis.supportedContent = site.supportedContent;\r\nglobalThis.mousePosition = site.mousePosition;\r\nglobalThis.refreshManager = refresh.refreshManager;\r\n\r\n// Assign all exported functions to the window object\r\nfor (const func of funcs)\r\n\tfor (const key of Object.keys(func)) {\r\n\t\tif (typeof func[key] === \"function\") {\r\n\t\t\t(window as any)[key] = func[key];\r\n\t\t}\r\n\t}\r\n"], "mappings": "iZAwyBO,IAAU,gBAAAA,iBAAV,CAaC,IAAK,cAAAC,gBACXA,4BAAA,QAAU,GAAV,UACAA,4BAAA,KAAO,GAAP,OACAA,4BAAA,QAAU,GAAV,UACAA,4BAAA,MAAQ,GAAR,UAJW,aAAAD,gBAAA,mBAOL,IAAKE,6BACXA,0BAAA,QAAU,GAAV,UACAA,0BAAA,QAAU,GAAV,UACAA,0BAAA,cAAgB,GAAhB,gBACAA,0BAAA,SAAW,GAAX,aAJWA,aAAAF,gBAAA,kBAgCZ,IAAK,iBAAAG,mBACJA,kCAAA,QAAU,GAAV,UACAA,kCAAA,SAAW,GAAX,WACAA,kCAAA,aAAe,GAAf,eAC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IAAI,cAAgB,GACpB,IAAI,gBAAgB,SAAS,CAC9B,CACD,CyBjHA,IAAM,MAAQ,CACb,4BACA,iBACA,aACA,6BACA,mCACA,iBACA,wBACA,eACA,eACA,yBACA,yBACA,0BACA,wBACA,qBACA,gBACA,iCACA,cACA,sBACA,wBACA,cACA,2BACA,mBACA,wBACA,eACA,kBACA,aACA,oBACA,gBACA,mBACA,gCACA,qBACA,gBACD,EAEA,WAAW,gBAAkB,gBAC7B,WAAW,iBAAwB,iBACnC,WAAW,cAAqB,cAChC,WAAW,eAAyB,eAGpC,QAAW,QAAQ,MAClB,QAAW,OAAO,OAAO,KAAK,IAAI,EAC7B,OAAO,KAAK,GAAG,GAAM,aACvB,OAAe,GAAG,EAAI,KAAK,GAAG", "names": ["VarioHubModels", "MessageLevel", "MessageType", "ApplicationType", "RunningOperations", "ProcessingStatus", "OperationType", "AddressingScope", "id", "e", "event", "title", "sub", "e", "id", "itemId", "id", "element", "event", "value", "SignEnumerations", "SignClientResponseCode", "SignDocumentResponseCode", "CertificatePurpose", "CertificateFileFormat", "UserFacsimileResponseCode", "itemId", "event", "SignDocument", "signatureFor", "title", "data", "asyncStates", "id", "index", "id", "event", "itemId", "value", "e", "containerId", "value", "event", "e", "title", "RequestStatus", "e", "containerId", "event", "id", "title", "modelDefinitionKey", "id", "id", "e", "title", "itemId", "id", "event", "e", "id", "currentUserEmail", "value", "value", "e", "arr", "id", "event", "title", "containerId", "$", "text", "sender", "sndMesssage", "sndDate", "sndId", "popup", "sidenav", "itemId", "itemId", "e", "id", "id", "objSmall", "title", "containerId", "itemId", "GlobalCopyBuffer", "modelId", "value", "e", "containerId", "id", "formatString", "event", "e", "containerId", "id", "itemId", "id", "e", "event", "id", "title", "e", "itemId", "isCorrespondence", "id", "containerId", "containerKey", "canShowWorkflowMessageParam", "othersWorkflowState", "hashId", "containerId", "editField", "modelId", "title", "e", "value", "id", "event", "itemId", "cell", "editField", "containerKey", "value", "event", "itemId", "actuallControlView", "e", "element", "title", "editField", "containerId", "filesInput", "filesWorkflowInput", "id", "attrs", "listId", "input", "itemType", "e", "event", "id", "element", "itemId", "value", "key", "dropArea", "showInfo", "id", "containerId", "itemId", "title", "row", "cell1", "value", "event", "x", "showInfo", "e", "itemId", "caption", "itemId", "containerId", "e", "event", "dropArea", "value", "id", "evt", "containerKey", "columns", "defKey", "itemType", "data", "event", "itemId", "containerKey", "event", "getNewNotifications", "e", "id", "containerK", "itemType", "e", "LogLevel", "value", "e", "e", "MessageType", "HubConnectionState", "e", "id", "HttpTransportType", "TransferFormat", "AbortController", "AbortController", "value", "e", "value", "e", "value", "event", "e", "value", "value", "currentUserId", "currentUserName", "e"] }