Advertisement
VladislavNechepaev

Untitled

Feb 25th, 2021
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery("input[type=\"submit\"]").each((index, elem) => {
  2.         elem.onclick = async function(e){
  3.           const mainOffice = fsNative.office.value
  4.           const addLocInfo = JSON.parse(fsNative.addloc.innerHTML)
  5.           console.log(mainOffice, addLocInfo)
  6.           const data = await fetch(`https://freshservicecounter.ringteam.com/v2/getcapacity?office=${JSON.stringify(officeCapacity)}&dates=${selectedDatesGlobal}${parkingActive ? "&getparking=true" : ""}`)
  7.           const json = await data.json()
  8.           var immediateCapacityCheck = true
  9.           for (let office in json) {
  10.             for (let date in json[office].capacity) {
  11.               if (json[office].capacity[date] >= json[office].limit && (office === mainOffice || (addLocInfo[date] && addLocInfo[date].includes(office)))) immediateCapacityCheck = false
  12.             }
  13.           }
  14.           console.log(capacityCheckMain, capacityCheckAdditional, parkingCheck, immediateCapacityCheck)
  15.           if (!capacityCheckMain || !capacityCheckAdditional || !parkingCheck || !immediateCapacityCheck) {
  16.             e.stopImmediatePropagation()
  17.             e.preventDefault()
  18.             renderController(true)
  19.             alert("Please check the capactiy for selected dates")                     //поменять нотифай если нужно!//
  20.           }
  21.         }
  22.       })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement