@silexpert/core 2.0.146 → 2.0.148
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.
- package/dist/client/index.mjs +6 -6
- package/dist/client/index.mjs.map +1 -1
- package/dist/client/{product-CMM11efR.mjs → product-cI7WAMo5.mjs} +2 -2
- package/dist/client/product-cI7WAMo5.mjs.map +1 -0
- package/dist/client/server/index.mjs +14 -14
- package/dist/client/server/index.mjs.map +1 -1
- package/dist/{index-BjSnLHXQ.d.mts → index-CrCkJdLX.d.mts} +228 -23
- package/dist/{index-BjSnLHXQ.d.mts.map → index-CrCkJdLX.d.mts.map} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/dist/{product-BwQV2WQl.mjs → product-DgUMWOGW.mjs} +2 -2
- package/dist/product-DgUMWOGW.mjs.map +1 -0
- package/dist/server/index.d.mts +3 -3
- package/dist/server/index.d.mts.map +1 -1
- package/dist/server/index.mjs +14 -14
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/client/product-CMM11efR.mjs.map +0 -1
- package/dist/product-BwQV2WQl.mjs.map +0 -1
package/dist/server/index.d.mts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { t as __name } from "../rolldown-runtime-BhWHdk3m.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { DX as EstimateInvoiceType, IJ as CreatePreSaleDocument, NJ as CreateInvoiceDocument, PJ as CreateMailHeader, dJ as ReadCommercialDocumentTemplate, fJ as ReadCommercialMailTemplate, v as CommercialSocietyVats } from "../index-CrCkJdLX.mjs";
|
|
3
3
|
import "dayjs/locale/fr.js";
|
|
4
4
|
//#region ts/utils/email.d.ts
|
|
5
5
|
export declare function generateSignature(params: any): string;
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region ts/utils/commercialManagement/document.d.ts
|
|
8
|
-
export declare function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument, shouldHideBrandName?: boolean, nodeEnv?: string | undefined): ReadCommercialDocumentTemplate;
|
|
8
|
+
export declare function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument, shouldHideBrandName?: boolean, nodeEnv?: string | undefined, societyVats?: CommercialSocietyVats): ReadCommercialDocumentTemplate;
|
|
9
9
|
export declare function generateMailHeader(params: CreateMailHeader, shouldHideBrandName?: boolean, nodeEnv?: string | undefined): ReadCommercialMailTemplate;
|
|
10
10
|
export declare const DUE_DATE_BEFORE_EMISSION_DATE_ERROR = "La date d’échéance ne peut pas être antérieure à la date d’émission.";
|
|
11
11
|
/**
|
|
12
12
|
* @public
|
|
13
13
|
* @description Si cette fonction est modifiée, penser à check si la fonction `checkErrors` de `emission.service.ts` du core doit être modifiée aussi
|
|
14
14
|
*/
|
|
15
|
-
export declare function checkCommercialDocumentInformation(payload: CreateInvoiceDocument | CreatePreSaleDocument): {
|
|
15
|
+
export declare function checkCommercialDocumentInformation(payload: CreateInvoiceDocument | CreatePreSaleDocument, societyVats?: CommercialSocietyVats): {
|
|
16
16
|
valid: boolean;
|
|
17
17
|
errors?: string[];
|
|
18
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../ts/utils/email.ts","../../ts/utils/commercialManagement/document.ts"],"mappings":";;;;wBA8NgB,kBAAkB;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../ts/utils/email.ts","../../ts/utils/commercialManagement/document.ts"],"mappings":";;;;wBA8NgB,kBAAkB;;;wBChLlB,2BACd,uBAAuB,qBACvB,SAAS,wBAAwB,uBACjC,+BACA,8BACA,cAAc,wBACb;wBAsNa,mBACd,QAAQ,kBACR,+BACA,+BACC;qBAqCU;;;;;wBAOG,mCACd,SAAS,wBAAwB,uBACjC,cAAc;EAEd;EACA"}
|
package/dist/server/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../rolldown-runtime-BhWHdk3m.mjs";import{
|
|
1
|
+
import"../rolldown-runtime-BhWHdk3m.mjs";import{B as e,E as t,G as n,S as r,T as i,X as a,a as o,c as s,d as c,et as l,f as u,g as d,ht as f,o as p,r as m,s as h,u as g,xt as _,yt as v}from"../product-DgUMWOGW.mjs";import{groupBy as y,orderBy as b,round as x,sumBy as S,uniq as C}from"lodash-es";import w from"dayjs";import T from"ejs";import E from"sanitize-html";import"dayjs/locale/fr.js";function getRoleSignature(e){if(e.positionLabel)return e.positionLabel;let t=e.roles.map(e=>e.id).includes(44)||e.roles.map(e=>e.id).includes(45),n=e.roles.map(e=>e.id).includes(19),r=e.roles.map(e=>e.id).includes(11),i=e.roles.map(e=>e.id).includes(12),a=e.roles.map(e=>e.id).includes(34),o=e.roles.map(e=>e.id).includes(20),s=e.roles.map(e=>e.id).includes(10),c=e.roles.map(e=>e.id).includes(50),l=e.roles.map(e=>e.id).includes(41),u=e.roles.map(e=>e.id).includes(51),f=e.roles.map(e=>e.id).includes(9),p=e.roles.map(e=>e.id).includes(2),m=e.roles.map(e=>e.id).includes(55),h=!!d(e.roles.map(e=>e.id),[3,15]).length;return f&&n?`Responsable commercial`:f?`Chargé${e.idCivility===2?`e`:``} de clientèle`:s&&n?`Responsable relations clients`:s?`Conseill${e.idCivility===2?`ère`:`er`} comptable`:m?`Référent${e.idCivility===2?`e`:``} technique`:c&&n?`Responsable chargé${e.idCivility===2?`e`:``} accueil clients`:c?`Chargé${e.idCivility===2?`e`:``} accueil clients`:l&&n?`Responsable chargé${e.idCivility===2?`e`:``} de la satisfaction clients`:l?`Chargé${e.idCivility===2?`e`:``} de la satisfaction clients`:u&&n?`Responsable aide comptable`:u?`Aide comptable`:a&&t?`Assistant facturation`:a&&n?`Responsable facturation`:a?`Chargé${e.idCivility===2?`e`:``} de facturation`:i&&t?`Assistant juridique`:i&&n?`Responsable juridique`:i?`Juriste`:r&&t?`Assistant paie`:r&&n?`Responsable paie`:r?`Gestionnaire de paie`:o?`Expert${e.idCivility===2?`e`:``}-comptable`:p?`Développeur web`:h&&n?`Responsable comptable`:h&&t?`Assistant comptable`:`Comptable`}function getHoraires(e){return e?.roles?.map(e=>e.id).includes(9)?`Du lundi au vendredi de 9h à 18h`:`Du lundi au jeudi de 9h à 17h<br/>Le vendredi de 9h à 12h`}function getMailSignature(e,t){let n=_({...t?{idTypeBrand:t}:{},objectWaited:`listMails.informatique`}),r=_({...t?{idTypeBrand:t}:{},objectWaited:`listMails.bonjour`});return e.roles.map(e=>e.id).includes(2)?n:e&&d(e.roles.map(e=>e.id),[3,15,51,9,55]).length?e.email:r}function getPhoneSignature(e){return e.phone&&e.phone!==`0383931414`?e.phone.replace(/\B(?=(\d{2})+(?!\d))/g,` `):null}function generateSignature(e){let{fromAddress:t=null,idTypeBrand:n=1,calendlyUrl:r=null,...i}=e,{user:a,forceRole:o=null}=i,s=v({idTypeBrand:n}),c=s.urlS3,l=s.name,u=s.companyInformation?.city,f=s.companyInformation?.postalAddress||``,p=s.commercialName,m=s.bank?.IBAN,h=s.bank?.BIC,g=s.listMails?.bonjour||``,_=s.listMails?.social||``,y=s.listMails?.gestion||``,b=s.listMails?.satisfaction||``,x=s.listMails?.resiliation||``,S=s.listMails?.support||``,C=s.listMails?.juridique||``,w=s.listMails?.facturation||``,E=s.colors?.primary||``,D=s.listPhones?.contact||``,O=s.listPhones?.juridique||``,k=s.listPhones?.social||``,A=[{email:b,forceRole:`satisfaction`},{email:x,forceRole:`resiliation`},{email:w,forceRole:`facturation`}].find(e=>e.email===t);A&&(o=A.forceRole);let j,M,N,P;return[j,M,N,P]=[`Expert-Comptable`,g,null,`Du lundi au vendredi de 9h à 18h`],a?.roles&&a.roles.some(e=>e.id===51)?(a={firstname:`L'équipe ${p}`,isAll:!0},M=y,j=``):d((a?.roles??[]).map(e=>e.id),[3,54]).length===2?(a={firstname:`L'équipe ${p}`,isAll:!0},M=g,j=``):o===`satisfaction`?(a={firstname:`Service satisfaction clients`,isAll:!0},M=b,j=``,N=D):o===`resiliation`?(a={firstname:`Service satisfaction clients`,isAll:!0},M=x,j=``,N=D):o===`social`?(a={firstname:`Service social`,isAll:!0},M=_,j=``,N=k):o===`support`?(a={firstname:`Service Support`,isAll:!0},M=S,j=null):o===`juridique`?(a={firstname:`Service juridique`,isAll:!0},M=C,j=null,N=O):o===`facturation`?(a={firstname:`Service facturation`,isAll:!0},M=w,j=null,N=D):!a||o===`generique`?(a={firstname:`L'équipe ${p}`,isAll:!0},j=``):a!==0&&(j=getRoleSignature(a),M=getMailSignature(a,n),P=getHoraires(a),N=getPhoneSignature(a)),r&&(a.calendlyUrl=r),T.render(`<% if (commercialName === 'Clementine' && isFacturation) { %>
|
|
2
2
|
<p style="font-size: 15px; font-family: Arial; margin:0; padding:0px 0 4px; color:#6E6E71; margin-bottom: 10px; font-weight: bold;">
|
|
3
3
|
<span style="color: #A0A0A0">Nos coordonnées bancaires </span>IBAN : <%= iban %> - BIC : <%= bic %>
|
|
4
4
|
</p>
|
|
@@ -248,7 +248,7 @@ class="signatureClementine">
|
|
|
248
248
|
Les informations contenues dans ce courrier électronique et ses pièces jointes sont confidentielles et couvertes par le secret professionnel. Si vous n'êtes pas le(s) destinataire(s) ou avez reçu ce courrier électronique par erreur, merci de bien vouloir supprimer l'email et d'en informer l'expéditeur dès que possible. Ce courrier électronique ne peut pas être divulgué, utilisé ou copié par quelqu'un d'autre que le(s) destinataire(s).
|
|
249
249
|
</td>
|
|
250
250
|
</tr>
|
|
251
|
-
</table>`,{forceRole:
|
|
251
|
+
</table>`,{forceRole:o,isFacturation:a.roles?a.roles.some(e=>e.id===34):!1,isDataOfficer:!a.roles||a.roles.some(e=>e.id===51),brandName:l,brandPostalAddress:f,brandCity:u,idTypeBrand:n,commercialName:p,iban:m,bic:h,hostS3:c,user:a,roleSignature:j,mailSignature:M,phoneSignature:p!==`Comptalib`&&N?N.replace(/\s+/gm,` `):null,standardPhoneSignature:p===`Comptalib`?null:D.replace(/\s+/gm,` `),horaires:P,primaryColor:E,supportMail:S},{})}var CommercialDocumentCommonHTML=class{header=`<style>html {
|
|
252
252
|
-webkit-print-color-adjust: exact;
|
|
253
253
|
}</style><% if (settings && settings.isEdgingDisplayed) { %>
|
|
254
254
|
<span id="header-edging" style="position: absolute; top: 0; left: 0; width: 100vw; font-size: 10px !important; height: 15px; background-color: <%= settings && settings.edgingColor ? settings.edgingColor : '#333333' %>; margin-bottom: 20px;"></span>
|
|
@@ -640,19 +640,19 @@ class="signatureClementine">
|
|
|
640
640
|
<% } %>
|
|
641
641
|
</div>
|
|
642
642
|
</div>
|
|
643
|
-
`};const
|
|
643
|
+
`};const D=new CommercialDocumentCommonHTML,O=`<html class="pdf-content">
|
|
644
644
|
|
|
645
645
|
<body>
|
|
646
646
|
|
|
647
647
|
${`<div class="row space-between">
|
|
648
648
|
<% if (settings && settings.logoAlignment === 'left') { %>
|
|
649
649
|
<div class="society-informations">
|
|
650
|
-
${
|
|
651
|
-
${
|
|
650
|
+
${D.logo}
|
|
651
|
+
${D.company}
|
|
652
652
|
</div>
|
|
653
653
|
<% } else { %>
|
|
654
|
-
<div class="society-informations">${
|
|
655
|
-
${
|
|
654
|
+
<div class="society-informations">${D.company}</div>
|
|
655
|
+
${D.logo}
|
|
656
656
|
<% } %>
|
|
657
657
|
</div>
|
|
658
658
|
|
|
@@ -711,12 +711,12 @@ class="signatureClementine">
|
|
|
711
711
|
<% if (title) { %><%=languageTemplate.template.common.headers.title %> : <%= title %><% } %>
|
|
712
712
|
</div>
|
|
713
713
|
|
|
714
|
-
<div class="row mt-10">${
|
|
714
|
+
<div class="row mt-10">${D.products}</div>
|
|
715
715
|
|
|
716
716
|
<div class="row space-between mt-20">
|
|
717
717
|
<div style="width: 55%;">
|
|
718
718
|
<% if (disableVat !== true && vats.length) { %>
|
|
719
|
-
${
|
|
719
|
+
${D.vatRecapitulation}
|
|
720
720
|
<% } %>
|
|
721
721
|
<% if (vatMention && vatMention !== 'TVA: Non concerné' && vatMention !== 'VAT: Not affected') { %><div class="vat-mention <%= disableVat !== true ? 'mt-20' : ''%>"><%= vatMention %></div><% } %>
|
|
722
722
|
<% if (comment) { %>
|
|
@@ -726,10 +726,10 @@ class="signatureClementine">
|
|
|
726
726
|
</div>
|
|
727
727
|
|
|
728
728
|
<div>
|
|
729
|
-
${
|
|
729
|
+
${D.amountRecapitulation}
|
|
730
730
|
|
|
731
731
|
<% if (isStripeAllowed && ![3, 2].includes(idEstimateInvoiceType)) { %>
|
|
732
|
-
<div style="text-align: right; margin-top: 30px;">${
|
|
732
|
+
<div style="text-align: right; margin-top: 30px;">${D.paymentButton}</div>
|
|
733
733
|
<% } %>
|
|
734
734
|
</div>
|
|
735
735
|
|
|
@@ -764,10 +764,10 @@ class="signatureClementine">
|
|
|
764
764
|
</body>
|
|
765
765
|
|
|
766
766
|
<style>
|
|
767
|
-
${
|
|
767
|
+
${D.style}
|
|
768
768
|
</style>
|
|
769
769
|
<style>
|
|
770
|
-
${
|
|
770
|
+
${D.styleWYSIWYG}
|
|
771
771
|
</style>
|
|
772
|
-
</html>`;function thirdPartyToReadThirdPartyEditing(e){return{...e,country:
|
|
772
|
+
</html>`;function thirdPartyToReadThirdPartyEditing(e){return{...e,country:r(e?.idCountry)?n.find(t=>t.id===e.idCountry)?.name?.toUpperCase()??null:null,deliveryCountry:r(e?.deliveryIdCountry)?n.find(t=>t.id===e.deliveryIdCountry)?.name?.toUpperCase()??null:null}}function generateCommercialDocument(n,r,i=!1,o=void 0,l){let getProductVatGroupKey=e=>h(e,l),d=b(r.products.map(e=>m(e,l),`reorder`)),v=b(Object.values(y(d,getProductVatGroupKey)).map(e=>s(e,l),`value`)).filter(t=>p(t.id,l)!==e.MARGE.id),D=thirdPartyToReadThirdPartyEditing(r.thirdParty),k;if(r.advanceProducts?.length){let n=Object.values(y(r.advanceProducts,getProductVatGroupKey)).map(e=>s(e,l),`value`).filter(t=>p(t.id,l)!==e.MARGE.id);k=v.map(e=>{let r=n.find(t=>t.name===e.name),i=e.base-(r?.base??0),a=e.toPay-(r?.toPay??0);return{...e,baseFormatted:t(i),amountFormatted:t(a)}})}let A=S(v,e=>x(e.amount)),j=S(d,`totalTaxExcludedRounded`),M=j+A,N=r.language??`fr`,P=c[N],F=a.find(e=>e.id===r.accountingCategory)?.label??null,I=r.recoveryCost,L={...r,thirdParty:D,paymentLink:r.paymentLink??`#`,idEstimateInvoiceType:n,title:r.title??null,cgv:g(r.cgv)?null:r.cgv,areCgvOnNewPage:r.settings?.areCgvOnNewPage??!0,name:r.name??null,number:r.number??null,street:r.street??null,zipCode:r.zipCode??null,city:r.city??null,legalForm:r.legalForm??null,capital:r.capital??null,siren:r.siren??null,rcs:r.rcs??null,vatCode:r.vatCode??null,nafCode:r.nafCode??null,penalties:r.penalties?u(N,r.penalties,`penalties`)??r.penalties:null,termsOfPayment:r.termsOfPayment?u(N,r.termsOfPayment,`termsOfPayment`)??r.termsOfPayment:null,recoveryCost:I?u(N,I,`recoveryCost`)??I:null,discount:r.discount?u(N,r.discount,`discount`)??r.discount:null,vatMention:r.vatMention?u(N,r.vatMention,`vatMention`)??r.vatMention:null,phoneContact:r.settings?.phoneContact??null,products:d,vats:v,totalTaxExcluded:j,totalTaxIncluded:x(M),totalTaxAndDiscountIncluded:x(M),generalDiscountFormatted:r.generalDiscount2?t(r.generalDiscount2):null,depositFormatted:r.deposit?t(r.deposit):null,totalTaxExcludedFormatted:t(j),totalTaxIncludedFormatted:t(M),totalTaxAndDiscountIncludedFormatted:t(M-(r.generalDiscount2??0)-(r.deposit??0)),totalVatAmountFormatted:t(A),font:{id:r.settings?.idFont??1,name:f.find(e=>e.id===r.settings?.idFont)?.name??f[0].name,url:f.find(e=>e.id===r.settings?.idFont)?.link??f[0].link},capitalFormatted:r.capital?`${r.capital}`.split(``).reduceRight((e,t,n,{length:r})=>`${t}${(r-(n+1))%3==0?` `:``}${e}`,``).trim():null,dueDateFormatted:r.dueDate?w(r.dueDate).format(`DD/MM/YYYY`):null,expirationDateFormatted:r.expirationDate?w(r.expirationDate).format(`DD/MM/YYYY`):null,emissionDateFormatted:r.emissionDate?w(r.emissionDate).format(`DD/MM/YYYY`):null,shouldDisplayDiscountColumn:!!d.find(e=>e.discount2&&e.discount2>0),marginVats:C(d.filter(e=>e.marginVatFormatted!==null).map(e=>e.marginVatFormatted)),accountingCategoryFormatted:F?u(N,F,`accountingCategory`)??null:null,brandColors:_({objectWaited:`colors`,nodeEnv:o}),brandName:`${_({objectWaited:`name`,nodeEnv:o})}`,shouldHideBrandName:i,addressComplement:r.addressComplement??null,paymentType:r.paymentType?u(N,r.paymentType,`paymentType`)??r.paymentType:null,languageTemplate:P},R=new CommercialDocumentCommonHTML,z=[2,3].includes(n)?r?.settings?.freeEstimateText:r?.settings?.freeInvoiceText;return{header:T.render(R.header,L,{}),body:T.render(O,{...L,cgv:L.cgv&&typeof L.cgv==`string`?E(L.cgv,{allowedTags:[`b`,`i`,`em`,`br`,`strong`,`p`,`span`,`li`,`ul`,`ol`,`h1`,`h2`,`h3`,`u`,`s`,`a`,`blockquote`],allowedAttributes:{a:[`href`,`name`,`target`,`data-list`],li:[`data-list`],"*":[`class`,`style`,`dir`]},allowedClasses:{"*":[/^ql-/]},allowedStyles:{"*":{color:[/^[a-z]+$/i,/^#(?:[0-9a-f]{3}){1,2}$/i,/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/i],"background-color":[/^[a-z]+$/i,/^#(?:[0-9a-f]{3}){1,2}$/i,/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/i],"text-align":[/^left$/i,/^right$/i,/^center$/i,/^justify$/i],"white-space":[/^pre-wrap$/i]}}}):null,comment:L.comment&&typeof L.comment==`string`?E(L.comment?.replace(/\n/g,`<br/>`),{allowedTags:[`b`,`i`,`em`,`br`,`strong`]}):null,products:L.products.map(e=>({...e,comment:e.comment&&typeof e.comment==`string`?E(e.comment?.replace(/\n/g,`<br/>`),{allowedTags:[`b`,`i`,`em`,`br`,`strong`]}):null,unitFormatted:u(N,e.unitFormatted,`unit`)})),vats:k??v},{}),footer:T.render(R.footer,{...L,freeText:z&&typeof z==`string`?E(z?.replace(/\n/g,`<br/>`),{allowedTags:[`b`,`i`,`em`,`br`,`strong`,`p`]}):null},{}),data:L}}function generateMailHeader(e,t=!1,n=void 0){let r=e.payload.language??`fr`,a=c[r];w.locale(`fr`);let o={...e.payload,totalTaxExcludedFormatted:i(e.payload.totalTaxExcluded),totalTaxIncludedFormatted:i(e.payload.totalTaxIncluded),totalVatFormatted:i(e.payload.totalTaxIncluded-e.payload.totalTaxExcluded),dueDateFormatted:e.payload.dueDate?w(e.payload.dueDate).format(`DD MMMM YYYY`):null,hasVat:e.hasVat,hostS3:e.hostS3,logoUrl:e.logoUrl,companyName:e.companyName,fileUrl:e.fileUrl,brandColors:_({objectWaited:`colors`,nodeEnv:n}),shouldHideBrandName:t,languageMail:a},s=new CommercialDocumentMailHTML;return{header:T.render(s.header,o,{})}}function isMissing(e){return e==null?!0:typeof e==`string`?e.trim().length===0:Array.isArray(e)?e.length===0:!1}const k=`La date d’échéance ne peut pas être antérieure à la date d’émission.`;function checkCommercialDocumentInformation(t,n){let r=[],getProductVatGroupKey=e=>h(e,n),i=b(t.products.map(e=>m(e,n),`reorder`)),a=b(Object.values(y(i,getProductVatGroupKey)).map(e=>s(e,n),`value`)).filter(t=>p(t.id,n)!==e.MARGE.id),c=S(a,e=>x(e.amount)),u=S(i,e=>x(e.totalTaxExcluded)),d=x(u+c),f=[{value:t.reference,error:`Le numéro de facture est obligatoire.`},{value:t.idEstimateInvoiceType,error:`Le type de document est obligatoire.`},{value:t.emissionDate,error:`La date d’émission est obligatoire.`},...i.flatMap((e,t)=>{let n=e.itemSaleName?.trim()?`"${e.itemSaleName}"`:`à la ligne ${t+1}`;return[{value:e.itemSaleName,error:`Le nom de l'article ${n} est obligatoire.`},{value:e.priceTaxExcluded,error:`Le prix net de l'article ${n} est obligatoire.`},{value:e.quantity,error:`La quantité de l'article ${n} est obligatoire.`},{value:e.unit,error:`Le code EN 16931 de l'article ${n} est obligatoire.`},{value:e.idVat,error:`Le type de TVA de l'article ${n} est obligatoire.`},{value:e.totalTaxExcluded,error:`Le montant net de l'article ${n} est obligatoire.`}]}),{value:t.name,error:`Le nom du vendeur est obligatoire.`},{value:t.siren,error:`Le SIREN du vendeur est obligatoire.`},{value:t.zipCode,error:`Le code postal du vendeur est obligatoire.`},{value:t.street,error:`L’adresse du vendeur est obligatoire.`},{value:t.city,error:`La ville du vendeur est obligatoire.`},{value:t.idCountry,error:`Le pays du vendeur est obligatoire.`},{value:t.thirdParty.company??t.thirdParty.fullname??`NA`,error:`Le nom de l’acheteur est obligatoire.`},{value:t.thirdParty?.idCountry,error:`Le pays de l’acheteur est obligatoire.`},...a.flatMap((e,t)=>[{value:e.amount,error:`Le montant de TVA à la ligne ${t+1} est obligatoire.`},{value:e.base,error:`La base d’imposition de la TVA à la ligne ${t+1} est obligatoire.`},{value:e.value,error:`Le type de TVA à la ligne ${t+1} est obligatoire.`}]),{value:u,error:`Le montant total hors taxe est obligatoire.`},{value:u,error:`La somme du montant net des lignes est obligatoire.`},{value:c,error:`Le montant total de TVA est obligatoire.`},{value:d,error:`Le montant total TTC est obligatoire.`}],g=l.find(e=>e.value===t.vatMention)?.taxType??`standard`;if([`margin`,`autoliquidation`,`export`,`exempt`].includes(g))for(let e of i)o(e.idVat,n)?.value!==0&&r.push(`L'article "${e.itemSaleName}" a une TVA non nulle alors que la mention légale de TVA est définie comme "${g}".`);return r.push(...f.filter(e=>isMissing(e.value)).map(e=>e.error)),[1,5].includes(t.idEstimateInvoiceType)&&!isMissing(t.dueDate)&&!isMissing(t.emissionDate)&&w(t.dueDate).isBefore(t.emissionDate,`day`)&&r.push(k),{valid:r.length===0,errors:r.length>0?r:void 0}}export{k as DUE_DATE_BEFORE_EMISSION_DATE_ERROR,checkCommercialDocumentInformation,generateCommercialDocument,generateMailHeader,generateSignature};
|
|
773
773
|
//# sourceMappingURL=index.mjs.map
|