This commit is contained in:
merelendor 2023-11-15 12:55:59 +03:00
commit ed272a3237
3 changed files with 58 additions and 19 deletions

View File

@ -12,29 +12,38 @@ export const logDocumentAccess = (payload) =>
{
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/logs/track`;
console.log("ACTION", "deals", "logDocumentAccess()", { url });
console.log("ACTION", "deals", "logDocumentAccess()", { payload });
// console.log("ACTION", "deals", "logDocumentAccess()", { url });
// console.log("ACTION", "deals", "logDocumentAccess()", { payload });
return new Promise((resolve, reject) =>
{
payload.lk_user_id = global.store.getState().user.email;
payload.acc_number = global.store.getState().company.active;
const state = global.store.getState();
axios.post(url, [ payload ], {
withCredentials: true,
})
.then((response) =>
if(!state.auth.observer)
{
console.log("ACTION", "deals", "logDocumentAccess()", "response", response.data);
payload.lk_user_id = state.user.email;
payload.acc_number = state.company.active;
axios.post(url, [ payload ], {
withCredentials: true,
})
.then((response) =>
{
// console.log("ACTION", "deals", "logDocumentAccess()", "response", response.data);
resolve();
})
.catch((error) =>
{
// console.error("ACTION", "deals", "logDocumentAccess()", "ERROR");
// console.error(error);
reject();
});
}
else
{
resolve();
})
.catch((error) =>
{
console.error("ACTION", "deals", "logDocumentAccess()", "ERROR");
console.error(error);
reject();
});
}
});
}

BIN
lib/ubuntu_mono_regular.ttf Normal file

Binary file not shown.

View File

@ -144,7 +144,7 @@ export default async function handler(req, res)
console.log("API", "download", "__dirname", __dirname);
const formPdfBytes = fs.readFileSync(`${ __dirname }/../../../../../lib/evo_anketa_v2_empty_licenses.pdf`);
const fontBytes = fs.readFileSync(`${ __dirname }/../../../../../lib/roboto.ttf`);
const fontBytes = fs.readFileSync(`${ __dirname }/../../../../../lib/ubuntu_mono_regular.ttf`);
const pdfDoc = await PDFDocument.load(formPdfBytes);
pdfDoc.registerFontkit(fontkit);
@ -207,9 +207,39 @@ export default async function handler(req, res)
const { registration_address, } = questionnaire[group][p].identity_document;
if(good(registration_address.name))
{
let field_text_value = registration_address.name.toString().toUpperCase();
/*
let field_text_value = "";
for(let a = 0; a < 7; a++)
{
for(let b = 0; b < 10; b++)
{
field_text_value = field_text_value + b;
if(b === 5)
{
field_text_value = field_text_value + " ";
}
}
}
*/
//const rx = new RegExp(/(\S)-(\S)/gim);
//field_text_value = field_text_value.replace(rx, "$1- $2");
fields[group][p][field].bind = form.getTextField(fields[group][p][field].name);
console.log(`${ group }_${ p }_${ field }`, { is_scrollable: fields[group][p][field].bind.isScrollable() });
if(fields[group][p][field].size !== undefined) { fields[group][p][field].bind.setFontSize(fields[group][p][field].size); }
fields[group][p][field].bind.setText(registration_address.name.toString().toUpperCase());
/*
if(field_text_value.length < 70)
{
}
else if(field_text_value.length < 14)
{
}
*/
fields[group][p][field].bind.setText(field_text_value);
}
}
else