Skip to content

Commit

Permalink
create Extractor CA VF
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJimmyChevallier committed Feb 17, 2025
1 parent 0bfdcbd commit 8250c8b
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 56 deletions.
8 changes: 4 additions & 4 deletions api/src/constants/extractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export const FUNCTIONS_ONLY_FOR_DDG_EXTRACTOR = [
export const FUNCTIONS_ONLY_FOR_DDG_EXTRACTOR_CA = [
{
category_label: "Magistrat",
label: "Vice-Président placé",
label: "VICE-PRÉSIDENT PLACÉ ADDITIONNEL",
code: "VPP ADDITIONNEL",
position: "Placé",
category_detail: "M-PLAC-ADD",
Expand All @@ -336,7 +336,7 @@ export const FUNCTIONS_ONLY_FOR_DDG_EXTRACTOR_CA = [
},
{
category_label: "Magistrat",
label: "Vice-Président placé",
label: "VICE-PRÉSIDENT PLACÉ DE SUBSTITUTION",
code: "VPP SUBSTITUTION",
position: "Placé",
category_detail: "M-PLAC-SUB",
Expand All @@ -345,7 +345,7 @@ export const FUNCTIONS_ONLY_FOR_DDG_EXTRACTOR_CA = [
},
{
category_label: "Magistrat",
label: "Juge placé",
label: "JUGE PLACÉ",
code: "JP ADDITIONNEL",
position: "Placé",
category_detail: "M-PLAC-ADD",
Expand All @@ -354,7 +354,7 @@ export const FUNCTIONS_ONLY_FOR_DDG_EXTRACTOR_CA = [
},
{
category_label: "Magistrat",
label: "Juge placé",
label: "JUGE PLACÉ",
code: "JP SUBSTITUTION",
position: "Placé",
category_detail: "M-PLAC-SUB",
Expand Down
50 changes: 25 additions & 25 deletions api/src/utils/extractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
FUNCTIONS_ONLY_FOR_DDG_EXTRACTOR,
FUNCTIONS_ONLY_FOR_DDG_EXTRACTOR_CA,
} from "../constants/extractor";
import { isCa } from "./ca";
import { isCa, isTj } from "./ca";

/**
* Tri par catégorie et par fonction
Expand Down Expand Up @@ -559,31 +559,12 @@ export const getViewModel = async (params) => {
: [];

if (isCa()) {
keys2.push(
"Temps ventilés sur la période (contentieux sociaux civils et commerciaux)"
);
keys2.push("Temps ventilés sur la période (service pénal)");
keys2.push(
"Temps ventilés sur la période (hors indisponibilités relevant de l'action 99)"
);
keys2.push(
"Temps ventilés sur la période (y.c. indisponibilités relevant de l'action 99)"
);
keys2.push("Soutien (Hors accueil du justiciable)");
keys2 = keys2.map((x) =>
x === "14. TOTAL INDISPONIBILITÉ"
? "14. TOTAL des INDISPONIBILITÉS relevant de l'action 99"
: x
);
} else {
/**
keys2.push("Temps ventilés sur la période (contentieux civils et sociaux)");
keys2.push("Temps ventilés sur la période (affaires pénales)");
keys2.push(
'Vérif adéquation "temps ventilé sur la période" et somme (temps ventilés civils + pénals + autres activités + indisponibilité)'
);
keys2.push("Temps ventilés sur la période (y.c. indisponibilités relevant de l'action 99)");
*/
keys2 = keys2.map((x) =>
x === "12. TOTAL INDISPONIBILITÉ"
? "12. TOTAL des INDISPONIBILITÉS relevant de l'action 99"
Expand Down Expand Up @@ -626,24 +607,42 @@ export const getViewModel = async (params) => {
(x) => x.sub !== "12.2. COMPTE ÉPARGNE TEMPS"
);
agregat = agregat.map((x) => {
if (x.global === "12. TOTAL INDISPONIBILITÉ")
if (x.global === "12. TOTAL INDISPONIBILITÉ" && isTj())
return {
...x,
global: "12. TOTAL des INDISPONIBILITÉS relevant de l'action 99",
global1: "12. TOTAL des INDISPONIBILITÉS relevant de l'action 99",
sub1: x.sub,
};

if (x.global === "14. TOTAL INDISPONIBILITÉ" && isCa())
return {
...x,
global: "14. TOTAL des INDISPONIBILITÉS relevant de l'action 99",
global1: "14. TOTAL des INDISPONIBILITÉS relevant de l'action 99",
sub1: x.sub,
};

if (
x.sub === "Absentéisme réintégré (CMO + Congé maternité + CET < 30 jours)"
x.global === "Absentéisme réintégré (CMO + Congé maternité + CET < 30 jours)" && isTj()
)
return {
...x,
global1:
"13. TOTAL des INDISPONIBILITÉS relevant de l'absentéisme (réintégrés dans les valeurs des rubriques et sous-rubriques",
"13. TOTAL des INDISPONIBILITÉS relevant de l'absentéisme (réintégrés dans les valeurs des rubriques et sous-rubriques)",
sub1: x.sub,
};

if (
x.global === "Absentéisme réintégré (CMO + Congé maternité + CET < 30 jours)" && isCa()
)
return {
...x,
global1:
"15. TOTAL des INDISPONIBILITÉS relevant de l'absentéisme (réintégrés dans les valeurs des rubriques et sous-rubriques)",
sub1: x.sub,
};

return { ...x, sub1: x.sub, global1: x.global };
});
// remplacer : "ETPT sur la période hors indisponibilités" => "ETPT sur la période, hors indisponibilités relevant de l'action 99 (absentéisme non déduit)""
Expand Down Expand Up @@ -885,6 +884,7 @@ export const computeExtract = async (
Matricule: human.matricule,
Catégorie: categoryName,
Fonction: fonctionName,
['Fonction recodée']:null,
["Date d'arrivée"]:
human.dateStart === null
? null
Expand All @@ -893,9 +893,9 @@ export const computeExtract = async (
human.dateEnd === null
? null
: setTimeToMidDay(human.dateEnd).toISOString().split("T")[0],
["ETPT sur la période absentéisme non déduit (hors action 99)"]:
["ETPT sur la période (absentéisme et action 99 déduits)"]:
reelEtp,
["Temps ventilés sur la période (hors action 99)"]: totalEtpt,
["Temps ventilés sur la période (absentéisme et action 99 déduits)"]: totalEtpt,
...refObj,
});
})
Expand Down
104 changes: 79 additions & 25 deletions front/src/app/services/excel/excel.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,20 +248,21 @@ export class ExcelService extends MainClass {

report.worksheets[indexTab].getCell('ZZ' + indexCell).value = ''; // TO SET ALL PREVIOUS COL

report = this.userService.isTJ()
? this.setExcelFunctionsTj(report, indexCell, viewModel)
: this.setExcelFunctionsCa(report, indexCell, viewModel);
report = this.setExcelFunctionsBinding(report, indexCell, viewModel);

report = this.userService.isTJ()
? this.setGapsJEJI(report, indexCell, viewModel)
: this.setGapsMineurs(report, indexCell, viewModel);

report = this.setJuridictionPickerByAgent(
report,
indexCell,
viewModel,
indexTab
);
report = this.userService.isTJ()
? this.setJuridictionPickerByAgent(
report,
indexCell,
viewModel,
indexTab
)
: this.addRecodedFonctionCA(report, indexCell, viewModel, indexFctCol);

report = this.setDopDownPlaceByAgent(report, indexFctCol, indexTab);
report = this.setDopDownJAByAgent(report, indexFctCol, indexTab);
report = this.setDopDownAttJByAgent(report, indexFctCol, indexTab);
Expand Down Expand Up @@ -609,22 +610,31 @@ export class ExcelService extends MainClass {
report.worksheets[etptDDGIndex].columns[0].width = 0;
report.worksheets[etptDDGIndex].columns[1].width = 0;
report.worksheets[etptDDGIndex].columns[2].width = 0;
report.worksheets[etptDDGIndex].columns[8].width = 20;
report.worksheets[etptDDGIndex].columns[9].width = 0;
report.worksheets[etptDDGIndex].columns[10].width = 0;
report.worksheets[etptDDGIndex].columns[11].width = 0;
report.worksheets[etptDDGIndex].columns[8].width = 20;

let index = 0;
do {
report.worksheets[etptDDGIndex].columns[12 + index].width = 26;
index++;
} while (index < 4);

if (this.userService.isCa()) {
report.worksheets[etptDDGIndex].columns[18].width = 0;
}

const etptAjustIndex =
this.findIndexByName(report.worksheets, 'ETPT A-JUST') || 0;
report.worksheets[etptAjustIndex].columns = [
...this.tabs.onglet1.columnSize,
];
report.worksheets[etptAjustIndex].columns[0].width = 16;
if (this.userService.isCa()) {
report.worksheets[etptAjustIndex].columns[7].width = 0;
report.worksheets[etptAjustIndex].columns[10].width = 26;
}

const agregatIndex =
this.findIndexByName(report.worksheets, 'Agrégats DDG') || 0;
Expand Down Expand Up @@ -653,7 +663,7 @@ export class ExcelService extends MainClass {
* @param viewModel
* @returns
*/
setExcelFunctionsTj(report: any, indexCell: number, viewModel: any) {
setExcelFunctionsBinding(report: any, indexCell: number, viewModel: any) {
const etptDDGIndex =
this.findIndexByName(report.worksheets, 'ETPT Format DDG') || 0;

Expand Down Expand Up @@ -707,8 +717,11 @@ export class ExcelService extends MainClass {
* @param viewModel
*/
setGapsMineurs(report: any, indexCell: number, viewModel: any) {
const etptDDGIndex =
this.findIndexByName(report.worksheets, 'ETPT Format DDG') || 0;

// ECART CTX MINEURS ONGLET DDG
report.worksheets[2].getCell(
report.worksheets[etptDDGIndex].getCell(
this.getExcelFormulaFormat(
['Ecart CTX MINEURS → détails manquants, à rajouter dans A-JUST'],
indexCell,
Expand Down Expand Up @@ -809,8 +822,18 @@ export class ExcelService extends MainClass {
* @returns
*/
setExcelFunctionsCa(report: any, indexCell: number, viewModel: any) {
const etptDDGIndex =
this.findIndexByName(report.worksheets, 'ETPT Format DDG') || 0;

let concatFct = this.getExcelFormulaFormat(
['Catégorie', 'Fonction'],
indexCell,
viewModel.days1,
'&'
);

// FONCTION RECODEE ONGLET DDG => AUTOMATISER PLUS TARD
report.worksheets[2].getCell('FA' + indexCell).value = {
report.worksheets[etptDDGIndex].getCell('FA' + indexCell).value = {
formula:
'=IF(H' +
indexCell +
Expand All @@ -821,7 +844,7 @@ export class ExcelService extends MainClass {
};

// FONCTION AGREGAT ONGLET DDG => AUTOMATISER PLUS TARD
report.worksheets[2].getCell('FB' + indexCell).value = {
report.worksheets[etptDDGIndex].getCell('FB' + indexCell).value = {
formula:
'=IFERROR(VLOOKUP(H' +
indexCell +
Expand All @@ -830,7 +853,7 @@ export class ExcelService extends MainClass {
')',
result: '',
};

/**
// SOCIAUX CIVILS ET COMMERCIAUX ONGLET DDG
report.worksheets[2].getCell(
this.getExcelFormulaFormat(
Expand Down Expand Up @@ -991,6 +1014,8 @@ export class ExcelService extends MainClass {
].width = 30;
report.worksheets[2].columns[15].width = 0;
*/
return report;
}

Expand Down Expand Up @@ -1117,7 +1142,7 @@ export class ExcelService extends MainClass {
type: 'list',
allowBlank: true,
formulae: this.userService.isCa()
? ['"JA Chambres Sociales,JA Siège autres,JA Parquet Général"']
? ['"JA Social,JA Siège autres,JA Parquet"']
: [
'"JA Social,JA Siège autres,JA Parquet,JA JAP,JA JE,JA JI,JA JLD"',
],
Expand All @@ -1133,10 +1158,7 @@ export class ExcelService extends MainClass {
* @returns
*/
setDopDownAttJByAgent(report: any, indexFctCol: string, indexTab: number) {
if (
report.worksheets[indexTab].getCell(indexFctCol).value === 'Att. J' &&
this.userService.isTJ()
) {
if (report.worksheets[indexTab].getCell(indexFctCol).value === 'Att. J') {
report.worksheets[indexTab].getCell(indexFctCol).value =
'Att. J Siège autres';
report.worksheets[indexTab].getCell(indexFctCol).dataValidation = {
Expand All @@ -1158,8 +1180,7 @@ export class ExcelService extends MainClass {
*/
setDopDownContAJPByAgent(report: any, indexFctCol: string, indexTab: number) {
if (
report.worksheets[indexTab].getCell(indexFctCol).value === 'CONT A JP' &&
this.userService.isTJ()
report.worksheets[indexTab].getCell(indexFctCol).value === 'CONT A JP'
) {
report.worksheets[indexTab].getCell(indexFctCol).value =
'CONT A JP Siège';
Expand All @@ -1186,8 +1207,7 @@ export class ExcelService extends MainClass {
) {
if (
report.worksheets[indexTab].getCell(indexCat).value === 'Greffe' &&
report.worksheets[indexTab].getCell(indexFctCol).value === 'CONT A' &&
this.userService.isTJ()
report.worksheets[indexTab].getCell(indexFctCol).value === 'CONT A'
) {
report.worksheets[indexTab].getCell(indexFctCol).value = 'CONT A Autres';
report.worksheets[indexTab].getCell(indexFctCol).dataValidation = {
Expand Down Expand Up @@ -1233,7 +1253,7 @@ export class ExcelService extends MainClass {
};

// ONGLET AGGREGAT MESSAGE SI ECART
report.worksheets[3]['_rows'][6].height = 40;
report.worksheets[3]['_rows'][6].height = 50;
report.worksheets[3].getCell('F7').value = {
formula:
"=IF(OR('Agrégats DDG'!L6<>'Agrégats DDG'!L7,'Agrégats DDG'!S6<>'Agrégats DDG'!S7,'Agrégats DDG'!U6<>'Agrégats DDG'!U7),CONCATENATE(\"Temps ventilés sur la période (hors action 99) :\",CHAR(10),\"ℹ️ Des ventilations sont incomplètes, se référer à la colonne N de l’onglet ETPT format DDG\"),\"Temps ventilés sur la période (hors action 99)\")",
Expand Down Expand Up @@ -1287,4 +1307,38 @@ export class ExcelService extends MainClass {
});
return report;
}
/**
* @param report
* @param indexCell
* @param viewModel
* @param indexFctCol
*/
addRecodedFonctionCA(
report: any,
indexCell: number,
viewModel: any,
indexFctCol: string
) {
const indexTab =
this.findIndexByName(report.worksheets, 'ETPT A-JUST') || 0;

report.worksheets[indexTab].getCell(
this.getExcelFormulaFormat(
['Fonction recodée'],
indexCell,
viewModel.days
)
).value = {
formula:
"='ETPT Format DDG'!" +
this.getExcelFormulaFormat(
['Fonction recodée'],
indexCell,
viewModel.days1
),
result: '',
};

return report;
}
}
4 changes: 2 additions & 2 deletions front/src/assets/nomenclature-A-Just-CA.html

Large diffs are not rendered by default.

Binary file modified front/src/assets/template4.xlsx
Binary file not shown.
Binary file modified front/src/assets/template4CA.xlsx
Binary file not shown.

0 comments on commit 8250c8b

Please sign in to comment.