{"version":3,"sources":["../js/Archive.js"],"names":["g_oArchive","g_ArchiveDocument","g_ArchiveCompareDocument","g_ArchivePollInterval","g_ArchiveIcons","Pending","InProgress","Complete","g_ArchivedDocumentStatus","initialiseArchiveModule","archiveDocumentId","archiveCompareDocument","applyArchiveLock","restoreDocument","pollArchiveStatus","lockScreen","showSpinnerMessage","showArchiveInfo","comboControl_UpdateAboveLock","comboControl_GetControlById","getArchiveControlId","removeArchiveLock","g_oGreenlightMessages","closeBubbles","hideSpinnerMessage","unlockScreen","displayInfoBubble","updateArchiveInfo","documentStatus","$","attr","addClass","removeClass","oJSON","oAPICredentials","SessionId","g_szSessionId","DocumentId","post","url","data","JSON","stringify","contentType","dataType","cache","success","oResponse","Success","Contents","setTimeout","oDocuments","documents","i","length","document","documentId","EventService","publish"],"mappings":"AAaA,IAAIA,WAAa,CAGhBC,kBAAmB,EAGnBC,0BAA0B,EAG1BC,sBAAuB,IAGvBC,eAAgB,CACfC,QAAS,sBACTC,WAAY,0BACZC,SAAU,mCAIXC,yBAA0B,EAM1BC,wBAAyB,SAAUC,kBAAmBC,wBAGrDX,WAAWC,kBAAoBS,kBAG/BV,WAAWE,yBAA2BS,uBAGtCX,WAAWY,mBAGXZ,WAAWa,kBAGXb,WAAWc,qBAMZF,iBAAkB,WAGjBG,aAGAC,mBAAmB,sBAGnBhB,WAAWiB,kBAGXC,6BAA6BC,4BAA4BnB,WAAWoB,uBAAuB,KAM5FC,kBAAmB,WAGlBrB,WAAWC,kBAAoB,EAG/BqB,sBAAsBC,aAAa,QAGnCC,qBAGAC,eAGAP,6BAA6BC,4BAA4BnB,WAAWoB,uBAAuB,KAM5FH,gBAAiB,WAGhBK,sBAAsBI,kBACrB,isBAIkK1B,WAAWI,eAAeE,WAAa,kMAC9DN,WAAWI,eAAeC,QAAU,oMACrCL,WAAWI,eAAeC,QAAU,oEAC/K,IAODsB,kBAAmB,SAAUC,gBAG5B,OAAQA,gBAIP,IAAK,WACL,IAAK,UACJC,EAAE,s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C,QAAS,SAAUC,WAGdd,MAAMI,YAAcrC,WAAWC,mBAK9B8C,UAAUC,UAKfhD,WAAW2B,kBAAkBoB,UAAUE,UAGb,aAAtBF,UAAUE,SAwBdC,WAAW,WAAclD,WAAWc,qBAAwBd,WAAWG,uBArBtE+C,WAAW,WAIV,IADA,IAAIC,WAAahC,4BAA4BnB,WAAWoB,uBAAuB,GAAOgC,UAC7EC,EAAI,EAAGA,EAAIF,WAAWG,OAAQD,IACtC,GAAIF,WAAWE,GAAGE,SAASC,YAAcxD,WAAWC,kBAAmB,CACtEkD,WAAWE,GAAGE,SAAS3B,eAAiB,EACxC,MAKF5B,WAAWqB,oBAGXoC,aAAaC,QAAQ,cACnB,UAaPtC,oBAAqB,WACpB,OAAOpB,WAAWE,yBAA2B,8BAAgC","file":"Archive-de6fbf6779.js","sourcesContent":["/*\r\n * Copyright (c) 2023 SGS Europe. All rights reserved.\r\n *\r\n * This program is the CONFIDENTIAL and PROPRIETARY property of SGS Europe.\r\n * Any unauthorised use, reproduction, or transfer of this program is strictly\r\n * prohibited.\r\n *\r\n * File Name: Archive.js\r\n *\r\n * Description:\tFunctionality relating to files that are not ready for viewing.\r\n * \r\n */\r\n\r\nvar g_oArchive = {\r\n\r\n\t// The current archive id.\r\n\tg_ArchiveDocument: 0,\r\n\r\n\t// If the current document is a comparison document.\r\n\tg_ArchiveCompareDocument: false,\r\n\r\n\t// The archive poll interval.\r\n\tg_ArchivePollInterval: 3000,\r\n\r\n\t// Globals.\r\n\tg_ArchiveIcons: {\r\n\t\tPending: \"img/Lock_wht_16.png\",\r\n\t\tInProgress: \"img/cog_icon_wht_24.png\",\r\n\t\tComplete: \"img/bubble_emblem-default24.png\"\r\n\t},\r\n\r\n\t// The archived document status.\r\n\tg_ArchivedDocumentStatus: 6,\r\n\r\n\t/**\r\n\t * Initialises the archive module.\r\n\t * @param {int} archiveDocumentId - The id of the archive document.\r\n\t */\r\n\tinitialiseArchiveModule: function (archiveDocumentId, archiveCompareDocument) {\r\n\t\t\r\n\t\t// Get the document we are in the archive process for.\r\n\t\tg_oArchive.g_ArchiveDocument = archiveDocumentId;\r\n\r\n\t\t// Get the archive compare document setting.\r\n\t\tg_oArchive.g_ArchiveCompareDocument = archiveCompareDocument;\r\n\r\n\t\t// Lock the screen.\r\n\t\tg_oArchive.applyArchiveLock();\r\n\r\n\t\t// Restore the document.\r\n\t\tg_oArchive.restoreDocument();\r\n\r\n\t\t// Poll the archive status.\r\n\t\tg_oArchive.pollArchiveStatus();\r\n\t},\r\n\r\n\t/**\r\n\t * Applies the archive lock.\r\n\t */\r\n\tapplyArchiveLock: function () {\r\n\t\t\r\n\t\t// Lock the screen.\r\n\t\tlockScreen();\r\n\r\n\t\t// Show the spinner message.\r\n\t\tshowSpinnerMessage(\"Restoring Document\");\r\n\r\n\t\t// Show the archive info.\r\n\t\tg_oArchive.showArchiveInfo();\r\n\r\n\t\t// Update the combo control lock settings.\r\n\t\tcomboControl_UpdateAboveLock(comboControl_GetControlById(g_oArchive.getArchiveControlId(), true));\r\n\t},\r\n\r\n\t/**\r\n\t * Removes the archive lock.\r\n\t */\r\n\tremoveArchiveLock: function () {\r\n\t\t\r\n\t\t// Reset the archive lock.\r\n\t\tg_oArchive.g_ArchiveDocument = 0;\r\n\r\n\t\t// Remove the archive info.\r\n\t\tg_oGreenlightMessages.closeBubbles(\"Info\");\r\n\r\n\t\t// Remove the spinner message.\r\n\t\thideSpinnerMessage();\r\n\r\n\t\t// Unlock the screen.\r\n\t\tunlockScreen();\r\n\r\n\t\t// Update the combo control lock settings.\r\n\t\tcomboControl_UpdateAboveLock(comboControl_GetControlById(g_oArchive.getArchiveControlId(), true));\r\n\t},\r\n\r\n\t/**\r\n\t * Shows the archive info.\r\n\t */\r\n\tshowArchiveInfo: function() {\r\n\r\n\t\t// Show the archive info bubble.\r\n\t\tg_oGreenlightMessages.displayInfoBubble(\r\n\t\t\t'
' + 'Archived Document' + '
' +\r\n\t\t\t'
' + 'This document has been archived. We are restoring the document and it will soon be available for use.' + '
' +\r\n\t\t\t'
' + 'Please either check back soon, or follow the process below.' + '
' +\r\n\t\t\t'
' + 'Once complete, this page will refresh and the document will become available:' + '
' +\r\n\t\t\t'
' + '' + 'Pending' + '
' +\r\n\t\t\t'
' + '' + 'Processing' + '
' +\r\n\t\t\t'
' + '' + 'Processed' + '
',\r\n\t\tfalse);\r\n\t},\r\n\r\n\t/**\r\n\t * Updates the archive info.\r\n\t * @param {string} documentStatus - The document status.\r\n\t */\r\n\tupdateArchiveInfo: function (documentStatus) {\r\n\r\n\t\t// Determine the status.\r\n\t\tswitch (documentStatus) {\r\n\r\n\t\t\t// Archived.\r\n\t\t\t// Pending.\r\n\t\t\tcase \"Archived\":\r\n\t\t\tcase \"Pending\":\r\n\t\t\t\t$(\"#imgArchivePending\").attr(\"src\", g_oArchive.g_ArchiveIcons.InProgress);\r\n\t\t\t\t$(\"#imgArchivePending\").addClass(\"speechbubble__image--spin\");\r\n\t\t\t\t$(\"#imgArchiveProcessing\").attr(\"src\", g_oArchive.g_ArchiveIcons.Pending);\r\n\t\t\t\t$(\"#imgArchiveProcessing\").removeClass(\"speechbubble__image--spin\");\r\n\t\t\t\t$(\"#imgArchiveProcessed\").attr(\"src\", g_oArchive.g_ArchiveIcons.Pending);\r\n\t\t\t\t$(\"#imgArchiveProcessed\").removeClass(\"speechbubble__image--spin\");\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Processing.\r\n\t\t\tcase \"Processing\":\r\n\t\t\t\t$(\"#imgArchivePending\").attr(\"src\", g_oArchive.g_ArchiveIcons.Complete);\r\n\t\t\t\t$(\"#imgArchivePending\").removeClass(\"speechbubble__image--spin\");\r\n\t\t\t\t$(\"#imgArchiveProcessing\").attr(\"src\", g_oArchive.g_ArchiveIcons.InProgress);\r\n\t\t\t\t$(\"#imgArchiveProcessing\").addClass(\"speechbubble__image--spin\");\r\n\t\t\t\t$(\"#imgArchiveProcessed\").attr(\"src\", g_oArchive.g_ArchiveIcons.Pending);\r\n\t\t\t\t$(\"#imgArchiveProcessed\").removeClass(\"speechbubble__image--spin\");\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Processed.\r\n\t\t\tcase \"Processed\":\r\n\t\t\t\t$(\"#imgArchivePending\").attr(\"src\", g_oArchive.g_ArchiveIcons.Complete);\r\n\t\t\t\t$(\"#imgArchivePending\").removeClass(\"speechbubble__image--spin\");\r\n\t\t\t\t$(\"#imgArchiveProcessing\").attr(\"src\", g_oArchive.g_ArchiveIcons.Complete);\r\n\t\t\t\t$(\"#imgArchiveProcessing\").removeClass(\"speechbubble__image--spin\");\r\n\t\t\t\t$(\"#imgArchiveProcessed\").attr(\"src\", g_oArchive.g_ArchiveIcons.Complete);\r\n\t\t\t\t$(\"#imgArchiveProcessed\").removeClass(\"speechbubble__image--spin\");\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Restores the document.\r\n\t */\r\n\trestoreDocument: function () {\r\n\r\n\t\t// Outline the data for the call.\r\n\t\tvar oJSON = {\r\n\t\t\toAPICredentials: { SessionId: g_szSessionId },\r\n\t\t\tDocumentId: g_oArchive.g_ArchiveDocument\r\n\t\t};\r\n\r\n\t\t// Restore the document status.\r\n\t\t$.post({\r\n\t\t\turl: \"GreenlightArchive/RestoreDocument\",\r\n\t\t\tdata: JSON.stringify(oJSON),\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: function (oResponse) {\r\n\t\t\t\t\r\n\t\t\t\t// Ensure we are still on the same archive document.\r\n\t\t\t\tif (oJSON.DocumentId != g_oArchive.g_ArchiveDocument) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Check for failures.\r\n\t\t\t\tif (!oResponse.Success) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Polls the archive status.\r\n\t */\r\n\tpollArchiveStatus: function () {\r\n\r\n\t\t// Outline the data for the call.\r\n\t\tvar oJSON = {\r\n\t\t\toAPICredentials: { SessionId: g_szSessionId },\r\n\t\t\tDocumentId: g_oArchive.g_ArchiveDocument\r\n\t\t};\r\n\r\n\t\t// Restore the document status.\r\n\t\t$.post({\r\n\t\t\turl: \"GreenlightArchive/GetDocumentStatus\",\r\n\t\t\tdata: JSON.stringify(oJSON),\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: function (oResponse) {\r\n\t\t\t\t\r\n\t\t\t\t// Ensure we are still on the same archive document.\r\n\t\t\t\tif (oJSON.DocumentId != g_oArchive.g_ArchiveDocument) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Check for failures.\r\n\t\t\t\tif (!oResponse.Success) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Update the archive information.\r\n\t\t\t\tg_oArchive.updateArchiveInfo(oResponse.Contents);\r\n\r\n\t\t\t\t// If this document is now complete, reload the document.\r\n\t\t\t\tif (oResponse.Contents == \"Processed\") {\r\n\r\n\t\t\t\t\t// Unlock and refresh the document.\r\n\t\t\t\t\tsetTimeout(function () {\r\n\r\n\t\t\t\t\t\t// Update the status of the restored document.\r\n\t\t\t\t\t\tvar oDocuments = comboControl_GetControlById(g_oArchive.getArchiveControlId(), false).documents;\r\n\t\t\t\t\t\tfor (var i = 0; i < oDocuments.length; i++) {\r\n\t\t\t\t\t\t\tif (oDocuments[i].document.documentId == g_oArchive.g_ArchiveDocument) {\r\n\t\t\t\t\t\t\t\toDocuments[i].document.documentStatus = 2;\r\n\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\r\n\t\t\t\t\t\t// Remove the archive lock.\r\n\t\t\t\t\t\tg_oArchive.removeArchiveLock();\r\n\r\n\t\t\t\t\t\t// Publish the doc change event to reload.\r\n\t\t\t\t\t\tEventService.publish('changeDoc');\r\n\t\t\t\t\t}, 1000);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Queue up the next poll.\r\n\t\t\t\tsetTimeout(function () { g_oArchive.pollArchiveStatus(); }, g_oArchive.g_ArchivePollInterval);\r\n\t\t\t}\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Gets the current archive control id.\r\n\t */\r\n\tgetArchiveControlId: function () {\r\n\t\treturn g_oArchive.g_ArchiveCompareDocument ? \"approvalCompareComboControl\" : \"approvalNameComboControl\";\r\n\t}\r\n};"]}