|
|
@ -101,22 +101,102 @@ const data = { |
|
|
|
/* 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'); |
|
|
|
|
|
|
|
res.setHeader("Content-Type", "text/html; charset=utf-8"); |
|
|
|
const data = { |
|
|
|
form: { |
|
|
|
url: { |
|
|
|
value: 'https://bodacc-datadila.opendatasoft.com/api/explore/v2.1/catalog/datasets/annonces-commerciales/exports/csv?lang=fr&refine=publicationavis%3A%22A%22&refine=publicationavis_facette%3A%22Bodacc%20A%22&refine=familleavis_lib%3A%22Ventes%20et%20cessions%22&refine=numerodepartement%3A%2275%22&refine=typeavis_lib%3A%22Avis%20d%E2%80%99annulation%22&timezone=Asia%2FBaghdad&use_labels=true&delimiter=%3B' |
|
|
|
}, |
|
|
|
columns: { |
|
|
|
options: [ |
|
|
|
'id', |
|
|
|
'publicationavis', |
|
|
|
'publicationavis_facette', |
|
|
|
'parution', |
|
|
|
'dateparution', |
|
|
|
'numeroannonce', |
|
|
|
'typeavis', |
|
|
|
'typeavis_lib', |
|
|
|
'familleavis', |
|
|
|
'familleavis_lib', |
|
|
|
'tribunal', |
|
|
|
'commercant', |
|
|
|
'ville', |
|
|
|
'registre', |
|
|
|
'pdf_parution_subfolder', |
|
|
|
'ispdf_unitaire', |
|
|
|
'listepersonnes.personne.administration', |
|
|
|
'listepersonnes.personne.numeroImmatriculation.nomGreffeImmat', |
|
|
|
'listepersonnes.personne.capital.devise', |
|
|
|
'listepersonnes.personne.capital.montantCapital', |
|
|
|
'listepersonnes.personne.adresseSiegeSocial.ville', |
|
|
|
'listepersonnes.personne.adresseSiegeSocial.codePostal', |
|
|
|
'listepersonnes.personne.adresseSiegeSocial.pays', |
|
|
|
'listepersonnes.personne.adresseSiegeSocial.typeVoie', |
|
|
|
'listepersonnes.personne.adresseSiegeSocial.numeroVoie', |
|
|
|
'listepersonnes.personne.adresseSiegeSocial.nomVoie', |
|
|
|
'listepersonnes.personne.adresseSiegeSocial.complGeographique', |
|
|
|
'listeetablissements.etablissement.qualiteEtablissement', |
|
|
|
'listeetablissements.etablissement.adresse.codePostal', |
|
|
|
'listeetablissements.etablissement.adresse.pays', |
|
|
|
'listeetablissements.etablissement.adresse.typeVoie', |
|
|
|
'listeetablissements.etablissement.adresse.numeroVoie', |
|
|
|
'listeetablissements.etablissement.adresse.nomVoie', |
|
|
|
'jugement', |
|
|
|
'acte.vente.publiciteLegale.titre', |
|
|
|
'acte.vente.opposition', |
|
|
|
'modificationsgenerales', |
|
|
|
'radiationaurcs', |
|
|
|
'depot', |
|
|
|
'listeprecedentexploitant.personne.typePersonne', |
|
|
|
'listeprecedentexploitant.personne.numeroImmatriculation.codeRCS', |
|
|
|
'listeprecedentexploitant.personne.numeroImmatriculation.numeroIdentification', |
|
|
|
'listeprecedentexploitant.personne.numeroImmatriculation.nomGreffeImmat', |
|
|
|
'listeprecedentexploitant.personne.denomination', |
|
|
|
'listeprecedentproprietaire.personne.typePersonne', |
|
|
|
'listeprecedentproprietaire.personne.numeroImmatriculation.codeRCS', |
|
|
|
'listeprecedentproprietaire.personne.numeroImmatriculation.numeroIdentification', |
|
|
|
'listeprecedentproprietaire.personne.numeroImmatriculation.nomGreffeImmat', |
|
|
|
'listeprecedentproprietaire.personne.denomination', |
|
|
|
'divers', |
|
|
|
'parutionavisprecedent.nomPublication', |
|
|
|
'parutionavisprecedent.dateParution', |
|
|
|
'parutionavisprecedent.numeroParution', |
|
|
|
'parutionavisprecedent.numeroAnnonce', |
|
|
|
], |
|
|
|
selected: initialSelectedColumns, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
res.send(templateService.renderPage("index", data)); |
|
|
|
res.send(templateService.renderPage('index', data)); |
|
|
|
return res; |
|
|
|
}); |
|
|
|
|
|
|
|
// 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"); |
|
|
|
}); |
|
|
|
|
|
|
|
router.post("/", function (req, res, next) { |
|
|
|
router.post('/', function(req, res, next) { |
|
|
|
// const url = 'https://bodacc-datadila.opendatasoft.com/api/explore/v2.1/catalog/datasets/annonces-commerciales/exports/csv?lang=fr&refine=publicationavis%3A%22A%22&refine=publicationavis_facette%3A%22Bodacc%20A%22&refine=familleavis_lib%3A%22Ventes%20et%20cessions%22&timezone=Asia%2FBaghdad&use_labels=true&delimiter=%3B';
|
|
|
|
|
|
|
|
// get url from form
|
|
|
@ -131,18 +211,25 @@ router.post("/", function (req, res, next) { |
|
|
|
return res.status(500).send("Invalid columns"); |
|
|
|
} |
|
|
|
|
|
|
|
fileService |
|
|
|
.parseFromUrl(url, columns) |
|
|
|
fileService.parseFromUrl(url, columns) |
|
|
|
.then((filename) => { |
|
|
|
res.send({ |
|
|
|
generated: filename, |
|
|
|
message: "Fichier généré avec success", |
|
|
|
}); |
|
|
|
message: 'Fichier généré avec success' |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.error("routes [/] error", err.message); |
|
|
|
return res.status(500).send("Invalid stream"); |
|
|
|
.catch(err => { |
|
|
|
console.error('routes [/] error', err.message); |
|
|
|
return res.status(500).send('Invalid stream'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
// 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; |
|
|
|