123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let PayBacks;
- (function (PayBacks) {
- let Components;
- (function (Components) {
- class LoyaltyPoints 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(id, containerid) {
- var html = "";
- return html;
- }
- load(id, containerid, callback) {
- }
- ScanSerialNo(serialno, container, propobj, callback) {
- $('.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 IsScannedCoupon = false;
- if (isMobileApp()) {
- IsScannedCoupon = true;
- }
- propobj[0].IsScannedCoupon = IsScannedCoupon;
- Bizgaze.Apps.Paybacks.Managers.SchemeManager.Instance().LoyaltyPoints(serialno.toUpperCase(), propobj).then(function (response) {
- let audiotype;
- debugger;
- if (response.result == null) {
- $(".scan_couponscancontol").val('');
- if (response.message.includes('Congratulations')) {
- MessageHelper.Instance().show_MandatoryFieldMessage('<strong>Success !</strong>' + response.message, "alert alert-success mb-0", $("#form-container-" + $("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr('id'));
- setTimeout(function () {
- $(".bizgaze_FormErrorMessages").empty();
- }, 3000);
- }
- else {
- MessageHelper.Instance().showError(response.message, $("#form-container-" + $("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr('id'));
- setTimeout(function () {
- $(".bizgaze_FormErrorMessages").empty();
- }, 3000);
- }
- }
- if (response.status == 0) {
- if (isMobileApp())
- Bizgaze.Apps.PayBacks.Components.LoyaltyPoints.Instance().andriodTextToSpeech('Coupon Applied');
- else {
- audiotype = Unibase.Platform.Automation.Enums.NotifyAlerts.CouponBeep;
- Unibase.Platform.Automation.Components.Notifier.Instance().playAudio(audiotype);
- }
- }
- else {
- if (isMobileApp())
- if (response.message.includes('Redeemed'))
- Bizgaze.Apps.PayBacks.Components.LoyaltyPoints.Instance().andriodTextToSpeech("Coupon already redeemed");
- else
- Bizgaze.Apps.PayBacks.Components.LoyaltyPoints.Instance().andriodTextToSpeech(response.message);
- else {
- if (response.message.includes('Invalid/duplicate')) {
- audiotype = Unibase.Platform.Automation.Enums.NotifyAlerts.InvalidDuplicateCoupon;
- Unibase.Platform.Automation.Components.Notifier.Instance().playAudio(audiotype);
- }
- else if (response.message.includes('Redeemed')) {
- audiotype = Unibase.Platform.Automation.Enums.NotifyAlerts.CouponAlreadyRedeemed;
- Unibase.Platform.Automation.Components.Notifier.Instance().playAudio(audiotype);
- }
- else if (response.message.includes('UnAuthentic')) {
- audiotype = Unibase.Platform.Automation.Enums.NotifyAlerts.UnAuthenticCoupon;
- Unibase.Platform.Automation.Components.Notifier.Instance().playAudio(audiotype);
- }
- else if (response.message.includes('contact')) {
- return null;
- }
- else if (response.message.includes('Deactivated')) {
- return null;
- }
- else if (response.message.includes('Congratulations')) {
- audiotype = Unibase.Platform.Automation.Enums.NotifyAlerts.Congratulations;
- Unibase.Platform.Automation.Components.Notifier.Instance().playAudio(audiotype);
- }
- else {
- audiotype = Unibase.Platform.Automation.Enums.NotifyAlerts.InvalidDuplicateCoupon;
- Unibase.Platform.Automation.Components.Notifier.Instance().playAudio(audiotype);
- }
- }
- }
- return false;
- });
- });
- }
- getloyaltypoints(contactid) {
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/paybacks/managers/schememanager.js", function () {
- Bizgaze.Apps.Paybacks.Managers.SchemeManager.Instance().getloyaltypointsbycontactid(contactid).then(function (response) {
- if (response.result !== null && response.result != '') {
- Bizgaze.Apps.PayBacks.Components.LoyaltyPoints.Instance()._totalamount = response.result.Points;
- $(".lblSum").text(Bizgaze.Apps.PayBacks.Components.LoyaltyPoints.Instance()._totalamount);
- $('#divsumDisplayText').text('Total Loyalty Points').addClass('mr-10');
- }
- });
- });
- }
- bindContact(autocontactid, textcontainerid) {
- var instance = this;
- var isCustomer = Unibase.Platform.Membership.Infos.Identity.getCurrentUser().isRestrictedUser;
- var UserId = Unibase.Platform.Membership.Infos.Identity.getCurrentUser().userId;
- if (isCustomer) {
- instance.fileCacheHelper.loadJsFile("apps/crm/contacts/managers/contactmanager.js", function () {
- Bizgaze.Apps.Crm.Contacts.Managers.ContactManager.Instance().getsprlOrgContact(UserId).then(function (response) {
- ;
- var contactId = response.result.OrgContactId;
- var orgContactName = response.result.OrgContactName;
- var organizationName = response.result.OrganizationName;
- var PhoneNumber = response.result.PhoneNumber;
- var SapCode = "";
- if (response.result.SAPCIN != null) {
- SapCode = response.result.SAPCIN;
- }
- if (response.result.StatusName != 'Confirmed') {
- $('.divCustomProperties_bizgazepaybacks_couponredemptions').remove();
- }
- if (response.result.StatusId == 2) {
- $('.divCustomProperties_bizgazepaybacks_couponredemptions').remove();
- }
- var organiozationid = response.result.OrganizationId;
- var contactName = organizationName + '-' + SapCode + '-' + PhoneNumber;
- var contact = new Option(contactName, organiozationid.toString(), true);
- $(autocontactid).append(contact);
- $(autocontactid).val(organiozationid).trigger("change");
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/tag/managers/tagmanager.js", function (response) {
- Unibase.Platform.Forms.Managers.TagManager.Instance().GetTagItemsByRefId(Number(organiozationid)).then(function (response) {
- if (response.result != null) {
- var data = response.result;
- $(autocontactid).attr('data-addldata', data[0].TagId);
- }
- });
- });
- });
- });
- }
- }
- andriodTextToSpeech(textToSpeech) {
- if (isMobileApp()) {
- Unibase.Platform.Helpers.MobileHelper.Instance().textToSpeech(textToSpeech);
- }
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new LoyaltyPoints();
- }
- return this.instance;
- }
- }
- Components.LoyaltyPoints = LoyaltyPoints;
- })(Components = PayBacks.Components || (PayBacks.Components = {}));
- })(PayBacks = Apps.PayBacks || (Apps.PayBacks = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
|