Allows the application's web app to be installed from the snippet page.
Requires that SoftadminSnippet.WebApp_Install_Button has been called.
SELECT
@InstructionIdJson = '[' + STRING_AGG('"' + I.Id + '"', ',') + ']'
FROM
(VALUES
(@InstallButtonContainerId),
(@AndroidInstructionsId),
(@IosInstructionsId),
(@GeneralInstructionsId)
) I(Id);
SELECT
'function showInstructions(deviceType, showInstallButton) {
if (showInstallButton) {
showSingleInstruction("' + @InstallButtonContainerId + '");
return;
}
if (deviceType === "ios") {
showSingleInstruction("' + @IosInstructionsId + '");
} else if (deviceType === "android") {
showSingleInstruction("' + @AndroidInstructionsId + '");
} else {
showSingleInstruction("' + @GeneralInstructionsId + '");
}
}
function showSingleInstruction(htmlId){
for (let currentId of ' + @InstructionIdJson + '){
if (currentId === htmlId){
document.getElementById(currentId).style.display = "block";
} else {
document.getElementById(currentId).style.display = "none";
}
}
}' AS JavaScript;
EXEC SoftadminSnippet.WebApp_Install_Init
@ApplicationUrl = 'https://path.com/Softadmin',
@LanguageId = 1,
@InstructionsCallbackJavaScriptFunctionName = 'showInstructions';