|
|
@ -13,18 +13,49 @@ function callback(response) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getSCurveData(){ |
|
|
|
function getSCurveData(){ |
|
|
|
$.ajax({ |
|
|
|
|
|
|
|
headers: { |
|
|
|
// Send a message to the parent window requesting the URL
|
|
|
|
"Content-Type": "application/json", |
|
|
|
window.parent.postMessage({ action: 'getUrl' }, '*'); |
|
|
|
"Authorization": `Bearer ${token}` |
|
|
|
|
|
|
|
}, |
|
|
|
// Listen for messages from the parent window
|
|
|
|
url: `${base_url}project/get-s-curve`, |
|
|
|
window.addEventListener('message', function(event) { |
|
|
|
type: "POST", |
|
|
|
if (event.data && event.data.action === 'sendUrl') { |
|
|
|
data:JSON.stringify(sCurvePayload), |
|
|
|
const parentUrl = event.data.url; |
|
|
|
success: function (data) { |
|
|
|
|
|
|
|
callback(data) |
|
|
|
// Remove the base URL and hash
|
|
|
|
} |
|
|
|
const path = parentUrl.replace("http://localhost:3000/#/dashboard-project/", ""); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Split the remaining path by "/"
|
|
|
|
|
|
|
|
const parts = path.split("/"); |
|
|
|
|
|
|
|
if (parts[2] && parts[2] == "1") { |
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
|
|
headers: { |
|
|
|
|
|
|
|
"Content-Type": "application/json", |
|
|
|
|
|
|
|
"Authorization": `Bearer ${token}` |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
url: `${base_url}project/get-linear-s-curve`, |
|
|
|
|
|
|
|
type: "POST", |
|
|
|
|
|
|
|
data:JSON.stringify(sCurvePayload), |
|
|
|
|
|
|
|
success: function (data) { |
|
|
|
|
|
|
|
callback(data) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} 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) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
function toggleOverlay() { |
|
|
|
function toggleOverlay() { |
|
|
@ -189,12 +220,7 @@ var lineOverlay = overlayControl.addOverlay(function(container) { |
|
|
|
ticks: { |
|
|
|
ticks: { |
|
|
|
display: true, |
|
|
|
display: true, |
|
|
|
min: 0, |
|
|
|
min: 0, |
|
|
|
max: 100, |
|
|
|
stepSize: 100, |
|
|
|
stepSize: 10, |
|
|
|
|
|
|
|
callback: function(current) { |
|
|
|
|
|
|
|
if (current > 100) {return "";} |
|
|
|
|
|
|
|
return current + "%"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
] |
|
|
|
] |
|
|
|