Advertisement
VladislavNechepaev

Untitled

Dec 29th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script src="https://freshservicecounter.ringteam.com/ringteam_portal_customization.js"></script>
  2. <script>
  3.   jQuery(document).on('ready', async function(){
  4.     console.log('[INIT]')
  5.     if (window.location.pathname === "/support/catalog/items/149") {
  6.       const durationList = {
  7.         "...": false,
  8.         "Full day": true,
  9.         "Half day": true,
  10.         "Short visit (up to 2 hours)": false
  11.       }
  12.       const officeList = {
  13.         "...": false,
  14.         "Toronto": true,
  15.         "Lviv": true,
  16.         "Lab64": true,
  17.         "Lab72": true,
  18.         "Lab72 / 1": false,
  19.         "Rancho 1": false,
  20.         "Rancho 2": false,
  21.         "QA Studio": false,
  22.         "New QA Studio": false,
  23.         "Community": false,
  24.         "Lab62": true
  25.       }
  26.       const officeMeido = {
  27.         "...": false,
  28.         "Toronto": true,
  29.         "Lviv": false,
  30.         "Lab64": true,
  31.         "Lab72": true,
  32.         "Lab72 / 1": false,
  33.         "Rancho 1": false,
  34.         "Rancho 2": false,
  35.         "QA Studio": false,
  36.         "New QA Studio": false,
  37.         "Community": false,
  38.         "Lab62": true
  39.       }
  40.       const officeCapacity = ["Toronto","Lab64","Lab62"]
  41.       const officeAddress = {
  42.         "...": "",
  43.         "Toronto": "м. Київ, вул. Велика Васильківська 100, 8 поверх",
  44.         "Lviv": "м. Львів, вул. Поповича, 9",
  45.         "Lab64": "м. Київ, вул. Велика Васильківська 64",
  46.         "Lab72": "м. Київ, вул. Велика Васильківська 72",
  47.         "Lab72 / 1": "м. Київ, вул. Велика Васильківська 72",
  48.         "Rancho 1": "м. Київ, пров. Малокитаївський, 12",
  49.         "Rancho 2": "м. Київ, вул. Травнева 28",
  50.         "QA Studio": "м. Київ, вул. Північно-Сирецька 1-3",
  51.         "New QA Studio": "м. Київ, просп. Перемоги 53",
  52.         "Community": "м. Київ, вул. Євгена Коновальця 44, 2 поверх",
  53.         "Lab62": "м. Київ, вул. Велика Васильківська 62"
  54.       }
  55.       const accessWeek = {
  56.         "...": false,
  57.         "Current week": true,
  58.         "Next week": true
  59.       }
  60.       const mealTypes = [
  61.         "Non-vegan",
  62.         "Vegan"
  63.       ]
  64.         var fsFields = {
  65.       duration: "requested_item_values_149_requested_item_value_attributes_cf_visit_duration_270753",
  66.       support_with_lunch: "requested_item_values_149_requested_item_value_attributes_cf_support_with_lunch_270753",
  67.       access_week: "requested_item_values_149_requested_item_value_attributes_cf_access_type_270753",
  68.       lunch_type: "requested_item_values_149_requested_item_value_attributes_cf_select_your_meal_preference_270753",
  69.       office: "requested_item_values_149_requested_item_value_attributes_cf_office_270753",
  70.       dates: [
  71.         "requested_item_values_149_requested_item_value_attributes_cf_day1_270753_date",
  72.         "requested_item_values_149_requested_item_value_attributes_cf_day2_270753_date",
  73.         "requested_item_values_149_requested_item_value_attributes_cf_day3_270753_date",
  74.         "requested_item_values_149_requested_item_value_attributes_cf_day4_270753_date",
  75.         "requested_item_values_149_requested_item_value_attributes_cf_day5_270753_date"              //ДОБАВИТЬ ДОПОЛНИТЕЛЬНІЕ ДНИ - скопировать айдишники каждого поля_ТЕСТОВІЙ РЕКВЕСТ//
  76.       ],
  77.       additional_locations: [
  78.         "requested_item_values_149_requested_item_value_attributes_cf_do_you_plan_to_visit_any_additional_location_during_the_requested_period_nbsp_270753",
  79.         "requested_item_values_149_requested_item_value_attributes_cf_additional_location_2_270753"
  80.       ],
  81.       meido: "requested_item_values_149_requested_item_value_attributes_cf_meido_body_270753",
  82.       document_text: "requested_item_values_149_requested_item_value_attributes_cf__270753",
  83.       document_check: "requested_item_values_149_requested_item_value_attributes_cf_v_270753",
  84.       addloc: "requested_item_values_149_requested_item_value_attributes_cf_additional_location_data_270753",
  85.       addloc_text: "requested_item_values_149_requested_item_value_attributes_cf_additional_location_270753"
  86.     }
  87.  
  88.       // -------------------------
  89.         var meidoActive
  90.         if (window.location.pathname === "/support/catalog/items/136") {
  91.           meidoActive = false
  92.         } else if (window.location.pathname === "/support/catalog/items/149") {
  93.           meidoActive = true
  94.         }
  95.         meidoToken = "test"
  96.       // -------------------------
  97.  
  98.       // -------------------------
  99.         var capacityActive = true
  100.       // -------------------------
  101.  
  102.           // ====================================================================
  103.           // ====================================================================
  104.           // ====================================================================
  105.  
  106.       const fsNative = {
  107.         duration: document.getElementById(fsFields.duration),
  108.         support_with_lunch: document.getElementById(fsFields.support_with_lunch).parentNode.childNodes.item(0),
  109.         access_week: document.getElementById(fsFields.access_week),
  110.         lunch_type: document.getElementById(fsFields.lunch_type),
  111.         office: document.getElementById(fsFields.office),
  112.         meido: document.getElementById(fsFields.meido),
  113.         dates: getElemList(fsFields.dates),
  114.         additional_locations: getElemList(fsFields.additional_locations),
  115.         document_text: document.getElementById(fsFields.document_text),
  116.         document_check: document.getElementById(fsFields.document_check).parentNode.childNodes.item(0),
  117.         addloc: document.getElementById(fsFields.addloc),
  118.         addloc_text: document.getElementById(fsFields.addloc_text)
  119.       }
  120.  
  121.       var activeDateCount = 0
  122.       const today = new Date()
  123.       const todayGlobal = today.toLocaleDateString()
  124.       const weekdayGlobal = today.getDay()
  125.       const currentHoursGlobal = today.getHours()
  126.         const currentMinutesGlobal = today.getMinutes()
  127.       var selectedDatesGlobal = []
  128.       var capacityCheck = true
  129.       var additionalLocationInfo = {}
  130.       var addLocationTable
  131.       var lastSelectedOffice
  132.  
  133.       const durationSelector = replaceInputWithDropdown(fsFields.duration, durationList, "duration")
  134.             durationSelector.parentNode.hidden = true
  135.       const officeSelector = replaceInputWithDropdown(fsFields.office, officeList, "office")
  136.       const accessWeekSelector = replaceInputWithDropdown(fsFields.access_week, accessWeek, "access-week")
  137.       const lunchTypeSelector = createSimplifiedDropdown(fsFields.lunch_type, mealTypes, "lunch_type")
  138.       const lunchCheckboxLabel = document.createTextNode("Please support me with lunch")                          // to add text Lunch will be provided in case your visit durayion is more than 2 hours//
  139.       const lunchCheckbox = createCustomCheckbox(document.getElementById(fsFields.support_with_lunch).parentNode, "show-lunch", lunchCheckboxLabel)
  140.       const dateList = createCustomDates(fsNative.dates)
  141.       const additionalOfficesList = createAdditionalOfficeSelectors(fsFields.additional_locations, officeList)
  142.       const capacityDisplay = createCapacityDisplay(fsNative.dates[0].parentNode.parentNode)
  143.       //--- capacity ---
  144.       if (capacityActive) {
  145.         fsNative.addloc.parentNode.hidden = true
  146.         fsNative.addloc_text.parentNode.hidden = true
  147.         fsNative.additional_locations.forEach(elem => { elem.parentNode.hidden = true })
  148.       }
  149.  
  150.  
  151.           //add hotDeskCheckbox
  152.       const hotdeskCheckboxLabel = document.createTextNode("I don`t have a permanent seat and would like to book a hot desk.");
  153.       const hotdeskCheckboxContainer = document.createElement('div');
  154.       document.getElementById(fsFields.office).parentNode.appendChild(hotdeskCheckboxContainer);
  155.       const hotdeskCheckbox = createCustomCheckbox(hotdeskCheckboxContainer, "show-hotdesk", hotdeskCheckboxLabel);
  156.       hotdeskCheckbox.checked = false;
  157.       const hotdeskText = document.createElement("p");
  158.       hotdeskText.innerHTML = "Please, follow the <a href='https://ringukraine.officespacesoftware.com/visual-directory/floors/139' style='color:blue;cursor:pointer;' target='_blank'>link</a> for hot desks booking system (applicable only for Full/half-day visit). Here`re <a href='https://docs.google.com/document/d/1llpCz3RbK0cBew7kSJhZPQwD5Om8Kgj0tTq-1kgONx4/edit' style='color:blue;cursor:pointer;' target='_blank'>instructions</a> on how to make a booking.";
  159.       hotdeskCheckboxContainer.appendChild(hotdeskText);
  160.  
  161.       const documentCheckboxLabel = document.createElement("span")
  162.       documentCheckboxLabel.innerHTML = "Я, {{ current_user.phone }}, ознайомився з документом та підтверджую що мій стан відповідає нормам відвідування офісу згідно з заявою.<br>*[✓] <i>означає, що дана відмітка прирівнюється до власноручного/факсимільного відтворення підпису особи.</i>"
  163.       const documentCheckbox = createCustomCheckbox(fsNative.document_check.parentNode, "document-check", documentCheckboxLabel)
  164.       const documentText = createDocumentSection(fsNative.document_text, todayGlobal)
  165.  
  166.       const dateControlAdd = document.createElement("button")
  167.       dateControlAdd.innerHTML = "+"
  168.       const dateControlRemove = document.createElement("button")
  169.       dateControlRemove.innerHTML = "-"
  170.  
  171.       lunchCheckbox.parentNode.hidden = true;
  172.       lunchTypeSelector.parentNode.hidden = true;
  173.       hotdeskCheckboxContainer.hidden = true;
  174.       hotdeskText.hidden = true;
  175.  
  176.       //durationSelector.addEventListener("change", function(){ renderController() })
  177.       officeSelector.addEventListener("change", function(){ renderController() })
  178.       accessWeekSelector.addEventListener("change", function(){ renderController() })
  179.       lunchCheckbox.addEventListener("change", function(){ renderController() })
  180.       hotdeskCheckbox.addEventListener("change", function(){ renderController() })
  181.       lunchTypeSelector.addEventListener("change", function(){ renderController() })
  182.  
  183.       dateList.forEach(dateElem => {
  184.         jQuery(dateElem).datepicker("option", {
  185.           onSelect: function() {
  186.             renderController()
  187.           }
  188.         })
  189.       })
  190.  
  191.       dateControlAdd.addEventListener("click", function(e){
  192.         e.preventDefault()
  193.         activeDateCount += 1
  194.         renderController()
  195.       })
  196.       dateControlRemove.addEventListener("click", function(e){
  197.         e.preventDefault()
  198.         activeDateCount -= 1
  199.         renderController()
  200.       })
  201.       additionalOfficesList.forEach(elem => {
  202.         elem.addEventListener("change", function(){ renderController() })
  203.       })
  204.  
  205.  
  206.       documentCheckbox.addEventListener("change", function(){ renderController() })
  207.  
  208.       var meidoMenu
  209.       document.getElementById(fsFields.meido).parentNode.style.display = "none"
  210.       if (meidoActive) {
  211.         const elems = document.getElementsByClassName("main pull-left")
  212.         meidoMenu = await meidoInit(elems[0], dateList, fsFields.meido, 125, false)  // change 125 to required limit
  213.         meidoMenu.hidden = true
  214.         renderController()
  215.       } else {
  216.         renderController()
  217.       }
  218.  
  219.       jQuery("input[type=\"submit\"]").each((index, elem) => {
  220.         elem.onclick = function(e){
  221.           if (!capacityCheck) {
  222.             e.stopImmediatePropagation()
  223.             e.preventDefault()
  224.               alert("Please check the capactiy for selected dates")                     //поменять нотифай если нужно!//
  225.           }
  226.         }
  227.       })
  228.  
  229.       function renderController(){
  230.         var values = {
  231.           duration: "Full day",
  232.           office: officeSelector.value,
  233.           access_week: accessWeekSelector.value
  234.         }
  235.  
  236.         fsNative.duration.value = values.duration === "..." ? "" : values.duration
  237.         fsNative.office.value = values.office === "..." ? "" : values.office
  238.  
  239.         if (capacityActive) {
  240.           if (values.office === "...") {
  241.             lastSelectedOffice = values.office
  242.             for (let elem of document.getElementsByClassName("addtable-container")) {
  243.               elem.innerHTML = ""
  244.             }
  245.             additionalLocationInfo = {}
  246.             populateAddLocation()
  247.           }
  248.           if (values.office !== "..." && values.office !== lastSelectedOffice) {
  249.             lastSelectedOffice = values.office
  250.             addLocationTable = buildAddLocationTable(values.office)
  251.             const addTableContainers = document.getElementsByClassName("addtable-container")
  252.             var index = 1
  253.             for (let elem of addTableContainers) {
  254.               elem.innerHTML = ""
  255.               const table = addLocationTable.cloneNode(true)
  256.               console.log(table.querySelectorAll('.add-office-label'))
  257.               for (let elem of table.querySelectorAll('.add-office-label')) {
  258.                 elem.htmlFor = elem.htmlFor + "_" + index
  259.               }
  260.               for (let elem of table.querySelectorAll('.add-office-checkbox')) {
  261.                 elem.id = elem.id + "_" + index
  262.                 elem.onclick = function(){ handleAddLocation(this) }
  263.               }
  264.               ++index
  265.               elem.appendChild(table)
  266.             }
  267.             additionalLocationInfo = {}
  268.             populateAddLocation()
  269.           }
  270.         }
  271.  
  272.         if (fsNative.office.value === 'Toronto') {
  273.           hotdeskCheckboxContainer.hidden = false;
  274.         } else {
  275.           hotdeskCheckbox.checked = false;
  276.           hotdeskCheckboxContainer.hidden = true;
  277.         }
  278.         if (!hotdeskCheckbox.checked) {
  279.           hotdeskText.hidden = true;
  280.         } else {
  281.           hotdeskText.hidden = false;
  282.         }
  283.  
  284.         const accessWeekChanged = fsNative.access_week.value === values.access_week ? false : true
  285.         fsNative.access_week.value = values.access_week === "..." ? "" : values.access_week
  286.         var datesInRequest = dateList.map(x => x.value).filter(x => !!x)
  287.         if (activeDateCount === 0) datesInRequest = datesInRequest[0] ? [datesInRequest[0]] : []
  288.         const today = new Date().toISOString().split("T")[0]
  289.         if (durationList[values.duration] && officeList[values.office] && accessWeek[values.access_week] && datesInRequest.length && !(datesInRequest.length === 1 && datesInRequest[0] === today) && !accessWeekChanged) {
  290.           lunchCheckbox.parentNode.hidden = false
  291.         } else {
  292.           lunchCheckbox.parentNode.hidden = true
  293.           lunchCheckbox.checked = false
  294.         }
  295.  
  296.         values.support_with_lunch = lunchCheckbox.checked
  297.         fsNative.support_with_lunch.value = lunchCheckbox.checked ? "1" : "0"
  298.         if (values.support_with_lunch) {
  299.           if (meidoActive) {
  300.             if (weekdayGlobal === 6 || weekdayGlobal === 0 || (weekdayGlobal === 5 && currentHoursGlobal >= 19 && currentMinutesGlobal >= 30) || values.access_week === "Current week" || !officeMeido[values.office]) {
  301.               lunchTypeSelector.parentNode.hidden = false
  302.               lunchTypeSelector.value = lunchTypeSelector.value ? lunchTypeSelector.value : mealTypes[0]
  303.               meidoMenu.hidden = true
  304.             } else {
  305.               lunchTypeSelector.parentNode.hidden = true
  306.               lunchTypeSelector.value = null
  307.               meidoMenu.hidden = false
  308.             }
  309.           } else {
  310.             lunchTypeSelector.parentNode.hidden = false
  311.             lunchTypeSelector.value = lunchTypeSelector.value ? lunchTypeSelector.value : mealTypes[0]
  312.           }
  313.         } else {
  314.           lunchTypeSelector.parentNode.hidden = true
  315.           lunchTypeSelector.value = null
  316.           if (meidoActive) meidoMenu.hidden = true
  317.         }
  318.  
  319.         values.lunch_type = lunchTypeSelector.value
  320.         fsNative.lunch_type.value = values.lunch_type ? values.lunch_type : ""
  321.  
  322.         const dateLimits = (values.access_week === "...") ? null : calcDateLimits(values.access_week === "Current week" ? true : false)
  323.         const dateLimitsRaw = dateLimits ? dateLimits.map(x => new Date(x).valueOf()) : null
  324.         var existingDates = []
  325.         var lastUsedFound = false;
  326.         if (accessWeekChanged) activeDateCount = 0
  327.         dateList.forEach((dateElem, index) => {
  328.           const dateNativeElem = fsNative.dates[index]
  329.           const timeNativeElem = document.getElementById(fsFields.dates[index].substring(0, fsFields.dates[index].length - 4) + "time")
  330.           const errorElem = document.getElementById("date_custom_" + (index+1) + "-error")
  331.           if (errorElem) errorElem.style.display = "none"
  332.           if (accessWeekChanged && index === 0) dateElem.value = null
  333.           const dateRawValue = new Date(dateElem.value).valueOf()
  334.           if (existingDates.includes(dateRawValue)) dateElem.value = null
  335.           if (dateLimits) {
  336.             jQuery("#date_custom_"+(index+1)).datepicker("option", {
  337.               minDate: new Date(dateLimits[0]),
  338.               maxDate: new Date(dateLimits[1])
  339.             })
  340.             dateElem.disabled = false
  341.             if (dateRawValue < dateLimitsRaw[0] || dateRawValue > dateLimitsRaw[1]) dateElem.value = null
  342.           } else {
  343.             dateElem.disabled = true
  344.           }
  345.           existingDates.push(dateRawValue)
  346.           const controlWrapper = document.getElementById("controls_" + index)
  347.           controlWrapper.innerHTML = ""
  348.           const addLocations = document.getElementById("addtable_" + (index+1)).querySelectorAll('.add-office-checkbox')
  349.           if (dateElem.value && dateElem.value !== "") {
  350.             dateNativeElem.value = reverseForFS(dateElem.value)
  351.             timeNativeElem.value = "00:00"
  352.             if (capacityActive) document.getElementById("addtable_wrapper_" + (index+1)).style.display = "block"
  353.           } else {
  354.             dateNativeElem.value = null
  355.             timeNativeElem.value = null
  356.             if (capacityActive) {
  357.               document.getElementById("addtable_wrapper_" + (index+1)).style.display = "none"
  358.               for (let checkbox of addLocations) {
  359.                 checkbox.checked = false
  360.               }
  361.             }
  362.           }
  363.           controlWrapper.style.display = "inline-block"
  364.           if (index < activeDateCount) {
  365.             dateElem.disabled = true
  366.             dateElem.parentNode.style.display = "block"
  367.           } else if (index === activeDateCount) {
  368.             if (dateLimits) dateElem.disabled = false
  369.             if (index > 0 && dateList[index-1].value) {
  370.                     const nextDate = new Date(dateList[index-1].value)
  371.                   nextDate.setDate(nextDate.getDate() + 1)
  372.               jQuery("#date_custom_"+(index+1)).datepicker("option", {
  373.                 minDate: nextDate
  374.               })
  375.                 }
  376.             dateElem.parentNode.style.display = "block"
  377.             if (activeDateCount > 0) controlWrapper.appendChild(dateControlRemove)
  378.             if (activeDateCount < dateList.length-1) {
  379.               controlWrapper.appendChild(dateControlAdd)
  380.               dateControlAdd.disabled = !dateElem.value
  381.             }
  382.           } else {
  383.             dateElem.parentNode.style.display = "none"
  384.             dateElem.value = null
  385.             dateNativeElem.value = null
  386.             timeNativeElem.value = null
  387.           }
  388.         })
  389.  
  390.  
  391.         if (capacityActive === true) {
  392.           const selectedDates = dateList.map(x => x.value).filter(x => !!x)
  393.           for (let date in additionalLocationInfo) {
  394.             if (!selectedDates.includes(date)) delete additionalLocationInfo[date]
  395.           }
  396.           populateAddLocation()
  397.           if (selectedDates.length && JSON.stringify(selectedDates) !== selectedDatesGlobal) {
  398.             fetch(`https://freshservicecounter.ringteam.com/v2/getcapacity?office=${JSON.stringify(officeCapacity)}&dates=${JSON.stringify(selectedDates)}`)
  399.             .then(res => {
  400.               return res.json()
  401.             })
  402.             .then(res => {
  403.             // main capacity
  404.               for (let officeName in res) {
  405.                 if (values.office === officeName) {
  406.                   capacityDisplay.innerHTML = ""
  407.                   const office = document.createElement("div")
  408.                   office.innerHTML = `<b>Office:</b> ${officeName}`
  409.                   const limit = document.createElement("div")
  410.                   limit.innerHTML = `<b>Limit:</b> ${res[officeName].limit} visitors per day`
  411.                   limit.style.borderBottom = "1px dotted grey"
  412.                   capacityDisplay.appendChild(office)
  413.                   capacityDisplay.appendChild(limit)
  414.                   var capacityDataArray = []
  415.                   for (let date in res[officeName].capacity) {
  416.                     capacityDataArray.push({ date: date, capacity: res[officeName].capacity[date] })
  417.                   }
  418.                   capacityDataArray.sort((x,y) => { return x.date > y.date ? 1 : -1 })
  419.                   capacityCheck = true
  420.                   capacityDataArray.forEach(obj => {
  421.                     const dateElem = document.createElement("div")
  422.                     dateElem.innerHTML = `<b>${obj.date}:</b> ${obj.capacity} visitors confirmed`
  423.                     //console.log(obj.capacity, res.limit)
  424.                     if (obj.capacity / res[officeName].limit >= 0.7) dateElem.style.color = "orange"
  425.                     if (obj.capacity >= res[officeName].limit) {
  426.                       dateElem.style.color = "red"
  427.                       capacityCheck = false
  428.                     }
  429.                     capacityDisplay.appendChild(dateElem)
  430.                   })
  431.                       capacityDisplay.hidden = false
  432.                 } else {
  433.                   //additional capacity
  434.                   dateList.forEach(dateElem => {
  435.                     var elem = dateElem.parentNode.getElementsByClassName("capacity_" + officeName)[0]
  436.                     elem.innerHTML = `${res[officeName].capacity[dateElem.value]}/${res[officeName].limit} confirmed`
  437.                   })
  438.                 }
  439.               }
  440.             })
  441.           } else {
  442.             capacityDisplay.hidden = true
  443.             capacityCheck = capacityDisplay.hidden
  444.           }
  445.             selectedDatesGlobal = JSON.stringify(selectedDates)
  446.         }
  447.  
  448.         if (meidoActive && values.access_week === "Next week") {
  449.           meidoCart.calcDateCollection()
  450.         } else {
  451.               fsNative.meido.innerHTML = null
  452.         }
  453.  
  454.         values.additional_offices = []
  455.         additionalOfficesList.forEach((elem, index) => {
  456.           values.additional_offices.push(elem.value)
  457.           if ((index === 0 && values.office !== "...") || (index > 0 && values.additional_offices[index-1] !== "...")) {
  458.             elem.parentNode.style.display = "block"
  459.           } else {
  460.             elem.parentNode.style.display = "none"
  461.             elem.value = "..."
  462.           }
  463.           fsNative.additional_locations[index].value = elem.value === "..." ? null : elem.value
  464.         })
  465.  
  466.         values.document_check = documentCheckbox.checked
  467.         fsNative.document_check.value = documentCheckbox.checked ? "1" : "0"
  468.         fsNative.document_check.checked = documentCheckbox.checked
  469.         const documentLocations = [values.office, values.additional_offices].flat().map(x => officeAddress[x]).filter(x => !!x).join(", ")
  470.         document.getElementById("doc-address").innerHTML = documentLocations
  471.         // =================================================
  472.         var text = `Заява на допуск до користування Простором Товариства з обмеженою відповідальністю «ТекХостинг» (далі – ТОВ «ТекХостинг»)
  473.  
  474. Я, фізична особа-підприємець ${"{{ current_user.phone }}"}, прошу допустити мене до користування офісним простором ТОВ «ТекХостинг» (далі – Простір), що знаходиться за адресою: ${documentLocations}.
  475.  
  476.  
  477. Я підтверджую, що на момент надання мені доступу до користування Простором:
  478.  
  479. • у мене відсутні будь-які ознаки ГРВІ, а саме: підвищена температура тіла (більше 37,2 С), кашель, утруднене дихання тощо;
  480. • я ознайомлений(а) з рекомендаціями МОЗ та ВООЗ щодо попередження зараження COVID-19 та їх дотримуюсь;
  481. • протягом останніх 14 днів я не перебував(ла) за межами України та не контактував(ла) з особами, щодо яких наявна підозра/хворими на COVID-19.
  482.  
  483. Я зобов’язуюсь під час користування Простором дотримуватися посилених санітарно-гігієнічних норм, а також рекомендацій МОЗ та ВООЗ щодо запобігання поширенню COVID-19, а саме:
  484.  
  485. • носити медичну маску/респіратор;
  486. • ретельно мити руки з милом протягом 20-40 сек. та регулярно обробляти їх антисептичним засобом під час перебування в Просторі;
  487. • дотримуватися дистанції min 1,5 (півтора) метри від інших відвідувачів Простору.
  488.  
  489. Дата: ${todayGlobal}`
  490.         // =================================================
  491.         fsNative.document_text.value = text
  492.       }
  493.  
  494.       function buildAddLocationTable(excluded){
  495.         const table = document.createElement('table')
  496.         table.style.margin = "10px"
  497.         const row = document.createElement('tr')
  498.         row.style.width = "800px"
  499.         row.style.display = "block"
  500.         table.appendChild(row)
  501.         var cellCount = 0
  502.         for (let office in officeList) {
  503.           if (office !== "..." && office !== excluded) {
  504.             var currentRow
  505.             if (cellCount <= 2) {
  506.               currentRow = table.childNodes[table.childNodes.length - 1]
  507.               ++cellCount
  508.             } else {
  509.               currentRow = document.createElement('tr')
  510.               table.appendChild(currentRow)
  511.               cellCount = 1
  512.             }
  513.             const cell = document.createElement('td')
  514.             cell.style.display = "inline-flex"
  515.             const label = document.createElement('label')
  516.             label.htmlFor = office
  517.             label.className += "add-office-label"
  518.             label.innerHTML = office
  519.             const checkbox = document.createElement('input')
  520.             checkbox.type = "checkbox"
  521.             checkbox.id = office
  522.             checkbox.className += "add-office-checkbox"
  523.               //checkbox.style.display = "inline-block"
  524.             checkbox.style.marginRight = "5px"
  525.             const capacity = document.createElement('span')
  526.             capacity.className += "capacity_" + office
  527.               //capacity.style.display = "inline-block"
  528.             capacity.style.marginLeft = "10px"
  529.  
  530.             cell.appendChild(checkbox)
  531.             cell.appendChild(label)
  532.             cell.appendChild(capacity)
  533.             cell.style.width = "33%"
  534.             currentRow.appendChild(cell)
  535.           }
  536.         }
  537.         return table
  538.       }
  539.  
  540.       function handleAddLocation(elem){
  541.         const dateId = elem.id[elem.id.length - 1]
  542.         const locationName = elem.id.substring(0, elem.id.length - 2)
  543.         const dateElem = document.getElementById("date_custom_" + dateId)
  544.         if (elem.checked) {
  545.           if (!additionalLocationInfo[dateElem.value]) additionalLocationInfo[dateElem.value] = []
  546.           additionalLocationInfo[dateElem.value].push(locationName)
  547.         } else {
  548.           const removed = additionalLocationInfo[dateElem.value].splice(additionalLocationInfo[dateElem.value].indexOf(locationName), 1)
  549.           if (!additionalLocationInfo[dateElem.value].length) delete additionalLocationInfo[dateElem.value]
  550.         }
  551.         populateAddLocation()
  552.       }
  553.  
  554.       function populateAddLocation(){
  555.         fsNative.addloc.innerHTML = JSON.stringify(additionalLocationInfo)
  556.         var text = []
  557.         for (let date in additionalLocationInfo) {
  558.           text.push(`${date}: ${additionalLocationInfo[date].join(", ")}`)
  559.         }
  560.         fsNative.addloc_text.innerHTML = text.join("; \n")
  561.       }
  562.     }
  563.  
  564.     if (window.location.pathname === "/support/catalog/items/136") {
  565.       const durationList = {
  566.         "...": false,
  567.         "Full day": true,
  568.         "Half day": true,
  569.         "Short visit (up to 2 hours)": false
  570.       }
  571.       const officeList = {
  572.         "...": false,
  573.         "Toronto": true,
  574.         "Lviv": true,
  575.         "Lab64": true,
  576.         "Lab72": true,
  577.         "Lab72 / 1": false,
  578.         "Rancho 1": false,
  579.         "Rancho 2": false,
  580.         "QA Studio": false,
  581.         "New QA Studio": false,
  582.         "Community": false,
  583.         "Lab62": true
  584.       }
  585.       const officeMeido = {
  586.         "...": false,
  587.         "Toronto": true,
  588.         "Lviv": false,
  589.         "Lab64": true,
  590.         "Lab72": true,
  591.         "Lab72 / 1": false,
  592.         "Rancho 1": false,
  593.         "Rancho 2": false,
  594.         "QA Studio": false,
  595.         "New QA Studio": false,
  596.         "Community": false,
  597.         "Lab62": true
  598.       }
  599.       const officeCapacity = ["Toronto"]
  600.       const officeAddress = {
  601.         "...": "",
  602.         "Toronto": "м. Київ, вул. Велика Васильківська 100, 8 поверх",
  603.         "Lviv": "м. Львів, вул. Поповича, 9",
  604.         "Lab64": "м. Київ, вул. Велика Васильківська 64",
  605.         "Lab72": "м. Київ, вул. Велика Васильківська 72",
  606.         "Lab72 / 1": "м. Київ, вул. Велика Васильківська 72",
  607.         "Rancho 1": "м. Київ, пров. Малокитаївський, 12",
  608.         "Rancho 2": "м. Київ, вул. Травнева 28",
  609.         "QA Studio": "м. Київ, вул. Північно-Сирецька 1-3",
  610.         "New QA Studio": "м. Київ, просп. Перемоги 53",
  611.         "Community": "м. Київ, вул. Євгена Коновальця 44, 2 поверх",
  612.         "Lab62": "м. Київ, вул. Велика Васильківська 62"
  613.       }
  614.       const accessWeek = {
  615.         "...": false,
  616.         "Current week": true,
  617.         "Next week": true
  618.       }
  619.       const mealTypes = [
  620.         "Non-vegan",
  621.         "Vegan"
  622.       ]
  623.         var fsFields = {
  624.       duration: "requested_item_values_136_requested_item_value_attributes_cf_visit_duration_270753",
  625.       support_with_lunch: "requested_item_values_136_requested_item_value_attributes_cf_support_with_lunch_270753",
  626.       access_week: "requested_item_values_136_requested_item_value_attributes_cf_access_type_270753",
  627.       lunch_type: "requested_item_values_136_requested_item_value_attributes_cf_select_your_meal_preference_270753",
  628.       office: "requested_item_values_136_requested_item_value_attributes_cf_office_270753",
  629.       dates: [
  630.         "requested_item_values_136_requested_item_value_attributes_cf_day1_270753_date",
  631.         "requested_item_values_136_requested_item_value_attributes_cf_day2_270753_date",
  632.         "requested_item_values_136_requested_item_value_attributes_cf_day3_270753_date",
  633.         "requested_item_values_136_requested_item_value_attributes_cf_day4_270753_date",
  634.         "requested_item_values_136_requested_item_value_attributes_cf_day5_270753_date",
  635.         "requested_item_values_136_requested_item_value_attributes_cf_day6_270753_date",
  636.         "requested_item_values_136_requested_item_value_attributes_cf_day7_270753_date"            //ДОБАВИТЬ ДОПОЛНИТЕЛЬНІЕ ДНИ - скопировать айдишники каждого поля_ РЕАЛЬНІЙ РЕКВЕСТ//
  637.       ],
  638.       additional_locations: [
  639.         "requested_item_values_136_requested_item_value_attributes_cf_do_you_plan_to_visit_any_additional_location_during_the_requested_period_nbsp_270753",
  640.         "requested_item_values_136_requested_item_value_attributes_cf_additional_location_2_270753"
  641.       ],
  642.       meido: "requested_item_values_136_requested_item_value_attributes_cf_meido_body_270753",
  643.       document_text: "requested_item_values_136_requested_item_value_attributes_cf__270753",
  644.       document_check: "requested_item_values_136_requested_item_value_attributes_cf_v_270753",
  645.     }
  646.  
  647.       // -------------------------
  648.         var meidoActive
  649.         if (window.location.pathname === "/support/catalog/items/136") {
  650.           meidoActive = false
  651.         } else if (window.location.pathname === "/support/catalog/items/149") {
  652.           meidoActive = true
  653.         }
  654.         meidoToken = "test"
  655.       // -------------------------
  656.  
  657.       // -------------------------
  658.         var capacityActive = true
  659.       // -------------------------
  660.  
  661.           // ====================================================================
  662.           // ====================================================================
  663.           // ====================================================================
  664.  
  665.       const fsNative = {
  666.         duration: document.getElementById(fsFields.duration),
  667.         support_with_lunch: document.getElementById(fsFields.support_with_lunch).parentNode.childNodes.item(0),
  668.         access_week: document.getElementById(fsFields.access_week),
  669.         lunch_type: document.getElementById(fsFields.lunch_type),
  670.         office: document.getElementById(fsFields.office),
  671.         meido: document.getElementById(fsFields.meido),
  672.         dates: getElemList(fsFields.dates),
  673.         additional_locations: getElemList(fsFields.additional_locations),
  674.         document_text: document.getElementById(fsFields.document_text),
  675.         document_check: document.getElementById(fsFields.document_check).parentNode.childNodes.item(0)
  676.       }
  677.  
  678.       var activeDateCount = 0
  679.       const today = new Date()
  680.       const todayGlobal = today.toLocaleDateString()
  681.       const weekdayGlobal = today.getDay()
  682.       const currentHoursGlobal = today.getHours()
  683.       const currentMinutesGlobal = today.getMinutes()
  684.       var selectedDatesGlobal = []
  685.       var capacityCheck = true
  686.  
  687.       const durationSelector = replaceInputWithDropdown(fsFields.duration, durationList, "duration")
  688.             durationSelector.parentNode.hidden = true
  689.       const officeSelector = replaceInputWithDropdown(fsFields.office, officeList, "office")
  690.       const accessWeekSelector = replaceInputWithDropdown(fsFields.access_week, accessWeek, "access-week")
  691.       const lunchTypeSelector = createSimplifiedDropdown(fsFields.lunch_type, mealTypes, "lunch_type")
  692.       const lunchCheckboxLabel = document.createTextNode("Please support me with lunch")                          // to add text Lunch will be provided in case your visit durayion is more than 2 hours//
  693.       const lunchCheckbox = createCustomCheckbox(document.getElementById(fsFields.support_with_lunch).parentNode, "show-lunch", lunchCheckboxLabel)
  694.       const dateList = createCustomDates(fsNative.dates)
  695.       const additionalOfficesList = createAdditionalOfficeSelectors(fsFields.additional_locations, officeList)
  696.       const capacityDisplay = createCapacityDisplay(fsNative.dates[0].parentNode.parentNode)
  697.  
  698.           //add hotDeskCheckbox
  699.       const hotdeskCheckboxLabel = document.createTextNode("I don`t have a permanent seat and would like to book a hot desk.");
  700.       const hotdeskCheckboxContainer = document.createElement('div');
  701.       document.getElementById(fsFields.office).parentNode.appendChild(hotdeskCheckboxContainer);
  702.       const hotdeskCheckbox = createCustomCheckbox(hotdeskCheckboxContainer, "show-hotdesk", hotdeskCheckboxLabel);
  703.       hotdeskCheckbox.checked = false;
  704.       const hotdeskText = document.createElement("p");
  705.       hotdeskText.innerHTML = "Please, follow the <a href='https://ringukraine.officespacesoftware.com/visual-directory/floors/139' style='color:blue;cursor:pointer;' target='_blank'>link</a> for hot desks booking system (applicable only for Full/half-day visit). Here`re <a href='https://docs.google.com/document/d/1llpCz3RbK0cBew7kSJhZPQwD5Om8Kgj0tTq-1kgONx4/edit' style='color:blue;cursor:pointer;' target='_blank'>instructions</a> on how to make a booking.";
  706.       hotdeskCheckboxContainer.appendChild(hotdeskText);
  707.  
  708.       const documentCheckboxLabel = document.createElement("span")
  709.       documentCheckboxLabel.innerHTML = "Я, {{ current_user.phone }}, ознайомився з документом та підтверджую що мій стан відповідає нормам відвідування офісу згідно з заявою.<br>*[✓] <i>означає, що дана відмітка прирівнюється до власноручного/факсимільного відтворення підпису особи.</i>"
  710.       const documentCheckbox = createCustomCheckbox(fsNative.document_check.parentNode, "document-check", documentCheckboxLabel)
  711.       const documentText = createDocumentSection(fsNative.document_text, todayGlobal)
  712.  
  713.       const dateControlAdd = document.createElement("button")
  714.       dateControlAdd.innerHTML = "+"
  715.       const dateControlRemove = document.createElement("button")
  716.       dateControlRemove.innerHTML = "-"
  717.  
  718.       lunchCheckbox.parentNode.hidden = true;
  719.       lunchTypeSelector.parentNode.hidden = true;
  720.       hotdeskCheckboxContainer.hidden = true;
  721.       hotdeskText.hidden = true;
  722.  
  723.       //durationSelector.addEventListener("change", function(){ renderController() })
  724.       officeSelector.addEventListener("change", function(){ renderController() })
  725.       accessWeekSelector.addEventListener("change", function(){ renderController() })
  726.       lunchCheckbox.addEventListener("change", function(){ renderController() })
  727.       hotdeskCheckbox.addEventListener("change", function(){ renderController() })
  728.       lunchTypeSelector.addEventListener("change", function(){ renderController() })
  729.  
  730.       dateList.forEach(dateElem => {
  731.         jQuery(dateElem).datepicker("option", {
  732.           onSelect: function() {
  733.             renderController()
  734.           }
  735.         })
  736.       })
  737.  
  738.       dateControlAdd.addEventListener("click", function(e){
  739.         e.preventDefault()
  740.         activeDateCount += 1
  741.         renderController()
  742.       })
  743.       dateControlRemove.addEventListener("click", function(e){
  744.         e.preventDefault()
  745.         activeDateCount -= 1
  746.         renderController()
  747.       })
  748.       additionalOfficesList.forEach(elem => {
  749.         elem.addEventListener("change", function(){ renderController() })
  750.       })
  751.  
  752.  
  753.       documentCheckbox.addEventListener("change", function(){ renderController() })
  754.  
  755.       var meidoMenu
  756.            document.getElementById(fsFields.meido).parentNode.style.display = "none"
  757.       if (meidoActive) {
  758.  
  759.         const elems = document.getElementsByClassName("main pull-left")
  760.         meidoMenu = await meidoInit(elems[0], dateList, fsFields.meido, 125, false)  // change 125 to required limit
  761.         console.log(meidoMenu)
  762.         meidoMenu.hidden = true
  763.         console.log("calling renderController")
  764.         renderController()
  765.       } else {
  766.         renderController()
  767.       }
  768.  
  769.       jQuery("input[type=\"submit\"]").each((index, elem) => {
  770.         elem.onclick = function(e){
  771.           if (!capacityCheck) {
  772.             e.stopImmediatePropagation()
  773.             e.preventDefault()
  774.               alert("Please check the capactiy for selected dates")                     //поменять нотифай если нужно!//
  775.           }
  776.         }
  777.       })
  778.  
  779.       function renderController(){
  780.         var values = {
  781.           //duration: durationSelector.value,
  782.           duration: "Full day",
  783.           office: officeSelector.value,
  784.           access_week: accessWeekSelector.value
  785.         }
  786.  
  787.         fsNative.duration.value = values.duration === "..." ? "" : values.duration
  788.         fsNative.office.value = values.office === "..." ? "" : values.office
  789.            if (fsNative.office.value === 'Toronto') {
  790.             hotdeskCheckboxContainer.hidden = false;
  791.           } else {
  792.             hotdeskCheckbox.checked = false;
  793.             hotdeskCheckboxContainer.hidden = true;
  794.           }
  795.         if (!hotdeskCheckbox.checked) {
  796.                 hotdeskText.hidden = true;
  797.             } else {
  798.                 hotdeskText.hidden = false;
  799.             }
  800.  
  801.         const accessWeekChanged = fsNative.access_week.value === values.access_week ? false : true
  802.         fsNative.access_week.value = values.access_week === "..." ? "" : values.access_week
  803.         var datesInRequest = dateList.map(x => x.value).filter(x => !!x)
  804.         if (activeDateCount === 0) datesInRequest = datesInRequest[0] ? [datesInRequest[0]] : []
  805.         const today = new Date().toISOString().split("T")[0]
  806.         if (durationList[values.duration] && officeList[values.office] && accessWeek[values.access_week] && datesInRequest.length && !(datesInRequest.length === 1 && datesInRequest[0] === today) && !accessWeekChanged) {
  807.           lunchCheckbox.parentNode.hidden = false
  808.         } else {
  809.           lunchCheckbox.parentNode.hidden = true
  810.           lunchCheckbox.checked = false
  811.         }
  812.  
  813.         values.support_with_lunch = lunchCheckbox.checked
  814.         fsNative.support_with_lunch.value = lunchCheckbox.checked ? "1" : "0"
  815.         if (values.support_with_lunch) {
  816.           if (meidoActive) {
  817.             if (weekdayGlobal === 6 || weekdayGlobal === 0 || (weekdayGlobal === 5 && currentHoursGlobal >= 19 && currentMinutesGlobal >= 30) || values.access_week === "Current week" || !officeMeido[values.office]) {
  818.               lunchTypeSelector.parentNode.hidden = false
  819.               lunchTypeSelector.value = lunchTypeSelector.value ? lunchTypeSelector.value : mealTypes[0]
  820.               meidoMenu.hidden = true
  821.             } else {
  822.               lunchTypeSelector.parentNode.hidden = true
  823.               lunchTypeSelector.value = null
  824.               meidoMenu.hidden = false
  825.             }
  826.           } else {
  827.             lunchTypeSelector.parentNode.hidden = false
  828.             lunchTypeSelector.value = lunchTypeSelector.value ? lunchTypeSelector.value : mealTypes[0]
  829.           }
  830.         } else {
  831.           lunchTypeSelector.parentNode.hidden = true
  832.           lunchTypeSelector.value = null
  833.           if (meidoActive) meidoMenu.hidden = true
  834.         }
  835.  
  836.         values.lunch_type = lunchTypeSelector.value
  837.         fsNative.lunch_type.value = values.lunch_type ? values.lunch_type : ""
  838.  
  839.         const dateLimits = (values.access_week === "...") ? null : calcDateLimits(values.access_week === "Current week" ? true : false)
  840.         const dateLimitsRaw = dateLimits ? dateLimits.map(x => new Date(x).valueOf()) : null
  841.         var existingDates = []
  842.         var lastUsedFound = false;
  843.         if (accessWeekChanged) activeDateCount = 0
  844.         dateList.forEach((dateElem, index) => {
  845.           const dateNativeElem = fsNative.dates[index]
  846.           const timeNativeElem = document.getElementById(fsFields.dates[index].substring(0, fsFields.dates[index].length - 4) + "time")
  847.           const errorElem = document.getElementById("date_custom_" + (index+1) + "-error")
  848.           if (errorElem) errorElem.style.display = "none"
  849.           if (accessWeekChanged && index === 0) dateElem.value = null
  850.           const dateRawValue = new Date(dateElem.value).valueOf()
  851.           if (existingDates.includes(dateRawValue)) dateElem.value = null
  852.           if (dateLimits) {
  853.             jQuery("#date_custom_"+(index+1)).datepicker("option", {
  854.               minDate: new Date(dateLimits[0]),
  855.               maxDate: new Date(dateLimits[1])
  856.             })
  857.             dateElem.disabled = false
  858.             if (dateRawValue < dateLimitsRaw[0] || dateRawValue > dateLimitsRaw[1]) dateElem.value = null
  859.           } else {
  860.             dateElem.disabled = true
  861.           }
  862.           existingDates.push(dateRawValue)
  863.           const controlWrapper = document.getElementById("controls_" + index)
  864.           controlWrapper.innerHTML = ""
  865.           if (dateElem.value) {
  866.             dateNativeElem.value = reverseForFS(dateElem.value)
  867.             timeNativeElem.value = "00:00"
  868.           } else {
  869.             dateNativeElem.value = null
  870.             timeNativeElem.value = null
  871.           }
  872.           controlWrapper.style.display = "inline"
  873.           if (index < activeDateCount) {
  874.             dateElem.disabled = true
  875.             dateElem.parentNode.style.display = "block"
  876.           } else if (index === activeDateCount) {
  877.             if (dateLimits) dateElem.disabled = false
  878.             if (index > 0 && dateList[index-1].value) {
  879.               const nextDate = new Date(dateList[index-1].value)
  880.               nextDate.setDate(nextDate.getDate() + 1)
  881.               jQuery("#date_custom_"+(index+1)).datepicker("option", {
  882.                 minDate: nextDate
  883.               })
  884.             }
  885.             dateElem.parentNode.style.display = "block"
  886.             if (activeDateCount > 0) controlWrapper.appendChild(dateControlRemove)
  887.             if (activeDateCount < dateList.length-1) {
  888.               controlWrapper.appendChild(dateControlAdd)
  889.               dateControlAdd.disabled = !dateElem.value
  890.             }
  891.           } else {
  892.             dateElem.parentNode.style.display = "none"
  893.             dateElem.value = null
  894.             dateNativeElem.value = null
  895.             timeNativeElem.value = null
  896.           }
  897.         })
  898.  
  899.  
  900.           if (capacityActive === true) {
  901.         const selectedDates = dateList.map(x => x.value).filter(x => !!x)
  902.         if (officeCapacity.includes(values.office) && selectedDates.length && JSON.stringify(selectedDates) !== selectedDatesGlobal) {
  903.           fetch(`https://freshservicecounter.ringteam.com/getcapacity?office=${values.office}&dates=${JSON.stringify(selectedDates)}`)
  904.           .then(res => {
  905.             return res.json()
  906.           })
  907.           .then(res => {
  908.             console.log(res)
  909.             capacityDisplay.innerHTML = ""
  910.             const office = document.createElement("div")
  911.             office.innerHTML = `<b>Office:</b> ${res.office}`
  912.             const limit = document.createElement("div")
  913.             limit.innerHTML = `<b>Limit:</b> ${res.limit} visitors per day`
  914.             limit.style.borderBottom = "1px dotted grey"
  915.             capacityDisplay.appendChild(office)
  916.             capacityDisplay.appendChild(limit)
  917.             var capacityDataArray = []
  918.             for (let date in res.capacity) {
  919.               capacityDataArray.push({ date: date, capacity: res.capacity[date] })
  920.             }
  921.             capacityDataArray.sort((x,y) => { return x.date > y.date ? 1 : -1 })
  922.             console.log(capacityDataArray)
  923.             capacityDataArray.forEach(obj => {
  924.               const dateElem = document.createElement("div")
  925.               dateElem.innerHTML = `<b>${obj.date}:</b> ${obj.capacity} visitors confirmed`
  926.               if (obj.capacity / res.limit >= 0.7) dateElem.style.color = "orange"
  927.                 if (obj.capacity >= res.limit){
  928.                 dateElem.style.color = "red"
  929.                 capacityCheck = false
  930.               }
  931.               capacityDisplay.appendChild(dateElem)
  932.             })
  933.             capacityDisplay.hidden = false
  934.           })
  935.         } else {
  936.           //capacityDisplay.innerHTML = ""
  937.           if (!officeCapacity.includes(values.office)) capacityDisplay.hidden = true
  938.         }
  939.         selectedDatesGlobal = JSON.stringify(selectedDates)
  940.         }
  941.         if (meidoActive && values.access_week === "Next week") {
  942.           meidoCart.calcDateCollection()
  943.         } else {
  944.           fsNative.meido.innerHTML = null
  945.         }
  946.  
  947.         values.additional_offices = []
  948.         additionalOfficesList.forEach((elem, index) => {
  949.           values.additional_offices.push(elem.value)
  950.           if ((index === 0 && values.office !== "...") || (index > 0 && values.additional_offices[index-1] !== "...")) {
  951.             elem.parentNode.style.display = "block"
  952.           } else {
  953.             elem.parentNode.style.display = "none"
  954.             elem.value = "..."
  955.           }
  956.           fsNative.additional_locations[index].value = elem.value === "..." ? null : elem.value
  957.         })
  958.  
  959.         values.document_check = documentCheckbox.checked
  960.         fsNative.document_check.value = documentCheckbox.checked ? "1" : "0"
  961.         fsNative.document_check.checked = documentCheckbox.checked
  962.         const documentLocations = [values.office, values.additional_offices].flat().map(x => officeAddress[x]).filter(x => !!x).join(", ")
  963.         document.getElementById("doc-address").innerHTML = documentLocations
  964.         // =================================================
  965.         var text = `Заява на допуск до користування Простором Товариства з обмеженою відповідальністю «ТекХостинг» (далі – ТОВ «ТекХостинг»)
  966.  
  967. Я, фізична особа-підприємець ${"{{ current_user.phone }}"}, прошу допустити мене до користування офісним простором ТОВ «ТекХостинг» (далі – Простір), що знаходиться за адресою: ${documentLocations}.
  968.  
  969.  
  970. Я підтверджую, що на момент надання мені доступу до користування Простором:
  971.  
  972. • у мене відсутні будь-які ознаки ГРВІ, а саме: підвищена температура тіла (більше 37,2 С), кашель, утруднене дихання тощо;
  973. • я ознайомлений(а) з рекомендаціями МОЗ та ВООЗ щодо попередження зараження COVID-19 та їх дотримуюсь;
  974. • протягом останніх 14 днів я не перебував(ла) за межами України та не контактував(ла) з особами, щодо яких наявна підозра/хворими на COVID-19.
  975.  
  976. Я зобов’язуюсь під час користування Простором дотримуватися посилених санітарно-гігієнічних норм, а також рекомендацій МОЗ та ВООЗ щодо запобігання поширенню COVID-19, а саме:
  977.  
  978. • носити медичну маску/респіратор;
  979. • ретельно мити руки з милом протягом 20-40 сек. та регулярно обробляти їх антисептичним засобом під час перебування в Просторі;
  980. • дотримуватися дистанції min 1,5 (півтора) метри від інших відвідувачів Простору.
  981.  
  982. Дата: ${todayGlobal}`
  983.         // =================================================
  984.         fsNative.document_text.value = text
  985.       }
  986.     }
  987. })
  988. </script>
  989.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement