Browse Source

fix: feedback

node10
Ubuntu 5 months ago
parent
commit
a510d411c9
  1. 7420
      package-lock.json
  2. 2
      package.json
  3. 16
      public/js/main.min.js.LICENSE.txt
  4. 6
      src/models/file.js
  5. 54
      src/routes/index.js
  6. 3
      src/services/file.js
  7. 29
      src/views/pages/index.hbs

7420
package-lock.json

File diff suppressed because it is too large

2
package.json

@ -39,7 +39,7 @@
"css-loader": "^6.8.1",
"css-minimizer-webpack-plugin": "^5.0.1",
"mini-css-extract-plugin": "^2.7.6",
"node-sass": "^4.9.4",
"node-sass": "^9.0.0",
"nodemon": "^3.0.1",
"sass-loader": "^13.3.2",
"webpack": "^5.88.2",

16
public/js/main.min.js.LICENSE.txt

@ -0,0 +1,16 @@
/*!
* Bootstrap v5.3.2 (https://getbootstrap.com/)
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* jQuery JavaScript Library v3.7.1
* https://jquery.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2023-08-28T13:37Z
*/

6
src/models/file.js

@ -188,9 +188,15 @@ class File {
columnsIndex[key].exist = headers.includes(columnsIndex[key].main);
if ( columnsIndex[key].exist ) {
columnsFiltered.push(columnsIndex[key].value);
if(columnsIndex[key].main ==='listeprecedentexploitant'){
result.push(`Prec Exp ${columnsIndex[key].last}`)
}else if(columnsIndex[key].main ==='listeprecedentproprietaire'){
result.push(`Prec Prop ${columnsIndex[key].last}`)
}else{
result.push(columnsIndex[key].last);
}
}
}
// Emit a parse.start event with the url and filepath
emitter.emit('parse.start', { url: this.url, filepath: this.filepath, headers, result: result });

54
src/routes/index.js

@ -10,7 +10,28 @@ const fileService = new FileService();
/* GET home page. */
router.get('/', async function(req, res, next) {
fileService.checkLastOperationDate();
let initialSelectedColumns = [
"region_code",
"region_nom_officiel",
"numerodepartement",
"departement_nom_officiel",
"cp",
"listepersonnes.personne.typePersonne",
"listepersonnes.personne.formeJuridique",
"listepersonnes.personne.denomination",
"listepersonnes.personne.numeroImmatriculation.codeRCS",
"listepersonnes.personne.numeroImmatriculation.numeroIdentification",
"listepersonnes.personne.nom",
"listepersonnes.personne.nomCommercial",
"listepersonnes.personne.prenom",
"listeetablissements.etablissement.activite",
"listeetablissements.etablissement.adresse.complGeographique",
"listeetablissements.etablissement.adresse.ville",
"acte.dateCommencementActivite",
"acte.vente.publiciteLegale.date",
"acte.descriptif",
"acte.vente.categorieVente",
];
res.setHeader('Content-Type', 'text/html; charset=utf-8');
const data = {
@ -75,28 +96,7 @@ router.get('/', async function(req, res, next) {
'parutionavisprecedent.numeroParution',
'parutionavisprecedent.numeroAnnonce',
],
selected: [
'region_code',
'region_nom_officiel',
'numerodepartement',
'departement_nom_officiel',
'cp',
'listepersonnes.personne.typePersonne',
'listepersonnes.personne.formeJuridique',
'listepersonnes.personne.denomination',
'listepersonnes.personne.numeroImmatriculation.codeRCS',
'listepersonnes.personne.numeroImmatriculation.numeroIdentification',
'listepersonnes.personne.nom',
'listepersonnes.personne.nomCommercial',
'listepersonnes.personne.prenom',
'listeetablissements.etablissement.activite',
'listeetablissements.etablissement.adresse.complGeographique',
'listeetablissements.etablissement.adresse.ville',
'acte.dateCommencementActivite',
'acte.vente.publiciteLegale.date',
'acte.descriptif',
'acte.vente.categorieVente',
]
selected: initialSelectedColumns,
}
}
};
@ -133,4 +133,12 @@ router.post('/', function(req, res, next) {
});
});
// Logic to handle the drag and drop update
router.post("/update-columns-order", async function (req, res, next) {
let newColumnsOrder = req.body.columnsOrder;
data.form.columns.selected = newColumnsOrder;
// Handle saving the new column order to a database or file if necessary
res.send("Columns order updated successfully");
});
module.exports = router;

3
src/services/file.js

@ -24,7 +24,8 @@ class FileService {
emitter.emit('parseFromUrl.error', { url, columns, error: 'Invalid columns' });
return Promise.reject(new Error('Invalid columns'));
}
const directoryPath = path.join(basedir, 'public/csv');
if(!fs.existsSync(directoryPath)) fs.mkdirSync(directoryPath);
// Create a new File instance
const file = new File(url);
const filepath = await file.download();

29
src/views/pages/index.hbs

@ -1,3 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Génération CSV</title>
<!-- Include jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- Include jQuery UI -->
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<!-- Include custom CSS -->
</head>
<body>
<div id="index">
<div class="container">
@ -39,12 +51,14 @@
</div>
<div class="col-12 col-md-6">
<div class="form-group form__column column-choices">
<label for="name" class="column-choices__title column-choices__title--green">Colonnes exportées</label>
<label for="name" class="column-choices__title column-choices__title--green">Colonnes
exportées</label>
<ul id="form__selected" class="column-choices__list">
{{#each form.columns.selected}}
<li class="form__choice column-choice" data-value="{{this}}">
<label class="column-choice__inner">
<input type="checkbox" name="columns[]" value="{{this}}" class="column-choice__input" checked="checked" />
<input type="checkbox" name="columns[]" value="{{this}}" class="column-choice__input"
checked="checked" />
<span class="column-choice__text">{{this}}</span>
</label>
</li>
@ -73,3 +87,14 @@
<!-- /.container-fluid -->
</div>
</div>
<!-- Script pour le fonctionnement de drag and drop et AJAX -->
<script>
$(document).ready(function () {
$("#form__selected").sortable({
revert: false,
helper: "clone"
});
});
</script>
</body>
</html>
Loading…
Cancel
Save