1 |
- var Bizgaze;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){class i extends Unibase.Platform.Core.BaseComponent{constructor(){super();this._totalamount=0;this._totalcount=0}cssFiles(){return["tenants/themes/compact/css/coupons.css"]}jsFiles(){return["platform/automation/enums/noitfyalerts.js","platform/automation/components/notifier.js"]}html(){return""}load(){}ScanSerialNo(t,i,r){$(".spanpoints").text("Points:");Unibase.Platform.Helpers.FileCacheHelper.Instance().loadCssFile("tenants/themes/compact/css/coupons.css",null);Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/paybacks/managers/schememanager.js",function(){var i=!1;isMobileApp()&&(i=!0);r[0].IsScannedCoupon=i;n.Apps.Paybacks.Managers.SchemeManager.Instance().LoyaltyPoints(t.toUpperCase(),r).then(function(t){let i;if(t.result==null&&($(".scan_couponscancontol").val(""),t.message.includes("Congratulations")?(MessageHelper.Instance().show_MandatoryFieldMessage("<strong>Success !<\/strong>"+t.message,"alert alert-success mb-0",$("#form-container-"+$("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr("id")),setTimeout(function(){$(".bizgaze_FormErrorMessages").empty()},3e3)):(MessageHelper.Instance().showError(t.message,$("#form-container-"+$("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr("id")),setTimeout(function(){$(".bizgaze_FormErrorMessages").empty()},3e3))),t.status==0)isMobileApp()?n.Apps.PayBacks.Components.LoyaltyPoints.Instance().andriodTextToSpeech("Coupon Applied"):(i=Unibase.Platform.Automation.Enums.NotifyAlerts.CouponBeep,Unibase.Platform.Automation.Components.Notifier.Instance().playAudio(i));else if(isMobileApp())t.message.includes("Redeemed")?n.Apps.PayBacks.Components.LoyaltyPoints.Instance().andriodTextToSpeech("Coupon already redeemed"):n.Apps.PayBacks.Components.LoyaltyPoints.Instance().andriodTextToSpeech(t.message);else if(t.message.includes("Invalid/duplicate"))i=Unibase.Platform.Automation.Enums.NotifyAlerts.InvalidDuplicateCoupon,Unibase.Platform.Automation.Components.Notifier.Instance().playAudio(i);else if(t.message.includes("Redeemed"))i=Unibase.Platform.Automation.Enums.NotifyAlerts.CouponAlreadyRedeemed,Unibase.Platform.Automation.Components.Notifier.Instance().playAudio(i);else if(t.message.includes("UnAuthentic"))i=Unibase.Platform.Automation.Enums.NotifyAlerts.UnAuthenticCoupon,Unibase.Platform.Automation.Components.Notifier.Instance().playAudio(i);else{if(t.message.includes("contact")||t.message.includes("Deactivated"))return null;t.message.includes("Congratulations")?(i=Unibase.Platform.Automation.Enums.NotifyAlerts.Congratulations,Unibase.Platform.Automation.Components.Notifier.Instance().playAudio(i)):(i=Unibase.Platform.Automation.Enums.NotifyAlerts.InvalidDuplicateCoupon,Unibase.Platform.Automation.Components.Notifier.Instance().playAudio(i))}return!1})})}getloyaltypoints(t){Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/paybacks/managers/schememanager.js",function(){n.Apps.Paybacks.Managers.SchemeManager.Instance().getloyaltypointsbycontactid(t).then(function(t){t.result!==null&&t.result!=""&&(n.Apps.PayBacks.Components.LoyaltyPoints.Instance()._totalamount=t.result.Points,$(".lblSum").text(n.Apps.PayBacks.Components.LoyaltyPoints.Instance()._totalamount),$("#divsumDisplayText").text("Total Loyalty Points").addClass("mr-10"))})})}bindContact(t){var i=this,r=Unibase.Platform.Membership.Infos.Identity.getCurrentUser().isRestrictedUser,u=Unibase.Platform.Membership.Infos.Identity.getCurrentUser().userId;r&&i.fileCacheHelper.loadJsFile("apps/crm/contacts/managers/contactmanager.js",function(){n.Apps.Crm.Contacts.Managers.ContactManager.Instance().getsprlOrgContact(u).then(function(n){var s=n.result.OrgContactId,h=n.result.OrgContactName,u=n.result.OrganizationName,f=n.result.PhoneNumber,r="";n.result.SAPCIN!=null&&(r=n.result.SAPCIN);n.result.StatusName!="Confirmed"&&$(".divCustomProperties_bizgazepaybacks_couponredemptions").remove();n.result.StatusId==2&&$(".divCustomProperties_bizgazepaybacks_couponredemptions").remove();var i=n.result.OrganizationId,e=u+"-"+r+"-"+f,o=new Option(e,i.toString(),!0);$(t).append(o);$(t).val(i).trigger("change");Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/tag/managers/tagmanager.js",function(){Unibase.Platform.Forms.Managers.TagManager.Instance().GetTagItemsByRefId(Number(i)).then(function(n){if(n.result!=null){var i=n.result;$(t).attr("data-addldata",i[0].TagId)}})})})})}andriodTextToSpeech(n){isMobileApp()&&Unibase.Platform.Helpers.MobileHelper.Instance().textToSpeech(n)}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.LoyaltyPoints=i})(i=t.Components||(t.Components={}))})(i=t.PayBacks||(t.PayBacks={}))})(t=n.Apps||(n.Apps={}))})(Bizgaze||(Bizgaze={}));
|