+
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/_components/AddAsyncUploadDownloader.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/_components/AddAsyncUploadDownloader.vue
index c06a160a0..42bc37ddc 100644
--- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/_components/AddAsyncUploadDownloader.vue
+++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/_components/AddAsyncUploadDownloader.vue
@@ -1,45 +1,42 @@
-
+
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/_components/helper.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/_components/helper.ts
index 0755dac57..1fffcfbf0 100644
--- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/_components/helper.ts
+++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/_components/helper.ts
@@ -1,18 +1,19 @@
-import {makeFetch} from "../../../../../ChillMainBundle/Resources/public/lib/api/apiMethods";
-import {PostStoreObjectSignature} from "../../types";
+import { makeFetch } from "../../../../../ChillMainBundle/Resources/public/lib/api/apiMethods";
+import { PostStoreObjectSignature } from "../../types";
-const algo = 'AES-CBC';
+const algo = "AES-CBC";
-const URL_POST = '/asyncupload/temp_url/generate/post';
+const URL_POST = "/asyncupload/temp_url/generate/post";
const keyDefinition = {
name: algo,
- length: 256
+ length: 256,
};
const createFilename = (): string => {
let text = "";
- const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+ const possible =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (let i = 0; i < 7; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
@@ -23,9 +24,12 @@ const createFilename = (): string => {
export const uploadFile = async (uploadFile: ArrayBuffer): Promise => {
const params = new URLSearchParams();
- params.append('expires_delay', "180");
- params.append('submit_delay', "180");
- const asyncData: PostStoreObjectSignature = await makeFetch("GET", URL_POST + "?" + params.toString());
+ params.append("expires_delay", "180");
+ params.append("submit_delay", "180");
+ const asyncData: PostStoreObjectSignature = await makeFetch(
+ "GET",
+ URL_POST + "?" + params.toString(),
+ );
const suffix = createFilename();
const filename = asyncData.prefix + suffix;
const formData = new FormData();
@@ -39,7 +43,7 @@ export const uploadFile = async (uploadFile: ArrayBuffer): Promise => {
const response = await window.fetch(asyncData.url, {
method: "POST",
body: formData,
- })
+ });
if (!response.ok) {
console.error("Error while sending file to store", response);
@@ -47,14 +51,23 @@ export const uploadFile = async (uploadFile: ArrayBuffer): Promise => {
}
return Promise.resolve(filename);
-}
+};
-export const encryptFile = async (originalFile: ArrayBuffer): Promise<[ArrayBuffer, Uint8Array, JsonWebKey]> => {
- console.log('encrypt', originalFile);
+export const encryptFile = async (
+ originalFile: ArrayBuffer,
+): Promise<[ArrayBuffer, Uint8Array, JsonWebKey]> => {
+ console.log("encrypt", originalFile);
const iv = crypto.getRandomValues(new Uint8Array(16));
- const key = await window.crypto.subtle.generateKey(keyDefinition, true, [ "encrypt", "decrypt" ]);
- const exportedKey = await window.crypto.subtle.exportKey('jwk', key);
- const encrypted = await window.crypto.subtle.encrypt({ name: algo, iv: iv}, key, originalFile);
+ const key = await window.crypto.subtle.generateKey(keyDefinition, true, [
+ "encrypt",
+ "decrypt",
+ ]);
+ const exportedKey = await window.crypto.subtle.exportKey("jwk", key);
+ const encrypted = await window.crypto.subtle.encrypt(
+ { name: algo, iv: iv },
+ key,
+ originalFile,
+ );
return Promise.resolve([encrypted, iv, exportedKey]);
};
diff --git a/src/Bundle/ChillDocStoreBundle/chill.webpack.config.js b/src/Bundle/ChillDocStoreBundle/chill.webpack.config.js
index 5d021462d..5fcfe4cd0 100644
--- a/src/Bundle/ChillDocStoreBundle/chill.webpack.config.js
+++ b/src/Bundle/ChillDocStoreBundle/chill.webpack.config.js
@@ -1,8 +1,13 @@
-module.exports = function(encore)
-{
- encore.addAliases({
- ChillDocStoreAssets: __dirname + '/Resources/public'
- });
- encore.addEntry('mod_async_upload', __dirname + '/Resources/public/module/async_upload/index.ts');
- encore.addEntry('mod_document_action_buttons_group', __dirname + '/Resources/public/module/document_action_buttons_group/index');
+module.exports = function (encore) {
+ encore.addAliases({
+ ChillDocStoreAssets: __dirname + "/Resources/public",
+ });
+ encore.addEntry(
+ "mod_async_upload",
+ __dirname + "/Resources/public/module/async_upload/index.ts",
+ );
+ encore.addEntry(
+ "mod_document_action_buttons_group",
+ __dirname + "/Resources/public/module/document_action_buttons_group/index",
+ );
};
diff --git a/src/Bundle/ChillEventBundle/Resources/public/chill/index.js b/src/Bundle/ChillEventBundle/Resources/public/chill/index.js
index adb0dd85e..4a0fc4ee0 100644
--- a/src/Bundle/ChillEventBundle/Resources/public/chill/index.js
+++ b/src/Bundle/ChillEventBundle/Resources/public/chill/index.js
@@ -1 +1 @@
-require('./chillevent.scss');
+require("./chillevent.scss");
diff --git a/src/Bundle/ChillEventBundle/chill.webpack.config.js b/src/Bundle/ChillEventBundle/chill.webpack.config.js
index 83c08a6ce..e2c1e14bc 100644
--- a/src/Bundle/ChillEventBundle/chill.webpack.config.js
+++ b/src/Bundle/ChillEventBundle/chill.webpack.config.js
@@ -1,4 +1,3 @@
-module.exports = function(encore, entries)
-{
- entries.push(__dirname + '/Resources/public/chill/index.js');
+module.exports = function (encore, entries) {
+ entries.push(__dirname + "/Resources/public/chill/index.js");
};
diff --git a/src/Bundle/ChillJobBundle/src/Resources/public/images/index.js b/src/Bundle/ChillJobBundle/src/Resources/public/images/index.js
index f8435adf5..cfdff8b99 100644
--- a/src/Bundle/ChillJobBundle/src/Resources/public/images/index.js
+++ b/src/Bundle/ChillJobBundle/src/Resources/public/images/index.js
@@ -1 +1 @@
-require('./footer_bandeau.jpg');
+require("./footer_bandeau.jpg");
diff --git a/src/Bundle/ChillJobBundle/src/Resources/public/module/cv_edit/index.js b/src/Bundle/ChillJobBundle/src/Resources/public/module/cv_edit/index.js
index 43917ddad..ee40b895a 100644
--- a/src/Bundle/ChillJobBundle/src/Resources/public/module/cv_edit/index.js
+++ b/src/Bundle/ChillJobBundle/src/Resources/public/module/cv_edit/index.js
@@ -1,43 +1,37 @@
-import { ShowHide } from 'ShowHide/show_hide.js';
+import { ShowHide } from "ShowHide/show_hide.js";
// listen to adding of formation and register a show hide
-var make_show_hide = function(entry) {
- let
- obtained = entry.querySelector('[data-diploma-obtained]'),
- reconnue = entry.querySelector('[data-diploma-reconnue]')
- ;
- var a = new ShowHide({
- load_event: null,
- froms: [ obtained ],
- container: [ reconnue ],
- test: function(froms, event) {
- for (let f of froms.values()) {
- for (let input of f.querySelectorAll('input').values()) {
- if (input.value === 'non-fr') {
- return input.checked;
- }
- }
- }
-
- return false;
+var make_show_hide = function (entry) {
+ let obtained = entry.querySelector("[data-diploma-obtained]"),
+ reconnue = entry.querySelector("[data-diploma-reconnue]");
+ var a = new ShowHide({
+ load_event: null,
+ froms: [obtained],
+ container: [reconnue],
+ test: function (froms, event) {
+ for (let f of froms.values()) {
+ for (let input of f.querySelectorAll("input").values()) {
+ if (input.value === "non-fr") {
+ return input.checked;
+ }
}
- });
+ }
+
+ return false;
+ },
+ });
};
-window.addEventListener('collection-add-entry', function(e) {
- if (e.detail.collection.dataset.collectionName === 'formations') {
- make_show_hide(e.detail.entry);
- }
+window.addEventListener("collection-add-entry", function (e) {
+ if (e.detail.collection.dataset.collectionName === "formations") {
+ make_show_hide(e.detail.entry);
+ }
});
// starting the formation on load
-window.addEventListener('load', function(_e) {
- let
- formations = document.querySelectorAll('[data-formation-entry]')
- ;
-
- for (let f of formations.values()) {
- make_show_hide(f);
- }
+window.addEventListener("load", function (_e) {
+ let formations = document.querySelectorAll("[data-formation-entry]");
+ for (let f of formations.values()) {
+ make_show_hide(f);
+ }
});
-
diff --git a/src/Bundle/ChillJobBundle/src/Resources/public/module/dispositif_edit/index.js b/src/Bundle/ChillJobBundle/src/Resources/public/module/dispositif_edit/index.js
index c8dba4ff7..9422ea433 100644
--- a/src/Bundle/ChillJobBundle/src/Resources/public/module/dispositif_edit/index.js
+++ b/src/Bundle/ChillJobBundle/src/Resources/public/module/dispositif_edit/index.js
@@ -1,72 +1,71 @@
-import { ShowHide } from 'ShowHide/show_hide.js';
+import { ShowHide } from "ShowHide/show_hide.js";
-var
- div_accompagnement = document.getElementById("form_accompagnement"),
- div_accompagnement_rqth = document.getElementById("form_accompagnement_rqth"),
- div_accompagnement_comment = document.getElementById("form_accompagnement_comment"),
- div_caf_id = document.getElementById("cafId"),
- div_caf_inscription_date = document.getElementById("cafInscriptionDate"),
- div_neet_eligibilite = document.getElementById("neetEligibilite"),
- div_neet_commission_date = document.getElementById("neetCommissionDate")
- ;
-
+var div_accompagnement = document.getElementById("form_accompagnement"),
+ div_accompagnement_rqth = document.getElementById("form_accompagnement_rqth"),
+ div_accompagnement_comment = document.getElementById(
+ "form_accompagnement_comment",
+ ),
+ div_caf_id = document.getElementById("cafId"),
+ div_caf_inscription_date = document.getElementById("cafInscriptionDate"),
+ div_neet_eligibilite = document.getElementById("neetEligibilite"),
+ div_neet_commission_date = document.getElementById("neetCommissionDate");
// faire apparaitre / disparaitre RQTH si RQTH coché
new ShowHide({
- "froms": [div_accompagnement],
- "test": function(froms, event) {
- for (let el of froms.values()) {
- for (let input of el.querySelectorAll('input').values()) {
- if (input.value === 'rqth') {
- return input.checked;
- }
- }
+ froms: [div_accompagnement],
+ test: function (froms, event) {
+ for (let el of froms.values()) {
+ for (let input of el.querySelectorAll("input").values()) {
+ if (input.value === "rqth") {
+ return input.checked;
}
- },
- "container": [div_accompagnement_rqth]
+ }
+ }
+ },
+ container: [div_accompagnement_rqth],
});
// faire apparaitre / disparaitre commetnaire si coché
new ShowHide({
- "froms": [div_accompagnement],
- "test": function(froms, event) {
- for (let el of froms.values()) {
- for (let input of el.querySelectorAll('input').values()) {
- if (input.value === 'autre') {
- return input.checked;
- }
- }
+ froms: [div_accompagnement],
+ test: function (froms, event) {
+ for (let el of froms.values()) {
+ for (let input of el.querySelectorAll("input").values()) {
+ if (input.value === "autre") {
+ return input.checked;
}
-
- return false;
- },
- "container": [div_accompagnement_comment]
+ }
+ }
+
+ return false;
+ },
+ container: [div_accompagnement_comment],
});
// faire apparaitre cafInscriptionDate seulement si cafID est rempli
new ShowHide({
- froms: [ div_caf_id ],
- test: function(froms, event) {
- for (let el of froms.values()) {
- return el.querySelector("input").value !== "";
- }
- },
- container: [ div_caf_inscription_date ],
- event_name: 'input'
+ froms: [div_caf_id],
+ test: function (froms, event) {
+ for (let el of froms.values()) {
+ return el.querySelector("input").value !== "";
+ }
+ },
+ container: [div_caf_inscription_date],
+ event_name: "input",
});
// faire apparaitre date de commission neet seulement si eligible
new ShowHide({
- froms: [ div_neet_eligibilite ],
- test: function(froms, event) {
- for (let el of froms.values()) {
- for (let input of el.querySelectorAll('input').values()) {
- if (input.value === "oui") {
- return input.checked;
- }
- }
+ froms: [div_neet_eligibilite],
+ test: function (froms, event) {
+ for (let el of froms.values()) {
+ for (let input of el.querySelectorAll("input").values()) {
+ if (input.value === "oui") {
+ return input.checked;
}
-
- return false;
- },
- container: [ div_neet_commission_date ]
-});
\ No newline at end of file
+ }
+ }
+
+ return false;
+ },
+ container: [div_neet_commission_date],
+});
diff --git a/src/Bundle/ChillJobBundle/src/Resources/public/module/immersion_edit/index.js b/src/Bundle/ChillJobBundle/src/Resources/public/module/immersion_edit/index.js
index c934b0b32..e1cb1ffdf 100644
--- a/src/Bundle/ChillJobBundle/src/Resources/public/module/immersion_edit/index.js
+++ b/src/Bundle/ChillJobBundle/src/Resources/public/module/immersion_edit/index.js
@@ -1,20 +1,17 @@
-import { ShowHide } from 'ShowHide/show_hide.js';
+import { ShowHide } from "ShowHide/show_hide.js";
-var
- div_objectifs = document.getElementById("objectifs"),
- div_objectifs_autre = document.getElementById("objectifsAutre")
- ;
-
+var div_objectifs = document.getElementById("objectifs"),
+ div_objectifs_autre = document.getElementById("objectifsAutre");
new ShowHide({
- froms: [div_objectifs],
- container: [div_objectifs_autre],
- test: function(froms, event) {
- for (let el of froms.values()) {
- for (let input of el.querySelectorAll('input').values()) {
- if (input.value === 'autre') {
- return input.checked;
- }
- }
+ froms: [div_objectifs],
+ container: [div_objectifs_autre],
+ test: function (froms, event) {
+ for (let el of froms.values()) {
+ for (let input of el.querySelectorAll("input").values()) {
+ if (input.value === "autre") {
+ return input.checked;
}
+ }
}
-});
\ No newline at end of file
+ },
+});
diff --git a/src/Bundle/ChillJobBundle/src/Resources/public/module/personal_situation/index.js b/src/Bundle/ChillJobBundle/src/Resources/public/module/personal_situation/index.js
index 4cb4bb246..bb378aca7 100644
--- a/src/Bundle/ChillJobBundle/src/Resources/public/module/personal_situation/index.js
+++ b/src/Bundle/ChillJobBundle/src/Resources/public/module/personal_situation/index.js
@@ -1,103 +1,102 @@
-import { ShowHide } from 'ShowHide/show_hide.js';
-var
- ressources = document.getElementById("ressources"),
- ressources_comment = document.getElementById("ressourcesComment"),
- handicap_is = document.getElementById('handicap_is'),
- handicap_if = document.getElementById('handicap_if'),
- situation_prof = document.getElementById('situation_prof'),
- type_contrat = document.getElementById('type_contrat'),
- type_contrat_aide = document.getElementById('type_contrat_aide'),
- situation_logement = document.getElementById('situation_logement'),
- situation_logement_precision = document.getElementById('situation_logement_precision')
- ;
-
+import { ShowHide } from "ShowHide/show_hide.js";
+var ressources = document.getElementById("ressources"),
+ ressources_comment = document.getElementById("ressourcesComment"),
+ handicap_is = document.getElementById("handicap_is"),
+ handicap_if = document.getElementById("handicap_if"),
+ situation_prof = document.getElementById("situation_prof"),
+ type_contrat = document.getElementById("type_contrat"),
+ type_contrat_aide = document.getElementById("type_contrat_aide"),
+ situation_logement = document.getElementById("situation_logement"),
+ situation_logement_precision = document.getElementById(
+ "situation_logement_precision",
+ );
new ShowHide({
- froms: [ressources],
- container: [ressources_comment],
- test: function(froms) {
- for (let f of froms.values()) {
- for (let input of f.querySelectorAll('input').values()) {
- if (input.value === 'autre') {
- return input.checked;
- }
- }
+ froms: [ressources],
+ container: [ressources_comment],
+ test: function (froms) {
+ for (let f of froms.values()) {
+ for (let input of f.querySelectorAll("input").values()) {
+ if (input.value === "autre") {
+ return input.checked;
}
+ }
}
+ },
});
new ShowHide({
- froms: [handicap_is],
- container: [handicap_if],
- test: function(froms) {
- for (let f of froms.values()) {
- for (let input of f.querySelectorAll('input').values()) {
- if (input.value === '1') {
- return input.checked;
- }
- }
+ froms: [handicap_is],
+ container: [handicap_if],
+ test: function (froms) {
+ for (let f of froms.values()) {
+ for (let input of f.querySelectorAll("input").values()) {
+ if (input.value === "1") {
+ return input.checked;
}
-
- return false;
+ }
}
+
+ return false;
+ },
});
var show_hide_contrat_aide = new ShowHide({
- froms: [type_contrat],
- container: [type_contrat_aide],
- test: function(froms) {
- for (let f of froms.values()) {
- for (let input of f.querySelectorAll('input').values()) {
- if (input.value === 'contrat_aide') {
- return input.checked;
- }
- }
+ froms: [type_contrat],
+ container: [type_contrat_aide],
+ test: function (froms) {
+ for (let f of froms.values()) {
+ for (let input of f.querySelectorAll("input").values()) {
+ if (input.value === "contrat_aide") {
+ return input.checked;
}
-
- return false;
+ }
}
+
+ return false;
+ },
});
new ShowHide({
- id: 'situation_prof_type_contrat',
- froms: [situation_prof],
- container: [type_contrat],
- test: function(froms) {
- for (let f of froms.values()) {
- for (let input of f.querySelectorAll('input').values()) {
- if (input.value === 'en_activite') {
- return input.checked;
- }
- }
+ id: "situation_prof_type_contrat",
+ froms: [situation_prof],
+ container: [type_contrat],
+ test: function (froms) {
+ for (let f of froms.values()) {
+ for (let input of f.querySelectorAll("input").values()) {
+ if (input.value === "en_activite") {
+ return input.checked;
}
-
- return false;
+ }
}
+
+ return false;
+ },
});
-window.addEventListener('show-hide-hide', function (e) {
- if (e.detail.id = 'situation_prof_type_contrat') {
- show_hide_contrat_aide.forceHide();
- }
+window.addEventListener("show-hide-hide", function (e) {
+ if ((e.detail.id = "situation_prof_type_contrat")) {
+ show_hide_contrat_aide.forceHide();
+ }
});
-window.addEventListener('show-hide-show', function (e) {
- if (e.detail.id = 'situation_prof_type_contrat') {
- show_hide_contrat_aide.forceCompute();
- }
+window.addEventListener("show-hide-show", function (e) {
+ if ((e.detail.id = "situation_prof_type_contrat")) {
+ show_hide_contrat_aide.forceCompute();
+ }
});
new ShowHide({
- froms: [situation_logement],
- container: [situation_logement_precision],
- test: function(froms) {
- for (let f of froms.values()) {
- for (let input of f.querySelectorAll('input')) {
- if (input.value === 'heberge_chez_tiers') {
- return input.checked;
- }
- }
+ froms: [situation_logement],
+ container: [situation_logement_precision],
+ test: function (froms) {
+ for (let f of froms.values()) {
+ for (let input of f.querySelectorAll("input")) {
+ if (input.value === "heberge_chez_tiers") {
+ return input.checked;
}
-
- return false;
+ }
}
-});
\ No newline at end of file
+
+ return false;
+ },
+});
diff --git a/src/Bundle/ChillJobBundle/src/Resources/public/sass/index.js b/src/Bundle/ChillJobBundle/src/Resources/public/sass/index.js
index 657c9677d..a914c6d1e 100644
--- a/src/Bundle/ChillJobBundle/src/Resources/public/sass/index.js
+++ b/src/Bundle/ChillJobBundle/src/Resources/public/sass/index.js
@@ -1 +1 @@
-require('./csconnectes.scss');
+require("./csconnectes.scss");
diff --git a/src/Bundle/ChillJobBundle/src/chill.webpack.config.js b/src/Bundle/ChillJobBundle/src/chill.webpack.config.js
index b648e23bb..7306e5deb 100644
--- a/src/Bundle/ChillJobBundle/src/chill.webpack.config.js
+++ b/src/Bundle/ChillJobBundle/src/chill.webpack.config.js
@@ -1,20 +1,18 @@
-module.exports = function(encore, chillEntries)
-{
- let
- dispositif_edit_file = __dirname + '/Resources/public/module/dispositif_edit/index.js',
- personal_situation_edit_file = __dirname + '/Resources/public/module/personal_situation/index.js',
- cv_edit_file = __dirname + '/Resources/public/module/cv_edit/index.js',
- immersion_edit_file = __dirname + '/Resources/public/module/immersion_edit/index.js',
- images = __dirname + '/Resources/public/images/index.js',
- sass_styles = __dirname + '/Resources/public/sass/index.js'
- ;
-
- encore.addEntry('dispositifs_edit', dispositif_edit_file);
- encore.addEntry('personal_situation_edit', personal_situation_edit_file);
- encore.addEntry('immersion_edit', immersion_edit_file);
- encore.addEntry('images', images);
- encore.addEntry('cs_cv', cv_edit_file);
-
- chillEntries.push(sass_styles);
+module.exports = function (encore, chillEntries) {
+ let dispositif_edit_file =
+ __dirname + "/Resources/public/module/dispositif_edit/index.js",
+ personal_situation_edit_file =
+ __dirname + "/Resources/public/module/personal_situation/index.js",
+ cv_edit_file = __dirname + "/Resources/public/module/cv_edit/index.js",
+ immersion_edit_file =
+ __dirname + "/Resources/public/module/immersion_edit/index.js",
+ images = __dirname + "/Resources/public/images/index.js",
+ sass_styles = __dirname + "/Resources/public/sass/index.js";
+ encore.addEntry("dispositifs_edit", dispositif_edit_file);
+ encore.addEntry("personal_situation_edit", personal_situation_edit_file);
+ encore.addEntry("immersion_edit", immersion_edit_file);
+ encore.addEntry("images", images);
+ encore.addEntry("cs_cv", cv_edit_file);
+ chillEntries.push(sass_styles);
};
diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/index.js b/src/Bundle/ChillMainBundle/Resources/public/chill/index.js
index 9f0384208..1601801a4 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/chill/index.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/chill/index.js
@@ -4,47 +4,44 @@
*/
/// import jQuery
-const $ = require('jquery');
+const $ = require("jquery");
global.$ = global.jQuery = $;
/// import select2
-const select2 = require('select2');
+const select2 = require("select2");
global.select2 = select2;
-require('select2/dist/css/select2.css');
-require('select2-bootstrap-theme/dist/select2-bootstrap.css');
-
+require("select2/dist/css/select2.css");
+require("select2-bootstrap-theme/dist/select2-bootstrap.css");
/*
* Load Chill themes assets
*/
-require('./chillmain.scss');
+require("./chillmain.scss");
-import { chill } from './js/chill.js';
+import { chill } from "./js/chill.js";
global.chill = chill;
-require('./js/date');
-require('./js/counter.js');
+require("./js/date");
+require("./js/counter.js");
/// Load fonts
-require('./fonts/OpenSans/OpenSans.scss')
+require("./fonts/OpenSans/OpenSans.scss");
/// Load images
-require('./img/favicon.ico');
-require('./img/logo-chill-sans-slogan_white.png');
-require('./img/logo-chill-outil-accompagnement_white.png');
-
+require("./img/favicon.ico");
+require("./img/logo-chill-sans-slogan_white.png");
+require("./img/logo-chill-outil-accompagnement_white.png");
/*
* Load local libs
* Some libs are only used in a few pages, they are loaded on a case by case basis
*/
-require('../lib/breadcrumb/index.js');
-require('../lib/download-report/index.js');
-require('../lib/select_interactive_loading/index.js');
+require("../lib/breadcrumb/index.js");
+require("../lib/download-report/index.js");
+require("../lib/select_interactive_loading/index.js");
//require('../lib/show_hide/index.js');
//require('../lib/tabs/index.js');
-
diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/js/chill.js b/src/Bundle/ChillMainBundle/Resources/public/chill/js/chill.js
index 709c755c6..9a54c22f5 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/chill/js/chill.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/chill/js/chill.js
@@ -1,107 +1,111 @@
/* jslint vars: true */
/*jslint indent: 4 */
/* global moment, $, window */
-'use strict';
+"use strict";
-var chill = function() {
+var chill = (function () {
+ /**
+ * Display an alert message when the user wants to leave a page containing a given form
+ * in a given state.
+ *
+ * The action of displaying the form be parametrised as :
+ * - always display the alert message when leaving
+ * - only display the alert message when the form contains some modified fields.
+ *
+ * @param{string} form_id An identification string of the form
+ * @param{string} alert_message The alert message to display
+ * @param{boolean} check_unsaved_data If true display the alert message only when the form
+ * contains some modified fields otherwise always display the alert when leaving
+ * @return nothing
+ */
+ function _generalDisplayAlertWhenLeavingForm(
+ form_id,
+ alert_message,
+ check_unsaved_data,
+ ) {
+ var form_submitted = false;
+ var unsaved_data = false;
- /**
- * Display an alert message when the user wants to leave a page containing a given form
- * in a given state.
- *
- * The action of displaying the form be parametrised as :
- * - always display the alert message when leaving
- * - only display the alert message when the form contains some modified fields.
- *
- * @param{string} form_id An identification string of the form
- * @param{string} alert_message The alert message to display
- * @param{boolean} check_unsaved_data If true display the alert message only when the form
- * contains some modified fields otherwise always display the alert when leaving
- * @return nothing
- */
- function _generalDisplayAlertWhenLeavingForm(form_id, alert_message, check_unsaved_data) {
- var form_submitted = false;
- var unsaved_data = false;
+ $(form_id)
+ .submit(function () {
+ form_submitted = true;
+ })
+ .on("reset", function () {
+ unsaved_data = false;
+ });
- $(form_id)
- .submit(function() {
- form_submitted = true;
- })
- .on('reset', function() {
- unsaved_data = false;
- })
- ;
+ $.each($(form_id).find(":input"), function (i, e) {
+ $(e).change(function () {
+ unsaved_data = true;
+ });
+ });
- $.each($(form_id).find(':input'), function(i,e) {
- $(e).change(function() {
- unsaved_data = true;
- });
- });
+ $(window).bind("beforeunload", function () {
+ if (!form_submitted && (unsaved_data || !check_unsaved_data)) {
+ return alert_message;
+ }
+ });
+ }
- $(window).bind('beforeunload', function(){
- if((!form_submitted) && (unsaved_data || !check_unsaved_data)) {
- return alert_message;
- }
- });
- }
-
- /**
- * Mark the choices "not specified" as check by default.
- *
- * This function apply to `custom field choices` when the `required`
- * option is false and `expanded` is true (checkboxes or radio buttons).
- *
- * @param{string} choice_name the name of the input
- */
- function checkNullValuesInChoices(choice_name) {
- var choices;
- choices = $("input[name='"+choice_name+"']:checked");
- if (choices.size() === 0) {
- $.each($("input[name='"+choice_name+"']"), function (i, e) {
- if (e.value === "") {
- e.checked = true;
- }
- });
+ /**
+ * Mark the choices "not specified" as check by default.
+ *
+ * This function apply to `custom field choices` when the `required`
+ * option is false and `expanded` is true (checkboxes or radio buttons).
+ *
+ * @param{string} choice_name the name of the input
+ */
+ function checkNullValuesInChoices(choice_name) {
+ var choices;
+ choices = $("input[name='" + choice_name + "']:checked");
+ if (choices.size() === 0) {
+ $.each($("input[name='" + choice_name + "']"), function (i, e) {
+ if (e.value === "") {
+ e.checked = true;
}
+ });
}
+ }
- /**
- * Display an alert message when the user wants to leave a page containing a given
- * modified form.
- *
- * @param{string} form_id An identification string of the form
- * @param{string} alert_message The alert message to display
- * @return nothing
- */
- function displayAlertWhenLeavingModifiedForm(form_id, alert_message) {
- _generalDisplayAlertWhenLeavingForm(form_id, alert_message, true);
- }
+ /**
+ * Display an alert message when the user wants to leave a page containing a given
+ * modified form.
+ *
+ * @param{string} form_id An identification string of the form
+ * @param{string} alert_message The alert message to display
+ * @return nothing
+ */
+ function displayAlertWhenLeavingModifiedForm(form_id, alert_message) {
+ _generalDisplayAlertWhenLeavingForm(form_id, alert_message, true);
+ }
- /**
- * Display an alert message when the user wants to leave a page containing a given
- * form that was not submitted.
- *
- * @param{string} form_id An identification string of the form
- * @param{string} alert_message The alert message to display
- * @return nothing
- */
- function displayAlertWhenLeavingUnsubmittedForm(form_id, alert_message) {
- _generalDisplayAlertWhenLeavingForm(form_id, alert_message, false);
- }
+ /**
+ * Display an alert message when the user wants to leave a page containing a given
+ * form that was not submitted.
+ *
+ * @param{string} form_id An identification string of the form
+ * @param{string} alert_message The alert message to display
+ * @return nothing
+ */
+ function displayAlertWhenLeavingUnsubmittedForm(form_id, alert_message) {
+ _generalDisplayAlertWhenLeavingForm(form_id, alert_message, false);
+ }
- /* Enable the following behavior : when the user change the value
+ /* Enable the following behavior : when the user change the value
of an other field, its checkbox is checked.
*/
- function checkOtherValueOnChange() {
- $('.input-text-other-value').each(function() {
- $(this).change(function() {
- var checkbox = $(this).parent().find('input[type=checkbox][value=_other]')[0];
- $(checkbox).prop('checked', ($(this).val() !== ''));
- });
- });
- }
+ function checkOtherValueOnChange() {
+ $(".input-text-other-value").each(function () {
+ $(this).change(function () {
+ var checkbox = $(this)
+ .parent()
+ .find("input[type=checkbox][value=_other]")[0];
+ $(checkbox).prop("checked", $(this).val() !== "");
+ });
+ });
+ }
- /**
+ /**
* Create an interraction between two select element (the parent and the
* child) of a given form : each parent option has a category, the
* child select only display options that have the same category of the
@@ -138,208 +142,231 @@ var chill = function() {
- quand vide
- quand choix
*/
- function categoryLinkParentChildSelect() {
- var forms_to_link = $('form:has(select.chill-category-link-parent)');
+ function categoryLinkParentChildSelect() {
+ var forms_to_link = $("form:has(select.chill-category-link-parent)");
- forms_to_link.each(function(i,form_selector) {
- var form = $(form_selector), parent_multiple;
- form.old_category = null;
- form.link_parent = $(form).find('.chill-category-link-parent');
- form.link_child = $(form).find('.chill-category-link-child');
+ forms_to_link.each(function (i, form_selector) {
+ var form = $(form_selector),
+ parent_multiple;
+ form.old_category = null;
+ form.link_parent = $(form).find(".chill-category-link-parent");
+ form.link_child = $(form).find(".chill-category-link-child");
- // check if the parent allow multiple or single results
- parent_multiple = $(form).find('.chill-category-link-parent').get(0).multiple;
- // if we use select2, parent_multiple will be `undefined`
- if (typeof parent_multiple == 'undefined') {
- // currently, I do not know how to check if multiple using select2.
- // we suppose that multiple is false (old behaviour)
- parent_multiple = false
- }
+ // check if the parent allow multiple or single results
+ parent_multiple = $(form)
+ .find(".chill-category-link-parent")
+ .get(0).multiple;
+ // if we use select2, parent_multiple will be `undefined`
+ if (typeof parent_multiple == "undefined") {
+ // currently, I do not know how to check if multiple using select2.
+ // we suppose that multiple is false (old behaviour)
+ parent_multiple = false;
+ }
- $(form.link_parent).addClass('select2');
- $(form.link_parant).select2({allowClear: true}); // it is weird: when I fix the typo here, the whole stuff does not work anymore...
+ $(form.link_parent).addClass("select2");
+ $(form.link_parant).select2({ allowClear: true }); // it is weird: when I fix the typo here, the whole stuff does not work anymore...
- if (parent_multiple == false) {
+ if (parent_multiple == false) {
+ form.old_category = null;
+ if ($(form.link_parent).select2("data") !== null) {
+ form.old_category = $(form.link_parent).select2(
+ "data",
+ ).element[0].dataset.linkCategory;
+ }
- form.old_category = null;
- if($(form.link_parent).select2('data') !== null) {
- form.old_category = ($(form.link_parent).select2('data').element[0].dataset.linkCategory);
- }
-
- $(form.link_child).find('option')
- .each(function(i,e) {
- if(
- ((!$(e).data('link-category')) || $(e).data('link-category') == form.old_category) &&
- ((!$(e).data('link-categories')) || form.old_category in $(e).data('link-categories').split(','))
- ) {
- $(e).show();
- // here, we should handle the optgroup
- } else {
- $(e).hide();
- // here, we should handle the optgroup
- }
- });
-
- form.link_parent.change(function() {
- var new_category = ($(form.link_parent).select2('data').element[0].dataset.linkCategory);
- if(new_category != form.old_category) {
- $(form.link_child).find('option')
- .each(function(i,e) {
- if(
- ((!$(e).data('link-category')) || $(e).data('link-category') == new_category) &&
- ((!$(e).data('link-categories')) || new_category in $(e).data('link-categories').split(','))
- ) {
- $(e).show();
- // here, we should handle the optgroup
- } else {
- $(e).hide();
- // here, we should handle the opgroup
- }
- });
- $(form.link_child).find('option')[0].selected = true;
- form.old_category = new_category;
- }
- });
+ $(form.link_child)
+ .find("option")
+ .each(function (i, e) {
+ if (
+ (!$(e).data("link-category") ||
+ $(e).data("link-category") == form.old_category) &&
+ (!$(e).data("link-categories") ||
+ form.old_category in $(e).data("link-categories").split(","))
+ ) {
+ $(e).show();
+ // here, we should handle the optgroup
} else {
- var i=0,
- selected_items = $(form.link_parent).find(':selected');
+ $(e).hide();
+ // here, we should handle the optgroup
+ }
+ });
- form.old_categories = [];
- for (i=0;i < selected_items.length; i++) {
- form.old_categories.push(selected_items[i].value);
+ form.link_parent.change(function () {
+ var new_category = $(form.link_parent).select2("data").element[0]
+ .dataset.linkCategory;
+ if (new_category != form.old_category) {
+ $(form.link_child)
+ .find("option")
+ .each(function (i, e) {
+ if (
+ (!$(e).data("link-category") ||
+ $(e).data("link-category") == new_category) &&
+ (!$(e).data("link-categories") ||
+ new_category in $(e).data("link-categories").split(","))
+ ) {
+ $(e).show();
+ // here, we should handle the optgroup
+ } else {
+ $(e).hide();
+ // here, we should handle the opgroup
}
-
- $(form.link_child).find('option')
- .each(function(i,e) {
- var visible;
- if(form.old_categories.indexOf(e.dataset.linkCategory) != -1) {
- $(e).show();
- if (e.parentNode instanceof HTMLOptGroupElement) {
- $(e.parentNode).show();
- }
- } else {
- $(e).hide();
- if (e.parentNode instanceof HTMLOptGroupElement) {
- // we check if the other options are visible.
- visible = false
- for (var l=0; l < e.parentNode.children.length; l++) {
- if (window.getComputedStyle(e.parentNode.children[l]).getPropertyValue('display') != 'none') {
- visible = true;
- }
- }
- // if any options are visible, we hide the optgroup
- if (visible == false) {
- $(e.parentNode).hide();
- }
- }
- }
- });
-
- form.link_parent.change(function() {
- var new_categories = [],
- selected_items = $(form.link_parent).find(':selected'),
- visible;
- for (i=0;i < selected_items.length; i++) {
- new_categories.push(selected_items[i].value);
- }
-
- if(new_categories != form.old_categories) {
- $(form.link_child).find('option')
- .each(function(i,e) {
- if(new_categories.indexOf(e.dataset.linkCategory) != -1) {
- $(e).show();
- // if parent is an opgroup, we show it
- if (e.parentNode instanceof HTMLOptGroupElement) {
- $(e.parentNode).show();
- }
- } else {
- $(e).hide();
- // we check if the parent is an optgroup
- if (e.parentNode instanceof HTMLOptGroupElement) {
- // we check if other options are visible
- visible = false
- for (var l=0; l < e.parentNode.children.length; l++) {
- if (window.getComputedStyle(e.parentNode.children[l]).getPropertyValue('display') != 'none') {
- visible = true;
- }
- }
- // if any options are visible, we hide the optgroup
- if (visible == false) {
- $(e.parentNode).hide();
- }
- }
- }
- });
- //$(form.link_child).find('option')[0].selected = true;
- form.old_categories = new_categories;
- }
- });
- }
+ });
+ $(form.link_child).find("option")[0].selected = true;
+ form.old_category = new_category;
+ }
});
- }
+ } else {
+ var i = 0,
+ selected_items = $(form.link_parent).find(":selected");
- function _displayHideTargetWithCheckbox(checkbox) {
- var target = checkbox.dataset.displayTarget,
- hideableElements;
-
- hideableElements = document.querySelectorAll('[data-display-show-hide="' + target + '"]');
-
- if (checkbox.checked) {
- for (let i=0; i < hideableElements.length; i = i+1) {
- hideableElements[i].style.display = "unset";
- }
- } else {
- for (let i=0; i < hideableElements.length; i = i+1) {
- hideableElements[i].style.display = "none";
- }
+ form.old_categories = [];
+ for (i = 0; i < selected_items.length; i++) {
+ form.old_categories.push(selected_items[i].value);
}
+ $(form.link_child)
+ .find("option")
+ .each(function (i, e) {
+ var visible;
+ if (form.old_categories.indexOf(e.dataset.linkCategory) != -1) {
+ $(e).show();
+ if (e.parentNode instanceof HTMLOptGroupElement) {
+ $(e.parentNode).show();
+ }
+ } else {
+ $(e).hide();
+ if (e.parentNode instanceof HTMLOptGroupElement) {
+ // we check if the other options are visible.
+ visible = false;
+ for (var l = 0; l < e.parentNode.children.length; l++) {
+ if (
+ window
+ .getComputedStyle(e.parentNode.children[l])
+ .getPropertyValue("display") != "none"
+ ) {
+ visible = true;
+ }
+ }
+ // if any options are visible, we hide the optgroup
+ if (visible == false) {
+ $(e.parentNode).hide();
+ }
+ }
+ }
+ });
+
+ form.link_parent.change(function () {
+ var new_categories = [],
+ selected_items = $(form.link_parent).find(":selected"),
+ visible;
+ for (i = 0; i < selected_items.length; i++) {
+ new_categories.push(selected_items[i].value);
+ }
+
+ if (new_categories != form.old_categories) {
+ $(form.link_child)
+ .find("option")
+ .each(function (i, e) {
+ if (new_categories.indexOf(e.dataset.linkCategory) != -1) {
+ $(e).show();
+ // if parent is an opgroup, we show it
+ if (e.parentNode instanceof HTMLOptGroupElement) {
+ $(e.parentNode).show();
+ }
+ } else {
+ $(e).hide();
+ // we check if the parent is an optgroup
+ if (e.parentNode instanceof HTMLOptGroupElement) {
+ // we check if other options are visible
+ visible = false;
+ for (var l = 0; l < e.parentNode.children.length; l++) {
+ if (
+ window
+ .getComputedStyle(e.parentNode.children[l])
+ .getPropertyValue("display") != "none"
+ ) {
+ visible = true;
+ }
+ }
+ // if any options are visible, we hide the optgroup
+ if (visible == false) {
+ $(e.parentNode).hide();
+ }
+ }
+ }
+ });
+ //$(form.link_child).find('option')[0].selected = true;
+ form.old_categories = new_categories;
+ }
+ });
+ }
+ });
+ }
+
+ function _displayHideTargetWithCheckbox(checkbox) {
+ var target = checkbox.dataset.displayTarget,
+ hideableElements;
+
+ hideableElements = document.querySelectorAll(
+ '[data-display-show-hide="' + target + '"]',
+ );
+
+ if (checkbox.checked) {
+ for (let i = 0; i < hideableElements.length; i = i + 1) {
+ hideableElements[i].style.display = "unset";
+ }
+ } else {
+ for (let i = 0; i < hideableElements.length; i = i + 1) {
+ hideableElements[i].style.display = "none";
+ }
}
+ }
- /**
- * create an interaction between a checkbox and element to show if the
- * checkbox is checked, or hide if the checkbox is not checked.
- *
- * The checkbox must have the data `data-display-target` with an id,
- * and the parts to show/hide must have the data `data-display-show-hide`
- * with the same value.
- *
- * Example :
- *
- * ```
- *
- *
- *
- *
- *
- * ```
- *
- * Hint: for forms in symfony, you could use the `id` of the form element,
- * accessible through `{{ form.vars.id }}`. This id should be unique.
- *
- *
- * @returns {undefined}
- */
- function listenerDisplayCheckbox() {
- var elements = document.querySelectorAll("[data-display-target]");
+ /**
+ * create an interaction between a checkbox and element to show if the
+ * checkbox is checked, or hide if the checkbox is not checked.
+ *
+ * The checkbox must have the data `data-display-target` with an id,
+ * and the parts to show/hide must have the data `data-display-show-hide`
+ * with the same value.
+ *
+ * Example :
+ *
+ * ```
+ *
+ *
+ *