@silexpert/core 1.0.63 → 1.0.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/es/api/resources/CalendarEvent.d.ts +2 -1
  2. package/es/api/resources/CalendarEvent.d.ts.map +1 -1
  3. package/es/api/resources/CalendarEvent.js +3 -0
  4. package/es/api/resources/CalendarEvent.js.map +1 -1
  5. package/es/api/resources/Commercial.d.ts +7 -0
  6. package/es/api/resources/Commercial.d.ts.map +1 -0
  7. package/es/api/resources/Commercial.js +7 -0
  8. package/es/api/resources/Commercial.js.map +1 -0
  9. package/es/api/resources/Sources.d.ts +6 -0
  10. package/es/api/resources/Sources.d.ts.map +1 -0
  11. package/es/api/resources/Sources.js +7 -0
  12. package/es/api/resources/Sources.js.map +1 -0
  13. package/es/api/resources/User.d.ts +1 -3
  14. package/es/api/resources/User.d.ts.map +1 -1
  15. package/es/api/resources/User.js +0 -4
  16. package/es/api/resources/User.js.map +1 -1
  17. package/es/api/resources.d.ts +4 -0
  18. package/es/api/resources.d.ts.map +1 -1
  19. package/es/api/resources.js +4 -0
  20. package/es/api/resources.js.map +1 -1
  21. package/es/types/Enum/ConstitutionState.d.ts +65 -0
  22. package/es/types/Enum/ConstitutionState.d.ts.map +1 -0
  23. package/es/types/Enum/ConstitutionState.js +66 -0
  24. package/es/types/Enum/ConstitutionState.js.map +1 -0
  25. package/es/types/Interface/api/calendarEvent/getLastInvalidateEvent.d.ts +4 -0
  26. package/es/types/Interface/api/calendarEvent/getLastInvalidateEvent.d.ts.map +1 -0
  27. package/es/types/Interface/api/calendarEvent/getLastInvalidateEvent.js +19 -0
  28. package/es/types/Interface/api/calendarEvent/getLastInvalidateEvent.js.map +1 -0
  29. package/es/types/Interface/api/commercialManagement/Create.d.ts +1 -1
  30. package/es/types/Interface/api/commercialManagement/Create.d.ts.map +1 -1
  31. package/es/types/Interface/api/commercialManagement/Create.js +2 -3
  32. package/es/types/Interface/api/commercialManagement/Create.js.map +1 -1
  33. package/es/types/Interface/api/society/QueryPaginatedSocietyWithStatsCa.d.ts +4 -0
  34. package/es/types/Interface/api/society/QueryPaginatedSocietyWithStatsCa.d.ts.map +1 -1
  35. package/es/types/Interface/api/society/QueryPaginatedSocietyWithStatsCa.js +30 -2
  36. package/es/types/Interface/api/society/QueryPaginatedSocietyWithStatsCa.js.map +1 -1
  37. package/es/types/Interface/api/wallet/UpdateAttribution.js +1 -1
  38. package/es/types/Interface/api/wallet/UpdateAttribution.js.map +1 -1
  39. package/es/types/index.d.ts +2 -0
  40. package/es/types/index.d.ts.map +1 -1
  41. package/es/types/index.js +2 -0
  42. package/es/types/index.js.map +1 -1
  43. package/es/utils/commercialManagement/document.d.ts.map +1 -1
  44. package/es/utils/commercialManagement/document.js +2 -2
  45. package/es/utils/commercialManagement/document.js.map +1 -1
  46. package/es/utils/commercialManagement/templates/body.js +2 -2
  47. package/es/utils/commercialManagement/templates/body.js.map +1 -1
  48. package/js/api/resources/CalendarEvent.js +6 -0
  49. package/js/api/resources/CalendarEvent.js.map +1 -1
  50. package/js/api/resources/Commercial.js +22 -0
  51. package/js/api/resources/Commercial.js.map +1 -0
  52. package/js/api/resources/Sources.js +18 -0
  53. package/js/api/resources/Sources.js.map +1 -0
  54. package/js/api/resources/User.js +0 -9
  55. package/js/api/resources/User.js.map +1 -1
  56. package/js/api/resources.js +7 -1
  57. package/js/api/resources.js.map +1 -1
  58. package/js/types/Enum/ConstitutionState.js +73 -0
  59. package/js/types/Enum/ConstitutionState.js.map +1 -0
  60. package/js/types/Interface/api/calendarEvent/getLastInvalidateEvent.js +29 -0
  61. package/js/types/Interface/api/calendarEvent/getLastInvalidateEvent.js.map +1 -0
  62. package/js/types/Interface/api/commercialManagement/Create.js +2 -2
  63. package/js/types/Interface/api/commercialManagement/Create.js.map +1 -1
  64. package/js/types/Interface/api/society/QueryPaginatedSocietyWithStatsCa.js +11 -1
  65. package/js/types/Interface/api/society/QueryPaginatedSocietyWithStatsCa.js.map +1 -1
  66. package/js/types/Interface/api/wallet/UpdateAttribution.js +4 -4
  67. package/js/types/Interface/api/wallet/UpdateAttribution.js.map +1 -1
  68. package/js/types/index.js +24 -0
  69. package/js/types/index.js.map +1 -1
  70. package/js/utils/commercialManagement/document.js +2 -0
  71. package/js/utils/commercialManagement/document.js.map +1 -1
  72. package/js/utils/commercialManagement/templates/body.js +2 -2
  73. package/js/utils/commercialManagement/templates/body.js.map +1 -1
  74. package/package.json +1 -1
  75. package/ts/api/resources/CalendarEvent.ts +5 -1
  76. package/ts/api/resources/Commercial.ts +9 -0
  77. package/ts/api/resources/Sources.ts +8 -0
  78. package/ts/api/resources/User.ts +1 -6
  79. package/ts/api/resources.ts +4 -0
  80. package/ts/types/Enum/ConstitutionState.ts +64 -0
  81. package/ts/types/Interface/api/calendarEvent/getLastInvalidateEvent.ts +8 -0
  82. package/ts/types/Interface/api/commercialManagement/Create.ts +2 -3
  83. package/ts/types/Interface/api/society/QueryPaginatedSocietyWithStatsCa.ts +26 -1
  84. package/ts/types/Interface/api/wallet/UpdateAttribution.ts +1 -1
  85. package/ts/types/index.ts +2 -0
  86. package/ts/utils/commercialManagement/document.ts +2 -0
  87. package/ts/utils/commercialManagement/templates/body.ts +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"document.js","mappings":";;;;;QAmBgBA,0B,GAAAA,0B;QAkDAC,uB,GAAAA,uB;;AArEhB;;AAGA;;IAAYC,K;;AAEZ;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAGA,MAAMC,GAAG,GAAGC,OAAO,CAAC,KAAD,CAAnB;;AAEM,SAAUJ,0BAAV,CAAqCK,qBAArC,EAAiFC,OAAjF,EAAuI;;;EAC3I,MAAMC,QAAQ,GAAG,qBAASD,OAAO,CAACC,QAAR,CAAiBC,GAAjB,CAAsBC,OAAD,IAAa,0CAA4BA,OAA5B,CAAlC,EAAwE,SAAxE,CAAT,CAAjB;EACA,MAAMC,IAAI,GAA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AAzE,MAA8E,IAA9E,IAA8EhC,aAA9E,GAA8EA,EAA9E,GAAkF;EA7BrG,CADF,CAAV;EAiCA,MAAMkC,cAAc,GAAG,IAAIC,oCAAJ,EAAvB;EAEA,OAAO;IACLU,MAAM,EAAEnG,GAAG,SAAH,OAAG,WAAH,GAAG,MAAH,MAAG,CAAEoG,MAAL,CAAYZ,cAAc,CAACW,MAA3B,EAAmCpF,IAAnC,CADH;IAELsF,IAAI,EAAErG,GAAG,SAAH,OAAG,WAAH,GAAG,MAAH,MAAG,CAAEoG,MAAL,CAAYE,kBAAZ,EAA0BvF,IAA1B,CAFD;IAGLwF,MAAM,EAAEvG,GAAG,SAAH,OAAG,WAAH,GAAG,MAAH,MAAG,CAAEoG,MAAL,CAAYZ,cAAc,CAACe,MAA3B,EAAiC/F,gCAAOO,IAAP,GAAW;MAAEyF,QAAQ,EAAE,mBAAO,SAAP,WAAO,WAAP,GAAO,MAAP,UAAO,CAAE3E,QAAT,MAAiB,IAAjB,IAAiB0B,aAAjB,GAAiB,MAAjB,GAAiBA,GAAE2C,eAAnB,MAAkC,IAAlC,IAAkCxC,aAAlC,GAAkCA,EAAlC,GAAsC;IAAlD,CAAX,CAAjC,CAHH;IAIL3C;EAJK,CAAP;AAMD","names":["generateCommercialDocument","generateAdvanceDocument","dayjs","ejs","require","idEstimateInvoiceType","payload","products","map","product","vats","Object","values","v","filter","id","Vat","MARGE","data","paymentLink","_a","title","_b","penalties","_c","compensation","_d","discount","_e","vatMention","_f","phoneContact","settings","_g","_h","totalTaxExcluded","totalTaxIncluded","totalTaxAndDiscountIncluded","generalDiscountFormatted","generalDiscount2","depositFormatted","deposit","totalTaxExcludedFormatted","totalTaxIncludedFormatted","totalTaxAndDiscountIncludedFormatted","_j","_k","totalVatAmountFormatted","font","_l","idFont","_m","FontIds","CIRCULAR_STD","name","find","f","_o","_p","fontList","url","_q","link","_r","capitalFormatted","capital","split","reduceRight","acc","char","i","length","trim","dueDateFormatted","dueDate","format","expirationDateFormatted","expirationDate","emissionDateFormatted","emissionDate","shouldDisplayDiscountColumn","p","discount2","marginVats","marginVatFormatted","accountingCategoryFormatted","a","accountingCategory","_s","label","_t","commonTemplate","CommercialDocumentCommonHTML","documentFreeText","EstimateInvoiceType","DEVIS","BON","includes","_u","freeEstimateText","_v","freeInvoiceText","header","render","body","bodyTemplate","footer","freeText","Error","ACOMPTE","disableVat","assetMarginVatIds","m","c"],"sourceRoot":"","sources":["../../../ts/utils/commercialManagement/document.ts"],"sourcesContent":["import {\n orderBy as _orderBy, groupBy as _groupBy, sumBy as _sumBy, uniq as _uniq,\n} from 'lodash';\nimport * as dayjs from 'dayjs';\nimport { ReadCommercialDocumentTemplate, ReadDocumentEditing } from '../../types/Interface/api/commercialManagement/Read';\nimport {\n AccountingCategoryList, FontIds, fontList, VatMarginCategyList,\n} from '../../types/Enum/CommercialManagement';\nimport { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';\nimport { Vat } from '../../types/Enum/Vat';\nimport { integerToFormattedAmountString } from '../amount';\nimport { CommercialDocumentCommonHTML } from './templates/common';\nimport { bodyTemplate } from './templates/body';\nimport { productToReadProductEditing } from './product';\nimport { vatToReadVatEditing } from './vat';\nimport { CreateInvoiceDocument, CreatePreSaleDocument } from '../../types';\n\nconst ejs = require('ejs');\n\nexport function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument): ReadCommercialDocumentTemplate {\n const products = _orderBy(payload.products.map((product) => productToReadProductEditing(product), 'reorder'));\n const vats = _orderBy(Object.values(_groupBy(products, 'vatFormatted')).map((v) => (vatToReadVatEditing(v)), 'value')).filter((v) => v.id !== Vat.MARGE.id);\n const data: ReadDocumentEditing = {\n ...payload,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\n title: payload.title ?? null,\n penalties: payload.penalties ?? null,\n compensation: payload.compensation ?? null,\n discount: payload.discount ?? null,\n vatMention: payload.vatMention ?? null,\n phoneContact: payload.settings?.phoneContact ?? null,\n products,\n vats,\n totalTaxExcluded: _sumBy(products, 'totalTaxExcluded'),\n totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),\n totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),\n generalDiscountFormatted: payload.generalDiscount2 ? integerToFormattedAmountString(payload.generalDiscount2) : null,\n depositFormatted: payload.deposit ? integerToFormattedAmountString(payload.deposit) : null,\n totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded')),\n totalTaxIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount')),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\n name: fontList.find((f) => f.id === payload.settings?.idFont)?.name ?? fontList[0].name,\n url: fontList.find((f) => f.id === payload.settings?.idFont)?.link ?? fontList[0].link,\n },\n capitalFormatted: payload.capital ? `${payload.capital}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim() : null,\n dueDateFormatted: payload.dueDate ? dayjs(payload.dueDate).format('DD/MM/YYYY') : null,\n expirationDateFormatted: payload.expirationDate ? dayjs(payload.expirationDate).format('DD/MM/YYYY') : null,\n emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,\n shouldDisplayDiscountColumn: !!products.find((p) => p.discount2 && p.discount2 > 0),\n // @ts-ignore\n marginVats: _uniq(products.filter((p) => p.marginVatFormatted !== null).map((p) => p.marginVatFormatted)),\n accountingCategoryFormatted: AccountingCategoryList.find((a) => a.id === payload.accountingCategory)?.label ?? null,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n const documentFreeText = [EstimateInvoiceType.DEVIS, EstimateInvoiceType.BON].includes(idEstimateInvoiceType) ? payload?.settings?.freeEstimateText : payload?.settings?.freeInvoiceText;\n\n return {\n header: ejs.render(commonTemplate.header, data),\n body: ejs.render(bodyTemplate, data),\n footer: ejs.render(commonTemplate.footer, { ...data, freeText: documentFreeText ?? null }),\n data,\n };\n}\n\nexport function generateAdvanceDocument(payload: CreateInvoiceDocument): ReadCommercialDocumentTemplate {\n if (!payload.deposit) throw new Error('Aucun acompte défini');\n\n const data: ReadDocumentEditing = {\n ...payload,\n title: payload.title ?? null,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType: EstimateInvoiceType.ACOMPTE,\n phoneContact: payload.settings?.phoneContact ?? null,\n products: [],\n vats: [],\n totalTaxExcluded: payload.deposit,\n totalTaxIncluded: payload.deposit,\n totalTaxAndDiscountIncluded: payload.deposit,\n generalDiscountFormatted: null,\n depositFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxExcludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxIncludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalVatAmountFormatted: integerToFormattedAmountString(0),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\n name: fontList.find((f) => f.id === payload.settings?.idFont)?.name ?? fontList[0].name,\n url: fontList.find((f) => f.id === payload.settings?.idFont)?.link ?? fontList[0].link,\n },\n capitalFormatted: payload.capital ? `${payload.capital}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim() : null,\n dueDateFormatted: payload.dueDate ? dayjs(payload.dueDate).format('DD/MM/YYYY') : null,\n expirationDateFormatted: payload.expirationDate ? dayjs(payload.expirationDate).format('DD/MM/YYYY') : null,\n emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,\n shouldDisplayDiscountColumn: false,\n disableVat: true,\n // @ts-ignore\n marginVats: _uniq((payload.assetMarginVatIds ?? []).map((m) => VatMarginCategyList.find((c) => c.id === m)?.label ?? null)),\n accountingCategoryFormatted: AccountingCategoryList.find((a) => a.id === payload.accountingCategory)?.label ?? null,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n\n return {\n header: ejs?.render(commonTemplate.header, data),\n body: ejs?.render(bodyTemplate, data),\n footer: ejs?.render(commonTemplate.footer, { ...data, freeText: payload?.settings?.freeInvoiceText ?? null }),\n data,\n };\n}"]}
1
+ {"version":3,"file":"document.js","mappings":";;;;;QAmBgBA,0B,GAAAA,0B;QAmDAC,uB,GAAAA,uB;;AAtEhB;;AAGA;;IAAYC,K;;AAEZ;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAGA,MAAMC,GAAG,GAAGC,OAAO,CAAC,KAAD,CAAnB;;AAEM,SAAUJ,0BAAV,CAAqCK,qBAArC,EAAiFC,OAAjF,EAAuI;;;EAC3I,MAAMC,QAAQ,GAAG,qBAASD,OAAO,CAACC,QAAR,CAAiBC,GAAjB,CAAsBC,OAAD,IAAa,0CAA4BA,OAA5B,CAAlC,EAAwE,SAAxE,CAAT,CAAjB;EACA,MAAMC,IAAI,GAAG,qBAASC,MAAM,CAACC,MAAP,CAAc,qBAASL,QAAT,EAAmB,cAAnB,CAAd,EAAkDC,GAAlD,CAAuDK,CAAD,IAAQ,8BAAoBA,CAApB,CAA9D,EAAuF,OAAvF,CAAT,EAA0GC,MAA1G,CAAkHD,CAAD,IAAOA,CAAC,CAACE,EAAF,KAASC,SAAIC,KAAJ,CAAUF,EAA3I,CAAb;EACA,MAAMG,IAAI,mCACLZ,OADK,GACE;IACVa,WAAW,EAAE,aAAO,CAACA,WAAR,MAAmB,IAAnB,IAAmBC,aAAnB,GAAmBA,EAAnB,GAAuB,GAD1B;IAEVf,qBA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E,GAAuE,MAAvE,GAAuEA,GAAEsC,KAAzE,MAA8E,IAA9E,IAA8EhC,aAA9E,GAA8EA,EAA9E,GAAkF;EA9BrG,CADF,CAAV;EAkCA,MAAMkC,cAAc,GAAG,IAAIC,oCAAJ,EAAvB;EAEA,OAAO;IACLU,MAAM,EAAErG,GAAG,SAAH,OAAG,WAAH,GAAG,MAAH,MAAG,CAAEsG,MAAL,CAAYZ,cAAc,CAACW,MAA3B,EAAmCtF,IAAnC,CADH;IAELwF,IAAI,EAAEvG,GAAG,SAAH,OAAG,WAAH,GAAG,MAAH,MAAG,CAAEsG,MAAL,CAAYE,kBAAZ,EAA0BzF,IAA1B,CAFD;IAGL0F,MAAM,EAAEzG,GAAG,SAAH,OAAG,WAAH,GAAG,MAAH,MAAG,CAAEsG,MAAL,CAAYZ,cAAc,CAACe,MAA3B,EAAiCjG,gCAAOO,IAAP,GAAW;MAAE2F,QAAQ,EAAE,mBAAO,SAAP,WAAO,WAAP,GAAO,MAAP,UAAO,CAAE7E,QAAT,MAAiB,IAAjB,IAAiB4B,aAAjB,GAAiB,MAAjB,GAAiBA,GAAE2C,eAAnB,MAAkC,IAAlC,IAAkCxC,aAAlC,GAAkCA,EAAlC,GAAsC;IAAlD,CAAX,CAAjC,CAHH;IAIL7C;EAJK,CAAP;AAMD","names":["generateCommercialDocument","generateAdvanceDocument","dayjs","ejs","require","idEstimateInvoiceType","payload","products","map","product","vats","Object","values","v","filter","id","Vat","MARGE","data","paymentLink","_a","title","_b","penalties","_c","compensation","_d","discount","_e","vatMention","_f","phoneContact","settings","_g","_h","comment","replace","totalTaxExcluded","totalTaxIncluded","totalTaxAndDiscountIncluded","generalDiscountFormatted","generalDiscount2","depositFormatted","deposit","totalTaxExcludedFormatted","totalTaxIncludedFormatted","totalTaxAndDiscountIncludedFormatted","_j","_k","totalVatAmountFormatted","font","_l","idFont","_m","FontIds","CIRCULAR_STD","name","find","f","_o","_p","fontList","url","_q","link","_r","capitalFormatted","capital","split","reduceRight","acc","char","i","length","trim","dueDateFormatted","dueDate","format","expirationDateFormatted","expirationDate","emissionDateFormatted","emissionDate","shouldDisplayDiscountColumn","p","discount2","marginVats","marginVatFormatted","accountingCategoryFormatted","a","accountingCategory","_s","label","_t","commonTemplate","CommercialDocumentCommonHTML","documentFreeText","EstimateInvoiceType","DEVIS","BON","includes","_u","freeEstimateText","_v","freeInvoiceText","header","render","body","bodyTemplate","footer","freeText","Error","ACOMPTE","disableVat","assetMarginVatIds","m","c"],"sourceRoot":"","sources":["../../../ts/utils/commercialManagement/document.ts"],"sourcesContent":["import {\n orderBy as _orderBy, groupBy as _groupBy, sumBy as _sumBy, uniq as _uniq,\n} from 'lodash';\nimport * as dayjs from 'dayjs';\nimport { ReadCommercialDocumentTemplate, ReadDocumentEditing } from '../../types/Interface/api/commercialManagement/Read';\nimport {\n AccountingCategoryList, FontIds, fontList, VatMarginCategyList,\n} from '../../types/Enum/CommercialManagement';\nimport { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';\nimport { Vat } from '../../types/Enum/Vat';\nimport { integerToFormattedAmountString } from '../amount';\nimport { CommercialDocumentCommonHTML } from './templates/common';\nimport { bodyTemplate } from './templates/body';\nimport { productToReadProductEditing } from './product';\nimport { vatToReadVatEditing } from './vat';\nimport { CreateInvoiceDocument, CreatePreSaleDocument } from '../../types';\n\nconst ejs = require('ejs');\n\nexport function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument): ReadCommercialDocumentTemplate {\n const products = _orderBy(payload.products.map((product) => productToReadProductEditing(product), 'reorder'));\n const vats = _orderBy(Object.values(_groupBy(products, 'vatFormatted')).map((v) => (vatToReadVatEditing(v)), 'value')).filter((v) => v.id !== Vat.MARGE.id);\n const data: ReadDocumentEditing = {\n ...payload,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\n title: payload.title ?? null,\n penalties: payload.penalties ?? null,\n compensation: payload.compensation ?? null,\n discount: payload.discount ?? null,\n vatMention: payload.vatMention ?? null,\n phoneContact: payload.settings?.phoneContact ?? null,\n comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\\n/g, '<br/>') : payload.comment,\n products,\n vats,\n totalTaxExcluded: _sumBy(products, 'totalTaxExcluded'),\n totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),\n totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),\n generalDiscountFormatted: payload.generalDiscount2 ? integerToFormattedAmountString(payload.generalDiscount2) : null,\n depositFormatted: payload.deposit ? integerToFormattedAmountString(payload.deposit) : null,\n totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded')),\n totalTaxIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount')),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\n name: fontList.find((f) => f.id === payload.settings?.idFont)?.name ?? fontList[0].name,\n url: fontList.find((f) => f.id === payload.settings?.idFont)?.link ?? fontList[0].link,\n },\n capitalFormatted: payload.capital ? `${payload.capital}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim() : null,\n dueDateFormatted: payload.dueDate ? dayjs(payload.dueDate).format('DD/MM/YYYY') : null,\n expirationDateFormatted: payload.expirationDate ? dayjs(payload.expirationDate).format('DD/MM/YYYY') : null,\n emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,\n shouldDisplayDiscountColumn: !!products.find((p) => p.discount2 && p.discount2 > 0),\n // @ts-ignore\n marginVats: _uniq(products.filter((p) => p.marginVatFormatted !== null).map((p) => p.marginVatFormatted)),\n accountingCategoryFormatted: AccountingCategoryList.find((a) => a.id === payload.accountingCategory)?.label ?? null,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n const documentFreeText = [EstimateInvoiceType.DEVIS, EstimateInvoiceType.BON].includes(idEstimateInvoiceType) ? payload?.settings?.freeEstimateText : payload?.settings?.freeInvoiceText;\n\n return {\n header: ejs.render(commonTemplate.header, data),\n body: ejs.render(bodyTemplate, data),\n footer: ejs.render(commonTemplate.footer, { ...data, freeText: documentFreeText ?? null }),\n data,\n };\n}\n\nexport function generateAdvanceDocument(payload: CreateInvoiceDocument): ReadCommercialDocumentTemplate {\n if (!payload.deposit) throw new Error('Aucun acompte défini');\n\n const data: ReadDocumentEditing = {\n ...payload,\n title: payload.title ?? null,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType: EstimateInvoiceType.ACOMPTE,\n phoneContact: payload.settings?.phoneContact ?? null,\n products: [],\n vats: [],\n totalTaxExcluded: payload.deposit,\n totalTaxIncluded: payload.deposit,\n totalTaxAndDiscountIncluded: payload.deposit,\n generalDiscountFormatted: null,\n comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\\n/g, '<br/>') : payload.comment,\n depositFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxExcludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxIncludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalVatAmountFormatted: integerToFormattedAmountString(0),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\n name: fontList.find((f) => f.id === payload.settings?.idFont)?.name ?? fontList[0].name,\n url: fontList.find((f) => f.id === payload.settings?.idFont)?.link ?? fontList[0].link,\n },\n capitalFormatted: payload.capital ? `${payload.capital}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim() : null,\n dueDateFormatted: payload.dueDate ? dayjs(payload.dueDate).format('DD/MM/YYYY') : null,\n expirationDateFormatted: payload.expirationDate ? dayjs(payload.expirationDate).format('DD/MM/YYYY') : null,\n emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,\n shouldDisplayDiscountColumn: false,\n disableVat: true,\n // @ts-ignore\n marginVats: _uniq((payload.assetMarginVatIds ?? []).map((m) => VatMarginCategyList.find((c) => c.id === m)?.label ?? null)),\n accountingCategoryFormatted: AccountingCategoryList.find((a) => a.id === payload.accountingCategory)?.label ?? null,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n\n return {\n header: ejs?.render(commonTemplate.header, data),\n body: ejs?.render(bodyTemplate, data),\n footer: ejs?.render(commonTemplate.footer, { ...data, freeText: payload?.settings?.freeInvoiceText ?? null }),\n data,\n };\n}"]}
@@ -90,7 +90,7 @@ const bodyTemplate = exports.bodyTemplate = `<html class="pdf-content">
90
90
  <% if (vatMention) { %><div class="vat-mention <%= disableVat !== true ? 'mt-20' : ''%>"><%= vatMention %></div><% } %>
91
91
  <% if (comment) { %>
92
92
  <p class="mt-20">Commentaire :<br/>
93
- <%= comment %>
93
+ <%- comment %>
94
94
  <% } %>
95
95
  </div>
96
96
 
@@ -118,7 +118,7 @@ const bodyTemplate = exports.bodyTemplate = `<html class="pdf-content">
118
118
  <br/>Bon pour accord : <br/><br/><br/><br/>
119
119
  <% } %>
120
120
 
121
- <% if (cgv && (idEstimateInvoiceType === ${_EstimateInvoice.EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${_EstimateInvoice.EstimateInvoiceType.BON})) { %>
121
+ <% if (cgv && ((settings && settings.invoiceCgv) || idEstimateInvoiceType === ${_EstimateInvoice.EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${_EstimateInvoice.EstimateInvoiceType.BON})) { %>
122
122
  <br><div style="page-break-after:always;"></div>
123
123
  <%- cgv %>
124
124
  <% } %>
@@ -1 +1 @@
1
- {"version":3,"file":"body.js","mappings":";;;;;;;AAAA;;AACA;;AAEA,MAAMA,cAAc,GAAG,IAAIC,oCAAJ,EAAvB;AAEA,MAAMC,cAAc,GAAG;;;YAGXF,cAAc,CAACG,IAAI;YACnBH,cAAc,CAACI,OAAO;;;4CAGUJ,cAAc,CAACI,OAAO;UACxDJ,cAAc,CAACG,IAAI;;;;;;;yCAOYE,qCAAoBC,GAAG;;gDAEhBD,qCAAoBE,KAAK;;gDAEzBF,qCAAoBG,OAAO;;gDAE3BH,qCAAoBI,KAAK;;gDAEzBJ,qCAAoBK,KAAK;;gDAEzBL,qCAAoBM,OAAO;;;;;mDAKxBN,qCAAoBM,OAAO;;oBAE1DN,qCAAoBC,GAAG,KAAKD,qCAAoBE,KAAK;;;;;;;2DAOdF,qCAAoBM,OAAO;;;;mDAInCN,qCAAoBC,GAAG,KAAKD,qCAAoBE,KAAK;;;;;;;;;;;;;;;;SA3CxG;AA6DO,MAAMK,YAAY,WAAZA,YAAY,GAAG;;;;IAIxBV,cAAc;;;;;;6BAMWF,cAAc,CAACa,QAAQ;;;;;YAKxCb,cAAc,CAACc,iBAAiB;;;;;;;;;;UAUlCd,cAAc,CAACe,oBAAoB;;;8DAGiBf,cAAc,CAACgB,aAAa;;;;;;;;;;;;;;;;wEAgBlBX,qCAAoBE,KAAK,iCAAiCF,qCAAoBC,GAAG;;;;+CAI1GD,qCAAoBE,KAAK,iCAAiCF,qCAAoBC,GAAG;;;;;;;QAOxHN,cAAc,CAACiB,KAAK;;QAvDrB","names":["commonTemplate","CommercialDocumentCommonHTML","headOfDocument","logo","company","EstimateInvoiceType","BON","DEVIS","FACTURE","AVOIR","RESTE","ACOMPTE","bodyTemplate","products","vatRecapitulation","amountRecapitulation","paymentButton","style"],"sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/templates/body.ts"],"sourcesContent":["import { EstimateInvoiceType } from '../../../types/Enum/EstimateInvoice';\nimport { CommercialDocumentCommonHTML } from './common';\n\nconst commonTemplate = new CommercialDocumentCommonHTML();\n\nconst headOfDocument = `<div class=\"row space-between\">\n <% if (settings && settings.logoAlignment === 'left') { %>\n <div class=\"society-informations\">\n ${commonTemplate.logo}\n ${commonTemplate.company}\n </div>\n <% } else { %>\n <div class=\"society-informations\">${commonTemplate.company}</div>\n ${commonTemplate.logo}\n <% } %>\n </div>\n\n <div class=\"row space-between items-end\" style=\"margin-top: 10px\">\n <div style=\"width: 45%; margin-top: auto;\">\n <span class=\"document-reference\">\n <% if (idEstimateInvoiceType === ${EstimateInvoiceType.BON}) { %>\n Bon de commande\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS}) { %>\n Devis\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.FACTURE}) { %>\n Facture\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.AVOIR}) { %>\n Avoir\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.RESTE}) { %>\n Facture de solde\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) { %>\n Facture d'acompte\n <% } %>\n <%= reference %></span><br/>\n <% if(emissionDate) {%><span class=\"document-emission-date\">Date d’émission : <%= emissionDateFormatted %></span><br/><% } %>\n <% if(dueDate && idEstimateInvoiceType !== ${EstimateInvoiceType.ACOMPTE}) {%>\n <span class=\"document-due-date\">\n <% if ([${EstimateInvoiceType.BON}, ${EstimateInvoiceType.DEVIS}].includes(idEstimateInvoiceType)) {%>\n Valide jusqu'au :\n <% } else { %>\n Date d'échéance :\n <% } %>\n <%= dueDateFormatted %></span>\n <% } %>\n <% if (expirationDate && idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) {%>\n <span class=\"document-due-date\">Date d'expiration : <%= expirationDateFormatted %></span>\n <% } %>\n <% if(termsOfPayment) { %>\n <br/><p style=\"margin-bottom: 0px;\"><%= [${EstimateInvoiceType.BON}, ${EstimateInvoiceType.DEVIS}].includes(idEstimateInvoiceType) ? 'Conditions de règlement' : 'Date limite de règlement' %> : <%= termsOfPayment %></p>\n <% } %>\n </div>\n <div style=\"width: 40%; margin-top: auto;\">\n <p></p>\n <% if (thirdParty) { %>\n <div class=\"<%= settings && settings.isCoordinatesFrameDisplayed ? 'customer-border' : '' %>\">\n <% if(thirdParty.fullname) {%><b><%= thirdParty.fullname %></b><br/><% } %>\n <% if(thirdParty.company) {%><%= thirdParty.company %><br/><% } %>\n <% if(thirdParty.address) {%><%= thirdParty.address %><br/><% } %>\n <% if(thirdParty.zipCode) {%><%= thirdParty.zipCode + ' ' %><% } %><%= thirdParty.city %><br/>\n <% if(thirdParty.deliveryAddress && thirdParty.deliveryCity && thirdParty.deliveryZipCode) {%>Adresse de livraison : <%= thirdParty.deliveryAddress %> <%= thirdParty.deliveryZipCode %> <%= thirdParty.deliveryCity %><br/><% } %>\n <% if(thirdParty.nSiret) {%>SIRET : <%= thirdParty.nSiret %><% } %>\n </div>\n <% } %>\n </div>\n </div>`;\n\nexport const bodyTemplate = `<html class=\"pdf-content\">\n\n <body>\n\n ${headOfDocument}\n\n <div class=\"row mt-25\">\n <% if (title) { %>Titre : <%= title %><% } %>\n </div>\n\n <div class=\"row mt-10\">${commonTemplate.products}</div>\n\n <div class=\"row space-between mt-20\">\n <div style=\"width: 55%;\">\n <% if (disableVat !== true && vats.length) { %>\n ${commonTemplate.vatRecapitulation}\n <% } %>\n <% if (vatMention) { %><div class=\"vat-mention <%= disableVat !== true ? 'mt-20' : ''%>\"><%= vatMention %></div><% } %>\n <% if (comment) { %>\n <p class=\"mt-20\">Commentaire :<br/>\n <%= comment %>\n <% } %>\n </div>\n\n <div>\n ${commonTemplate.amountRecapitulation}\n\n <% if (isStripeAllowed) { %>\n <div style=\"text-align: right; margin-top: 30px;\">${commonTemplate.paymentButton}</div>\n <% } %>\n </div>\n \n </div>\n\n <% if (settings && (settings.iban || settings.bic)) { %>\n <div class=\"row mt-30 space-between\" style=\"page-break-inside: avoid !important;\">\n <div>\n <% if (settings && (settings.iban || settings.bic)) { %>\n <% if(settings.iban) { %>IBAN : <%= settings.iban %><br/><% } %>\n <% if(settings.bic) { %>BIC : <%= settings.bic %><% } %>\n <% } %>\n </div>\n </div>\n <% } %>\n <% if (settings && settings.bonPour && (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>\n <br/>Bon pour accord : <br/><br/><br/><br/>\n <% } %>\n\n <% if (cgv && (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>\n <br><div style=\"page-break-after:always;\"></div>\n <%- cgv %>\n <% } %>\n </body>\n\n <style>\n ${commonTemplate.style}\n </style>\n</html>`;"]}
1
+ {"version":3,"file":"body.js","mappings":";;;;;;;AAAA;;AACA;;AAEA,MAAMA,cAAc,GAAG,IAAIC,oCAAJ,EAAvB;AAEA,MAAMC,cAAc,GAAG;;;YAGXF,cAAc,CAACG,IAAI;YACnBH,cAAc,CAACI,OAAO;;;4CAGUJ,cAAc,CAACI,OAAO;UACxDJ,cAAc,CAACG,IAAI;;;;;;;yCAOYE,qCAAoBC,GAAG;;gDAEhBD,qCAAoBE,KAAK;;gDAEzBF,qCAAoBG,OAAO;;gDAE3BH,qCAAoBI,KAAK;;gDAEzBJ,qCAAoBK,KAAK;;gDAEzBL,qCAAoBM,OAAO;;;;;mDAKxBN,qCAAoBM,OAAO;;oBAE1DN,qCAAoBC,GAAG,KAAKD,qCAAoBE,KAAK;;;;;;;2DAOdF,qCAAoBM,OAAO;;;;mDAInCN,qCAAoBC,GAAG,KAAKD,qCAAoBE,KAAK;;;;;;;;;;;;;;;;SA3CxG;AA6DO,MAAMK,YAAY,WAAZA,YAAY,GAAG;;;;IAIxBV,cAAc;;;;;;6BAMWF,cAAc,CAACa,QAAQ;;;;;YAKxCb,cAAc,CAACc,iBAAiB;;;;;;;;;;UAUlCd,cAAc,CAACe,oBAAoB;;;8DAGiBf,cAAc,CAACgB,aAAa;;;;;;;;;;;;;;;;wEAgBlBX,qCAAoBE,KAAK,iCAAiCF,qCAAoBC,GAAG;;;;oFAIrED,qCAAoBE,KAAK,iCAAiCF,qCAAoBC,GAAG;;;;;;;QAO7JN,cAAc,CAACiB,KAAK;;QAvDrB","names":["commonTemplate","CommercialDocumentCommonHTML","headOfDocument","logo","company","EstimateInvoiceType","BON","DEVIS","FACTURE","AVOIR","RESTE","ACOMPTE","bodyTemplate","products","vatRecapitulation","amountRecapitulation","paymentButton","style"],"sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/templates/body.ts"],"sourcesContent":["import { EstimateInvoiceType } from '../../../types/Enum/EstimateInvoice';\nimport { CommercialDocumentCommonHTML } from './common';\n\nconst commonTemplate = new CommercialDocumentCommonHTML();\n\nconst headOfDocument = `<div class=\"row space-between\">\n <% if (settings && settings.logoAlignment === 'left') { %>\n <div class=\"society-informations\">\n ${commonTemplate.logo}\n ${commonTemplate.company}\n </div>\n <% } else { %>\n <div class=\"society-informations\">${commonTemplate.company}</div>\n ${commonTemplate.logo}\n <% } %>\n </div>\n\n <div class=\"row space-between items-end\" style=\"margin-top: 10px\">\n <div style=\"width: 45%; margin-top: auto;\">\n <span class=\"document-reference\">\n <% if (idEstimateInvoiceType === ${EstimateInvoiceType.BON}) { %>\n Bon de commande\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS}) { %>\n Devis\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.FACTURE}) { %>\n Facture\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.AVOIR}) { %>\n Avoir\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.RESTE}) { %>\n Facture de solde\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) { %>\n Facture d'acompte\n <% } %>\n <%= reference %></span><br/>\n <% if(emissionDate) {%><span class=\"document-emission-date\">Date d’émission : <%= emissionDateFormatted %></span><br/><% } %>\n <% if(dueDate && idEstimateInvoiceType !== ${EstimateInvoiceType.ACOMPTE}) {%>\n <span class=\"document-due-date\">\n <% if ([${EstimateInvoiceType.BON}, ${EstimateInvoiceType.DEVIS}].includes(idEstimateInvoiceType)) {%>\n Valide jusqu'au :\n <% } else { %>\n Date d'échéance :\n <% } %>\n <%= dueDateFormatted %></span>\n <% } %>\n <% if (expirationDate && idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) {%>\n <span class=\"document-due-date\">Date d'expiration : <%= expirationDateFormatted %></span>\n <% } %>\n <% if(termsOfPayment) { %>\n <br/><p style=\"margin-bottom: 0px;\"><%= [${EstimateInvoiceType.BON}, ${EstimateInvoiceType.DEVIS}].includes(idEstimateInvoiceType) ? 'Conditions de règlement' : 'Date limite de règlement' %> : <%= termsOfPayment %></p>\n <% } %>\n </div>\n <div style=\"width: 40%; margin-top: auto;\">\n <p></p>\n <% if (thirdParty) { %>\n <div class=\"<%= settings && settings.isCoordinatesFrameDisplayed ? 'customer-border' : '' %>\">\n <% if(thirdParty.fullname) {%><b><%= thirdParty.fullname %></b><br/><% } %>\n <% if(thirdParty.company) {%><%= thirdParty.company %><br/><% } %>\n <% if(thirdParty.address) {%><%= thirdParty.address %><br/><% } %>\n <% if(thirdParty.zipCode) {%><%= thirdParty.zipCode + ' ' %><% } %><%= thirdParty.city %><br/>\n <% if(thirdParty.deliveryAddress && thirdParty.deliveryCity && thirdParty.deliveryZipCode) {%>Adresse de livraison : <%= thirdParty.deliveryAddress %> <%= thirdParty.deliveryZipCode %> <%= thirdParty.deliveryCity %><br/><% } %>\n <% if(thirdParty.nSiret) {%>SIRET : <%= thirdParty.nSiret %><% } %>\n </div>\n <% } %>\n </div>\n </div>`;\n\nexport const bodyTemplate = `<html class=\"pdf-content\">\n\n <body>\n\n ${headOfDocument}\n\n <div class=\"row mt-25\">\n <% if (title) { %>Titre : <%= title %><% } %>\n </div>\n\n <div class=\"row mt-10\">${commonTemplate.products}</div>\n\n <div class=\"row space-between mt-20\">\n <div style=\"width: 55%;\">\n <% if (disableVat !== true && vats.length) { %>\n ${commonTemplate.vatRecapitulation}\n <% } %>\n <% if (vatMention) { %><div class=\"vat-mention <%= disableVat !== true ? 'mt-20' : ''%>\"><%= vatMention %></div><% } %>\n <% if (comment) { %>\n <p class=\"mt-20\">Commentaire :<br/>\n <%- comment %>\n <% } %>\n </div>\n\n <div>\n ${commonTemplate.amountRecapitulation}\n\n <% if (isStripeAllowed) { %>\n <div style=\"text-align: right; margin-top: 30px;\">${commonTemplate.paymentButton}</div>\n <% } %>\n </div>\n \n </div>\n\n <% if (settings && (settings.iban || settings.bic)) { %>\n <div class=\"row mt-30 space-between\" style=\"page-break-inside: avoid !important;\">\n <div>\n <% if (settings && (settings.iban || settings.bic)) { %>\n <% if(settings.iban) { %>IBAN : <%= settings.iban %><br/><% } %>\n <% if(settings.bic) { %>BIC : <%= settings.bic %><% } %>\n <% } %>\n </div>\n </div>\n <% } %>\n <% if (settings && settings.bonPour && (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>\n <br/>Bon pour accord : <br/><br/><br/><br/>\n <% } %>\n\n <% if (cgv && ((settings && settings.invoiceCgv) || idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>\n <br><div style=\"page-break-after:always;\"></div>\n <%- cgv %>\n <% } %>\n </body>\n\n <style>\n ${commonTemplate.style}\n </style>\n</html>`;"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.0.63",
3
+ "version": "1.0.67",
4
4
  "description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
5
5
  "homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
6
6
  "main": "js/index.js",
@@ -1,6 +1,6 @@
1
1
  import { CancelToken } from 'axios';
2
2
  import {
3
- CreateCalendarEventForUsers, GetAllCalendarEvent, ICalendarEvent, ICalendarEventUser, QueryCalendarEvent, ReadAllCalendarEvent, UpdateCalendarEvent, VerifyCalendarEvent,
3
+ CreateCalendarEventForUsers, GetAllCalendarEvent, GetLastInvalidateEvent, ICalendarEvent, ICalendarEventUser, QueryCalendarEvent, ReadAllCalendarEvent, UpdateCalendarEvent, VerifyCalendarEvent,
4
4
  } from '../../types';
5
5
  import { Resource } from '../Resource';
6
6
 
@@ -13,6 +13,10 @@ export class CalendarEvent extends Resource {
13
13
  return this.axios.post('/calendar-events/verify', payload);
14
14
  }
15
15
 
16
+ verifyInvalidate(params: GetLastInvalidateEvent): Promise<Date> {
17
+ return this.axios.get('/calendar-events/verify-invalidate', { params });
18
+ }
19
+
16
20
  get(id: number, params: QueryCalendarEvent): Promise<ICalendarEvent> {
17
21
  return this.axios.get(`/calendar-events/${id}`, { params });
18
22
  }
@@ -0,0 +1,9 @@
1
+ import { CancelToken } from 'axios';
2
+ import { Resource } from '../Resource';
3
+ import { QueryPaginatedSocietyWithStatsCa, BasePaginate, SocietyWithStatsCaParams } from '../../types';
4
+
5
+ export class Commercial extends Resource {
6
+ getStatsCa(params: QueryPaginatedSocietyWithStatsCa, cancelToken?: CancelToken): Promise<BasePaginate<SocietyWithStatsCaParams>> {
7
+ return this.axios.$get('/commercial/paginated-with-stats-ca', { ...(cancelToken ? { cancelToken } : {}), params });
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ import { Resource } from '../Resource';
2
+ import { ISource } from '../../types';
3
+
4
+ export class Sources extends Resource {
5
+ getAll(): Promise<ISource[]> {
6
+ return this.axios.$get('/sources');
7
+ }
8
+ }
@@ -1,7 +1,6 @@
1
- import { CancelToken } from 'axios';
2
1
  import { Resource } from '../Resource';
3
2
  import {
4
- IUser, QueryConfirm, QueryResendConfirmationLink, CreateUser, CreateCoworker, QueryUserSmsConfirmation, QueryGetAllFromSociety, QuerySocieties, ISociety, Role, TimeCounterType, QueryGetAllCollaborators, QueryGetAllCollaboratorsByRoles, QueryPaginatedSocietyWithStatsCa, BasePaginate, SocietyWithStatsCaParams,
3
+ IUser, QueryConfirm, QueryResendConfirmationLink, CreateUser, CreateCoworker, QueryUserSmsConfirmation, QueryGetAllFromSociety, QuerySocieties, ISociety, Role, TimeCounterType, QueryGetAllCollaborators, QueryGetAllCollaboratorsByRoles,
5
4
  } from '../../types';
6
5
 
7
6
  export class User extends Resource {
@@ -69,8 +68,4 @@ export class User extends Resource {
69
68
  getInfo(): Promise<IUser> {
70
69
  return this.axios.$get('user');
71
70
  }
72
- // FIXME: CancelToken
73
- getStatsCa(params: QueryPaginatedSocietyWithStatsCa, cancelToken?: CancelToken): Promise<BasePaginate<SocietyWithStatsCaParams>> {
74
- return this.axios.$get('/user/paginated-with-stats-ca', { ...(cancelToken ? { cancelToken } : {}), params });
75
- }
76
71
  }
@@ -105,6 +105,8 @@ import { PaymentExpectation } from './resources/PaymentExpectation';
105
105
  import { StatisticDirection } from './resources/statistic/Direction';
106
106
  import { TerminationList } from './resources/TerminationList';
107
107
  import { SlowDetection } from './resources/SlowDetection';
108
+ import { Sources } from './resources/Sources';
109
+ import { Commercial } from './resources/Commercial';
108
110
 
109
111
  export const resources = {
110
112
  simulation: Simulation,
@@ -167,6 +169,7 @@ export const resources = {
167
169
  bankStatement: BankStatement,
168
170
  shareCapital: ShareCapital,
169
171
  closing: Closing,
172
+ commercial: Commercial,
170
173
  machineLearning: MachineLearning,
171
174
  workingSchedule: WorkingSchedule,
172
175
  revision: Revision,
@@ -214,4 +217,5 @@ export const resources = {
214
217
  paymentExpectation: PaymentExpectation,
215
218
  terminationList: TerminationList,
216
219
  slowDetection: SlowDetection,
220
+ sources: Sources,
217
221
  };
@@ -0,0 +1,64 @@
1
+ export enum ConstitutionState {
2
+ TO_CONTACT = 1,
3
+ IN_CREATION_BY_SALES_SERVICE = 2,
4
+ FINISHED = 3,
5
+ WAITING_INFORMATION_SHEET = 4,
6
+ WAITING_DEPOSIT_CERTIFICATE = 5,
7
+ WAITING_SIGNED_DOCS_OR_AL_PAYMENT_OR_COURT_FEES = 6,
8
+ WAITING_KBIS = 7,
9
+ WAITING_RIB_OR_SEPA = 8,
10
+ INVOICING_TO_D0 = 9,
11
+ ABANDONED_CASE = 10,
12
+ }
13
+ export const ConstitutionStateDetail = {
14
+ TO_CONTACT: {
15
+ id: 1,
16
+ name: 'À contacter',
17
+ color: 'grey lighten-4',
18
+ },
19
+ IN_CREATION_BY_SALES_SERVICE: {
20
+ id: 2,
21
+ name: 'En cours de création par le service commercial / client',
22
+ color: 'primary',
23
+ },
24
+ FINISHED: {
25
+ id: 3,
26
+ name: 'Dossier terminé',
27
+ color: 'success',
28
+ },
29
+ WAITING_INFORMATION_SHEET: {
30
+ id: 4,
31
+ name: 'Attente fiche de renseignement',
32
+ color: 'blue lighten-4',
33
+ },
34
+ WAITING_DEPOSIT_CERTIFICATE: {
35
+ id: 5,
36
+ name: 'Attente certificat de dépôt',
37
+ color: 'blue',
38
+ },
39
+ WAITING_SIGNED_DOCS_OR_AL_PAYMENT_OR_COURT_FEES: {
40
+ id: 6,
41
+ name: 'Attente doc signés / paiement AL / frais de Greffe',
42
+ color: 'blue lighten-4',
43
+ },
44
+ WAITING_KBIS: {
45
+ id: 7,
46
+ name: 'Attente KBIS',
47
+ color: 'purple lighten-4',
48
+ },
49
+ WAITING_RIB_OR_SEPA: {
50
+ id: 8,
51
+ name: 'Attente RIB / Mandat SEPA',
52
+ color: 'yellow lighten-4',
53
+ },
54
+ INVOICING_TO_D0: {
55
+ id: 9,
56
+ name: 'Facturation à faire',
57
+ color: 'primary lighten-2',
58
+ },
59
+ ABANDONED_CASE: {
60
+ id: 10,
61
+ name: 'Dossier en abandon',
62
+ color: 'grey darken-3',
63
+ },
64
+ };
@@ -0,0 +1,8 @@
1
+ import { IsInt } from 'class-validator';
2
+ import { ApiProperty } from '../../../../utils/decorators';
3
+
4
+ export class GetLastInvalidateEvent {
5
+ @ApiProperty()
6
+ @IsInt()
7
+ idUser: number;
8
+ }
@@ -299,9 +299,8 @@ export class CommercialDocumentInputs {
299
299
  @ApiProperty({ description: 'Pénalité de retard' })
300
300
  penalties: string | null;
301
301
 
302
- @ApiProperty({ description: 'Remise globale' })
303
- @IsNumber()
304
- generalDiscount2: number;
302
+ @ApiPropertyOptional({ description: 'Remise globale' })
303
+ generalDiscount2: number | null;
305
304
 
306
305
  @ApiProperty({ description: 'Indemnité forfaitaire' })
307
306
  compensation: string | null;
@@ -1,7 +1,9 @@
1
1
  import {
2
+ IsBoolean,
2
3
  IsInt, IsOptional, IsString,
3
4
  } from 'class-validator';
4
5
  import { ApiPropertyOptional } from '../../../../utils';
6
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
5
7
 
6
8
  export class QueryPaginatedSocietyWithStatsCa {
7
9
  @ApiPropertyOptional()
@@ -9,6 +11,24 @@ export class QueryPaginatedSocietyWithStatsCa {
9
11
  @IsString()
10
12
  search?: string;
11
13
 
14
+ @ApiPropertyOptional()
15
+ @IsOptional()
16
+ @IsBoolean()
17
+ @ToBoolean()
18
+ isInCA?: boolean;
19
+
20
+ @ApiPropertyOptional()
21
+ @IsOptional()
22
+ @IsBoolean()
23
+ @ToBoolean()
24
+ turnoverRefused?: boolean;
25
+
26
+ @ApiPropertyOptional()
27
+ @IsOptional()
28
+ @IsBoolean()
29
+ @ToBoolean()
30
+ isAdditionalSales?: boolean;
31
+
12
32
  @ApiPropertyOptional()
13
33
  @IsOptional()
14
34
  @IsInt()
@@ -44,7 +64,12 @@ export class QueryPaginatedSocietyWithStatsCa {
44
64
  @IsInt({ each: true })
45
65
  idState?: number[];
46
66
 
47
- @ApiPropertyOptional({ default: 25 })
67
+ @ApiPropertyOptional()
68
+ @IsOptional()
69
+ @IsInt()
70
+ idConstitutionState?: number;
71
+
72
+ @ApiPropertyOptional({ default: 20 })
48
73
  @IsOptional()
49
74
  @IsInt()
50
75
  limit?: number;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  IsBoolean, IsNumber, IsOptional, IsPositive,
3
3
  } from 'class-validator';
4
- import { ApiProperty, ApiPropertyOptional } from '../../../../utils/decorators';
4
+ import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
5
5
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
6
6
 
7
7
  export class UpdateAttribution {
package/ts/types/index.ts CHANGED
@@ -399,6 +399,7 @@ export * from './Enum/FieldSocietyStat';
399
399
  export * from './Enum/PrestationType';
400
400
  export * from './Enum/StatsCaStateDetail';
401
401
  export * from './Enum/Lab';
402
+ export * from './Enum/ConstitutionState';
402
403
  export * from './Enum/Supervision';
403
404
  export * from './Enum/Notification';
404
405
  export * from './Enum/Comment';
@@ -765,6 +766,7 @@ export * from './Interface/api/calendarEvent/updateCalendarEvent';
765
766
  export * from './Interface/api/calendarEvent/interval';
766
767
  export * from './Interface/api/calendarEvent/queryCalendarEvent';
767
768
  export * from './Interface/api/calendarEvent/getAllCalendarEvent';
769
+ export * from './Interface/api/calendarEvent/getLastInvalidateEvent';
768
770
  export * from './Interface/api/calendarEvent/readAllCalendarEvent';
769
771
  export * from './Interface/api/checklist/Read';
770
772
  export * from './Interface/api/checklist/Query';
@@ -30,6 +30,7 @@ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoic
30
30
  discount: payload.discount ?? null,
31
31
  vatMention: payload.vatMention ?? null,
32
32
  phoneContact: payload.settings?.phoneContact ?? null,
33
+ comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\n/g, '<br/>') : payload.comment,
33
34
  products,
34
35
  vats,
35
36
  totalTaxExcluded: _sumBy(products, 'totalTaxExcluded'),
@@ -82,6 +83,7 @@ export function generateAdvanceDocument(payload: CreateInvoiceDocument): ReadCom
82
83
  totalTaxIncluded: payload.deposit,
83
84
  totalTaxAndDiscountIncluded: payload.deposit,
84
85
  generalDiscountFormatted: null,
86
+ comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\n/g, '<br/>') : payload.comment,
85
87
  depositFormatted: integerToFormattedAmountString(payload.deposit),
86
88
  totalTaxExcludedFormatted: integerToFormattedAmountString(payload.deposit),
87
89
  totalTaxIncludedFormatted: integerToFormattedAmountString(payload.deposit),
@@ -84,7 +84,7 @@ export const bodyTemplate = `<html class="pdf-content">
84
84
  <% if (vatMention) { %><div class="vat-mention <%= disableVat !== true ? 'mt-20' : ''%>"><%= vatMention %></div><% } %>
85
85
  <% if (comment) { %>
86
86
  <p class="mt-20">Commentaire :<br/>
87
- <%= comment %>
87
+ <%- comment %>
88
88
  <% } %>
89
89
  </div>
90
90
 
@@ -112,7 +112,7 @@ export const bodyTemplate = `<html class="pdf-content">
112
112
  <br/>Bon pour accord : <br/><br/><br/><br/>
113
113
  <% } %>
114
114
 
115
- <% if (cgv && (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>
115
+ <% if (cgv && ((settings && settings.invoiceCgv) || idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>
116
116
  <br><div style="page-break-after:always;"></div>
117
117
  <%- cgv %>
118
118
  <% } %>