diff --git a/actions/logsActions.js b/actions/logsActions.js index 0c88ab3..9377363 100644 --- a/actions/logsActions.js +++ b/actions/logsActions.js @@ -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(); - }); + } }); } \ No newline at end of file diff --git a/lib/ubuntu_mono_regular.ttf b/lib/ubuntu_mono_regular.ttf new file mode 100644 index 0000000..4977028 Binary files /dev/null and b/lib/ubuntu_mono_regular.ttf differ diff --git a/pages/api/questionnaire/download.js b/pages/api/questionnaire/download.js index e331b63..bec8028 100644 --- a/pages/api/questionnaire/download.js +++ b/pages/api/questionnaire/download.js @@ -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