@galadrim/galadmin 0.1.208 → 0.1.210
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/api.js +36 -5
- package/dist/api.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +11 -0
- package/package.json +1 -1
- package/src/api.ts +39 -7
- package/src/front/build/asset-manifest.json +3 -3
- package/src/front/build/index.html +1 -1
- package/src/front/build/static/js/{main.509108ea.js → main.8164246f.js} +3 -3
- package/src/front/build/static/js/{main.509108ea.js.map → main.8164246f.js.map} +1 -1
- package/src/front/ckeditor5-build/node_modules/semver/bin/semver.js +0 -0
- package/src/front/src/components/Input.js +9 -0
- package/src/front/src/components/inputs/CompanyInput.js +187 -0
- package/src/front/src/components/inputs/DatetimeInput.js +1 -1
- package/src/front/src/pages/EditRecord.js +0 -7
- package/src/front/src/utils/getFormattedValue.js +2 -0
- package/src/types/config.ts +14 -0
- package/src/front/ckeditor5-build/node_modules/.bin/semver +0 -12
- package/src/front/ckeditor5-build/node_modules/.bin/semver.cmd +0 -17
- package/src/front/ckeditor5-build/node_modules/.bin/semver.ps1 +0 -28
- /package/src/front/build/static/js/{main.509108ea.js.LICENSE.txt → main.8164246f.js.LICENSE.txt} +0 -0
package/dist/types/config.d.ts
CHANGED
|
@@ -47,6 +47,16 @@ export type AddressColumn = {
|
|
|
47
47
|
countryField?: string;
|
|
48
48
|
postalCodeField?: string;
|
|
49
49
|
};
|
|
50
|
+
export type CompanyColumn = {
|
|
51
|
+
dataType: "company";
|
|
52
|
+
sirenField?: string;
|
|
53
|
+
siretField?: string;
|
|
54
|
+
companyNameField?: string;
|
|
55
|
+
addressField?: string;
|
|
56
|
+
zipCodeField?: string;
|
|
57
|
+
cityField?: string;
|
|
58
|
+
activityNumberField?: string;
|
|
59
|
+
};
|
|
50
60
|
export type DateColumn = {
|
|
51
61
|
dataType: "date";
|
|
52
62
|
name: string;
|
|
@@ -366,6 +376,7 @@ export type Config = {
|
|
|
366
376
|
ssl?: any;
|
|
367
377
|
};
|
|
368
378
|
googleMapsKey?: string;
|
|
379
|
+
inseeKey?: string;
|
|
369
380
|
hideMultiselect?: boolean;
|
|
370
381
|
hideBranding?: boolean;
|
|
371
382
|
sidebar?: {
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -63,7 +63,7 @@ export default (db, config, user) => {
|
|
|
63
63
|
queryString += ")"
|
|
64
64
|
}
|
|
65
65
|
const limit = params.allRecords ? 999999 : parseInt(params.limit)
|
|
66
|
-
const query = params.customQuery || ("SELECT " + (params.selectExpression || "*") + " FROM ?? " + (params.join || "") + queryString + " " + (params.groupBy ? "GROUP BY " + params.groupBy : "") + (params.orderBy || params.primaryId ? " ORDER BY " + (params.orderBy || `${params.table}.${params.primaryId}`) : "") +
|
|
66
|
+
const query = params.customQuery || ("SELECT " + (params.selectExpression || "*") + " FROM ?? " + (params.join || "") + queryString + " " + (params.groupBy ? "GROUP BY " + params.groupBy : "") + (params.orderBy || params.primaryId ? " ORDER BY " + (params.orderBy || `${params.table}.${params.primaryId}`) : "") + " LIMIT ? OFFSET ?")
|
|
67
67
|
const queryParams = [params.table, limit, Math.max((params.page - 1) * limit, 0)]
|
|
68
68
|
const { err, rows } = await db.query(query, queryParams)
|
|
69
69
|
if (err) {
|
|
@@ -200,6 +200,8 @@ export default (db, config, user) => {
|
|
|
200
200
|
|
|
201
201
|
app.post('/records', async function (req, res, next) {
|
|
202
202
|
const view = config.views[req.body.viewIndex];
|
|
203
|
+
const isDesc = req.body.isDesc === null ? view.isDesc : req.body.isDesc
|
|
204
|
+
const orderBy = req.body.orderBy || (view.subviews && req.body.subviewIndex !== undefined ? view.subviews[req.body.subviewIndex]?.orderBy : null) || view.orderBy
|
|
203
205
|
const { rows: records, queryString, input, error } = await getRecords({
|
|
204
206
|
table: view.tableName,
|
|
205
207
|
page: req.body.page,
|
|
@@ -212,8 +214,7 @@ export default (db, config, user) => {
|
|
|
212
214
|
customQuery: view.customQuery,
|
|
213
215
|
join: view.join,
|
|
214
216
|
selectExpression: view.selectExpression,
|
|
215
|
-
orderBy: [
|
|
216
|
-
isDesc: req.body.isDesc === null ? view.isDesc : req.body.isDesc,
|
|
217
|
+
orderBy: [orderBy ? `${orderBy} ${isDesc ? "DESC" : "ASC"}` : null, view.primaryId].filter(x => x).join(", "),
|
|
217
218
|
primaryId: view.primaryId,
|
|
218
219
|
query: req.body.query,
|
|
219
220
|
groupBy: view.groupBy,
|
|
@@ -319,6 +320,8 @@ export default (db, config, user) => {
|
|
|
319
320
|
|
|
320
321
|
app.post('/recordsExport', async function (req, res) {
|
|
321
322
|
const view = config.views[req.body.viewIndex];
|
|
323
|
+
const orderBy = req.body.orderBy || view.orderBy;
|
|
324
|
+
const isDesc = req.body.isDesc === null ? view.isDesc : req.body.isDesc;
|
|
322
325
|
const { rows: records, error } = await getRecords({
|
|
323
326
|
table: view.tableName,
|
|
324
327
|
page: 1,
|
|
@@ -327,8 +330,7 @@ export default (db, config, user) => {
|
|
|
327
330
|
customQuery: view.customQuery,
|
|
328
331
|
join: view.join,
|
|
329
332
|
selectExpression: view.selectExpression,
|
|
330
|
-
orderBy:
|
|
331
|
-
isDesc: req.body.isDesc === null ? view.isDesc : req.body.isDesc,
|
|
333
|
+
orderBy: orderBy ? `${orderBy} ${isDesc ? "DESC" : "ASC"}` : null,
|
|
332
334
|
primaryId: view.primaryId,
|
|
333
335
|
query: req.body.query,
|
|
334
336
|
groupBy: view.groupBy,
|
|
@@ -833,7 +835,7 @@ export default (db, config, user) => {
|
|
|
833
835
|
})
|
|
834
836
|
.then(() => {
|
|
835
837
|
res.status(200).send({
|
|
836
|
-
path
|
|
838
|
+
path: s3Config.pathTransform ? s3Config.pathTransform(path) : path,
|
|
837
839
|
aspectRatio,
|
|
838
840
|
originalFilename,
|
|
839
841
|
});
|
|
@@ -852,7 +854,7 @@ export default (db, config, user) => {
|
|
|
852
854
|
if (err) return res.status(500).send(err);
|
|
853
855
|
res.send({
|
|
854
856
|
url: `https://${s3Config.host}/${s3Config.bucket}/${path}`,
|
|
855
|
-
path
|
|
857
|
+
path: s3Config.pathTransform ? s3Config.pathTransform(path) : path,
|
|
856
858
|
aspectRatio,
|
|
857
859
|
originalFilename
|
|
858
860
|
})
|
|
@@ -917,6 +919,36 @@ export default (db, config, user) => {
|
|
|
917
919
|
uploadFile(column, "file", req, res);
|
|
918
920
|
})
|
|
919
921
|
|
|
922
|
+
app.get('/searchCompanies', async (req, res) => {
|
|
923
|
+
if (!config.inseeKey) {
|
|
924
|
+
return res.status(403).send("inseeKey is not set in the config")
|
|
925
|
+
}
|
|
926
|
+
const response = await axios.get(`https://api.insee.fr/entreprises/sirene/siret`, {
|
|
927
|
+
headers: {
|
|
928
|
+
"Authorization": `Bearer ${config.inseeKey}`,
|
|
929
|
+
"Accept": "application/json"
|
|
930
|
+
},
|
|
931
|
+
params: {
|
|
932
|
+
q: `denominationUniteLegale:${req.query.query}* OR siren:${req.query.query}*`,
|
|
933
|
+
nombre: 100
|
|
934
|
+
}
|
|
935
|
+
});
|
|
936
|
+
const results = response.data.etablissements
|
|
937
|
+
.filter((etablissement) => etablissement.uniteLegale.etatAdministratifUniteLegale === "A")
|
|
938
|
+
.map((etablissement) => ({
|
|
939
|
+
id: Math.random().toString().slice(2),
|
|
940
|
+
companyName: etablissement.uniteLegale.denominationUniteLegale,
|
|
941
|
+
siret: etablissement.siret,
|
|
942
|
+
siren: etablissement.siren,
|
|
943
|
+
address: `${etablissement.adresseEtablissement.numeroVoieEtablissement || ""} ${etablissement.adresseEtablissement.typeVoieEtablissement || ""} ${etablissement.adresseEtablissement.libelleVoieEtablissement || ""}`,
|
|
944
|
+
city: etablissement.adresseEtablissement.libelleCommuneEtablissement,
|
|
945
|
+
zipCode: etablissement.adresseEtablissement.codePostalEtablissement,
|
|
946
|
+
activityNumber: etablissement.uniteLegale.activitePrincipaleUniteLegale,
|
|
947
|
+
}))
|
|
948
|
+
.slice(0, 10)
|
|
949
|
+
res.send(results)
|
|
950
|
+
})
|
|
951
|
+
|
|
920
952
|
return app
|
|
921
953
|
}
|
|
922
954
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"main.css": "/_HOMEPAGE_/static/css/main.eacc50f1.css",
|
|
4
|
-
"main.js": "/_HOMEPAGE_/static/js/main.
|
|
4
|
+
"main.js": "/_HOMEPAGE_/static/js/main.8164246f.js",
|
|
5
5
|
"static/media/gt-eesti-medium.woff": "/_HOMEPAGE_/static/media/gt-eesti-medium.a48c02fa57e83ab6ddcd.woff",
|
|
6
6
|
"static/media/gt-eesti-regular.woff": "/_HOMEPAGE_/static/media/gt-eesti-regular.304a7ae06ee4a4d5d04a.woff",
|
|
7
7
|
"static/media/logo.png": "/_HOMEPAGE_/static/media/logo.e407b9ca7e302466a07d.png",
|
|
8
8
|
"static/media/cubano.woff": "/_HOMEPAGE_/static/media/cubano.4eaa47ef94222121a371.woff",
|
|
9
9
|
"index.html": "/_HOMEPAGE_/index.html",
|
|
10
10
|
"main.eacc50f1.css.map": "/_HOMEPAGE_/static/css/main.eacc50f1.css.map",
|
|
11
|
-
"main.
|
|
11
|
+
"main.8164246f.js.map": "/_HOMEPAGE_/static/js/main.8164246f.js.map"
|
|
12
12
|
},
|
|
13
13
|
"entrypoints": [
|
|
14
14
|
"static/css/main.eacc50f1.css",
|
|
15
|
-
"static/js/main.
|
|
15
|
+
"static/js/main.8164246f.js"
|
|
16
16
|
]
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="fr"><head><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script><script src="https://momentjs.com/downloads/moment-timezone-with-data-10-year-range.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/locale/fr.js"></script><script async="async" defer="defer" src="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.0/spectrum.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/air-datepicker/2.2.3/js/datepicker.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/air-datepicker/2.2.3/js/i18n/datepicker.fr.min.js"></script><script async="async" defer="defer" src="https://cdnjs.cloudflare.com/ajax/libs/downloadjs/1.4.8/download.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script><script async="async" defer="defer" src="https://cdn.jsdelivr.net/npm/sweetalert"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/quill/1.3.6/quill.min.js"></script><script src="https://sdk.amazonaws.com/js/aws-sdk-2.606.0.min.js"></script><script src="https://kit.fontawesome.com/75b28933ed.js" crossorigin="anonymous" async="async" defer="defer"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/air-datepicker/2.2.3/css/datepicker.min.css"/><link rel="stylesheet" href="/_HOMEPAGE_/spectrum.css"/><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/quill/1.3.6/quill.snow.min.css"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta charset="utf-8"/><link rel="icon" href="/_HOMEPAGE_/favicon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/_HOMEPAGE_/manifest.json"/><title>Back-office</title><script defer="defer" src="/_HOMEPAGE_/static/js/main.
|
|
1
|
+
<!doctype html><html lang="fr"><head><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script><script src="https://momentjs.com/downloads/moment-timezone-with-data-10-year-range.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/locale/fr.js"></script><script async="async" defer="defer" src="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.0/spectrum.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/air-datepicker/2.2.3/js/datepicker.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/air-datepicker/2.2.3/js/i18n/datepicker.fr.min.js"></script><script async="async" defer="defer" src="https://cdnjs.cloudflare.com/ajax/libs/downloadjs/1.4.8/download.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script><script async="async" defer="defer" src="https://cdn.jsdelivr.net/npm/sweetalert"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/quill/1.3.6/quill.min.js"></script><script src="https://sdk.amazonaws.com/js/aws-sdk-2.606.0.min.js"></script><script src="https://kit.fontawesome.com/75b28933ed.js" crossorigin="anonymous" async="async" defer="defer"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/air-datepicker/2.2.3/css/datepicker.min.css"/><link rel="stylesheet" href="/_HOMEPAGE_/spectrum.css"/><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/quill/1.3.6/quill.snow.min.css"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta charset="utf-8"/><link rel="icon" href="/_HOMEPAGE_/favicon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/_HOMEPAGE_/manifest.json"/><title>Back-office</title><script defer="defer" src="/_HOMEPAGE_/static/js/main.8164246f.js"></script><link href="/_HOMEPAGE_/static/css/main.eacc50f1.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|