| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494 |
- var Unibase;
- (function (Unibase) {
- let Themes;
- (function (Themes) {
- let Compact;
- (function (Compact) {
- let Components;
- (function (Components) {
- class MobilRegisterUser extends Unibase.Platform.Core.BaseComponent {
- jsFiles() {
- return ["tenants/themes/compact/index.anonymous.js", "platform/membership/managers/accountmanager.js", "libs/passwordrequirement/passwordrequirement.js"];
- }
- cssFiles() {
- return ["libs/passwordrequirement/passwordrequirement.css", 'tenants/themes/compact/css/style.ext.css'];
- }
- html(id, containerid) {
- if (jQuery("#external-form").length === 0) {
- var index = new Components.Index_Anonymous();
- index.init(null);
- }
- const html = `<div><form id="frm_RegisterUser" default="" data-validate="parsley" data-isdynamic="false"><div id="div_ValidationSummary"></div><div id="div_RegisterUser"><h1 class="display-4 mb-30 text-dark-100 text-center">Registration</h1><div class="alert alert-primary d-none">We will send new code to your <a href=""><u>Email or Phone</u></a> to create your password.</div><div class="form-group"><input class="form-control" required placeholder="Enter Registered Phone Number" id="txt_EmailorPhone" type="text"></div>
- <div class="form-group floating-label-form-group floating-label-form-group-with-value focus" id="div_TenantsAutoComplete">
- <select id="ddl_Tenant" class="hidden form-control value-control" data-isdynamic="false"></select></div><button class="btn btn-primary btn-block" type="button" id="btn_SendOtp">Confirm</button><p class="text-right mt-20"><a href="Index.html#/login">Back to login</a></p></div><div id="div_CreatePswd" class="d-none"><h1 class="display-5 mb-30 text-center">Create your Password</h1><div class="form-group"><label class="form-control" id="lbl_Email"></label></div><div class="form-group"><input class="form-control pr-password " required id="txt_NewPswd" placeholder="New password" type="password" ><span toggle="#txt_NewPswd" id="passwordHide" class="fa fa-eye-slash font-15 mr-10 field-icon"></span><div class="showpwsdreq"></div></div><div class="form-group"><input class="form-control" required id="txt_ConfirmPswd" placeholder="Re-enter new password" type="password" autocomplete="new-password"><span toggle="#txt_ConfirmPswd" id="confirmPasswordHide" class="fa fa-eye-slash font-15 mr-10 field-icon"></span></div><button class="btn btn-primary btn-block mb-20" disabled="disabled" type="button" id="btn_CreatePswd">Create Password</button><div class="input-group mb-20"><div class="custom-control custom-checkbox col-xs"><input class="custom-control-input" id="InputTermsandConditions" type="checkbox"><label class="custom-control-label font-14" for="InputTermsandConditions">I accept the terms & conditions</label></div></div><p class="text-right"><a href="Index.html#/login">Back to login</a></p></div><div id="div_SuccessMsg" class="d-none"><div class="d-62 bg-white rounded-circle mb-10 d-flex align-items-center justify-content-center mx-auto"><i class="fa fa-check font-50 text-success"></i></div><h1 class="display-4 mb-20 text-center">Password Created Successfully</h1><p class="text-center"><a href="Index.html#/login">Click here to Login</a></p></div></form>
-
- <div id="modal_Otp" class="modal fade hide">
- <div class="modal-dialog modal-dialog-centered">
- <div class="modal-content">
- <div class="modal-header border-0 d-block"><button type="button" class="btn btn-link pull-right font-16 text-secondary p-0" data-dismiss="modal" aria-hidden="true" >×</button></div>
- <div class="modal-body text-center" id="div_modalbody">
- <img src="tenants/themes/compact/imgs/otp-verify-img.png" class="img-fluid h-100p mx-auto my-10" >
- <h4 class="modal-title font-weight-600">OTP Verification</h4>
- <h6 class="position-relative py-3">Enter 6 Digit Verification Code Sent</h6>
- <div class="lbl_Otp"></div>
- <div class="otpdiv my-10">
- <div class="floating-label-form-group mb-2 p-0">
- <input class="form-control bg-transparent txt_Otp" onkeyup='Unibase.Themes.Compact.Components.MobilRegisterUser.Instance().otpInputTabChange(1)' id ="txt_Otp" type="text" maxlength="1" autocomplete="off">
- <input class="form-control bg-transparent txt_Otp" onkeyup='Unibase.Themes.Compact.Components.MobilRegisterUser.Instance().otpInputTabChange(2)' id ="txt_Otp" type="text" maxlength="1" autocomplete="off">
- <input class="form-control bg-transparent txt_Otp" onkeyup='Unibase.Themes.Compact.Components.MobilRegisterUser.Instance().otpInputTabChange(3)' id ="txt_Otp" type="text" maxlength="1" autocomplete="off">
- <input class="form-control bg-transparent txt_Otp" onkeyup='Unibase.Themes.Compact.Components.MobilRegisterUser.Instance().otpInputTabChange(4)' id ="txt_Otp" type="text" maxlength="1" autocomplete="off">
- <input class="form-control bg-transparent txt_Otp" onkeyup='Unibase.Themes.Compact.Components.MobilRegisterUser.Instance().otpInputTabChange(5)' id ="txt_Otp" type="text" maxlength="1" autocomplete="off">
- <input class="form-control bg-transparent txt_Otp" onkeyup='Unibase.Themes.Compact.Components.MobilRegisterUser.Instance().otpInputTabChange(6)' id ="txt_Otp" type="text" maxlength="1" autocomplete="off">
- <input class="form-control hidden optmsg d-none" id="otpMsg" >
- </div>
- </div>
- <div class=" timerdiv">
- <div class="mt-10 text-danger">Time left: <span id="mycounter"></span></div>
- </div>
- </div>
- <div class="modal-footer py-10" style="display:block"><button type = "button" class="btn btn-outline-primary pull-left" disabled="disabled" id="btn_ResendOtp">Resend</button><button type = "button" class="btn btn-outline-primary pull-right" id="btn_VerifyOtp">Verify</button></div>
- </div>
- </div>
- </div>
- </div>
-
- <div id="modal_termsandconditions" class="modal fade hide"><div class="modal-dialog"><div class="modal-content"><div class="modal-header py-1"><h6 class="modal-title pull-left">Terms of Use</h6><a href="javascript:void(0);" class="font-26 pull-right text-danger" data-dismiss="modal" aria-hidden="true">×</a></div>
- <div class="modal-body biz-custom-scrollbar pt-1" style="overflow-y:auto;height: 87vh;" id="div_modalbody">
- <div class="mb-25">
- <p class="lbl_content pb-1">Please read and review these Terms of Use terms and conditions (T&C) carefully before accessing or using this Distributor Management System Application (Application). By accessing or using this Application, you acknowledge that you have read, understood and agreed to the T&C. If you do not agree to the T&C, you may not access or use the Application and are advised to stop proceeding immediately. If you choose to continue, it shall be deemed that you have hereby read, understood and accepted these T&C along with the terms and conditions and privacy policy of this Application.</p>
- <p class="lbl_content py-1"><b>Meaning of Terms</b>:<br>
- The term ”DMS” refers to Distributor Management System.<br>
- The term ”ExxonMobil” refers solely and exclusively to ExxonMobil Lubricants Pvt. Ltd. , 1st Main Road, Whitefield Main Road, 5th Floor, Prestige Shantiniketan Complex Road, Bengaluru, Karnataka 560048, India and/or its successors in interest and may include its directors, employees and authorised personnel.<br>
- The term “Application” refers to DMS or any related digital or online platform built specifically for you or to which you have been given access due to and in furtherance of any contract, agreement or understanding with ExxonMobil.
- Content. The user agrees that access to and use of this Application and the content thereof is at his/her own risk. ExxonMobil shall not be liable for any damages, including without limitation, consequential, indirect, direct, incidental, arising out of access to, use of or inability to use the Application, or any errors or omissions in the content thereof. This limitation includes damages to, or for any viruses that infect your computer equipment.</p>
-
- <p class="lbl_content py-1"><b>Submission of Information</b><br> By submitting information via this Application:</p>
- <ul>
- <li>(a) user acknowledges that he/she is over 18 years of age, of sound mind, not a declared insolvent and have not been convicted of any offence involving moral turpitude.</li>
-
- <li>(b) user warrants that he/she has all legal, moral, and other rights that may be necessary to publish the information;</li>
-
- <li>(c) user acknowledges and agrees that ExxonMobil shall have the right (but not obligation), at its sole discretion, to refuse to publish or to remove or block access to any content provided at any time and for any reason, with or without notice to the user and that ExxonMobil shall the right to assimilate, collect, reproduce and use the information provided by the user in any manner we deem fit.</li>
-
- <li>(d) ExxonMobil, by way of this Application, will collect your personal/business information (Name, address, ID Number, Date of Birth and your customer contact details such as Name, Contact details, Location, Organization Address) for the purpose of facilitating your registration and participation the DMS program. For avoidance of doubt, the user confirms that it has the right to provide the customer contact details.</li>
-
- <li>(e) ExxonMobil can further use the collected personal/business information to update about any future promotions information related to DMS, sending Mobil product related marketing/promotional materials and to facilitate/execute marketing program redemptions. The service under Application may include certain communications from ExxonMobil, such as service announcements, administrative messages, and newsletters. You understand that these communications shall be considered part of using the Application. Use of Application. Your access to and use of the content contained in this Application is subject to the T&C. By accessing and using this Application, you accept, without limitation or qualification, these T&C.</li></ul>
-
- <b>User Sign up Obligations</b>: You need to sign up for a user account by providing all required information in order to access or use the Application. If you represent an organization and wish to use the Application for corporate use, we recommend that you, sign up for user accounts by providing your corporate contact information. In particular, we recommend that you use your corporate email address. You agree to: a) provide true, accurate, current and complete information about yourself as prompted by the sign-up process; and b) maintain and promptly update the information provided during sign up to keep it true, accurate, current, and complete.
-
- <p class="lbl_content py-1">Your Conduct: User agrees not to upload, transmit, post, comment, email or otherwise make available to the Application/site, any content, information or other material in any format that:</p>
- <ul>
- <li>(a) is false, inaccurate, unlawful, harmful, threatening, abusive, harassing, tortious, defamatory, vulgar, obscene, invasive of another’s privacy, libelous, hurts religious or national sentiment, against public policy and/or otherwise objectionable;</li>
-
- <li>(b) contains viruses, worms, corrupted files, or any other similar software or programs designed to interrupt, destroy or limit the functionality of any computer software or hardware or telecommunications equipment.</li>
-
- <li>(c) infringes any third party's intellectual property;</li>
-
- <li>(d) User agrees that he/she will not transmit or access any data that infringes any patent, trademark,
- trade secret, copyright or other proprietary rights of any party</li></ul>
-
- <p class="lbl_content py-1">Indemnification. User agrees to indemnify, defend and hold harmless ExxonMobil, its officers, directors, employees, agents, suppliers and third party partners from and against all losses, expenses, damages and costs, including reasonable attorneys' fee, resulting from any violation by user of these T&C.</p>
-
- <p class="lbl_content py-1">Disclaimer of Warranties You expressly understand and agree that the use of the services is at your sole risk. The services are provided on an as-is-and-as-available basis.</p>
-
- <p class="lbl_content py-1">ExxonMobil expressly disclaims all warranties of any kind, whether express or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. ExxonMobil makes no warranty that the services will be uninterrupted, timely, secure, or error free. Use of any material downloaded or obtained through the use of the services/Application shall be at your own discretion and risk and you will be solely responsible for any damage to your computer system, mobile telephone, wireless device or data that results from the use of the services or the download of any such material.</p>
-
- <p class="lbl_content py-1"><b>Privacy</b>. ExxonMobil respects the privacy of its website users. Please refer to both mobil.co.in Privacy Policy and your organization's Privacy Policy, as applicable, for users' rights and responsibilities with respect to information that is disclosed on this Application. Users understand that under some limited circumstances, ExxonMobil may be required by law to disclose their personal information and any other submitted information by them. Participants thereby authorize ExxonMobil or its affiliates in this regard. Any personal data relating to entrants will be used solely in accordance with current India data protection legislation and best practice. Please see the mobil.co.in Privacy Policy for further details</p>
-
- <p class="lbl_content py-1"><b>Confidential Information</b>.Subject to any applicable terms and conditions set forth in our Privacy Policy, your Privacy Policy, or any non-disclosure agreements, any communication or other material that you submit or post via this Application will not be deemed to be confidential information unless so specified by ExxonMobil in advance.</p>
-
- <p class="lbl_content py-1"><b>Trademarks</b>. All ExxonMobil product names, whether or not appearing in large print or with the trademark symbol, are trademarks of ExxonMobil, its affiliates, related companies or its licensors or joint venture partners, unless otherwise noted. The use or misuse of these trademarks or any other materials, except as permitted herein, is expressly prohibited and may be in violation of copyright law, trademark law, the law of privacy and publicity, and communications regulations and statutes. Please be advised that ExxonMobil actively and aggressively enforces its intellectual property rights to the fullest extent of the law. By submitting any trademarked Content via this Application, you warrant and represent that you have all legal, moral, and other rights that may be necessary to publish, republish or distribute the content and will comply to any and all trademark law with respect to that content.</p>
-
- <p class="lbl_content py-1"><b>Third Party Websites and Links</b>. The content in this Application may contain links or references to other websites maintained by your organization or by third parties over whom ExxonMobil has no control. ExxonMobil makes no warranties or representations of any kind as to the accuracy, currency, or completeness of any information contained in such websites and shall have no liability for any damages or injuries of any kind arising from such content or information. Inclusion of any external or third party link does not imply an endorsement or recommendation by ExxonMobil.</p>
-
- <p class="lbl_content py-1"><b>Copyrights</b>. The entire Contents of this Application are subject to copyright protection. Any ExxonMobil proprietary Content in this Application may not be copied other than for noncommercial individual reference with all copyright or other proprietary notices retained, and thereafter may not be recopied, reproduced or otherwise redistributed. Except as expressly provided above, you may not otherwise copy, display, download, distribute, modify, reproduce, republish or retransmit any information, text or documents contained in this Application or any portion thereof in any electronic medium or in hard copy, or create any derivative work based on such images, text or documents, without the express written consent of ExxonMobil. Nothing contained herein shall be construed as conferring by implication, estoppel or otherwise any license or right under any patent or trademark of ExxonMobil, or any third party. By submitting any copyrighted Content via this Application, you warrant and represent that you have all legal, moral, and other rights that may be necessary to publish, republish or distribute the Content and will comply to any and all copyright law with respect to that Content.</p>
-
- <p class="lbl_content py-1"><b>Void Where Prohibited</b>. This Application and its Contents are intended to comply with the laws and regulations in India. Although the information on this Application may be accessible to users outside of India, the information pertaining to ExxonMobil Catalog is intended for use only by residents of India. ExxonMobil reserves to right to limit provision of its products or services to any person, geographic region or jurisdiction and/or to limit the quantities or any products or services we provide. Any offer for any product or service made on this Application is void where prohibited.</p>
-
- <p class="lbl_content py-1"><b>Governing Laws</b>. This Terms of Use Agreement / T&C and your use of the Application shall be governed by the laws of India without regard to its conflicts of laws principles. Any legal action or proceeding related to this Application shall be brought exclusively in a court at Bangalore.</p>
-
- <p class="lbl_content py-1"><b>Miscellaneous</b>. If any provision of this Terms of Use Agreement/ T&C is held to be unlawful, void or unenforceable, then such provision shall be severable without affecting the enforceability of all remaining provisions. ExxonMobil reserves the right to alter or delete materials from this Application at any time at its discretion. ExxonMobil may modify the T&C at any time through a service announcement or by sending email to your primary email address.</p>
-
- <p class="lbl_content py-1 pb-5">Suspension and Termination ExxonMobil may suspend your user account or temporarily disable access to whole or part of any service in the event of any suspected illegal activity, extended periods of inactivity or requests by law enforcement or other government agencies.</p>
- </div>
- </div>
- <div class="modal-footer fixed-bottom p-0 py-3 bg-white rounded">
- <div class="input-group "><div class="custom-control terms-conditions custom-checkbox col-xs btn btn-outline-success btn-rounded mx-auto d-flex justify-content-center text-center w-30 my-5 py-2 font-weight-500"><input class="custom-control-input " id="InputTermsandConditionsAccept" type="checkbox"><label class="custom-control-label font-14" for="InputTermsandConditionsAccept">I Accept</label></div></div></div></div><div</div></div></div>`;
- return html;
- }
- load(id, containerid, callback) {
- $(".pr-password").click(function () {
- var signUpPswd = $(".pr-password");
- signUpPswd.passwordRequirements({
- numCharacters: 8,
- useLowercase: true,
- useUppercase: true,
- useNumbers: true,
- useSpecial: true
- });
- });
- this._accountManager = Unibase.Platform.Membership.Managers.AccountManager.Instance();
- jQuery(".preloader-it").delay(500).fadeOut("slow");
- jQuery("#external-container").delay(500).fadeIn("slow");
- jQuery("#bizgaze_body").css("background-color", "#f4f6f7");
- $("#div_modalbody").removeAttr("style");
- $(".btn-outline-secondary").addClass('hidden');
- $("#passwordHide").click(function () {
- var input = $('#txt_NewPswd');
- input.attr('type') == "password" ? input.attr('type', 'text') : input.attr('type', 'password');
- $("#passwordHide").toggleClass('fa-eye-slash fa-eye');
- });
- $("#confirmPasswordHide").click(function () {
- var input = $('#txt_ConfirmPswd');
- input.attr('type') == "password" ? input.attr('type', 'text') : input.attr('type', 'password');
- $('#confirmPasswordHide').toggleClass('fa-eye-slash fa-eye');
- });
- $("#OtpHide").click(function () {
- var input = $('#txt_Otp');
- input.attr('type') == "password" ? input.attr('type', 'text') : input.attr('type', 'password');
- $('#OtpHide').toggleClass('fa-eye-slash fa-eye');
- });
- $("#txt_EmailorPhone").keypress(function (e) {
- if (e.which == 13)
- document.getElementById("btn_SendOtp").click();
- });
- $("#txt_EmailorPhone").focusout(function (e) {
- instance.loadUserTenants();
- });
- $(".txt_Otp:last").keypress(function (e) {
- if (e.which == 13)
- $("#btn_VerifyOtp").click();
- });
- $("#txt_NewPswd,#txt_ConfirmPswd").keypress(function (e) {
- if (e.which == 13)
- document.getElementById("btn_CreatePswd").click();
- });
- var instance = this;
- $("#btn_SendOtp").click(function () {
- instance.validate();
- });
- $("#btn_CreatePswd").click(function () {
- instance.createPassword();
- });
- $("#btn_VerifyOtp").click(function () {
- instance.verifyOtp();
- });
- $("#btn_ResendOtp").click(function () {
- instance.sendOtp(instance.OtpId);
- });
- $("#InputTermsandConditions").click(function (e) {
- e.stopPropagation();
- e.preventDefault();
- $("#modal_termsandconditions").modal("show");
- });
- $("#InputTermsandConditionsAccept").click(function () {
- var accept = $("#InputTermsandConditionsAccept").prop("checked");
- if (accept == true) {
- $('#InputTermsandConditions').prop('checked', true);
- $("#modal_termsandconditions").modal('hide');
- $('#btn_CreatePswd').prop("disabled", false);
- }
- else {
- $('#InputTermsandConditions').prop('checked', false);
- $('#btn_CreatePswd').prop("disabled", true);
- }
- });
- $('.floating-label-form-group .txt_Otp').on('input', function (e) {
- const inputEl = this;
- inputEl.value = inputEl.value.replace(/[^0-9]/g, '');
- });
- $(".txt_Otp").click(function () {
- $(".lbl_Otp").empty();
- });
- if (callback != null)
- callback();
- }
- otpInputTabChange(val) {
- const ele = $('.txt_Otp');
- if (ele[val - 1].value != '') {
- if (ele[val])
- ele[val].focus();
- }
- else if (ele[val - 1].value == '') {
- if (ele[val - 2])
- ele[val - 2].focus();
- }
- }
- loadTenants() {
- var instance = this;
- instance._accountManager.getTenants().then(function (response) {
- var res = response;
- let cmbLob = document.getElementById('ddl_Tenant');
- $('#ddl_Tenant').empty();
- $('#ddl_Tenant').append('<option value=0>Select Distributor</option>');
- for (var i = 0; i < response.result.length; i++) {
- var data = response.result[i];
- var opt = document.createElement("option");
- var Name = data.tenantName;
- var id = data.tenantId;
- opt.text = Name;
- opt.value = id;
- cmbLob.append(opt);
- }
- if (res.result.filter(x => x.isTemplateDb == false).length == 1) {
- var Id = $('#ddl_Tenant option[value=' + res.result.filter(x => x.isTemplateDb == false)[0].tenantId + ']');
- Id.attr("selected", true);
- $("#ddl_Tenant").prop('disabled', true);
- }
- });
- }
- loadUserTenants() {
- var instance = this;
- var emailorphone = $("#txt_EmailorPhone").val();
- instance._accountManager.getUserTenants(emailorphone).then(function (response) {
- debugger;
- var res = response;
- let cmbLob = document.getElementById('ddl_Tenant');
- $('#ddl_Tenant').empty();
- $('#ddl_Tenant').append('<option value=0>Select Distributor</option>');
- for (var i = 0; i < response.result.length; i++) {
- var data = response.result[i];
- var opt = document.createElement("option");
- var Name = data.tenantName;
- var id = data.defaultTenantId;
- opt.text = Name;
- opt.value = id;
- cmbLob.append(opt);
- }
- if (res.result.filter(x => x.isTemplateDb == false).length == 1) {
- var Id = $('#ddl_Tenant option[value=' + res.result.filter(x => x.isTemplateDb == false)[0].tenantId + ']');
- Id.attr("selected", true);
- $("#ddl_Tenant").removeClass('hidden');
- $("#ddl_Tenant").prop('disabled', true);
- }
- else if (res.result.length == 1) {
- var Id = $('#ddl_Tenant option[value=' + res.result[0].defaultTenantId + ']');
- Id.attr("selected", true);
- $("#ddl_Tenant").removeClass('hidden');
- $("#ddl_Tenant").prop('disabled', true);
- }
- else if (res.result.length == 0) {
- $("#ddl_Tenant").addClass('hidden');
- MessageHelper.Instance().showError("This Numberis not registered with any distributor! Please contact your DSR for further process.", "div_ValidationSummary");
- return false;
- }
- else {
- var Id = $('#ddl_Tenant option[value=' + res.result[0].defaultTenantId + ']');
- Id.attr("selected", true);
- $("#ddl_Tenant").removeClass('hidden');
- $("#ddl_Tenant").prop('disabled', false);
- }
- });
- }
- validate() {
- $(".lbl_Otp").text("");
- $("#txt_Otp").val('');
- $("#div_ValidationSummary").empty();
- var phoneOrEmail = $("#txt_EmailorPhone").val();
- var tenantId = $("#ddl_Tenant option:selected").val();
- if (phoneOrEmail == "" && tenantId == 0) {
- MessageHelper.Instance().showError("Please enter Email/Phone and select a Distributor !", "div_ValidationSummary");
- return false;
- }
- if (phoneOrEmail == "") {
- MessageHelper.Instance().showError("Email or Phone cannot be Empty!", "div_ValidationSummary");
- return false;
- }
- if (tenantId == 0) {
- MessageHelper.Instance().showError("Please select a Distributor", "div_ValidationSummary");
- return false;
- }
- else {
- var instance = this;
- instance._accountManager.getContact(phoneOrEmail, tenantId).then(function (response) {
- if (response.result != null) {
- instance.Email = response.result.emailAddress;
- instance.ContactNumber = response.result.phoneNumber;
- instance.UserName = response.result.unibaseId;
- instance.TenantId = response.result.tenantId;
- instance.ContactName = response.result.userName;
- $("#div_ValidationSummary").empty();
- instance.sendOtp(0);
- }
- else {
- MessageHelper.Instance().showError(response.message, "div_ValidationSummary");
- }
- });
- }
- }
- sendOtp(IsResend) {
- var instance = this;
- $(".preloader-it").fadeIn();
- var postData = {
- ContactOrEmail: $("#txt_EmailorPhone").val(),
- FirstName: instance.ContactName,
- LastName: "",
- ContactNumber: "",
- Email: "",
- TenantName: "",
- IsSignup: false,
- IsForgotPswd: false,
- IsRegisterUser: true,
- UnibaseId: instance.UserName,
- OtpId: IsResend,
- UserOtp: ""
- };
- instance._accountManager.sendOtp(postData).then(function (response) {
- if (IsResend != 0) {
- $(".lbl_Otp").text("We have resent the OTP to your Registered Mobile Number!").removeClass('text-danger');
- }
- if (response == 0) {
- $(".preloader-it").delay(200).fadeOut("slow");
- MessageHelper.Instance().showError("Some Error has occurred!", 'div_ValidationSummary');
- }
- else {
- instance.OtpId = response;
- $("#modal_Otp").modal("show");
- $(".preloader-it").delay(200).fadeOut("slow");
- $("#btn_ResendOtp").prop("disabled", true);
- $(".otpdiv").removeClass('hidden');
- $(".timerdiv").removeClass('hidden');
- $(".modal-footer").show();
- $("#txt_Otp").parent().removeClass('col-sm-12').addClass('col-sm-7');
- Unibase.Themes.Compact.Components.MobilRegisterUser.Instance().timer(60, IsResend);
- }
- }, function () {
- $(".preloader-it").delay(200).fadeOut("slow");
- MessageHelper.Instance().showError("Some Error has occurred!", 'div_ValidationSummary');
- });
- }
- verifyOtp() {
- var otpMsg = "";
- $(".floating-label-form-group .txt_Otp").each(function () {
- otpMsg += $(this).val();
- });
- parseInt(otpMsg);
- $(".floating-label-form-group").find('#otpMsg').attr("value", otpMsg);
- var instance = this;
- if ($("#otpMsg").val() == "")
- $(".lbl_Otp").text("Please Enter OTP!").addClass('text-danger', '');
- if ($("#otpMsg").val() < 6)
- $(".lbl_Otp").text("Please Enter 6 Digit OTP!").addClass('text-danger', '');
- else {
- var postData = {
- FirstName: "",
- LastName: "",
- ContactNumber: "",
- Email: "",
- TenantName: "",
- ContactOrEmail: "",
- IsForgotPswd: false,
- IsRegisterUser: false,
- IsSignup: true,
- UnibaseId: "",
- OtpId: instance.OtpId,
- UserOtp: $("#otpMsg").val(),
- };
- instance._accountManager.verifyOtp(postData).then(function (response) {
- if (response.code.toString() == "2") {
- $(".preloader-it").delay(200).fadeOut("slow");
- $(".lbl_Otp").text("Otp Expired, Please click on Resend to get new OTP").addClass('text-danger', '');
- $("#otpMsg").val('');
- }
- else if (response.result != null) {
- if (response.result.contactConfirmed == false && response.result.emailConfirmed == false) {
- $(".preloader-it").delay(200).fadeOut("slow");
- $(".lbl_Otp").text("Invalid OTP!").addClass('text-danger', '');
- $("#otpMsg").text('');
- }
- else {
- $(".preloader-it").fadeIn();
- $("#div_RegisterUser").addClass('d-none');
- $("#modal_Otp").modal("hide");
- $(".preloader-it").delay(200).fadeOut("slow");
- $("#lbl_Email").text($("#txt_EmailorPhone").val());
- $("#div_CreatePswd").removeClass('d-none');
- }
- }
- });
- }
- }
- createPassword() {
- var instance = this;
- $("#div_ValidationSummary").empty();
- var confirmPassword = $("#txt_ConfirmPswd").val();
- var password = $("#txt_NewPswd").val();
- if (password.length == 0 || confirmPassword.length == 0) {
- MessageHelper.Instance().showError("Password fields cannot be empty!", 'div_ValidationSummary');
- return false;
- }
- if (password.length < 8 || confirmPassword.length < 8) {
- MessageHelper.Instance().showError("Password must be atleast 8 characters!", 'div_ValidationSummary');
- return false;
- }
- if (password != confirmPassword) {
- MessageHelper.Instance().showError("New and Confirm Passwords doesn't match!", "div_ValidationSummary");
- return false;
- }
- var password = $("#txt_ConfirmPswd").val();
- ;
- var decimal = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,15}$/;
- var checkpassword = password.match(decimal) ? true : false;
- if (checkpassword == false) {
- $(".pr-password").focus();
- MessageHelper.Instance().showError("Please Match the Password in requested Format", "div_ValidationSummary");
- return false;
- }
- var postData = {
- Password: $("#txt_NewPswd").val(),
- UserName: instance.UserName,
- Email: instance.Email,
- ContactNumber: instance.ContactNumber,
- TenantId: instance.TenantId,
- };
- instance._accountManager.registerUser(postData).then(function (response) {
- if (response.errors == null) {
- $("#div_CreatePswd").addClass('d-none');
- $("#div_SuccessMsg").removeClass('d-none');
- MessageHelper.Instance().showSuccess("Password Created Successfully", 'div_ValidationSummary');
- }
- else {
- $(".preloader-it").delay(200).fadeOut("slow");
- MessageHelper.Instance().showError(response.errors[0], "div_ValidationSummary");
- }
- });
- }
- submit() {
- }
- timer(remaining, resend) {
- let timerOn = true;
- let m = Math.floor(remaining / 60);
- let s = remaining % 60;
- let mins = m < 10 ? '0' + m : m;
- let seconds = s < 10 ? '0' + s : s;
- document.getElementById('mycounter').innerHTML = mins + ':' + seconds;
- remaining -= 1;
- if (remaining >= 0 && timerOn) {
- setTimeout(function () {
- Unibase.Themes.Compact.Components.MobilRegisterUser.Instance().timer(remaining, resend);
- }, 1000);
- return;
- }
- if (!timerOn) {
- return;
- }
- if (resend != 0) {
- $(".otpdiv").addClass('hidden');
- $(".timerdiv").addClass('hidden');
- $(".lbl_Otp").text("Please contact the DSR for registration!").addClass('text-danger', '');
- $(".modal-footer").hide();
- }
- else {
- $("#btn_ResendOtp").prop("disabled", false);
- $("#txt_Otp").parent().removeClass('col-sm-7').addClass('col-sm-12');
- }
- }
- static Instance() {
- return new MobilRegisterUser();
- }
- }
- Components.MobilRegisterUser = MobilRegisterUser;
- })(Components = Compact.Components || (Compact.Components = {}));
- })(Compact = Themes.Compact || (Themes.Compact = {}));
- })(Themes = Unibase.Themes || (Unibase.Themes = {}));
- })(Unibase || (Unibase = {}));
|