Form Loading in iframe
This commit is contained in:
+77
-67
@@ -1,80 +1,90 @@
|
||||
import {
|
||||
decrypt
|
||||
} from "./cookiehelper.js";
|
||||
import {
|
||||
_serverUrl
|
||||
} from "./setting.js";
|
||||
import {decrypt} from "./cookiehelper.js";
|
||||
import {_serverUrl} from "./setting.js";
|
||||
|
||||
let serverUrl = _serverUrl();
|
||||
let baseUserInfo = decrypt(document.cookie.split('=')[1]);
|
||||
let baseUserInfo = decrypt(document.cookie.split("=")[1]);
|
||||
let baseSessionId = baseUserInfo.sessionId;
|
||||
|
||||
export function getData(url) {
|
||||
var datastr = null;
|
||||
var method = "GET";
|
||||
let serviceurl = serverUrl + url;
|
||||
var datastr = null;
|
||||
var method = "GET";
|
||||
let serviceurl = serverUrl + url;
|
||||
|
||||
return $.ajax({
|
||||
type: method,
|
||||
url: serviceurl,
|
||||
crossDomain: true,
|
||||
contentType: "application/json",
|
||||
cache: true,
|
||||
jsonp: false,
|
||||
data: datastr,
|
||||
beforeSend: function(xhr) {
|
||||
if (baseUserInfo != undefined && baseUserInfo != null) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + JSON.parse(baseUserInfo).sessionId);
|
||||
xhr.setRequestHeader('geoposition', 0 + ':' + 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
return $.ajax({
|
||||
type: method,
|
||||
url: serviceurl,
|
||||
crossDomain: true,
|
||||
contentType: "application/json",
|
||||
cache: true,
|
||||
jsonp: false,
|
||||
data: datastr,
|
||||
beforeSend: function (xhr) {
|
||||
if (baseUserInfo != undefined && baseUserInfo != null) {
|
||||
xhr.setRequestHeader(
|
||||
"Authorization",
|
||||
"Basic " + JSON.parse(baseUserInfo).sessionId
|
||||
);
|
||||
xhr.setRequestHeader("geoposition", 0 + ":" + 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function getDataObj(url, data, async, type) { //url, data, true, "POST"
|
||||
export function getDataObj(url, data, async, type) {
|
||||
//url, data, true, "POST"
|
||||
|
||||
let serviceurl = serverUrl + url;
|
||||
return $.ajax({
|
||||
type: type,
|
||||
url: serviceurl,
|
||||
data: JSON.stringify(data),
|
||||
contentType: 'application/json',
|
||||
traditional: true,
|
||||
crossDomain: true,
|
||||
async: async,
|
||||
beforeSend: function(xhr) {
|
||||
if (baseUserInfo != undefined && baseUserInfo != null) {
|
||||
xhr.setRequestHeader('Authorization', 'Basic ' + JSON.parse(baseUserInfo).sessionId);
|
||||
xhr.setRequestHeader('geoposition', 0 + ':' + 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
let serviceurl = serverUrl + url;
|
||||
return $.ajax({
|
||||
type: type,
|
||||
url: serviceurl,
|
||||
data: JSON.stringify(data),
|
||||
contentType: "application/json",
|
||||
traditional: true,
|
||||
crossDomain: true,
|
||||
async: async,
|
||||
beforeSend: function (xhr) {
|
||||
if (baseUserInfo != undefined && baseUserInfo != null) {
|
||||
xhr.setRequestHeader(
|
||||
"Authorization",
|
||||
"Basic " + JSON.parse(baseUserInfo).sessionId
|
||||
);
|
||||
xhr.setRequestHeader("geoposition", 0 + ":" + 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function formatLocal(dateTime) {
|
||||
var hou = new Date(dateTime).getHours(),
|
||||
sec, min, day, month, years;
|
||||
if (hou < 24) {
|
||||
min = new Date(dateTime).getMinutes();
|
||||
if (min < 60) {
|
||||
sec = new Date(dateTime).getSeconds();
|
||||
if (sec < 60) {
|
||||
return sec + ' Seconds';
|
||||
}
|
||||
} else {
|
||||
return min + ' Minutes';
|
||||
}
|
||||
return hou + ' Hours';
|
||||
} else { //24 >
|
||||
day = new Date(dateTime).getHours();
|
||||
if (day > 31) { // 31 day
|
||||
month = new Date(dateTime).getMonth();
|
||||
if (month > 12) { // 12 months
|
||||
years = new Date(dateTime).getFullYear();
|
||||
return years + ' Years';
|
||||
}
|
||||
return month + ' month';
|
||||
}
|
||||
return day + ' day';
|
||||
var hou = new Date(dateTime).getHours(),
|
||||
sec,
|
||||
min,
|
||||
day,
|
||||
month,
|
||||
years;
|
||||
if (hou < 24) {
|
||||
min = new Date(dateTime).getMinutes();
|
||||
if (min < 60) {
|
||||
sec = new Date(dateTime).getSeconds();
|
||||
if (sec < 60) {
|
||||
return sec + " Seconds";
|
||||
}
|
||||
} else {
|
||||
return min + " Minutes";
|
||||
}
|
||||
}
|
||||
return hou + " Hours";
|
||||
} else {
|
||||
//24 >
|
||||
day = new Date(dateTime).getHours();
|
||||
if (day > 31) {
|
||||
// 31 day
|
||||
month = new Date(dateTime).getMonth();
|
||||
if (month > 12) {
|
||||
// 12 months
|
||||
years = new Date(dateTime).getFullYear();
|
||||
return years + " Years";
|
||||
}
|
||||
return month + " month";
|
||||
}
|
||||
return day + " day";
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -1,6 +1,6 @@
|
||||
const cryptoProvider = window['CryptoJS'];
|
||||
const cryptoAlgorithm = window['CryptoJS'].AES;
|
||||
const _secretKey = 'unibase';
|
||||
const cryptoProvider = window["CryptoJS"];
|
||||
const cryptoAlgorithm = window["CryptoJS"].AES;
|
||||
const _secretKey = "unibase";
|
||||
|
||||
export function encrypt(content) {
|
||||
return cryptoAlgorithm.encrypt(content, _secretKey).toString();
|
||||
@@ -13,29 +13,29 @@ export function decrypt(encoded) {
|
||||
}
|
||||
|
||||
export function setCookie(cname, cvalue, exdays) {
|
||||
let _cookievalue = '';
|
||||
let _cookievalue = "";
|
||||
if (cvalue) {
|
||||
_cookievalue = encrypt(cvalue);
|
||||
}
|
||||
var d = new Date();
|
||||
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
|
||||
var expires = 'expires=' + d.toUTCString();
|
||||
var expires = "expires=" + d.toUTCString();
|
||||
document.cookie =
|
||||
cname +
|
||||
'=' +
|
||||
"=" +
|
||||
_cookievalue +
|
||||
';' +
|
||||
";" +
|
||||
expires +
|
||||
';path=/;samesite=none;secure=true';
|
||||
";path=/;samesite=none;secure=true";
|
||||
}
|
||||
|
||||
export function getCookie(cname) {
|
||||
var name = cname + '=';
|
||||
var name = cname + "=";
|
||||
var decodedCookie = decodeURIComponent(document.cookie);
|
||||
var ca = decodedCookie.split(';');
|
||||
var ca = decodedCookie.split(";");
|
||||
for (var i = 0; i < ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0) === ' ') {
|
||||
while (c.charAt(0) === " ") {
|
||||
c = c.substring(1);
|
||||
}
|
||||
|
||||
@@ -45,11 +45,11 @@ export function getCookie(cname) {
|
||||
return cookie_decrypt;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
return "";
|
||||
}
|
||||
|
||||
export function isAuthenticated() {
|
||||
if (getCookie('_idty')) {
|
||||
if (getCookie("_idty")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
+130
-125
@@ -1,142 +1,147 @@
|
||||
const serverUrl = 'http://localhost:3086/';
|
||||
const serverUrl = "http://localhost:3086/";
|
||||
let otpid;
|
||||
let sendotp;
|
||||
let unibaseid;
|
||||
async function showOtpBox() {
|
||||
let inputdetails = document.getElementById('txt_PhoneorMail').value;
|
||||
let inputdetails = document.getElementById("txt_PhoneorMail").value;
|
||||
|
||||
let sendnumber = await fetch(serverUrl + 'account/getuserbyphoneormail/' + inputdetails + '/' + inputdetails)
|
||||
let textdata = await sendnumber.json();
|
||||
if (textdata.result != null) {
|
||||
unibaseid = textdata.result.unibaseId;
|
||||
var myHeaders = new Headers();
|
||||
myHeaders.append("Content-Type", "application/json");
|
||||
let sendnumber = await fetch(
|
||||
serverUrl +
|
||||
"account/getuserbyphoneormail/" +
|
||||
inputdetails +
|
||||
"/" +
|
||||
inputdetails
|
||||
);
|
||||
let textdata = await sendnumber.json();
|
||||
if (textdata.result != null) {
|
||||
unibaseid = textdata.result.unibaseId;
|
||||
var myHeaders = new Headers();
|
||||
myHeaders.append("Content-Type", "application/json");
|
||||
|
||||
var raw = JSON.stringify({
|
||||
"FirstName": "",
|
||||
"LastName": "",
|
||||
"ContactNumber": "",
|
||||
"Email": "",
|
||||
"TenantName": "",
|
||||
"ContactOrEmail": inputdetails,
|
||||
"IsSignup": false,
|
||||
"IsRegisterUser": false,
|
||||
"IsForgotPswd": true,
|
||||
"UnibaseId": unibaseid,
|
||||
"OtpId": 0,
|
||||
"UserOtp": ""
|
||||
});
|
||||
var raw = JSON.stringify({
|
||||
FirstName: "",
|
||||
LastName: "",
|
||||
ContactNumber: "",
|
||||
Email: "",
|
||||
TenantName: "",
|
||||
ContactOrEmail: inputdetails,
|
||||
IsSignup: false,
|
||||
IsRegisterUser: false,
|
||||
IsForgotPswd: true,
|
||||
UnibaseId: unibaseid,
|
||||
OtpId: 0,
|
||||
UserOtp: "",
|
||||
});
|
||||
|
||||
var requestOptions = {
|
||||
method: 'POST',
|
||||
headers: myHeaders,
|
||||
body: raw,
|
||||
redirect: 'follow'
|
||||
};
|
||||
var requestOptions = {
|
||||
method: "POST",
|
||||
headers: myHeaders,
|
||||
body: raw,
|
||||
redirect: "follow",
|
||||
};
|
||||
|
||||
fetch(serverUrl + 'account/sendotp', requestOptions)
|
||||
.then(response => response.text())
|
||||
.then(function(result) {
|
||||
optid = result;
|
||||
document.getElementById('div_ForgotPswd').style.display = 'none';
|
||||
document.getElementById('modal_Otp').style.display = 'block';
|
||||
document.getElementById('div_ValidationSummary').innerHTML = "";
|
||||
})
|
||||
.catch(error => console.log('error', error));
|
||||
} else {
|
||||
let html = '<div class="p-2"><span class="error-warning">Error !</span> Email/Phonenumber does not exist</div>';
|
||||
document.getElementById('div_ValidationSummary').innerHTML = "";
|
||||
let error = document.getElementById('div_ValidationSummary');
|
||||
error.insertAdjacentHTML('beforeend', html);
|
||||
}
|
||||
fetch(serverUrl + "account/sendotp", requestOptions)
|
||||
.then((response) => response.text())
|
||||
.then(function (result) {
|
||||
optid = result;
|
||||
document.getElementById("div_ForgotPswd").style.display = "none";
|
||||
document.getElementById("modal_Otp").style.display = "block";
|
||||
document.getElementById("div_ValidationSummary").innerHTML = "";
|
||||
})
|
||||
.catch((error) => console.log("error", error));
|
||||
} else {
|
||||
let html =
|
||||
'<div class="p-2"><span class="error-warning">Error !</span> Email/Phonenumber does not exist</div>';
|
||||
document.getElementById("div_ValidationSummary").innerHTML = "";
|
||||
let error = document.getElementById("div_ValidationSummary");
|
||||
error.insertAdjacentHTML("beforeend", html);
|
||||
}
|
||||
}
|
||||
|
||||
/*verify otp*/
|
||||
async function showPasswordBox() {
|
||||
let inputdetails = document.getElementById('txt_Code').value;
|
||||
if (inputdetails.length > 0) {
|
||||
var myHeaders = new Headers();
|
||||
myHeaders.append("Content-Type", "application/json");
|
||||
var raw = JSON.stringify({
|
||||
"FirstName": "",
|
||||
"LastName": "",
|
||||
"ContactNumber": "",
|
||||
"Email": "",
|
||||
"TenantName": "",
|
||||
"ContactOrEmail": "",
|
||||
"IsForgotPswd": false,
|
||||
"IsRegisterUser": false,
|
||||
"IsSignup": true,
|
||||
"UnibaseId": "",
|
||||
"OtpId": optid,
|
||||
"UserOtp": inputdetails
|
||||
});
|
||||
|
||||
var requestOptions = {
|
||||
method: 'POST',
|
||||
headers: myHeaders,
|
||||
body: raw,
|
||||
redirect: 'follow'
|
||||
};
|
||||
|
||||
fetch(serverUrl + 'account/verifyotp', requestOptions)
|
||||
.then(response => response.text())
|
||||
.then(function(result) {
|
||||
let data = JSON.parse(result);
|
||||
if (data.result.contactConfirmed == true) {
|
||||
document.getElementById('modal_Otp').style.display = 'none';
|
||||
document.getElementById('div_ResetPswd').style.display = 'block';
|
||||
document.getElementById('div_ValidationSummary').innerHTML = "";
|
||||
} else {
|
||||
let html = '<div class="p-2" ><span class="error-warning">Error !</span> Enter Valid OTP</div>';
|
||||
document.getElementById('div_ValidationSummary').innerHTML = "";
|
||||
let error = document.getElementById('div_ValidationSummary');
|
||||
error.insertAdjacentHTML('beforeend', html);
|
||||
}
|
||||
})
|
||||
.catch(error => console.log('error', error));
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
let inputdetails = document.getElementById("txt_Code").value;
|
||||
if (inputdetails.length > 0) {
|
||||
var myHeaders = new Headers();
|
||||
myHeaders.append("Content-Type", "application/json");
|
||||
var raw = JSON.stringify({
|
||||
FirstName: "",
|
||||
LastName: "",
|
||||
ContactNumber: "",
|
||||
Email: "",
|
||||
TenantName: "",
|
||||
ContactOrEmail: "",
|
||||
IsForgotPswd: false,
|
||||
IsRegisterUser: false,
|
||||
IsSignup: true,
|
||||
UnibaseId: "",
|
||||
OtpId: optid,
|
||||
UserOtp: inputdetails,
|
||||
});
|
||||
|
||||
var requestOptions = {
|
||||
method: "POST",
|
||||
headers: myHeaders,
|
||||
body: raw,
|
||||
redirect: "follow",
|
||||
};
|
||||
|
||||
fetch(serverUrl + "account/verifyotp", requestOptions)
|
||||
.then((response) => response.text())
|
||||
.then(function (result) {
|
||||
let data = JSON.parse(result);
|
||||
if (data.result.contactConfirmed == true) {
|
||||
document.getElementById("modal_Otp").style.display = "none";
|
||||
document.getElementById("div_ResetPswd").style.display = "block";
|
||||
document.getElementById("div_ValidationSummary").innerHTML = "";
|
||||
} else {
|
||||
let html =
|
||||
'<div class="p-2" ><span class="error-warning">Error !</span> Enter Valid OTP</div>';
|
||||
document.getElementById("div_ValidationSummary").innerHTML = "";
|
||||
let error = document.getElementById("div_ValidationSummary");
|
||||
error.insertAdjacentHTML("beforeend", html);
|
||||
}
|
||||
})
|
||||
.catch((error) => console.log("error", error));
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
function showSuccessBox() {
|
||||
let txt_NewPassword = document.getElementById('txt_NewPassword').value;
|
||||
let txt_ConfirmPassword = document.getElementById('txt_ConfirmPassword').value;
|
||||
if (txt_NewPassword == txt_ConfirmPassword) {
|
||||
var myHeaders = new Headers();
|
||||
myHeaders.append("Content-Type", "application/json");
|
||||
var raw = JSON.stringify({
|
||||
"Password": txt_NewPassword,
|
||||
"UserName": unibaseid
|
||||
});
|
||||
var requestOptions = {
|
||||
method: 'POST',
|
||||
headers: myHeaders,
|
||||
body: raw,
|
||||
redirect: 'follow'
|
||||
};
|
||||
fetch(serverUrl + 'account/updatepassword', requestOptions)
|
||||
.then(response => response.text())
|
||||
.then(function(result) {
|
||||
let updatepassword = JSON.parse(result);
|
||||
let message = updatepassword.message;
|
||||
if (message == 'Password Updated Successfully') {
|
||||
document.getElementById('div_ValidationSummary').innerHTML = "";
|
||||
document.getElementById('div_ResetPswd').style.display = 'none';
|
||||
document.getElementById('div_SuccessMsg').style.display = 'block';
|
||||
}
|
||||
})
|
||||
.catch(error => console.log('error', error));
|
||||
|
||||
} else {
|
||||
let html = '<div class="p-2"> <span class="error-warning">Error !</span> Password Does not Match</div>';
|
||||
document.getElementById('div_ValidationSummary').innerHTML = "";
|
||||
let error = document.getElementById('div_ValidationSummary');
|
||||
error.insertAdjacentHTML('beforeend', html);
|
||||
}
|
||||
|
||||
}
|
||||
let txt_NewPassword = document.getElementById("txt_NewPassword").value;
|
||||
let txt_ConfirmPassword = document.getElementById(
|
||||
"txt_ConfirmPassword"
|
||||
).value;
|
||||
if (txt_NewPassword == txt_ConfirmPassword) {
|
||||
var myHeaders = new Headers();
|
||||
myHeaders.append("Content-Type", "application/json");
|
||||
var raw = JSON.stringify({
|
||||
Password: txt_NewPassword,
|
||||
UserName: unibaseid,
|
||||
});
|
||||
var requestOptions = {
|
||||
method: "POST",
|
||||
headers: myHeaders,
|
||||
body: raw,
|
||||
redirect: "follow",
|
||||
};
|
||||
fetch(serverUrl + "account/updatepassword", requestOptions)
|
||||
.then((response) => response.text())
|
||||
.then(function (result) {
|
||||
let updatepassword = JSON.parse(result);
|
||||
let message = updatepassword.message;
|
||||
if (message == "Password Updated Successfully") {
|
||||
document.getElementById("div_ValidationSummary").innerHTML = "";
|
||||
document.getElementById("div_ResetPswd").style.display = "none";
|
||||
document.getElementById("div_SuccessMsg").style.display = "block";
|
||||
}
|
||||
})
|
||||
.catch((error) => console.log("error", error));
|
||||
} else {
|
||||
let html =
|
||||
'<div class="p-2"> <span class="error-warning">Error !</span> Password Does not Match</div>';
|
||||
document.getElementById("div_ValidationSummary").innerHTML = "";
|
||||
let error = document.getElementById("div_ValidationSummary");
|
||||
error.insertAdjacentHTML("beforeend", html);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-7
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
getCookie
|
||||
} from "./cookiehelper.js";
|
||||
import {
|
||||
initListIndex
|
||||
} from "./list.index.js";
|
||||
import {getCookie} from "./cookiehelper.js";
|
||||
import {initListIndex} from "./list.index.js";
|
||||
|
||||
initListIndex();
|
||||
|
||||
|
||||
+277
-174
@@ -1,183 +1,237 @@
|
||||
/*Data loading start here*/
|
||||
import {
|
||||
getCookie
|
||||
} from "./cookiehelper.js";
|
||||
|
||||
import {
|
||||
getData,
|
||||
getDataObj
|
||||
} from "./base.js";
|
||||
import {getCookie} from "./cookiehelper.js";
|
||||
|
||||
import {getData, getDataObj} from "./base.js";
|
||||
import {_serverUrl} from "./setting.js";
|
||||
function createLoad(data) {
|
||||
let html = "";
|
||||
if (data.length != 0) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
html += `<li class="p-0">
|
||||
<a href="javascript:;" class="dropdown-item create-form-btn" data-AppConfigType="${data[i].AppConfigType}" data-AppPermissionId="${data[i].AppPermissionId}" data-AppConfigurationId="${data[i].AppConfigurationId}" data-formid="${data[i].FormId}" data-installedAppid="${data[i].InstalledAppId}">${data[i].AppTitle}</a>
|
||||
</li>`;
|
||||
}
|
||||
} else {
|
||||
html += `<li class="p-0">Apps are Not Installed</li>`;
|
||||
}
|
||||
$("#crte-btn-lst").html(html);
|
||||
$(".create-form-btn").on("click", function () {
|
||||
const date = new Date();
|
||||
let number = date.getTime();
|
||||
let serverUrl = _serverUrl();
|
||||
let appName = $(this).text();
|
||||
let formId = $(this).attr("data-formid");
|
||||
let installedAppId = $(this).attr("data-installedappid");
|
||||
let appConfigurationId = $(this).attr("data-appconfigurationid");
|
||||
let pk_id = 0;
|
||||
const cookie = getCookie("_idty");
|
||||
let fomrhtml = "";
|
||||
if (cookie) {
|
||||
const {unibaseId, tenantId, userId} = JSON.parse(cookie);
|
||||
fomrhtml = `<div class="frm-ifre frm-ifre-${number}" id="frm-ifre-${number}">
|
||||
<ul class="m-0 p-0">
|
||||
<li class="frm-hdr">
|
||||
<div>${appName}</div>
|
||||
<div class="ctrl">
|
||||
<a href="javascript:;" class="minimize" data-unid="${number}" data-ispopup="true"><span><i class="la la-minus"></i></span></a>
|
||||
<a href="javascript:;" class="maximum" data-unid="${number}"><span><i class="la la-expand"></i></span></a>
|
||||
<a href="javascript:;" class="compress d-none" data-unid="${number}"><span><i class="las la-compress"></i></span></a>
|
||||
<a href="javascript:;" class="close" data-unid="${number}"><span><i class="la la-times"></i></span></a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="frm-bdy">
|
||||
<iframe class="ld-frm-src" data-ispopup="false" src="${serverUrl}#/${unibaseId}/${tenantId}/${userId}/${installedAppId}/${formId}/${pk_id}/${appConfigurationId}/loadform"></iframe>
|
||||
</li>
|
||||
<li class="frm-ftr"></li>
|
||||
</ul>
|
||||
</div>`;
|
||||
}
|
||||
$("#list-page").after(fomrhtml);
|
||||
window.window.postMessage("ld-frm-ifrme", "*");
|
||||
hdrCrtnClckEvnt(number);
|
||||
});
|
||||
}
|
||||
function hdrCrtnClckEvnt(number) {
|
||||
$(`.frm-ifre-${number} .minimize`).on("click", function () {
|
||||
let id = $(this).attr("data-unid");
|
||||
let isPopUpState = $(this).attr("data-ispopup");
|
||||
let height = $(`.frm-ifre-${id}`).find(".frm-hdr").height();
|
||||
$(`.frm-ifre-${id} .frm-bdy`).toggleClass("d-none");
|
||||
if (isPopUpState == "true") {
|
||||
// popup large
|
||||
$(this).attr("data-ispopup", "false");
|
||||
$(`.frm-ifre-${id}`).css({
|
||||
width: "22%",
|
||||
height: height,
|
||||
bottom: "0px",
|
||||
});
|
||||
} else {
|
||||
// popup small
|
||||
$(this).attr("data-ispopup", "true");
|
||||
$(`.frm-ifre-${id}`).css({
|
||||
width: "",
|
||||
height: "",
|
||||
bottom: "",
|
||||
});
|
||||
}
|
||||
});
|
||||
$(`.frm-ifre-${number} .maximum`).on("click", function () {
|
||||
let id = $(this).attr("data-unid");
|
||||
$(this).addClass("d-none");
|
||||
$(this).siblings(".compress").removeClass("d-none");
|
||||
$(`.frm-ifre-${id}`).find(".ld-frm-src").attr("data-ispopup", "true");
|
||||
$(`.frm-ifre-${id}`).css({width: "75%", height: "", bottom: "auto"});
|
||||
$(`.frm-ifre-${id} .ld-frm-src`).css({width: "100%"});
|
||||
$(`.frm-ifre-${id} .frm-bdy`).removeClass("d-none");
|
||||
$("#list-page").css({filter: "blur(2px)", opacity: "0.5"});
|
||||
});
|
||||
$(`.frm-ifre-${number} .compress`).on("click", function () {
|
||||
let id = $(this).attr("data-unid");
|
||||
$(this).addClass("d-none");
|
||||
$(this).siblings(".maximum").removeClass("d-none");
|
||||
$(`.frm-ifre-${id}`).css({width: "", bottom: ""});
|
||||
$(`.frm-ifre-${id} .ld-frm-src`).css({width: ""});
|
||||
$("#list-page").css({filter: "", opacity: ""});
|
||||
});
|
||||
$(`.frm-ifre-${number} .close`).on("click", function () {
|
||||
let id = $(this).attr("data-unid");
|
||||
$("#list-page").css({filter: "unset", opacity: "1"});
|
||||
$(`.frm-ifre-${id}`).remove();
|
||||
});
|
||||
}
|
||||
function loadData() {
|
||||
getData(
|
||||
"apis/v4/unibase/reminders/platform/getunreadreminders/ReminderType/6/PageSize/20"
|
||||
).then(function(result) {
|
||||
let response = JSON.parse(result.result);
|
||||
if (response.length != 0) {
|
||||
// Notifcations
|
||||
let bdyUI = '<div class="accordion" id="notifi-list">';
|
||||
for (var i = 0; i < response.length; i++) {
|
||||
bdyUI += `<li class="item-li" id="${
|
||||
response[i].ReminderId
|
||||
}" data-ref="${
|
||||
response[i].RedirectOptions.RefId
|
||||
}" data-installedAppId="${
|
||||
response[i].RedirectOptions.InstalledAppId
|
||||
}" data-formId="${response[i].RedirectOptions.CreateFormId}">
|
||||
<div class="accordion-header" id="accHeader-${
|
||||
response[i].ReminderId
|
||||
}">
|
||||
<div class="notifiListItms accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#collapse-${
|
||||
response[i].ReminderId
|
||||
}" aria-expanded="false" aria-controls="collapseOne">
|
||||
getData(
|
||||
"apis/v4/unibase/reminders/platform/getunreadreminders/ReminderType/6/PageSize/20"
|
||||
).then(function (result) {
|
||||
let response = JSON.parse(result.result);
|
||||
if (response.length != 0) {
|
||||
// Notifcations
|
||||
let bdyUI = '<div class="accordion" id="notifi-list">';
|
||||
for (var i = 0; i < response.length; i++) {
|
||||
bdyUI += `<li class="item-li" id="${response[i].ReminderId}" data-ref="${response[i].RedirectOptions.RefId}" data-installedAppId="${response[i].RedirectOptions.InstalledAppId}" data-formId="${response[i].RedirectOptions.CreateFormId}">
|
||||
<div class="accordion-header" id="accHeader-${response[i].ReminderId}">
|
||||
<div class="notifiListItms accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#collapse-${response[i].ReminderId}" aria-expanded="false" aria-controls="collapseOne">
|
||||
<div class="row m-0 w-100 p-0 ">
|
||||
<div class="col-1 ">
|
||||
<input class="form-check-input mx-1" type="checkbox" value="" id="flexCheckDefault">
|
||||
</div>
|
||||
<div class="col-4 text-truncate">
|
||||
<span class="mx-1">${
|
||||
response[i].Subject
|
||||
}</span>
|
||||
<span class="mx-1">${response[i].Subject}</span>
|
||||
</div>
|
||||
<div class="col-5 text-truncate">
|
||||
<span class="mx-1">${
|
||||
response[i].Message
|
||||
}</span>
|
||||
<span class="mx-1">${response[i].Message}</span>
|
||||
</div>
|
||||
<div class="col-2 text-truncate">
|
||||
<span class="mx-1">22 minutes ago</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="collapse-${
|
||||
response[i].ReminderId
|
||||
}" class="accordion-collapse collapse" aria-labelledby="accHeader-${
|
||||
response[i].ReminderId
|
||||
}" data-bs-parent="#notifi-list">
|
||||
<div class="accordion-body" id="accBody${
|
||||
response[i].ReminderId
|
||||
}">
|
||||
<div id="collapse-${response[i].ReminderId}" class="accordion-collapse collapse" aria-labelledby="accHeader-${response[i].ReminderId}" data-bs-parent="#notifi-list">
|
||||
<div class="accordion-body" id="accBody${response[i].ReminderId}">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>`;
|
||||
}
|
||||
bdyUI += "</div>";
|
||||
$(".bdy-ul").append(bdyUI);
|
||||
|
||||
$(".notifiListItms").on("click", function() {
|
||||
let _this = $(this).parents(".item-li");
|
||||
let obj = {
|
||||
FromDate: "2022/11/30",
|
||||
InstalledAppId: Number($(_this).attr("data-installedAppId")),
|
||||
RecordId: Number($(_this).attr("data-ref")),
|
||||
ToDate: "2022/11/30",
|
||||
};
|
||||
//let obj = { "FromDate": "2022/11/30", "InstalledAppId": 102530270000109, "RecordId": 102533490346298, "ToDate": "2022/11/30" };
|
||||
getDataObj(
|
||||
"apis/v4/unibase/platform/widgets/getdefaultwidget",
|
||||
obj,
|
||||
true,
|
||||
"POST"
|
||||
).then(function(response) {
|
||||
let res = JSON.parse(response.result),
|
||||
html = "";
|
||||
if (response.message == "200" && response.errors == null) {
|
||||
html = `<ul class="p-0 m-0 d-flex flex-row">`;
|
||||
if (
|
||||
res.AppConfigurations != null &&
|
||||
res.AppConfigurations.length > 0
|
||||
) {
|
||||
for (var k = 0; k < res.AppConfigurations.length; k++) {
|
||||
html += `<li class="mx-2 btn-outline-primary btn btn-sm">${res.AppConfigurations[k].SettingName}</li>`;
|
||||
}
|
||||
} else {
|
||||
html += `<li class="p-1 my-0 alert alert-danger" role="alert">
|
||||
}
|
||||
bdyUI += "</div>";
|
||||
$(".bdy-ul").append(bdyUI);
|
||||
|
||||
$(".notifiListItms").on("click", function () {
|
||||
let _this = $(this).parents(".item-li");
|
||||
let obj = {
|
||||
FromDate: "2022/11/30",
|
||||
InstalledAppId: Number($(_this).attr("data-installedAppId")),
|
||||
RecordId: Number($(_this).attr("data-ref")),
|
||||
ToDate: "2022/11/30",
|
||||
};
|
||||
//let obj = { "FromDate": "2022/11/30", "InstalledAppId": 102530270000109, "RecordId": 102533490346298, "ToDate": "2022/11/30" };
|
||||
getDataObj(
|
||||
"apis/v4/unibase/platform/widgets/getdefaultwidget",
|
||||
obj,
|
||||
true,
|
||||
"POST"
|
||||
).then(function (response) {
|
||||
let res = JSON.parse(response.result),
|
||||
html = "";
|
||||
if (response.message == "200" && response.errors == null) {
|
||||
html = `<ul class="p-0 m-0 d-flex flex-row">`;
|
||||
if (
|
||||
res.AppConfigurations != null &&
|
||||
res.AppConfigurations.length > 0
|
||||
) {
|
||||
for (var k = 0; k < res.AppConfigurations.length; k++) {
|
||||
html += `<li class="mx-2 btn-outline-primary btn btn-sm">${res.AppConfigurations[k].SettingName}</li>`;
|
||||
}
|
||||
} else {
|
||||
html += `<li class="p-1 my-0 alert alert-danger" role="alert">
|
||||
App Configurations Not configure
|
||||
</li>`;
|
||||
}
|
||||
if (res.Stages != null) {
|
||||
for (var x = 0; x < res.Stages.length; x++) {
|
||||
if (res.Stages[x].IsDefault) {
|
||||
html += `<li class="ml-auto">
|
||||
}
|
||||
if (res.Stages != null) {
|
||||
for (var x = 0; x < res.Stages.length; x++) {
|
||||
if (res.Stages[x].IsDefault) {
|
||||
html += `<li class="ml-auto">
|
||||
<a class="btn btn-sm btn-secondary dropdown-toggle" href="javascript:void(0)" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
${res.Stages[x].StageName}
|
||||
</a>
|
||||
<ul class="dropdown-menu">`;
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < res.Stages.length; i++) {
|
||||
if (!res.Stages[i].IsDefault) {
|
||||
html += `<li><a class="dropdown-item" href="javascript:void(0);">${res.Stages[i].StageName}</a></li>`;
|
||||
}
|
||||
}
|
||||
html += "</ul></li>";
|
||||
} else {
|
||||
html += `<li class="p-1 my-0 alert alert-danger ml-auto" role="alert">
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < res.Stages.length; i++) {
|
||||
if (!res.Stages[i].IsDefault) {
|
||||
html += `<li><a class="dropdown-item" href="javascript:void(0);">${res.Stages[i].StageName}</a></li>`;
|
||||
}
|
||||
}
|
||||
html += "</ul></li>";
|
||||
} else {
|
||||
html += `<li class="p-1 my-0 alert alert-danger ml-auto" role="alert">
|
||||
No Stages
|
||||
</li>`;
|
||||
}
|
||||
html += `<li class="p-1 mx-2 my-0 btn-outline-info detailBtn btn btn-sm" data-appid="${Number($(_this).attr("data-installedAppId"))}" data-recordid="${Number($(_this).attr("data-ref"))}">Details-Page</li></ul>`;
|
||||
} else {
|
||||
html += `<div class="alert alert-danger" role="alert">
|
||||
}
|
||||
html += `<li class="p-1 mx-2 my-0 btn-outline-info detailBtn btn btn-sm" data-appid="${Number(
|
||||
$(_this).attr("data-installedAppId")
|
||||
)}" data-recordid="${Number(
|
||||
$(_this).attr("data-ref")
|
||||
)}">Details-Page</li></ul>`;
|
||||
} else {
|
||||
html += `<div class="alert alert-danger" role="alert">
|
||||
${response.message} ${response.errors}
|
||||
</div>`;
|
||||
}
|
||||
$(_this).find(".accordion-body").html(html);
|
||||
detailClick();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
getData(
|
||||
"apis/v4/unibase/reminders/platform/getunreadreminders/ReminderType/1/PageSize/20"
|
||||
).then(function(tskResp) {
|
||||
let response = JSON.parse(tskResp.result);
|
||||
if (response.length != 0) {
|
||||
let _tskhtml = '<div class="accordion" id="task-list">';
|
||||
for (var i = 0; i < response.length; i++) {
|
||||
|
||||
_tskhtml += `<li class="item-li" id="${
|
||||
response[i].ReminderId
|
||||
}" data-ref="${
|
||||
response[i].RedirectOptions.RefId
|
||||
}" data-installedAppId="${
|
||||
response[i].RedirectOptions.InstalledAppId
|
||||
}" data-formId="${response[i].RedirectOptions.CreateFormId}">
|
||||
<div class="accordion-header" id="accHeader-${
|
||||
response[i].ReminderId
|
||||
}">
|
||||
<div class="tskListItms accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#collapse-${
|
||||
response[i].ReminderId
|
||||
}" aria-expanded="false" aria-controls="collapseOne">
|
||||
}
|
||||
$(_this).find(".accordion-body").html(html);
|
||||
detailClick();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
getData(
|
||||
"apis/v4/unibase/reminders/platform/getunreadreminders/ReminderType/1/PageSize/20"
|
||||
).then(function (tskResp) {
|
||||
let response = JSON.parse(tskResp.result);
|
||||
if (response.length != 0) {
|
||||
let _tskhtml = '<div class="accordion" id="task-list">';
|
||||
for (var i = 0; i < response.length; i++) {
|
||||
_tskhtml += `<li class="item-li" id="${response[i].ReminderId}" data-ref="${response[i].RedirectOptions.RefId}" data-installedAppId="${response[i].RedirectOptions.InstalledAppId}" data-formId="${response[i].RedirectOptions.CreateFormId}">
|
||||
<div class="accordion-header" id="accHeader-${response[i].ReminderId}">
|
||||
<div class="tskListItms accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#collapse-${response[i].ReminderId}" aria-expanded="false" aria-controls="collapseOne">
|
||||
<div class="row m-0 w-100 p-0 ">
|
||||
<div class="col-1 ">
|
||||
<input class="form-check-input mx-1" type="checkbox" value="" id="flexCheckDefault">
|
||||
</div>
|
||||
<div class="col-4 text-truncate">
|
||||
<span class="mx-1">${
|
||||
response[i].Subject
|
||||
}</span>
|
||||
<span class="mx-1">${response[i].Subject}</span>
|
||||
</div>
|
||||
<div class="col-5 text-truncate">
|
||||
<span class="mx-1">${
|
||||
response[i].Message
|
||||
}</span>
|
||||
<span class="mx-1">${response[i].Message}</span>
|
||||
</div>
|
||||
<div class="col-2 text-truncate">
|
||||
<span class="mx-1">2 seconds</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="collapse-${
|
||||
response[i].ReminderId
|
||||
}" class="accordion-collapse collapse" aria-labelledby="accHeader-${
|
||||
response[i].ReminderId
|
||||
}" data-bs-parent="#notifi-list">
|
||||
<div class="accordion-body" id="accBody${
|
||||
response[i].ReminderId
|
||||
}">
|
||||
<div id="collapse-${response[i].ReminderId}" class="accordion-collapse collapse" aria-labelledby="accHeader-${response[i].ReminderId}" data-bs-parent="#notifi-list">
|
||||
<div class="accordion-body" id="accBody${response[i].ReminderId}">
|
||||
<ul class="p-0 m-0 d-flex flex-row justify-content-between">
|
||||
<li class="mx-2 btn-outline-success btn btn-sm">Confirm</li>
|
||||
<li class="mx-2 btn-outline-danger btn btn-sm">Reject</li>
|
||||
@@ -188,54 +242,103 @@ function loadData() {
|
||||
</div>
|
||||
</div>
|
||||
</li>`;
|
||||
}
|
||||
_tskhtml += "</div>";
|
||||
$(".bdy-ul").append(_tskhtml);
|
||||
detailClick()
|
||||
}
|
||||
_tskhtml += "</div>";
|
||||
$(".bdy-ul").append(_tskhtml);
|
||||
detailClick();
|
||||
}
|
||||
});
|
||||
|
||||
// create button apps load
|
||||
let appName = [];
|
||||
getData("apis/v4/unibase/platform/apps/myapps").then(function (res) {
|
||||
let response = JSON.parse(res.result);
|
||||
jQuery.each(response, async function (index, item) {
|
||||
let installedAppId = Number(item.MyAppId);
|
||||
await getData(
|
||||
`apis/v4/unibase/platform/apps/listappconfigurations/installedappid/${installedAppId}`
|
||||
).then(function (result) {
|
||||
if (
|
||||
result.result != null &&
|
||||
result.result != "" &&
|
||||
result.result != "[]"
|
||||
) {
|
||||
let _data = JSON.parse(result.result);
|
||||
let data = _data.filter((x) => x.SettingUrlType == 1);
|
||||
if (data.length != 0) {
|
||||
appName.push({
|
||||
SettingUrlType: data[0].SettingUrlType,
|
||||
AppTitle: data[0].AppTitle,
|
||||
FormId: data[0].FormId,
|
||||
InstalledAppId: data[0].InstalledAppId,
|
||||
RoleSettingAppId: data[0].RoleSettingAppId,
|
||||
InstalledAppGuid: data[0].InstalledAppGuid,
|
||||
AppConfigurationId: data[0].AppConfigurationId,
|
||||
AppPermissionId: data[0].AppPermissionId,
|
||||
AppConfigType: data[0].AppConfigType,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
await createLoad(appName);
|
||||
});
|
||||
});
|
||||
}
|
||||
export function detailClick(){
|
||||
$('.detailBtn').click(function() {
|
||||
$('.bdy-ul').addClass('d-none');
|
||||
let installedAppId = +$(this).attr('data-appId');
|
||||
let recordId = +$(this).attr('data-recordId')
|
||||
// Unibase.Themes.Compact.Components.Notification.Instance().loadReminderDetails(105013010001972,105010260000090,'Details','null',6,0,null)
|
||||
const cookie = getCookie('_idty');
|
||||
if (cookie) {
|
||||
const {
|
||||
unibaseId,
|
||||
tenantId,
|
||||
userId
|
||||
} = JSON.parse(cookie);
|
||||
debugger;
|
||||
$('#detailIframe').html(
|
||||
`<iframe width="100%" style="min-height:calc(100vh - ${$('.tp-bar').height()}px)" name="srcframe" id="srcframe" class="srcframe" src="http://localhost:3088/#/${unibaseId}/${tenantId}/${userId}/${recordId}/${installedAppId}/loadDetail"></iframe>`
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
export function detailClick() {
|
||||
$(".detailBtn").click(function () {
|
||||
let serverUrl = _serverUrl();
|
||||
$(".bdy-ul").addClass("d-none");
|
||||
let installedAppId = +$(this).attr("data-appId");
|
||||
let recordId = +$(this).attr("data-recordId");
|
||||
// Unibase.Themes.Compact.Components.Notification.Instance().loadReminderDetails(105013010001972,105010260000090,'Details','null',6,0,null)
|
||||
const cookie = getCookie("_idty");
|
||||
if (cookie) {
|
||||
const {unibaseId, tenantId, userId} = JSON.parse(cookie);
|
||||
debugger;
|
||||
$("#detailIframe").html(
|
||||
`<iframe width="100%" style="min-height:calc(100vh - ${$(
|
||||
".tp-bar"
|
||||
).height()}px)" name="srcframe" id="srcframe" class="srcframe" src="${serverUrl}#/${unibaseId}/${tenantId}/${userId}/${recordId}/${installedAppId}/loadDetail"></iframe>`
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function initListIndex() {
|
||||
let _userInfo = atob(document.cookie.split("=")[1]);
|
||||
let userInfo = " JSON.parse(_userInfo).result";
|
||||
let sessionId = "userInfo.sessionId";
|
||||
let _userInfo = atob(document.cookie.split("=")[1]);
|
||||
let userInfo = " JSON.parse(_userInfo).result";
|
||||
let sessionId = "userInfo.sessionId";
|
||||
|
||||
let usrinfoHTML = `<li><a class="dropdown-item" href="javascript:void(0);">${userInfo.name}</a></li>
|
||||
let usrinfoHTML = `<li><a class="dropdown-item" href="javascript:void(0);">${userInfo.name}</a></li>
|
||||
<li><a class="dropdown-item" href="javascript:void(0);">Cloud Settings</a></li>
|
||||
<li><a class="dropdown-item" href="javascript:void(0);">Help</a></li>
|
||||
<li><a class="dropdown-item" href="javascript:void(0);">Logoff</a></li>`;
|
||||
$(".icn-circle").text(userInfo?.name?.charAt(0)?.toUpperCase());
|
||||
$(".uindtls").html(usrinfoHTML);
|
||||
$(".icn-circle").text(userInfo?.name?.charAt(0)?.toUpperCase());
|
||||
$(".uindtls").html(usrinfoHTML);
|
||||
|
||||
// List Page loading
|
||||
// List Page loading
|
||||
|
||||
/*Data loading start here*/
|
||||
$(".mnNvIcn").click(function() {
|
||||
$(".lft-nav-bar").toggleClass("lft-nav-bar-Wrap");
|
||||
$(".ctr-lst-pge").toggleClass("lft-nav-bar-Wrap");
|
||||
/*Data loading start here*/
|
||||
$(".mnNvIcn").click(function () {
|
||||
$(".lft-nav-bar").toggleClass("lft-nav-bar-Wrap");
|
||||
$(".ctr-lst-pge").toggleClass("lft-nav-bar-Wrap");
|
||||
});
|
||||
$(".mre-drp a.sub-nav-item.more").on("click", function () {
|
||||
$(".sub-nav-item").removeClass("active");
|
||||
if ($(this)[0].className.includes("active")) {
|
||||
$(this).find("i").css("transform", "rotate(0deg)");
|
||||
$(this).removeClass("active");
|
||||
} else {
|
||||
$(this).find("i").css("transform", "rotate(180deg)");
|
||||
$(this).addClass("active");
|
||||
}
|
||||
$(this).siblings(".ul-drpdown").toggleClass("d-none");
|
||||
});
|
||||
$("a.sub-nav-item")
|
||||
.not(".more.active")
|
||||
.on("click", function () {
|
||||
$(".sub-nav-item").not(".more.active").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
});
|
||||
loadData();
|
||||
}
|
||||
loadData();
|
||||
}
|
||||
|
||||
+100
-106
@@ -1,147 +1,141 @@
|
||||
import {
|
||||
setCookie
|
||||
} from "./cookiehelper.js";
|
||||
import {
|
||||
_serverUrl
|
||||
} from "./setting.js";
|
||||
|
||||
import {setCookie} from "./cookiehelper.js";
|
||||
import {_serverUrl} from "./setting.js";
|
||||
|
||||
const serverUrl = _serverUrl();
|
||||
|
||||
const emailInputEl = document.getElementById("email");
|
||||
const passwordInputEl = document.getElementById("password");
|
||||
const emailErrEl = document.getElementById("emailErrMsg");
|
||||
const passwordErrEl = document.getElementById("passwordErrMsg");
|
||||
const emailContainerEl = document.getElementById("emailBox");
|
||||
const passwordContainerEl = document.getElementById("passwordBox");
|
||||
const showPasswordChk = document.getElementById("showPassword");
|
||||
const emailNextBtn = document.getElementById("emailNextBtn");
|
||||
const renterEmailLink = document.getElementById("renterEmail");
|
||||
const loginSubmitBtn = document.getElementById("loginSubmitBtn");
|
||||
|
||||
const emailInputEl = document.getElementById('email');
|
||||
const passwordInputEl = document.getElementById('password');
|
||||
const emailErrEl = document.getElementById('emailErrMsg');
|
||||
const passwordErrEl = document.getElementById('passwordErrMsg');
|
||||
const emailContainerEl = document.getElementById('emailBox');
|
||||
const passwordContainerEl = document.getElementById('passwordBox');
|
||||
const showPasswordChk = document.getElementById('showPassword');
|
||||
const emailNextBtn = document.getElementById('emailNextBtn');
|
||||
const renterEmailLink = document.getElementById('renterEmail');
|
||||
const loginSubmitBtn = document.getElementById('loginSubmitBtn');
|
||||
|
||||
passwordContainerEl.style.display = 'none';
|
||||
passwordContainerEl.style.display = "none";
|
||||
emailInputEl.focus();
|
||||
|
||||
function showPasswordBox() {
|
||||
const email = emailInputEl.value;
|
||||
if (validateEmailOrPhone()) {
|
||||
emailContainerEl.style.display = 'none';
|
||||
passwordContainerEl.style.display = 'block';
|
||||
document.getElementById('entered-email').innerHTML = email;
|
||||
passwordInputEl.focus();
|
||||
emailInputEl.classList.remove('error');
|
||||
emailErrEl.innerText = '';
|
||||
} else {
|
||||
emailInputEl.classList.add('error');
|
||||
emailErrEl.innerText = 'Please enter valid email or phone';
|
||||
}
|
||||
const email = emailInputEl.value;
|
||||
if (validateEmailOrPhone()) {
|
||||
emailContainerEl.style.display = "none";
|
||||
passwordContainerEl.style.display = "block";
|
||||
document.getElementById("entered-email").innerHTML = email;
|
||||
passwordInputEl.focus();
|
||||
emailInputEl.classList.remove("error");
|
||||
emailErrEl.innerText = "";
|
||||
} else {
|
||||
emailInputEl.classList.add("error");
|
||||
emailErrEl.innerText = "Please enter valid email or phone";
|
||||
}
|
||||
}
|
||||
|
||||
function validateEmailOrPhone() {
|
||||
const value = emailInputEl.value.trim();
|
||||
const regx = /^[6-9]\d{9}$/;
|
||||
if (value.includes('@') || regx.test(value)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
const value = emailInputEl.value.trim();
|
||||
const regx = /^[6-9]\d{9}$/;
|
||||
if (value.includes("@") || regx.test(value)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function togglePassword() {
|
||||
const ele = document.getElementById('showPassword');
|
||||
const password = passwordInputEl;
|
||||
const ele = document.getElementById("showPassword");
|
||||
const password = passwordInputEl;
|
||||
|
||||
if (password.value.length > 0) {
|
||||
passwordInputEl.value = password.value;
|
||||
password.focus();
|
||||
if (ele.checked) {
|
||||
password.setAttribute('type', 'text');
|
||||
} else {
|
||||
password.setAttribute('type', 'password');
|
||||
}
|
||||
if (password.value.length > 0) {
|
||||
passwordInputEl.value = password.value;
|
||||
password.focus();
|
||||
if (ele.checked) {
|
||||
password.setAttribute("type", "text");
|
||||
} else {
|
||||
password.setAttribute("type", "password");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onPasswordFocusOut() {
|
||||
const passwordLabel = document.getElementById('passwordLabel');
|
||||
if (passwordInputEl.value.length > 0) {
|
||||
passwordLabel.classList.add('password-fixed');
|
||||
} else {
|
||||
passwordLabel.classList.remove('password-fixed');
|
||||
}
|
||||
const passwordLabel = document.getElementById("passwordLabel");
|
||||
if (passwordInputEl.value.length > 0) {
|
||||
passwordLabel.classList.add("password-fixed");
|
||||
} else {
|
||||
passwordLabel.classList.remove("password-fixed");
|
||||
}
|
||||
}
|
||||
|
||||
function onEmailFocusOut() {
|
||||
const emailLabel = document.getElementById('emailLabel');
|
||||
if (emailInputEl.value.trim()) {
|
||||
emailLabel.classList.add('password-fixed');
|
||||
} else {
|
||||
emailLabel.classList.remove('password-fixed');
|
||||
}
|
||||
const emailLabel = document.getElementById("emailLabel");
|
||||
if (emailInputEl.value.trim()) {
|
||||
emailLabel.classList.add("password-fixed");
|
||||
} else {
|
||||
emailLabel.classList.remove("password-fixed");
|
||||
}
|
||||
}
|
||||
|
||||
function loginUser(email, password) {
|
||||
const postData = JSON.stringify({
|
||||
UserName: email,
|
||||
Password: password,
|
||||
UnibaseId: '',
|
||||
RememberMe: false,
|
||||
const postData = JSON.stringify({
|
||||
UserName: email,
|
||||
Password: password,
|
||||
UnibaseId: "",
|
||||
RememberMe: false,
|
||||
});
|
||||
|
||||
const requestOptions = {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: postData,
|
||||
redirect: "follow",
|
||||
};
|
||||
|
||||
fetch(serverUrl + "account/login", requestOptions)
|
||||
.then((response) => response.text())
|
||||
.then((result) => {
|
||||
const data = JSON.parse(result);
|
||||
if (data.status === 0) {
|
||||
setCookie("_idty", JSON.stringify(data.result), 1);
|
||||
window.location = "../authentication";
|
||||
} else {
|
||||
passwordErrEl.innerText = data.message;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
passwordErrEl.innerText = error;
|
||||
});
|
||||
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: postData,
|
||||
redirect: 'follow',
|
||||
};
|
||||
|
||||
fetch(serverUrl + 'account/login', requestOptions)
|
||||
.then((response) => response.text())
|
||||
.then((result) => {
|
||||
const data = JSON.parse(result);
|
||||
if (data.status === 0) {
|
||||
setCookie('_idty', JSON.stringify(data.result), 1);
|
||||
window.location = '../authentication';
|
||||
} else {
|
||||
passwordErrEl.innerText = data.message;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
passwordErrEl.innerText = error;
|
||||
});
|
||||
}
|
||||
|
||||
function validateLogin() {
|
||||
const email = emailInputEl.value;
|
||||
const password = passwordInputEl.value;
|
||||
if (password.trim().length !== 0) {
|
||||
loginUser(email, password);
|
||||
} else {
|
||||
passwordInputEl.classList.add('error');
|
||||
passwordErrEl.innerText = 'Please enter valid password';
|
||||
}
|
||||
const email = emailInputEl.value;
|
||||
const password = passwordInputEl.value;
|
||||
if (password.trim().length !== 0) {
|
||||
loginUser(email, password);
|
||||
} else {
|
||||
passwordInputEl.classList.add("error");
|
||||
passwordErrEl.innerText = "Please enter valid password";
|
||||
}
|
||||
}
|
||||
|
||||
function reEnterEmailClickHandler() {
|
||||
emailContainerEl.style.display = 'block';
|
||||
passwordContainerEl.style.display = 'none';
|
||||
emailInputEl.focus();
|
||||
emailContainerEl.style.display = "block";
|
||||
passwordContainerEl.style.display = "none";
|
||||
emailInputEl.focus();
|
||||
}
|
||||
|
||||
function initializeEventListeners() {
|
||||
emailNextBtn.addEventListener('click', showPasswordBox);
|
||||
emailNextBtn.addEventListener("click", showPasswordBox);
|
||||
|
||||
showPasswordChk.addEventListener('click', togglePassword);
|
||||
showPasswordChk.addEventListener("click", togglePassword);
|
||||
|
||||
passwordInputEl.addEventListener('focusout', onPasswordFocusOut);
|
||||
passwordInputEl.addEventListener("focusout", onPasswordFocusOut);
|
||||
|
||||
emailInputEl.addEventListener('focusout', onEmailFocusOut);
|
||||
emailInputEl.addEventListener("focusout", onEmailFocusOut);
|
||||
|
||||
loginSubmitBtn.addEventListener('click', validateLogin);
|
||||
loginSubmitBtn.addEventListener("click", validateLogin);
|
||||
|
||||
renterEmailLink.addEventListener('click', reEnterEmailClickHandler);
|
||||
renterEmailLink.addEventListener("click", reEnterEmailClickHandler);
|
||||
}
|
||||
|
||||
initializeEventListeners();
|
||||
initializeEventListeners();
|
||||
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
import { isAuthenticated } from "./cookiehelper.js";
|
||||
import {isAuthenticated} from "./cookiehelper.js";
|
||||
|
||||
function checkUser(params) {
|
||||
if (isAuthenticated()) {
|
||||
window.location = './authentication';
|
||||
} else {
|
||||
window.location = './login';
|
||||
}
|
||||
if (isAuthenticated()) {
|
||||
window.location = "./authentication";
|
||||
} else {
|
||||
window.location = "./login";
|
||||
}
|
||||
}
|
||||
|
||||
checkUser();
|
||||
checkUser();
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
export function _serverUrl() {
|
||||
// sachin 2.0 commitw
|
||||
// sudheer 1.0 new branch
|
||||
return 'http://localhost:3086/';
|
||||
}
|
||||
// sachin 2.0 commitw
|
||||
// sudheer 1.0 new branch
|
||||
//return "http://localhost:3088/";
|
||||
//return "http://localhost:3086/";
|
||||
//return "https://c01.bizgaze.app/";
|
||||
return "http://192.168.88.99:4001/";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user