{"version":3,"sources":["webpack:///main.js","webpack:///webpack/bootstrap ee57791e80fb03bb3080","webpack:///./src/js/app.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","askUsername","message","prompt","askPassword","setCredentials","sessionStorage","setItem","username","password","headers","set","btoa","e","removeItem","window","alert","fetchData","fetch","MONITOR_URL","method","then","response","status","json","responseJson","fillDataRows","dataRows","columnsConfig","resetPage","fetchTime","clearTimeout","setTimeout","NUMBER_OF_SEC_TO_FETCH","catch","error","console","returnTime","options","year","month","day","weekday","timezone","hour","minute","second","Date","toLocaleString","tickAClock","paginatorBox","clock","statusTime","currentTick","NUMBER_OF_TICKS_SCROLL","scrolling","paginatorObj","updatePage","MS_IN_A_TICK","createStatusBar","statusBar","document","createElement","className","appendChild","createTable","table","headerConfig","insertBefore","createHeaderRow","firstChild","tableData","innerText","renderTable","generateEmptyRows","rowsCount","length","refsToSpan","data","columnConfig","cell","j","classList","add","innerHTML","createRow","columns","row","cells","_iteratorNormalCompletion","_didIteratorError","_iteratorError","undefined","_step","_iterator","Symbol","iterator","next","done","column","value","push","err","return","config","_createRow","_ref","rowsData","_createRow2","scrollToSmooth","goto","scrollTo","top","behavior","innerHeight","pageYOffset","docHeight","screenHeight","Headers","getItem","log","body","Math","max","scrollHeight","documentElement","offsetHeight","clientHeight","getNumberOfPages","ceil","getCurrentPage","setData","span","this"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,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AK5D,UAAL,SAA0B6D,KAAKH,iBAA/B,IAAmDG,KAAKL,oBAE1DvE,WAAY,SAASP,EAAcC,GACjCkF,KAAKF,QAAQjF,GACbC,EAAMqB,UAAYnC,KA0GtBpB,KACAsC","file":"main.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar headers = new Headers();\nheaders.set('Authorization', '');\n\nvar username = sessionStorage.getItem(\"username\") || askUsername();\nvar password = sessionStorage.getItem(\"password\") || askPassword();\n\nvar MONITOR_URL = \"https://1cweb.cloudzz.com/tehpostach/hs/monitor\";\n\nconsole.log(\"MONITOR_URL\", MONITOR_URL);\n\nvar MS_IN_A_TICK = 1000;\nvar NUMBER_OF_TICKS_SCROLL = 10;\nvar NUMBER_OF_SEC_TO_FETCH = 60;\n\nfunction askUsername(message) {\n  return prompt(message || 'Please, enter your username');\n}\n\nfunction askPassword(message) {\n  return prompt(message || 'Please, enter your password');\n}\n\nfunction setCredentials() {\n  sessionStorage.setItem(\"username\", username);\n  sessionStorage.setItem(\"password\", password);\n\n  try {\n    headers.set('Authorization', 'Basic ' + btoa(username + \":\" + password));\n  } catch (e) {\n    sessionStorage.removeItem(\"username\");\n    sessionStorage.removeItem(\"password\");\n    window.alert(\"error in password, \\n\" + e);\n  }\n}\n\nif (username && password) {\n  setCredentials();\n}\n\nvar fetchTime = void 0,\n    statusTime = void 0,\n    currentTick = 0;\nvar headerConfig = [\"model\", \"order\", \"q-ty\", \"producer\", \"status\", \"deadline\"];\nvar columnsConfig = [\"MODEL\", \"ORDER\", \"QUANTITY\", \"PRODUCER\", \"STATUS\", \"DEADLINE\"];\nvar table = document.createElement('div');\nvar dataRows = document.createElement('div');\n\nfunction initTable() {\n  table.classList.add('table');\n  document.body.appendChild(table);\n  dataRows.classList.add('app-data-rows');\n  table.appendChild(dataRows);\n  createTable(table, headerConfig);\n}\n\ninitTable();\n\nvar docHeight = function docHeight() {\n  return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight);\n},\n    screenHeight = function screenHeight() {\n  return document.documentElement.clientHeight - document.documentElement.clientHeight / 10;\n};\n\nfunction fetchData() {\n  fetch(MONITOR_URL, {\n    method: 'GET',\n    headers: headers\n  }).then(function (response) {\n    if (response.status === 200) {\n      return response.json();\n    } else {\n      throw response;\n    }\n  }).then(function (responseJson) {\n    fillDataRows(dataRows, columnsConfig, responseJson);\n    resetPage();\n\n    fetchTime && clearTimeout(fetchTime);\n    fetchTime = setTimeout(fetchData, NUMBER_OF_SEC_TO_FETCH * 1000);\n  }).catch(function (error) {\n    if (error && error.status && error.status >= 400 && error.status < 500) {\n      username = askUsername('You have entered an invalid username, enter valid one');\n      password = askPassword('Now enter the correct password, please');\n      if (username && password) {\n        setCredentials();\n        fetchData();\n      }\n    } else {\n      console.error(error);\n    }\n  });\n}\nfunction returnTime() {\n  var options = {\n    year: 'numeric',\n    month: 'long',\n    day: 'numeric',\n    weekday: 'long',\n    timezone: 'UTC',\n    hour: 'numeric',\n    minute: 'numeric',\n    second: 'numeric'\n  };\n  return new Date().toLocaleString('uk', options);\n}\nvar paginatorObj = {\n  getNumberOfPages: function getNumberOfPages() {\n    return Math.ceil(docHeight() / screenHeight());\n  },\n  getCurrentPage: function getCurrentPage() {\n    return Math.ceil(window.pageYOffset / screenHeight()) + 1;\n  },\n  setData: function setData(span) {\n    span.innerText = 'Page: ' + this.getCurrentPage() + '/' + this.getNumberOfPages();\n  },\n  updatePage: function updatePage(paginatorBox, clock) {\n    this.setData(paginatorBox);\n    clock.innerText = returnTime();\n  }\n};\n\nfunction tickAClock(paginatorBox, clock) {\n  statusTime && clearTimeout(statusTime);\n  statusTime = setTimeout(function () {\n    currentTick = (currentTick + 1) % NUMBER_OF_TICKS_SCROLL;\n    currentTick || scrolling();\n    paginatorObj.updatePage(paginatorBox, clock);\n    tickAClock(paginatorBox, clock);\n  }, MS_IN_A_TICK);\n}\nfunction createStatusBar() {\n  var statusBar = document.createElement('div'),\n      clock = document.createElement('span'),\n      paginatorBox = document.createElement('span');\n\n  statusBar.className = 'status-bar';\n  clock.className = 'clock';\n  paginatorBox.className = 'paginator';\n\n  statusBar.appendChild(clock);\n  statusBar.appendChild(paginatorBox);\n\n  tickAClock(paginatorBox, clock);\n\n  return statusBar;\n}\nfunction createTable(table, headerConfig) {\n  table.insertBefore(createHeaderRow(headerConfig), table.firstChild);\n  table.appendChild(createStatusBar());\n}\nfunction fillDataRows(dataRows, columnsConfig, tableData) {\n  dataRows.innerText = '';\n  var refsToSpan = generateEmptyRows({ dataRows: dataRows, rowsCount: tableData.length, columnsConfig: columnsConfig });\n  renderTable(refsToSpan, tableData, columnsConfig);\n}\nfunction renderTable(refsToSpan, data, columnConfig) {\n  for (var i = 0; i < refsToSpan.length; i++) {\n    var cell = refsToSpan[i];\n    for (var j = 0; j < columnConfig.length; j++) {\n      if (data[i][columnConfig[j]] === \"Заплановано\") {\n        cell[j].classList.add('planned');\n      } else if (data[i][columnConfig[j]] === \"Завершено\") {\n        cell[j].classList.add('finished');\n      } else if (data[i][columnConfig[j]] === \"У виробництві\") {\n        cell[j].classList.add('processing');\n      } else if (columnsConfig[j] === \"DEADLINE\" && data[i]['REDCOLOUR'] === 1) {\n        cell[j].classList.add('deadline-lost');\n      }\n      cell[j].innerHTML = data[i][columnConfig[j]];\n    }\n  }\n}\nfunction createRow(columns) {\n  var row = document.createElement('div');\n  row.classList.add('app-row');\n  var cells = [];\n  var _iteratorNormalCompletion = true;\n  var _didIteratorError = false;\n  var _iteratorError = undefined;\n\n  try {\n    for (var _iterator = columns[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n      var column = _step.value;\n\n      var cell = document.createElement('span');\n      cell.classList.add('app-cell-' + column);\n      cells.push(cell);\n      row.appendChild(cell);\n    }\n  } catch (err) {\n    _didIteratorError = true;\n    _iteratorError = err;\n  } finally {\n    try {\n      if (!_iteratorNormalCompletion && _iterator.return) {\n        _iterator.return();\n      }\n    } finally {\n      if (_didIteratorError) {\n        throw _iteratorError;\n      }\n    }\n  }\n\n  return {\n    row: row,\n    cells: cells\n  };\n}\nfunction createHeaderRow(config) {\n  var _createRow = createRow(config),\n      row = _createRow.row,\n      cells = _createRow.cells;\n\n  row.classList.add('app-header');\n  for (var i = 0; i < config.length; i++) {\n    cells[i].innerText = config[i];\n    cells[i].classList.add('app-head');\n    cells[i].classList.add('app-head-' + config[i]);\n  }\n  return row;\n}\nfunction generateEmptyRows(_ref) {\n  var dataRows = _ref.dataRows,\n      rowsCount = _ref.rowsCount,\n      columnsConfig = _ref.columnsConfig;\n\n  var rowsData = [];\n  for (var i = 0; i < rowsCount; i++) {\n    var _createRow2 = createRow(columnsConfig),\n        row = _createRow2.row,\n        cells = _createRow2.cells;\n\n    dataRows.appendChild(row);\n    rowsData.push(cells);\n  }\n  return rowsData;\n}\nfunction scrollToSmooth(goto) {\n  window.scrollTo({\n    top: typeof goto !== 'number' ? 0 : goto,\n    behavior: \"smooth\"\n  });\n}\nfunction resetPage() {\n  scrollToSmooth();\n  currentTick = 0;\n}\nfunction scrolling() {\n  scrollToSmooth(window.innerHeight + window.pageYOffset >= docHeight() ? 0 : window.pageYOffset + screenHeight());\n}\n\nfetchData();\nscrolling();\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// main.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ee57791e80fb03bb3080","let headers = new Headers();\nheaders.set('Authorization', '');\n\nlet username = sessionStorage.getItem(\"username\") || askUsername();\nlet password = sessionStorage.getItem(\"password\") || askPassword();\n\n\nlet MONITOR_URL = \"ENV_MONITOR_URL\";\n\nconsole.log(\"MONITOR_URL\", MONITOR_URL);\n\nconst MS_IN_A_TICK = 1000;\nconst NUMBER_OF_TICKS_SCROLL = 10;\nconst NUMBER_OF_SEC_TO_FETCH = 60;\n\nfunction askUsername(message) {\n  return prompt(message || 'Please, enter your username');\n}\n\nfunction askPassword(message) {\n  return prompt(message || 'Please, enter your password');\n}\n\nfunction setCredentials() {\n  sessionStorage.setItem(\"username\", username);\n  sessionStorage.setItem(\"password\", password);\n\n  try {\n    headers.set('Authorization', 'Basic ' + btoa(username + \":\" + password));\n  } catch (e) {\n    sessionStorage.removeItem(\"username\");\n    sessionStorage.removeItem(\"password\");\n    window.alert(\"error in password, \\n\" + e);\n  }\n}\n\nif (username && password) {\n  setCredentials();\n}\n\nlet fetchTime, statusTime, currentTick = 0;\nconst headerConfig = [\n  \"model\",\n  \"order\",\n  \"q-ty\",\n  \"producer\",\n  \"status\",\n  \"deadline\"\n];\nconst columnsConfig = [\n  \"MODEL\",\n  \"ORDER\",\n  \"QUANTITY\",\n  \"PRODUCER\",\n  \"STATUS\",\n  \"DEADLINE\"\n];\nconst table = document.createElement('div');\nconst dataRows = document.createElement('div');\n\nfunction initTable() {\n  table.classList.add('table');\n  document.body.appendChild(table);\n  dataRows.classList.add('app-data-rows');\n  table.appendChild(dataRows);\n  createTable(table, headerConfig);\n}\n\ninitTable();\n\nconst docHeight = () =>\n        Math.max(\n            document.body.scrollHeight, document.documentElement.scrollHeight,\n            document.body.offsetHeight, document.documentElement.offsetHeight,\n            document.body.clientHeight, document.documentElement.clientHeight\n        ),\n    screenHeight = () => document.documentElement.clientHeight - document.documentElement.clientHeight / 10;\n\nfunction fetchData() {\n  fetch(MONITOR_URL, {\n    method: 'GET',\n    headers: headers\n  })\n      .then((response) => {\n        if(response.status === 200) {\n          return response.json();\n        } else {\n          throw response;\n        }\n      })\n      .then((responseJson) => {\n        fillDataRows(dataRows, columnsConfig, responseJson);\n        resetPage();\n\n        fetchTime && clearTimeout(fetchTime);\n        fetchTime = setTimeout(fetchData, NUMBER_OF_SEC_TO_FETCH * 1000);\n      })\n      .catch((error) => {\n        if(error && error.status && (error.status >= 400 && error.status < 500) ) {\n          username = askUsername('You have entered an invalid username, enter valid one');\n          password = askPassword('Now enter the correct password, please');\n          if(username && password) {\n            setCredentials();\n            fetchData();\n          }\n        } else {\n          console.error(error);\n        }\n      });\n}\nfunction returnTime() {\n  const options = {\n    year: 'numeric',\n    month: 'long',\n    day: 'numeric',\n    weekday: 'long',\n    timezone: 'UTC',\n    hour: 'numeric',\n    minute: 'numeric',\n    second: 'numeric'\n  };\n  return new Date().toLocaleString('uk', options);\n}\nconst paginatorObj = {\n  getNumberOfPages: function() {\n    return Math.ceil(docHeight() / screenHeight());\n  },\n  getCurrentPage: function() {\n    return Math.ceil(window.pageYOffset / screenHeight()) + 1;\n  },\n  setData: function(span) {\n    span.innerText = `Page: ${this.getCurrentPage()}/${this.getNumberOfPages()}`;\n  },\n  updatePage: function(paginatorBox, clock) {\n    this.setData(paginatorBox);\n    clock.innerText = returnTime();\n  }\n};\n\nfunction tickAClock(paginatorBox, clock) {\n  statusTime && clearTimeout(statusTime);\n  statusTime = setTimeout(() => {\n    currentTick = (currentTick + 1) % NUMBER_OF_TICKS_SCROLL;\n    currentTick || scrolling();\n    paginatorObj.updatePage(paginatorBox, clock);\n    tickAClock(paginatorBox, clock);\n  }, MS_IN_A_TICK);\n}\nfunction createStatusBar() {\n  let statusBar = document.createElement('div'),\n      clock = document.createElement('span'),\n      paginatorBox = document.createElement('span');\n\n  statusBar.className = 'status-bar';\n  clock.className = 'clock';\n  paginatorBox.className = 'paginator';\n\n  statusBar.appendChild(clock);\n  statusBar.appendChild(paginatorBox);\n\n  tickAClock(paginatorBox, clock);\n\n  return statusBar;\n}\nfunction createTable(table, headerConfig) {\n  table.insertBefore(createHeaderRow(headerConfig), table.firstChild);\n  table.appendChild(createStatusBar());\n}\nfunction fillDataRows(dataRows, columnsConfig, tableData) {\n  dataRows.innerText = '';\n  const refsToSpan = generateEmptyRows({ dataRows, rowsCount: tableData.length, columnsConfig });\n  renderTable(refsToSpan, tableData, columnsConfig);\n}\nfunction renderTable(refsToSpan, data, columnConfig) {\n  for (let i = 0; i < refsToSpan.length; i++) {\n    const cell = refsToSpan[i];\n    for (let j = 0; j < columnConfig.length; j++) {\n      if (data[i][columnConfig[j]] === \"Заплановано\") {\n        cell[j].classList.add('planned');\n      } else if (data[i][columnConfig[j]] === \"Завершено\") {\n        cell[j].classList.add('finished');\n      } else if (data[i][columnConfig[j]] === \"У виробництві\") {\n        cell[j].classList.add('processing');\n      } else if (columnsConfig[j] === \"DEADLINE\" && data[i]['REDCOLOUR'] === 1) {\n        cell[j].classList.add('deadline-lost');\n      }\n      cell[j].innerHTML = data[i][columnConfig[j]];\n    }\n  }\n}\nfunction createRow(columns) {\n  const row = document.createElement('div');\n  row.classList.add('app-row');\n  const cells = [];\n  for (let column of columns) {\n    const cell = document.createElement('span');\n    cell.classList.add(`app-cell-${column}`);\n    cells.push(cell);\n    row.appendChild(cell);\n  }\n  return {\n    row,\n    cells\n  };\n}\nfunction createHeaderRow(config) {\n  const {\n    row,\n    cells\n  } = createRow(config);\n  row.classList.add('app-header');\n  for (let i = 0; i < config.length; i++) {\n    cells[i].innerText = config[i];\n    cells[i].classList.add(`app-head`);\n    cells[i].classList.add(`app-head-${config[i]}`);\n  }\n  return row;\n}\nfunction generateEmptyRows({dataRows, rowsCount, columnsConfig}) {\n  const rowsData = [];\n  for (let i = 0; i < rowsCount; i++) {\n    const { row, cells } = createRow(columnsConfig);\n    dataRows.appendChild(row);\n    rowsData.push(cells);\n  }\n  return rowsData;\n}\nfunction scrollToSmooth(goto) {\n  window.scrollTo({\n    top: (typeof goto !== 'number') ? 0 : goto,\n    behavior: \"smooth\"\n  });\n}\nfunction resetPage() {\n  scrollToSmooth();\n  currentTick = 0;\n}\nfunction scrolling() {\n  scrollToSmooth(window.innerHeight + window.pageYOffset >= docHeight() ? 0 : window.pageYOffset + screenHeight());\n}\n\nfetchData();\nscrolling();\n\n\n\n// WEBPACK FOOTER //\n// ./src/js/app.js"],"sourceRoot":""}