Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Instrument List] Refresh on Stage Update #9040

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions modules/instrument_list/templates/instrument_list_controlpanel.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@
{section name=item loop=$status}
<li>
{if $access.status and $status[item].showlink|default}
<span class="fa-li"><i class="{$status[item].icon|default:'far fa-square'}"></i></span><a href="?candID={$candID}&sessionID={$sessionID}&setStageUpdate={$status[item].label}">{$status[item].label}</a>
{assign var="onclickValue" value="{$status[item].label}"}
<span class="fa-li">
<i class="{$status[item].icon|default:'far fa-square'}"></i>
</span>
<a
onclick="setStageAndUpdate('{$onclickValue}')"
style="cursor: pointer;"
>
{$status[item].label}
</a>
{else}
<span class="fa-li"><i class="{$status[item].icon|default:'far fa-square'}"></i></span>{$status[item].label}
<span class="fa-li"><i class="{$status[item].icon|default:'far fa-square'}"></i></span>{$status[item].label}
{/if}
</li>
{/section}

</ul>

<h3 class="controlPanelSection">Send Time Point</h3>
Expand Down Expand Up @@ -90,3 +98,23 @@
{/if}
</li>
</ul>

<script>
function setStageAndUpdate(stageLabel) {
// Make an AJAX request to the endpoint
var xhr = new XMLHttpRequest();
skarya22 marked this conversation as resolved.
Show resolved Hide resolved
xhr.open('GET', '?candID={$candID}&sessionID={$sessionID}&setStageUpdate=' + encodeURIComponent(stageLabel), true);

xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
console.log('Request successful');
skarya22 marked this conversation as resolved.
Show resolved Hide resolved
window.location.reload(true);
} else {
// Request failed, handle errors if needed
console.error('Request failed with status ' + xhr.status);
}
};

xhr.send();
}
</script>
Loading