Iniit
This commit is contained in:
@@ -0,0 +1,584 @@
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var Bizgaze;
|
||||
(function (Bizgaze) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Communications;
|
||||
(function (Communications) {
|
||||
let AI;
|
||||
(function (AI) {
|
||||
let Components;
|
||||
(function (Components) {
|
||||
class BusinessCards extends Unibase.Platform.Core.BaseComponent {
|
||||
constructor() {
|
||||
super();
|
||||
this.inputParameters = [];
|
||||
this.reportIdGallery = null;
|
||||
this.fileValue = null;
|
||||
this.reqType = 1;
|
||||
this.resumeType = ['pdf', 'doc', 'docx'];
|
||||
this.businessCardsType = ['png', 'jpg', 'jpeg', 'JPEG', 'pdf'];
|
||||
this.salesInvoiceType = ['pdf'];
|
||||
this.currFile = '';
|
||||
this.moreFiles = [];
|
||||
this.lastLength = 0;
|
||||
this.contid = '';
|
||||
this.navigationhelper = Unibase.Platform.Helpers.NavigationHelper.Instance();
|
||||
}
|
||||
cssFiles() {
|
||||
return [];
|
||||
}
|
||||
jsFiles() {
|
||||
return ["apps/communications/events/managers/gallerymanager.js", "apps/communications/ai/components/resumeparsingmanager.js"];
|
||||
}
|
||||
getMulupleBase64(event) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let file = event.target.files;
|
||||
const promisesArr = [];
|
||||
for (let i = 0; i < file.length; i++) {
|
||||
const currFile = file[i];
|
||||
const currp = new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(currFile);
|
||||
reader.onloadend = function () {
|
||||
var base64String = reader.result.toString().replace(/^data:.+;base64,/, '');
|
||||
var fileReq = {
|
||||
FileData: base64String,
|
||||
FileName: currFile.name.split('.').slice(0, -1).join('.'),
|
||||
FileType: currFile.name.split('.').pop(),
|
||||
FilePath: ''
|
||||
};
|
||||
resolve(fileReq);
|
||||
};
|
||||
reader.onerror = function (e) {
|
||||
reject(e);
|
||||
};
|
||||
});
|
||||
promisesArr.push(currp);
|
||||
}
|
||||
const ans = yield Promise.all(promisesArr);
|
||||
return ans;
|
||||
});
|
||||
}
|
||||
getCompressFiles(e) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let instance = this;
|
||||
const compressArr = [];
|
||||
for (let i = 0; i < e.target.files.length; i++) {
|
||||
const currFile = e.target.files[i];
|
||||
console.log(currFile);
|
||||
let baseString = yield instance.compressImgInputMoreHandler(currFile);
|
||||
compressArr.push(baseString);
|
||||
}
|
||||
let cardsBox = '';
|
||||
return compressArr;
|
||||
});
|
||||
}
|
||||
generateCardsHTML() {
|
||||
let instance = this;
|
||||
let cards = instance.moreFiles;
|
||||
if ($('.childContainerBusinessCard').length === 0) {
|
||||
$('.containerBusinessCards').append('<div style="gap:20px; display:grid; align-items: start; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-content: flex-start;" class="childContainerBusinessCard w-100 h-100 py-4"></div>');
|
||||
}
|
||||
let cardsHTML = '';
|
||||
for (let i = instance.lastLength; i < cards.length; i++) {
|
||||
const currItem = cards[i];
|
||||
cardsHTML += instance.cardbox(`data:image/png;base64, ${currItem.FileData}`, currItem.FileName, currItem.FileType);
|
||||
}
|
||||
$('.addMoreFiles').remove();
|
||||
cardsHTML += instance.addMoreFileHTML();
|
||||
$('.childContainerBusinessCard').append(cardsHTML);
|
||||
$('.deleteBcard').each(function (i, evt) {
|
||||
$(evt).off().click(function (el) {
|
||||
const elId = $(el.target).parents('.businessCardbox').data('id');
|
||||
const newFilterArr = instance.moreFiles.filter((e) => {
|
||||
return e.FileName != elId;
|
||||
});
|
||||
instance.moreFiles = newFilterArr;
|
||||
$(el.target).parents('.businessCardbox').remove();
|
||||
if ($('.deleteBcard').length === 0) {
|
||||
$('.containerBusinessCards').html('');
|
||||
$('.containerBusinessCards').append($(instance.getChildHTML()));
|
||||
instance.moreFiles = [];
|
||||
instance.loadEvents(instance);
|
||||
}
|
||||
});
|
||||
});
|
||||
instance.loadEvents(instance);
|
||||
}
|
||||
load(id, containerid, callback) {
|
||||
let instance = this;
|
||||
instance.contid = containerid;
|
||||
instance.loadEvents(instance);
|
||||
let isMoblie = !(Unibase.Themes.Compact.Components.Index.Instance().desktopMode == true);
|
||||
let addHTMLMOBILE = `<div class="text-center"><label for="formImgInput"><button class="w-150p btn btn-primary btn-sm clickEventDisabled">Browse Images</button></label></div>`;
|
||||
if (!isMoblie) {
|
||||
addHTMLMOBILE = '';
|
||||
}
|
||||
$('.onlyValuesDisplayAI').append(addHTMLMOBILE);
|
||||
}
|
||||
checkAllValidition(uploadedFiles) {
|
||||
let files = uploadedFiles;
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const currFile = files[i];
|
||||
if (this.checkIsValidFile(this.businessCardsType, currFile.FileType) === false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
addMoreFileHTML() {
|
||||
let isMoblie = !(Unibase.Themes.Compact.Components.Index.Instance().desktopMode == true);
|
||||
let html = ``;
|
||||
if (isMoblie) {
|
||||
return `
|
||||
<div data-name="addmore" class="addMoreFiles d-flex justify-content-end align-items-center border p-4 overflow-hide position-relative" style="min-height:100%;max-height:max-content;">
|
||||
|
||||
<div class="w-sm-100p h-100p p-2 text-center d-flex justify-content-end align-items-center flex-column" >
|
||||
<input multiple id="addMoreFilesAfter" type="file" class="d-none" />
|
||||
<label for="addMoreFilesAfter" class="d-flex flex-center flex-column w-100p btn btn-primary">
|
||||
Files
|
||||
</label>
|
||||
<input id="formImgInputMobile" multiple class="m-0 d-none" accept="image/*" type="file">
|
||||
<label for="formImgInputMobile" class="btn bg-primary w-100p text-white">Images</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
else {
|
||||
return `
|
||||
<div data-name="addmore" class="addMoreFiles border p-4 overflow-hide position-relative d-flex justify-content-center align-items-center" style="min-height:100%;max-height:max-content;">
|
||||
|
||||
<div class="w-sm-100p h-100p p-2 text-center" >
|
||||
<input multiple id="addMoreFilesAfter" type="file" class="d-none" />
|
||||
<label for="addMoreFilesAfter" class="d-flex flex-center flex-column">
|
||||
<span class="font-50 cursor-pointer"> <i class="fa fa-paperclip"> </i></span >
|
||||
<span>Add more </span>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
getErrorHTML(message) {
|
||||
return `<div class="errorDiv py-10 d-flex justify-content-center align-items-center" style="
|
||||
background: #ff000024;
|
||||
"><span class="fa fa-info-circle pr-1 pt-1 text-danger"></span><span> ${message} </span></div>`;
|
||||
}
|
||||
setErrorRes(mess) {
|
||||
$('.errorDivPlaceHere').removeClass('d-none');
|
||||
let errorHTML = this.getErrorHTML(mess);
|
||||
$('.errorDivPlaceHere').html(errorHTML);
|
||||
document.querySelector('.errorDivPlaceHere').scrollIntoView();
|
||||
}
|
||||
loadEvents(instance) {
|
||||
$('#businesscardInput, #addMoreFilesAfter,#formImgInputMobile,#formImgInput,#formAIInputId').off().change(function (e) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
debugger;
|
||||
if (e.currentTarget.files.length === 0) {
|
||||
return;
|
||||
}
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().showLoading();
|
||||
const uploadedFiles = yield instance.getMulupleBase64(e);
|
||||
if (instance.checkAllValidition(uploadedFiles)) {
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
$('.errorDivPlaceHere').removeClass('d-none');
|
||||
let errorHTML = instance.getErrorHTML('File Not Supported');
|
||||
$('.errorDivPlaceHere').html(errorHTML);
|
||||
console.log(instance.moreFiles);
|
||||
return;
|
||||
}
|
||||
instance.lastLength = instance.moreFiles.length - 1 === -1 ? 0 : instance.moreFiles.length;
|
||||
instance.moreFiles = [...instance.moreFiles, ...uploadedFiles];
|
||||
const compressFiles = yield instance.getCompressFiles(e);
|
||||
let j = 0;
|
||||
for (let i = instance.lastLength; i < instance.moreFiles.length; i++) {
|
||||
instance.moreFiles[i]['FileData'] = compressFiles[j++];
|
||||
}
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
if ($('.childContainerBusinessCard').length === 0) {
|
||||
$('.containerBusinessCards').html('');
|
||||
}
|
||||
instance.generateCardsHTML();
|
||||
$('#businesscardInput').val('');
|
||||
$('#formAIInputId').val('');
|
||||
$('#formImgInput').val('');
|
||||
$('#formImgInputMobile').val('');
|
||||
$('#addMoreFilesAfter').val('');
|
||||
});
|
||||
});
|
||||
$('.resumeParsingButtonDelete').off().click(function (e) {
|
||||
});
|
||||
$('.resumeParsingButton').off().click(function (e) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
debugger;
|
||||
let res = null;
|
||||
console.log(instance.moreFiles);
|
||||
try {
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().showLoading();
|
||||
res = yield instance.postBusinessCard(instance.moreFiles);
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
instance.moreFiles = [];
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
$('.errorDivPlaceHere').removeClass('d-none');
|
||||
const responseText = JSON.parse(err.responseText);
|
||||
instance.setErrorRes(responseText.title);
|
||||
return;
|
||||
}
|
||||
if (res === null) {
|
||||
instance.setErrorRes('Something Went wrong');
|
||||
return;
|
||||
}
|
||||
if (res.code != '0') {
|
||||
instance.setErrorRes(res.message);
|
||||
return;
|
||||
}
|
||||
if (res.message == 'Email Already Exists, Mobile Number Already Exists' || res.message == 'Phone Number Already Exists, Email Already Exists') {
|
||||
instance.setErrorRes(res.message);
|
||||
return;
|
||||
}
|
||||
if (res.result === 'Invalid image') {
|
||||
instance.setErrorRes('Invalid image');
|
||||
return;
|
||||
}
|
||||
$('#' + instance.contid).modal('hide');
|
||||
$('#' + instance.contid).remove();
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(Unibase.Platform.Helpers.NavigationHelper.installedAppId, null);
|
||||
Unibase.Platform.Helpers.NavigationHelper.IsListRefresh = true;
|
||||
});
|
||||
});
|
||||
$('.labelInputWhite').off();
|
||||
$('.labelInputWhite').on('dragstart', function (e) {
|
||||
debugger;
|
||||
$('.onlyValuesDisplayAI').addClass('.clickEventDisabled');
|
||||
});
|
||||
$('.labelInputWhite').on('dragenter', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
debugger;
|
||||
$('.labelInputWhite').addClass('dragEnterResume');
|
||||
$('.onlyValuesDisplayAI').addClass('clickEventDisabled');
|
||||
});
|
||||
$('.labelInputWhite').on('dragleave', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
$('.labelInputWhite').removeClass('dragEnterResume');
|
||||
});
|
||||
$('.labelInputWhite').on('dragstop', function (e) {
|
||||
$('.labelInputWhite').removeClass('dragEnterResume');
|
||||
$('.onlyValuesDisplayAI').removeClass('.clickEventDisabled');
|
||||
});
|
||||
$('.labelInputWhite').on('dragover', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
$('.labelInputWhite').on('drop', function (e) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
try {
|
||||
$('.labelInputWhite').removeClass('dragEnterResume');
|
||||
debugger;
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().showLoading();
|
||||
let event = {
|
||||
target: {
|
||||
files: e.originalEvent.dataTransfer.files
|
||||
}
|
||||
};
|
||||
const uploadedFiles = yield instance.getMulupleBase64(event);
|
||||
if (instance.checkAllValidition(uploadedFiles)) {
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
$('.errorDivPlaceHere').removeClass('d-none');
|
||||
let errorHTML = instance.getErrorHTML('File Not Supported');
|
||||
$('.errorDivPlaceHere').html(errorHTML);
|
||||
console.log(instance.moreFiles);
|
||||
return;
|
||||
}
|
||||
instance.lastLength = instance.moreFiles.length - 1 === -1 ? 0 : instance.moreFiles.length;
|
||||
instance.moreFiles = [...instance.moreFiles, ...uploadedFiles];
|
||||
const compressFiles = yield instance.getCompressFiles(event);
|
||||
let j = 0;
|
||||
for (let i = instance.lastLength; i < instance.moreFiles.length; i++) {
|
||||
instance.moreFiles[i]['FileData'] = compressFiles[j++];
|
||||
}
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
if ($('.childContainerBusinessCard').length === 0) {
|
||||
$('.containerBusinessCards').html('');
|
||||
}
|
||||
instance.generateCardsHTML();
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
$('.bsClose').off().click(function () {
|
||||
instance.moreFiles = [];
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp();
|
||||
});
|
||||
}
|
||||
cardbox(img, filename, filetype) {
|
||||
if (filetype === 'pdf') {
|
||||
img = '/tenants/themes/compact/imgs/pdfimgdoc.png';
|
||||
}
|
||||
return `
|
||||
<div data-id="${filename}" data-name="${filename}_bcards" class="businessCardbox border h-100 p-4 overflow-hide position-relative" style="height:min-content;">
|
||||
<div class="position-absolute" style="top:10px;right:10px;"><span class="w-30p bg-white cursor-pointer deleteBcard"><i style="pointer-events:none;" class="fa fa-trash-o text-danger font-18"></i> </span> </div>
|
||||
<div class="w-sm-100p w-md-100 h-100p p-2" >
|
||||
<img class="w-100 h-100" src="${img}" alt="${filename}"/>
|
||||
</div>
|
||||
<div class="word-break text-center">
|
||||
${filename}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
createLead() {
|
||||
let detailContainer = "#" + Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1];
|
||||
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_stagename").Value != "Lead") {
|
||||
$(detailContainer).find('.DetailSetting_' + Unibase.Themes.Providers.DetailHelper.installedAppId + '_ConvertToLead').click(function () {
|
||||
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_stagename").Value != "Lead") {
|
||||
var postData = {
|
||||
CONTACTPERSONNAME: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_contactpersonname").Value,
|
||||
Designation: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_designation").Value,
|
||||
PhoneNumber: Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_phonenumber").Value),
|
||||
Email: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_email").Value,
|
||||
ADDRESS: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_address").Value,
|
||||
PinCode1: Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_pincode1").Value),
|
||||
country_code: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_countrycode").Value,
|
||||
LandMark1: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_landmark1").Value,
|
||||
state_name: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_statename").Value,
|
||||
state_code: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_statecode").Value,
|
||||
CityName1: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_cityname1").Value,
|
||||
Urls: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_urls").Value,
|
||||
OrganizationName: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_organizationname").Value,
|
||||
OrganizationNumber: Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_organizationnumber").Value),
|
||||
OrganizationEmail: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_organizationemail").Value
|
||||
};
|
||||
var installedappid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_installedappid").Value;
|
||||
Unibase.Apps.Collaboration.ResumeParsingManager.Instance().createLead(postData).then(function (res) {
|
||||
if (res.message == "Lead Saved Successfully") {
|
||||
Unibase.Platform.Apps.Managers.StageManager.Instance().getStageByStageName(installedappid, "Lead").then(function (response) {
|
||||
Unibase.Themes.Compact.Components.Details.Instance().change(response.result.StageId, installedappid);
|
||||
$('.li_DetailSetting_' + Unibase.Themes.Providers.DetailHelper.installedAppId + '_ConvertToLead').hide();
|
||||
});
|
||||
MessageHelper.Instance().showSuccess(res.message, "Unibase_ValidationSummary");
|
||||
}
|
||||
else
|
||||
$('.li_DetailSetting_' + Unibase.Themes.Providers.DetailHelper.installedAppId + '_ConvertToLead').show();
|
||||
MessageHelper.Instance().showSuccess(res.message, "Unibase_ValidationSummary");
|
||||
});
|
||||
}
|
||||
else
|
||||
$("#div_App_DefaultWidgetSettings").hide();
|
||||
});
|
||||
}
|
||||
else
|
||||
$("#div_App_DefaultWidgetSettings").hide();
|
||||
}
|
||||
postBusinessCard(payload) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let res = yield Unibase.Apps.Collaboration.ResumeParsingManager.Instance().postbusinessCard(payload);
|
||||
return res;
|
||||
});
|
||||
}
|
||||
compressImgInputMoreHandler(doc) {
|
||||
let instance = this;
|
||||
let imageFormat = 'jpeg';
|
||||
return new Promise((reslove, reject) => {
|
||||
const MAX_WIDTH = 1000;
|
||||
const MAX_HEIGHT = 1000;
|
||||
const MIME_TYPE = 'image/' + imageFormat;
|
||||
const QUALITY = 1;
|
||||
const file = doc;
|
||||
const blobURL = URL.createObjectURL(file);
|
||||
const img = new Image();
|
||||
img.src = blobURL;
|
||||
img.onerror = function () {
|
||||
reject("Cannot load image");
|
||||
URL.revokeObjectURL(this.src);
|
||||
console.log("Cannot load image");
|
||||
};
|
||||
img.onload = function () {
|
||||
const [newWidth, newHeight] = instance.calculateSize(img, MAX_WIDTH, MAX_HEIGHT);
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = newWidth;
|
||||
canvas.height = newHeight;
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(img, 0, 0, newWidth, newHeight);
|
||||
canvas.toBlob((blob) => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', blob);
|
||||
for (let [name, value] of formData) {
|
||||
if (name === 'file') {
|
||||
let reader = new FileReader();
|
||||
reader.onloadend = function () {
|
||||
let base64String = `${reader.result}`.replace(/^data:.+;base64,/, "");
|
||||
reslove(base64String);
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
}
|
||||
}
|
||||
}, MIME_TYPE, QUALITY);
|
||||
};
|
||||
});
|
||||
}
|
||||
compressImgInputHandler(ev) {
|
||||
let instance = this;
|
||||
let imageFormat = 'jpeg';
|
||||
return new Promise((reslove, reject) => {
|
||||
const MAX_WIDTH = 1000;
|
||||
const MAX_HEIGHT = 1000;
|
||||
const MIME_TYPE = 'image/' + imageFormat;
|
||||
const QUALITY = 1;
|
||||
const file = ev.target.files[0];
|
||||
const blobURL = URL.createObjectURL(file);
|
||||
const img = new Image();
|
||||
img.src = blobURL;
|
||||
img.onerror = function () {
|
||||
reject("Cannot load image");
|
||||
URL.revokeObjectURL(this.src);
|
||||
console.log("Cannot load image");
|
||||
};
|
||||
img.onload = function () {
|
||||
const [newWidth, newHeight] = instance.calculateSize(img, MAX_WIDTH, MAX_HEIGHT);
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = newWidth;
|
||||
canvas.height = newHeight;
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(img, 0, 0, newWidth, newHeight);
|
||||
canvas.toBlob((blob) => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', blob);
|
||||
for (let [name, value] of formData) {
|
||||
if (name === 'file') {
|
||||
let reader = new FileReader();
|
||||
reader.onloadend = function () {
|
||||
let base64String = `${reader.result}`.replace(/^data:.+;base64,/, "");
|
||||
reslove(base64String);
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
}
|
||||
}
|
||||
}, MIME_TYPE, QUALITY);
|
||||
};
|
||||
});
|
||||
}
|
||||
calculateSize(img, maxWidth, maxHeight) {
|
||||
let width = img.width;
|
||||
let height = img.height;
|
||||
if (width > height) {
|
||||
if (width > maxWidth) {
|
||||
height = Math.round((height * maxWidth) / width);
|
||||
width = maxWidth;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (height > maxHeight) {
|
||||
width = Math.round((width * maxHeight) / height);
|
||||
height = maxHeight;
|
||||
}
|
||||
}
|
||||
return [width, height];
|
||||
}
|
||||
checkIsValidFile(values, type) {
|
||||
const twoLower = type.toLowerCase();
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
if (twoLower == values[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
init(containerid) {
|
||||
}
|
||||
getChildHTML() {
|
||||
return `<div class="parsingForm m-0 p-0 w-400p h-450p w-md-500p justify-content-center align-items-center py-5 border-dashed d-flex flex-column"
|
||||
style="border: 4px #beccd6;">
|
||||
|
||||
<div class="resumeParsingButtonDelete d-none"> <i class="fa fa-trash-o text-danger font-18"></i> </div>
|
||||
<div class="resumeDivImg d-none my-2 rounded overflow-hide">
|
||||
<img class="w-100 h-100" src="" />
|
||||
</div>
|
||||
<div for="formAIInputId"
|
||||
class=" d-flex flex-column align-items-center m-0 labelInputWhite h-100 w-100 rounded-10">
|
||||
<div class="d-flex flex-column justify-content-center align-items-center h-100 w-100">
|
||||
<div class="font-50 w-100p text-center clickEventDisabled">
|
||||
<img class="w-100" src="/tenants/themes/compact/imgs/cloudresume.png" />
|
||||
</div>
|
||||
<div class="onlyValuesDisplayAI ">
|
||||
<span>Click To Browse PDF, PNG, JPEJ, JPG to Upload</span>
|
||||
<div class="text-center">
|
||||
<input type="file" multiple id="businesscardInput" class="d-none" />
|
||||
<label for="businesscardInput" class="btn bg-primary w-150p text-white">Upload</label>
|
||||
</div>
|
||||
</div>
|
||||
<input id="formAIInputId" multiple class="resumeParsingInput m-0 d-none" type="file">
|
||||
<input id="formImgInput" multiple class="m-0 d-none" accept="image/*" type="file">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="text-center py-30 d-none fileMessageDisplay"></div>`;
|
||||
}
|
||||
html(id, containerid) {
|
||||
let html = `
|
||||
<div id="img-modal" class="modal-content h-100">
|
||||
|
||||
|
||||
<div class="modal-body bg-white simple-scroll-bar edit-filters-body py-0 bg-cyan-light-5">
|
||||
<div class="text-danger errorDivPlaceHere d-none p-10"></div>
|
||||
<div
|
||||
class="align-items-center d-flex flex-column d-flex h-100 justify-content-center w-100 containerBusinessCards">
|
||||
|
||||
|
||||
${this.getChildHTML()}
|
||||
|
||||
</div>
|
||||
<div class="spinner-border" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer pa-10"> <button type="button" id="btn_CloseForm_${id}"
|
||||
class="btn btn-light btn-sm mr-auto bsClose">Close</button>
|
||||
<button class="btn btn-primary resumeParsingButton btn-sm" type="button">Submit</button>
|
||||
</div>
|
||||
</div>`;
|
||||
return html;
|
||||
}
|
||||
callBusinessCards() {
|
||||
let instances = this;
|
||||
instances.navigationHelper.popup(0, '', this, null, Unibase.Platform.Helpers.Size.Medium);
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new BusinessCards();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
Components.BusinessCards = BusinessCards;
|
||||
})(Components = AI.Components || (AI.Components = {}));
|
||||
})(AI = Communications.AI || (Communications.AI = {}));
|
||||
})(Communications = Apps.Communications || (Apps.Communications = {}));
|
||||
})(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
|
||||
})(Bizgaze || (Bizgaze = {}));
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,507 @@
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var Bizgaze;
|
||||
(function (Bizgaze) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Communications;
|
||||
(function (Communications) {
|
||||
let AI;
|
||||
(function (AI) {
|
||||
let Components;
|
||||
(function (Components) {
|
||||
class ResumeParsing extends Unibase.Platform.Core.BaseComponent {
|
||||
constructor() {
|
||||
super();
|
||||
this.inputParameters = [];
|
||||
this.reportIdGallery = null;
|
||||
this.fileValue = null;
|
||||
this.reqType = 1;
|
||||
this.resumeType = ['PDF', 'doc', 'docx'];
|
||||
this.businessCardsType = ['png', 'jpg', 'jpeg', 'JPEG', 'pdf'];
|
||||
this.salesInvoiceType = ['pdf'];
|
||||
this.currFile = '';
|
||||
this.navigationhelper = Unibase.Platform.Helpers.NavigationHelper.Instance();
|
||||
}
|
||||
cssFiles() {
|
||||
return [];
|
||||
}
|
||||
jsFiles() {
|
||||
return ["apps/communications/events/managers/gallerymanager.js", "apps/communications/ai/components/resumeparsingmanager.js"];
|
||||
}
|
||||
load(id, containerid, callback) {
|
||||
let instance = this;
|
||||
$('.resumeParsingInput, #formImgInput').change(function (e) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (e.currentTarget.files.length === 0) {
|
||||
return;
|
||||
}
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().showLoading();
|
||||
let file = yield Unibase.Platform.Helpers.FileHelper.Instance().getBase64(e);
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
let whichType = [];
|
||||
if (instance.reqType == 1) {
|
||||
whichType = instance.resumeType;
|
||||
}
|
||||
else if (instance.reqType == 2) {
|
||||
whichType = instance.businessCardsType;
|
||||
}
|
||||
else if (instance.reqType == 3) {
|
||||
whichType = instance.salesInvoiceType;
|
||||
}
|
||||
$('.fileMessageDisplay').removeClass('d-none');
|
||||
$('.fileMessageDisplay').html(`<span><span class="font-weight-700">File Name: </span><span>${file.FileName} </span></span>`);
|
||||
const lowercaseWords = whichType.map(word => word.toLowerCase());
|
||||
if (instance.checkIsValidFile(lowercaseWords, file.FileType.toLowerCase()) === false) {
|
||||
$('.resumeParsingButton').prop('disabled', true);
|
||||
let idGen = Math.random() * 999;
|
||||
idGen = `${idGen}_selectedFile`;
|
||||
$('.fileMessageDisplay').html(`<span class="${idGen} text-danger">Wrong File Selected</span>`);
|
||||
$('#formAIInputId').val('');
|
||||
$('#formImgInput').val('');
|
||||
setTimeout(function () {
|
||||
$('.fileMessageDisplay').addClass('d-none');
|
||||
$('.fileMessageDisplay').html('');
|
||||
}, 3000);
|
||||
return;
|
||||
}
|
||||
$('.resumeParsingButton').prop('disabled', false);
|
||||
$('.resumeParsingButtonDelete').removeClass('d-none');
|
||||
$(`.resumeDivImg`).removeClass('d-none');
|
||||
if (instance.reqType === 2) {
|
||||
if (file.FileType == 'pdf') {
|
||||
$(`.resumeDivImg img`).attr('src', `/tenants/themes/compact/imgs/fileuploaded.png`);
|
||||
}
|
||||
else {
|
||||
let baseString = yield instance.compressImgInputHandler(e);
|
||||
$(`.resumeDivImg img`).attr('src', `data:image/png;base64, ${file.FileData}`);
|
||||
file.FileData = `${baseString}`;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$(`.resumeDivImg img`).attr('src', `/tenants/themes/compact/imgs/fileuploaded.png`);
|
||||
}
|
||||
$('.labelInputWhite').removeClass('d-flex').addClass('d-none');
|
||||
instance.fileValue = file;
|
||||
});
|
||||
});
|
||||
$('.resumeParsingButtonDelete').click(function (e) {
|
||||
$('.resumeParsingButtonDelete').addClass('d-none');
|
||||
$('.labelInputWhite').addClass('d-flex').removeClass('d-none');
|
||||
$(`.resumeDivImg`).addClass('d-none');
|
||||
$('.fileMessageDisplay').html('');
|
||||
$('.fileMessageDisplay').addClass('d-none');
|
||||
$('#formAIInputId').val('');
|
||||
$('#formImgInput').val('');
|
||||
});
|
||||
$('.resumeParsingButton').click(function (e) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
e.preventDefault();
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().showLoading();
|
||||
if (instance.fileValue === null) {
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
return;
|
||||
}
|
||||
;
|
||||
let file = instance.fileValue;
|
||||
let payload = {
|
||||
"FileData": file.FileData,
|
||||
"FileName": file.FileName,
|
||||
"FilePath": "test",
|
||||
"FileType": instance.fileValue.FileType
|
||||
};
|
||||
let message = '';
|
||||
$('.fileMessageDisplay').removeClass('d-none');
|
||||
$('.fileMessageDisplay').html(file.FileName);
|
||||
try {
|
||||
if (instance.reqType == 1) {
|
||||
message = yield instance.postResume(payload);
|
||||
}
|
||||
else if (instance.reqType == 2) {
|
||||
message = yield instance.postBusinessCard(payload);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
MessageHelper.Instance().showError(err === null || err === void 0 ? void 0 : err.message, "div_message");
|
||||
return;
|
||||
}
|
||||
let res = JSON.parse(message.result);
|
||||
if (message.result === 'Invalid image') {
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
MessageHelper.Instance().showError("Invalid image", "div_message");
|
||||
return;
|
||||
}
|
||||
if (res.status == 0) {
|
||||
$('.fileMessageDisplay').removeClass('d-none');
|
||||
$('.fileMessageDisplay').html(`<span class="text-success">Upload Successs</span>`);
|
||||
}
|
||||
else {
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
MessageHelper.Instance().showError(res.message, "div_message");
|
||||
return;
|
||||
}
|
||||
if (message.message == 'Email Already Exists, Mobile Number Already Exists' || message.message == 'Phone Number Already Exists, Email Already Exists') {
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
MessageHelper.Instance().showError(message.message, "div_message");
|
||||
return;
|
||||
}
|
||||
if (message.code != '0') {
|
||||
$('.fileMessageDisplay').removeClass('d-none');
|
||||
if ((message === null || message === void 0 ? void 0 : message.message) == '') {
|
||||
$('.fileMessageDisplay').html(`<span class="text-danger">${message === null || message === void 0 ? void 0 : message.code}</span>`);
|
||||
}
|
||||
else {
|
||||
$('.fileMessageDisplay').html(`<span class="text-danger">${message === null || message === void 0 ? void 0 : message.message}</span>`);
|
||||
}
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
setTimeout(function () {
|
||||
$('.fileMessageDisplay').addClass('d-none');
|
||||
$('.fileMessageDisplay').html('');
|
||||
}, 3000);
|
||||
return;
|
||||
}
|
||||
if (res === null) {
|
||||
$('.fileMessageDisplay').removeClass('d-none');
|
||||
if ((message === null || message === void 0 ? void 0 : message.message) == '') {
|
||||
$('.fileMessageDisplay').html(`<span class="text-danger">${message === null || message === void 0 ? void 0 : message.code}</span>`);
|
||||
}
|
||||
else {
|
||||
$('.fileMessageDisplay').html(`<span class="text-danger">${message === null || message === void 0 ? void 0 : message.message}</span>`);
|
||||
}
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
setTimeout(function () {
|
||||
$('.fileMessageDisplay').addClass('d-none');
|
||||
$('.fileMessageDisplay').html('');
|
||||
}, 3000);
|
||||
return;
|
||||
}
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
$('.fileMessageDisplay').removeClass('d-none');
|
||||
$('.fileMessageDisplay').html('');
|
||||
$('#' + containerid).modal('hide');
|
||||
$('#' + containerid).remove();
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().loadDetail(Number(res.result), Unibase.Platform.Helpers.NavigationHelper.installedAppId, null);
|
||||
Unibase.Platform.Helpers.NavigationHelper.IsListRefresh = true;
|
||||
});
|
||||
});
|
||||
if (instance.reqType == 1) {
|
||||
let htmlstr = instance.appendTextValuesValid(instance.resumeType);
|
||||
let isMoblie = !(Unibase.Themes.Compact.Components.Index.Instance().desktopMode == true);
|
||||
let addHTMLMOBILE = `<label for="formAIInputId"><button class="btn btn-primary btn-sm clickEventDisabled">${htmlstr}</button></label>`;
|
||||
let str = addHTMLMOBILE;
|
||||
$('.onlyValuesDisplayAI').html(str);
|
||||
}
|
||||
else if (instance.reqType == 2) {
|
||||
let isMoblie = !(Unibase.Themes.Compact.Components.Index.Instance().desktopMode == true);
|
||||
let addHTMLMOBILE = `<label for="formImgInput"><button class="btn btn-primary btn-sm clickEventDisabled">Browse Images</button></label>`;
|
||||
if (!isMoblie) {
|
||||
addHTMLMOBILE = '';
|
||||
}
|
||||
let str = `<div class="">
|
||||
<div class="font-14 text-light-60">Drag & Drop files here</div>
|
||||
<div class="text-light-60 text-center my-2">or</div>
|
||||
<div class="text-center"><div><label for="formAIInputId"><button class="btn btn-primary btn-sm clickEventDisabled">Browse Files</button></label></div><div class="mobilemodeInput">
|
||||
${addHTMLMOBILE}
|
||||
</div></div>
|
||||
</div>`;
|
||||
$('.onlyValuesDisplayAI').html(str);
|
||||
}
|
||||
$('.labelInputWhite').on('dragenter', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
$('.labelInputWhite').addClass('dragEnterResume');
|
||||
});
|
||||
$('.labelInputWhite').on('dragleave', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
$('.labelInputWhite').removeClass('dragEnterResume');
|
||||
});
|
||||
$('.labelInputWhite').on('dragstop', function (e) {
|
||||
$('.labelInputWhite').removeClass('dragEnterResume');
|
||||
});
|
||||
$('.labelInputWhite').on('dragover', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
$('.labelInputWhite').on('drop', function (e) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
$('.labelInputWhite').removeClass('dragEnterResume');
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().showLoading();
|
||||
let event = {
|
||||
target: {
|
||||
files: e.originalEvent.dataTransfer.files
|
||||
}
|
||||
};
|
||||
let file = yield Unibase.Platform.Helpers.FileHelper.Instance().getBase64(event);
|
||||
let whichType = [];
|
||||
if (instance.reqType == 1) {
|
||||
whichType = instance.resumeType;
|
||||
}
|
||||
else if (instance.reqType == 2) {
|
||||
whichType = instance.businessCardsType;
|
||||
}
|
||||
else if (instance.reqType == 3) {
|
||||
whichType = instance.salesInvoiceType;
|
||||
}
|
||||
if (instance.checkIsValidFile(whichType, file.FileType) === false) {
|
||||
$('.resumeParsingButton').prop('disabled', true);
|
||||
let idGen = Math.random() * 999;
|
||||
idGen = `${idGen}_selectedFile`;
|
||||
$('.fileMessageDisplay').removeClass('d-none');
|
||||
$('.fileMessageDisplay').html(`<span class="${idGen} text-danger">Wrong File Selected</span>`);
|
||||
$('#formAIInputId').val('');
|
||||
$('#formImgInput').val('');
|
||||
setTimeout(function () {
|
||||
$('.fileMessageDisplay').addClass('d-none');
|
||||
$('.fileMessageDisplay').html('');
|
||||
}, 5000);
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
return;
|
||||
}
|
||||
if (instance.reqType === 2) {
|
||||
$(`.resumeDivImg img`).attr('src', `data:image/png;base64, ${file.FileData}`);
|
||||
let baseString = yield instance.compressImgInputHandler(e);
|
||||
file.FileData = `${baseString}`;
|
||||
}
|
||||
else {
|
||||
$(`.resumeDivImg img`).attr('src', `/tenants/themes/compact/imgs/fileuploaded.png`);
|
||||
}
|
||||
$('.labelInputWhite').addClass('d-none').removeClass('d-flex');
|
||||
$(`.resumeDivImg`).removeClass('d-none');
|
||||
$('.resumeParsingButton').prop('disabled', false);
|
||||
$('.resumeParsingButtonDelete').removeClass('d-none');
|
||||
$('.fileMessageDisplay').removeClass('d-none');
|
||||
$('.fileMessageDisplay').html(`<span><span class="font-w700">File Name: </span><span class="">${file.FileName} </span></span>`);
|
||||
instance.fileValue = file;
|
||||
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
|
||||
});
|
||||
});
|
||||
}
|
||||
createLead() {
|
||||
let detailContainer = "#" + Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1];
|
||||
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_stagename").Value != "Lead") {
|
||||
$(detailContainer).find('.DetailSetting_' + Unibase.Themes.Providers.DetailHelper.installedAppId + '_ConvertToLead').click(function () {
|
||||
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_stagename").Value != "Lead") {
|
||||
var postData = {
|
||||
CONTACTPERSONNAME: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_contactpersonname").Value,
|
||||
Designation: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_designation").Value,
|
||||
PhoneNumber: Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_phonenumber").Value),
|
||||
Email: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_email").Value,
|
||||
ADDRESS: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_address").Value,
|
||||
PinCode1: Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_pincode1").Value),
|
||||
country_code: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_countrycode").Value,
|
||||
LandMark1: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_landmark1").Value,
|
||||
state_name: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_statename").Value,
|
||||
state_code: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_statecode").Value,
|
||||
CityName1: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_cityname1").Value,
|
||||
Urls: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_urls").Value,
|
||||
OrganizationName: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_organizationname").Value,
|
||||
OrganizationNumber: Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_organizationnumber").Value),
|
||||
OrganizationEmail: Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_organizationemail").Value
|
||||
};
|
||||
var installedappid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_installedappid").Value;
|
||||
Unibase.Apps.Collaboration.ResumeParsingManager.Instance().createLead(postData).then(function (res) {
|
||||
if (res.message == "Lead Saved Successfully") {
|
||||
Unibase.Platform.Apps.Managers.StageManager.Instance().getStageByStageName(installedappid, "Lead").then(function (response) {
|
||||
Unibase.Themes.Compact.Components.Details.Instance().change(response.result.StageId, installedappid);
|
||||
$('.li_DetailSetting_' + Unibase.Themes.Providers.DetailHelper.installedAppId + '_ConvertToLead').hide();
|
||||
});
|
||||
MessageHelper.Instance().showSuccess(res.message, "Unibase_ValidationSummary");
|
||||
}
|
||||
else
|
||||
$('.li_DetailSetting_' + Unibase.Themes.Providers.DetailHelper.installedAppId + '_ConvertToLead').show();
|
||||
MessageHelper.Instance().showSuccess(res.message, "Unibase_ValidationSummary");
|
||||
});
|
||||
}
|
||||
else
|
||||
$("#div_App_DefaultWidgetSettings").hide();
|
||||
});
|
||||
}
|
||||
else
|
||||
$("#div_App_DefaultWidgetSettings").hide();
|
||||
}
|
||||
postResume(payload) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let instance = this;
|
||||
let res = yield Unibase.Apps.Collaboration.ResumeParsingManager.Instance().postResume(payload);
|
||||
return res;
|
||||
});
|
||||
}
|
||||
postBusinessCard(payload) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let res = yield Unibase.Apps.Collaboration.ResumeParsingManager.Instance().postbusinessCard(payload);
|
||||
return res;
|
||||
});
|
||||
}
|
||||
compressImgInputHandler(ev) {
|
||||
let instance = this;
|
||||
let imageFormat = 'jpeg';
|
||||
return new Promise((reslove, reject) => {
|
||||
const MAX_WIDTH = 1000;
|
||||
const MAX_HEIGHT = 1000;
|
||||
const MIME_TYPE = 'image/' + imageFormat;
|
||||
const QUALITY = 1;
|
||||
const file = ev.target.files[0];
|
||||
const blobURL = URL.createObjectURL(file);
|
||||
const img = new Image();
|
||||
img.src = blobURL;
|
||||
img.onerror = function () {
|
||||
reject("Cannot load image");
|
||||
URL.revokeObjectURL(this.src);
|
||||
console.log("Cannot load image");
|
||||
};
|
||||
img.onload = function () {
|
||||
const [newWidth, newHeight] = instance.calculateSize(img, MAX_WIDTH, MAX_HEIGHT);
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = newWidth;
|
||||
canvas.height = newHeight;
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(img, 0, 0, newWidth, newHeight);
|
||||
canvas.toBlob((blob) => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', blob);
|
||||
for (let [name, value] of formData) {
|
||||
if (name === 'file') {
|
||||
let reader = new FileReader();
|
||||
reader.onloadend = function () {
|
||||
let base64String = `${reader.result}`.replace(/^data:.+;base64,/, "");
|
||||
reslove(base64String);
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
}
|
||||
}
|
||||
}, MIME_TYPE, QUALITY);
|
||||
};
|
||||
});
|
||||
}
|
||||
calculateSize(img, maxWidth, maxHeight) {
|
||||
let width = img.width;
|
||||
let height = img.height;
|
||||
if (width > height) {
|
||||
if (width > maxWidth) {
|
||||
height = Math.round((height * maxWidth) / width);
|
||||
width = maxWidth;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (height > maxHeight) {
|
||||
width = Math.round((width * maxHeight) / height);
|
||||
height = maxHeight;
|
||||
}
|
||||
}
|
||||
return [width, height];
|
||||
}
|
||||
appendTextValuesValid(arr) {
|
||||
let values = '';
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (i != arr.length - 1) {
|
||||
values = values + `${arr[i]},`;
|
||||
}
|
||||
else {
|
||||
values = values + arr[i];
|
||||
}
|
||||
}
|
||||
let str = `Click To Browse <span class="font-weight-700">${values}</span> to Upload`;
|
||||
return str;
|
||||
}
|
||||
getLabelHTML() {
|
||||
return `<label for="formAIInputId" class="p-5 d-flex flex-column bg-white rounded-10">
|
||||
<div class="font-50 text-center">
|
||||
<img src="/tenants/themes/compact/imgs/scanai.png" />
|
||||
</div>
|
||||
<div class="onlyValuesDisplayAI">
|
||||
Click To Browse PDF to Upload
|
||||
</div>
|
||||
<input id="formAIInputId" class="resumeParsingInput d-none" type="file">
|
||||
</label>`;
|
||||
}
|
||||
checkIsValidFile(values, type) {
|
||||
const twoLower = type.toLowerCase();
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
if (twoLower == values[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
init(containerid) {
|
||||
}
|
||||
html(id, containerid) {
|
||||
let html = `
|
||||
<div id="img-modal" class="modal-content h-100">
|
||||
<div id="div_message" class="clear"></div>
|
||||
|
||||
<div class="modal-body bg-white simple-scroll-bar edit-filters-body py-0 bg-cyan-light-5">
|
||||
<div class="align-items-center d-flex flex-column d-flex h-100 justify-content-center w-100">
|
||||
|
||||
|
||||
<div class="parsingForm m-0 p-0 w-400p h-450p w-md-500p justify-content-center align-items-center py-5 border-dashed d-flex flex-column" style="border: 4px #beccd6;">
|
||||
|
||||
<div class="resumeParsingButtonDelete d-none"> <i class="fa fa-trash-o text-danger font-18"></i> </div>
|
||||
<div class="resumeDivImg d-none my-2 rounded overflow-hide" >
|
||||
<img class="w-100 h-100" src="" />
|
||||
</div>
|
||||
<div for="formAIInputId" class=" d-flex flex-column align-items-center m-0 labelInputWhite h-100 w-100 rounded-10">
|
||||
<div class="d-flex flex-column justify-content-center align-items-center h-100 w-100">
|
||||
<div class="font-50 w-100p text-center clickEventDisabled">
|
||||
<img class="w-100" src="/tenants/themes/compact/imgs/cloudresume.png" />
|
||||
</div>
|
||||
<div class="onlyValuesDisplayAI ">
|
||||
Click To Browse PDF to Upload
|
||||
</div>
|
||||
<input id="formAIInputId" class="resumeParsingInput m-0 d-none" type="file">
|
||||
<input id="formImgInput" class="m-0 d-none" accept="image/*" type="file">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="mt-20">
|
||||
|
||||
|
||||
</div>
|
||||
<div class="text-center py-30 d-none fileMessageDisplay"></div>
|
||||
|
||||
</div>
|
||||
<div class="spinner-border" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer pa-10"> <button type="button"
|
||||
onclick="Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp()" id="btn_CloseForm_${id}"
|
||||
class="btn btn-light btn-sm mr-auto">Close</button>
|
||||
<button disabled class="btn btn-primary resumeParsingButton btn-sm" type="button">Submit</button>
|
||||
</div>
|
||||
</div>`;
|
||||
return html;
|
||||
}
|
||||
callResumeParsing(type = 1) {
|
||||
let instances = this;
|
||||
instances.reqType = type;
|
||||
instances.navigationHelper.popup(0, '', this, null, Unibase.Platform.Helpers.Size.Medium);
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new ResumeParsing();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
Components.ResumeParsing = ResumeParsing;
|
||||
})(Components = AI.Components || (AI.Components = {}));
|
||||
})(AI = Communications.AI || (Communications.AI = {}));
|
||||
})(Communications = Apps.Communications || (Apps.Communications = {}));
|
||||
})(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
|
||||
})(Bizgaze || (Bizgaze = {}));
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,70 @@
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var Unibase;
|
||||
(function (Unibase) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Collaboration;
|
||||
(function (Collaboration) {
|
||||
class ResumeParsingManager extends Unibase.Platform.Core.BaseManager {
|
||||
createLead(obj) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = 'apis/v4/bizgaze/integrations/businesscards/createlead';
|
||||
return yield this.dataHelper().postAsync(url, obj).then(function (response) {
|
||||
if (response.result != null) {
|
||||
response.result = JSON.parse(response.result);
|
||||
}
|
||||
return response;
|
||||
});
|
||||
});
|
||||
}
|
||||
postResume(data) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = 'apis/v4/bizgaze/integrations/ai/uploadresume';
|
||||
return yield this.dataHelper().postAsync(url, data).then(function (response) {
|
||||
return response;
|
||||
});
|
||||
});
|
||||
}
|
||||
postUserRegister(data) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = 'apis/v4/bizgaze/integrations/facerecognization/register';
|
||||
return yield this.dataHelper().postAsync(url, data).then(function (response) {
|
||||
return response;
|
||||
});
|
||||
});
|
||||
}
|
||||
postUserDetect(data) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = 'apis/v4/bizgaze/integrations/facerecognization/detect';
|
||||
return yield this.dataHelper().postAsync(url, data).then(function (response) {
|
||||
return response;
|
||||
});
|
||||
});
|
||||
}
|
||||
postbusinessCard(data) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = 'apis/v4/bizgaze/integrations/ai/uploadbusinesscards/list';
|
||||
return yield this.dataHelper().postAsync(url, data).then(function (response) {
|
||||
return response;
|
||||
});
|
||||
});
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new ResumeParsingManager();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
Collaboration.ResumeParsingManager = ResumeParsingManager;
|
||||
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
|
||||
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
|
||||
})(Unibase || (Unibase = {}));
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"resumeparsingmanager.js","sourceRoot":"","sources":["resumeparsingmanager.ts"],"names":[],"mappings":";;;;;;;;;AACA,IAAU,OAAO,CAkEhB;AAlED,WAAU,OAAO;IACb,IAAiB,IAAI,CAgEpB;IAhED,WAAiB,IAAI;QACjB,IAAiB,aAAa,CA6D7B;QA7DD,WAAiB,aAAa;YAE1B,MAAa,oBAAqB,SAAQ,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW;gBAEjE,UAAU,CAAC,GAAG;;wBAChB,MAAM,GAAG,GAAG,0CAA0C,CAAC;wBACvD,OAAO,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,QAAQ;4BACtE,IAAI,QAAQ,CAAC,MAAM,IAAI,IAAI,EAAE;gCACzB,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;6BACjD;4BACD,OAAO,QAAQ,CAAC;wBACpB,CAAC,CAAC,CAAC;oBACP,CAAC;iBAAA;gBAEK,UAAU,CAAC,IAAS;;wBAEtB,MAAM,GAAG,GAAG,8CAA8C,CAAC;wBAC3D,OAAO,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,QAAQ;4BAIvE,OAAO,QAAQ,CAAC;wBACpB,CAAC,CAAC,CAAC;oBAEP,CAAC;iBAAA;gBAEK,gBAAgB,CAAC,IAAS;;wBAC5B,MAAM,GAAG,GAAG,yDAAyD,CAAC;wBACtE,OAAO,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,QAAQ;4BACvE,OAAO,QAAQ,CAAC;wBACpB,CAAC,CAAC,CAAC;oBACP,CAAC;iBAAA;gBAEK,cAAc,CAAC,IAAS;;wBAC1B,MAAM,GAAG,GAAG,uDAAuD,CAAC;wBACpE,OAAO,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,QAAQ;4BACvE,OAAO,QAAQ,CAAC;wBACpB,CAAC,CAAC,CAAC;oBACP,CAAC;iBAAA;gBAGK,gBAAgB,CAAC,IAAS;;wBAE5B,MAAM,GAAG,GAAG,0DAA0D,CAAC;wBACvE,OAAO,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,QAAQ;4BAIvE,OAAO,QAAQ,CAAC;wBACpB,CAAC,CAAC,CAAC;oBAEP,CAAC;iBAAA;gBAGD,MAAM,CAAC,QAAQ;oBACX,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;wBAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,oBAAoB,EAAE,CAAC;qBAC9C;oBACD,OAAO,IAAI,CAAC,QAAQ,CAAC;gBACzB,CAAC;aACJ;YA1DY,kCAAoB,uBA0DhC,CAAA;QACL,CAAC,EA7DgB,aAAa,GAAb,kBAAa,KAAb,kBAAa,QA6D7B;IAEL,CAAC,EAhEgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAgEpB;AACL,CAAC,EAlES,OAAO,KAAP,OAAO,QAkEhB"}
|
||||
Reference in New Issue
Block a user