Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery("input[type=\"submit\"]").each((index, elem) => {
- elem.onclick = async function(e){
- if (checkBrowser()) {
- if (!capacityCheckMain || !capacityCheckAdditional || !parkingCheck) {
- e.stopImmediatePropagation()
- e.preventDefault()
- renderController(true)
- alert("Please check the capactiy for selected dates") //поменять нотифай если нужно!//
- }
- } else {
- const mainOffice = fsNative.office.value
- const addLocInfo = JSON.parse(fsNative.addloc.innerHTML)
- console.log(mainOffice, addLocInfo)
- const data = await fetch(`https://freshservicecounter.ringteam.com/v2/getcapacity?office=${JSON.stringify(officeCapacity)}&dates=${selectedDatesGlobal}${parkingActive ? "&getparking=true" : ""}`)
- //const data = await fetch(`http://localhost:5000/v2/getcapacity?office=${JSON.stringify(officeCapacity)}&dates=${selectedDatesGlobal}${parkingActive ? "&getparking=true" : ""}`)
- const json = await data.json()
- console.log('GOT DATA ON CHECK')
- console.log(json)
- var immediateCapacityCheck = true
- for (let office in json) {
- for (let date in json[office].capacity) {
- if (json[office].capacity[date] >= json[office].limit && (office === mainOffice || (addLocInfo[date] && addLocInfo[date].includes(office)))) immediateCapacityCheck = false
- }
- }
- console.log(capacityCheckMain, capacityCheckAdditional, parkingCheck, immediateCapacityCheck)
- if (!capacityCheckMain || !capacityCheckAdditional || !parkingCheck || !immediateCapacityCheck) {
- e.stopImmediatePropagation()
- e.preventDefault()
- renderController(true)
- alert("Please check the capactiy for selected dates") //поменять нотифай если нужно!//
- }
- }
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement