Skip to content

Commit

Permalink
feat: create dedicated folder for cloud nourd
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelDemey committed Feb 17, 2024
1 parent 5cfde40 commit e80315f
Show file tree
Hide file tree
Showing 16 changed files with 1,770 additions and 915 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@master
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
- name: Install Front
run: npm --prefix public install
run: npm --prefix public install --force
- name: Build Back
run: npm --prefix functions install
- name: Deploy to Firebase for ${{ matrix.org }}
Expand Down
46 changes: 40 additions & 6 deletions functions/src/generator/lib/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import * as ejs from "ejs";
import * as markdownToPDf from "markdown-pdf";
import * as os from "os";

import ConventionEn from "../templates/convention_en";
import ConventionFr from "../templates/convention_fr";
import InvoiceFr from "../templates/invoice_fr";
import ProformaInvoiceFr from "../templates/proforma_invoice_fr";
import { Configuration, Settings, SponsorshipConfiguration } from "../../model";

function getSponsoringFees(sponsoringConfiguration: SponsorshipConfiguration): [string, number, number] {
Expand Down Expand Up @@ -44,13 +40,23 @@ function generateFile(
}

const [SPONSORING_TEXT, SPONSORING_NUMBER, NUMBER_PLACE] = getSponsoringFees(sponsoringConfiguration);

const LINES: { label: string; price: number }[] = [];
let total = SPONSORING_NUMBER;
LINES.push({ label: `Partenariat ${settings.gdg.event}`, price: SPONSORING_NUMBER });

(config.options ?? []).forEach((option: { label: string; total: number }) => {
total += option.total;
LINES.push({ label: option.label, price: option.total });
});
config;
return new Promise((resolve, reject) => {
const data = {
CONSIDERATIONS:
config.lang === "fr"
? sponsoringConfiguration?.considerations
: sponsoringConfiguration?.considerationsEn ?? sponsoringConfiguration?.considerations,
HAS_BOOTH: sponsoringConfiguration?.hasBooth.toString(),
HAS_BOOTH: sponsoringConfiguration?.hasBooth?.toString(),
COMPANY: getOfficialName(),
SIRET: config.siret,
COMPANY_ADDRESS: config.address,
Expand All @@ -65,7 +71,7 @@ function generateFile(
SPONSORING: config.sponsoring,
PO: config.PO,
SPONSORING_TEXT,
SPONSORING_NUMBER,
SPONSORING_NUMBER: total,
START_DATE: settings.convention.startdate,
END_DATE: settings.convention.enddate,
DATE,
Expand Down Expand Up @@ -98,6 +104,11 @@ function generateFile(
}

export function generateProformaInvoice(config: any, settings: Settings, configurationFromFirestore: Configuration) {
const ProformaInvoiceFr =
settings.gdg.event === "Devfest Lille"
? require("./template_devfest/proforma_invoice_fr")
: require("./template_cloudnord/proforma_invoice_fr");

return generateFile(
config,
`proforma_invoice_${config.id}.pdf`,
Expand All @@ -108,6 +119,11 @@ export function generateProformaInvoice(config: any, settings: Settings, configu
);
}
export function generateDevis(config: any, settings: Settings, configurationFromFirestore: Configuration) {
const ProformaInvoiceFr =
settings.gdg.event === "Devfest Lille"
? require("./template_devfest/proforma_invoice_fr")
: require("./template_cloudnord/proforma_invoice_fr");

return generateFile(
config,
`devis_${config.id}.pdf`,
Expand All @@ -118,6 +134,11 @@ export function generateDevis(config: any, settings: Settings, configurationFrom
);
}
export function generateDepositInvoice(config: any, settings: Settings, configurationFromFirestore: Configuration) {
const ProformaInvoiceFr =
settings.gdg.event === "Devfest Lille"
? require("./template_devfest/proforma_invoice_fr")
: require("./template_cloudnord/proforma_invoice_fr");

return generateFile(
config,
`deposit_invoice_${config.id}.pdf`,
Expand All @@ -128,9 +149,22 @@ export function generateDepositInvoice(config: any, settings: Settings, configur
);
}
export function generateInvoice(config: any, settings: Settings, configurationFromFirestore: Configuration) {
const InvoiceFr =
settings.gdg.event === "Devfest Lille"
? require("./template_devfest/invoice_fr")
: require("./template_cloudnord/invoice_fr");
return generateFile(config, `invoice_${config.id}.pdf`, InvoiceFr, settings, "", configurationFromFirestore);
}
export function generateConvention(config: any, settings: Settings, configurationFromFirestore: Configuration) {
const ConventionFr =
settings.gdg.event === "Devfest Lille"
? require("./template_devfest/convention_fr")
: require("./template_cloudnord/convention_fr");
const ConventionEn =
settings.gdg.event === "Devfest Lille"
? require("./template_devfest/convention_en")
: require("./template_cloudnord/convention_en");

return generateFile(
config,
`convention_${config.id}.pdf`,
Expand Down
File renamed without changes.
84 changes: 84 additions & 0 deletions functions/src/generator/templates_cloudnord/convention_en.ts

Large diffs are not rendered by default.

105 changes: 105 additions & 0 deletions functions/src/generator/templates_cloudnord/convention_fr.ts

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions functions/src/generator/templates_cloudnord/invoice_fr.ts

Large diffs are not rendered by default.

83 changes: 83 additions & 0 deletions functions/src/generator/templates_cloudnord/proforma_invoice_fr.ts

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ export default `
<th><b>Montant</b></th>
</thead>
<tbody>
<tr>
<td><b><%= DATE %></b></td>
<td>Partenariat <%= EVENT_NAME %> <%= EVENT_EDITION %></td>
<td><%= SPONSORING_NUMBER %> € HT</td>
</tr>
<% for(var i=0; i < LINES.length; i++) { %>
//Partenariat <%= EVENT_NAME %> <%= EVENT_EDITION %>
<tr>
<td><b><%= DATE %></b></td>
<td><%= LINES[i].label %></td>
<td><%= LINES[i].price %> € HT</td>
</tr>
<% } %>
<tr>
<td></td>
<td>TVA 0%</td>
Expand All @@ -60,7 +63,7 @@ export default `
</table>
<br>
<div style="font-size: 8px">
Facture arrêtée à la somme de <%= SPONSORING_TEXT %> (<%= SPONSORING_NUMBER %>).
Facture arrêtée à la somme de <%= SPONSORING_NUMBER %>€ TTC.
TVA non applicable, article 261 du Code général des impôts.
</div>
<div style="font-size: 8px">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ export default `
<th><b>Montant</b></th>
</thead>
<tbody>
<tr>
<td><b><%= DATE %></b></td>
<td>Partenariat <%= EVENT_NAME %> <%= EVENT_EDITION %></td>
<td><%= SPONSORING_NUMBER %> € HT</td>
</tr>
<% for(var i=0; i < LINES.length; i++) { %>
//Partenariat <%= EVENT_NAME %> <%= EVENT_EDITION %>
<tr>
<td><b><%= DATE %></b></td>
<td><%= LINES[i].label %></td>
<td><%= LINES[i].price %> € HT</td>
</tr>
<% } %>
<tr>
<td></td>
<td>TVA 0%</td>
Expand All @@ -61,7 +64,7 @@ export default `
</table>
<br>
<div style="font-size: 8px">
Facture arrêtée à la somme de <%= SPONSORING_TEXT %> (<%= SPONSORING_NUMBER %>).
Facture arrêtée à la somme de <%= SPONSORING_NUMBER %>€ TTC.
TVA non applicable, article 261 du Code général des impôts.
</div>
<div style="font-size: 8px">
Expand Down
4 changes: 2 additions & 2 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as cms4devfestFunctions from "./cms4devfest";
import * as cms4devfestFunctionsGdg from "./cms4devfest-gdg";
//import * as cms4devfestFunctionsGdg from "./cms4devfest-gdg";

export const cms = cms4devfestFunctions;
export const cms4devfestgdg = cms4devfestFunctionsGdg;
//export const cms4devfestgdg = cms4devfestFunctionsGdg;

/*export const cms4devfestcloudnord = {
};*/
Loading

0 comments on commit e80315f

Please sign in to comment.