Skip to content

Instantly share code, notes, and snippets.

@Ayyagaries
Created November 1, 2019 21:28
Show Gist options
  • Save Ayyagaries/0c3c7f94f2bb81498f3c6e2034778e76 to your computer and use it in GitHub Desktop.
Save Ayyagaries/0c3c7f94f2bb81498f3c6e2034778e76 to your computer and use it in GitHub Desktop.
checkout.js
function afterCheckOut(didUserCheckinFromMobile) {
var badge_flash_status = false;
console.log("-----I am here in after checkout the vist ID is still ------ " + Alloy.Globals.visitId);
//$.btn_checkin.setTitle('Check In');
if (OS_IOS) {
api.get({
url: 'check_badge_status',
data: {
token: rep_token,
visit_id: Alloy.Globals.visitId
},
success: function(_response) {
Alloy.Globals.visitId = 0;
checkedInFacilityId = 0;
App.closeLoading();
badge_flash_status = _response.badge_flash_status;
if ((badge_flash_status) && (didUserCheckinFromMobile)) {
var check_out_data = {
"didRepCheckout": true
};
var payLoad = JSON.stringify(check_out_data);
if (Ti.Platform.canOpenURL("securebadge://")) {
(Ti.Platform.openURL("securebadge://index?checkout=" + payLoad));
App.closeScreen();
Ti.App.fireEvent('Facilities.afterCheckOutTransmit');
} else {
var dialog = Ti.UI.createAlertDialog({
buttonNames: ['OK'],
message: "Please install Sec3ure Go! app from app store",
title: "Sec3ure Go"
});
dialog.show();
}
} else {
App.closeScreen();
Ti.App.fireEvent('Facilities.afterCheckOutTransmit');
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment