|
|
|
@ -13,59 +13,59 @@ function callback(response) {
|
|
|
|
|
return_first = response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getSCurveData(){ |
|
|
|
|
|
|
|
|
|
// Send a message to the parent window requesting the URL
|
|
|
|
|
window.parent.postMessage({ action: 'getUrl' }, '*'); |
|
|
|
|
|
|
|
|
|
// Listen for messages from the parent window
|
|
|
|
|
window.addEventListener('message', function(event) { |
|
|
|
|
if (event.data && event.data.action === 'sendUrl') { |
|
|
|
|
const parentUrl = event.data.url; |
|
|
|
|
function messageListener(event) { |
|
|
|
|
if (event.data && event.data.action === 'sendUrl') { |
|
|
|
|
const parentUrl = event.data.url; |
|
|
|
|
|
|
|
|
|
// Remove the base URL and hash
|
|
|
|
|
const path = parentUrl.replace("https://adw.ospro.id/#/dashboard-project/", ""); |
|
|
|
|
|
|
|
|
|
// Split the remaining path by "/"
|
|
|
|
|
parts = path.split("/"); |
|
|
|
|
if (parts[2] && parts[2] == "1") { |
|
|
|
|
$.ajax({ |
|
|
|
|
headers: { |
|
|
|
|
"Content-Type": "application/json", |
|
|
|
|
"Authorization": `Bearer ${token}` |
|
|
|
|
}, |
|
|
|
|
url: `${base_url}project/calculate-s-curve`, |
|
|
|
|
type: "POST", |
|
|
|
|
data:JSON.stringify(sCurvePayload), |
|
|
|
|
success: function (data) { |
|
|
|
|
callback(data) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
$.ajax({ |
|
|
|
|
headers: { |
|
|
|
|
"Content-Type": "application/json", |
|
|
|
|
"Authorization": `Bearer ${token}` |
|
|
|
|
}, |
|
|
|
|
url: `${base_url}project/s-curve-command`, |
|
|
|
|
type: "POST", |
|
|
|
|
data:JSON.stringify(sCurvePayload), |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
$.ajax({ |
|
|
|
|
headers: { |
|
|
|
|
"Content-Type": "application/json", |
|
|
|
|
"Authorization": `Bearer ${token}` |
|
|
|
|
}, |
|
|
|
|
url: `${base_url}project/get-s-curve`, |
|
|
|
|
type: "POST", |
|
|
|
|
data:JSON.stringify(sCurvePayload), |
|
|
|
|
success: function (data) { |
|
|
|
|
callback(data) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// Split the remaining path by "/"
|
|
|
|
|
parts = path.split("/"); |
|
|
|
|
if (parts[2] && parts[2] == "1") { |
|
|
|
|
$.ajax({ |
|
|
|
|
headers: { |
|
|
|
|
"Content-Type": "application/json", |
|
|
|
|
"Authorization": `Bearer ${token}` |
|
|
|
|
}, |
|
|
|
|
url: `${base_url}project/calculate-s-curve`, |
|
|
|
|
type: "POST", |
|
|
|
|
data: JSON.stringify(sCurvePayload), |
|
|
|
|
success: function (data) { |
|
|
|
|
callback(data) |
|
|
|
|
window.removeEventListener('message', messageListener); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
$.ajax({ |
|
|
|
|
headers: { |
|
|
|
|
"Content-Type": "application/json", |
|
|
|
|
"Authorization": `Bearer ${token}` |
|
|
|
|
}, |
|
|
|
|
url: `${base_url}project/s-curve-command`, |
|
|
|
|
type: "POST", |
|
|
|
|
data: JSON.stringify(sCurvePayload), |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
$.ajax({ |
|
|
|
|
headers: { |
|
|
|
|
"Content-Type": "application/json", |
|
|
|
|
"Authorization": `Bearer ${token}` |
|
|
|
|
}, |
|
|
|
|
url: `${base_url}project/get-s-curve`, |
|
|
|
|
type: "POST", |
|
|
|
|
data: JSON.stringify(sCurvePayload), |
|
|
|
|
success: function (data) { |
|
|
|
|
callback(data) |
|
|
|
|
window.removeEventListener('message', messageListener); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getSCurveData() { |
|
|
|
|
window.parent.postMessage({ action: 'getUrl' }, '*'); |
|
|
|
|
window.addEventListener('message', messageListener); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
function toggleOverlay() { |
|
|
|
|