-
-
-
-
diff --git a/static/packs/js/application-985e65316d409d1cd5d3.js b/static/packs/js/application-985e65316d409d1cd5d3.js
deleted file mode 100644
index f8be493d..00000000
--- a/static/packs/js/application-985e65316d409d1cd5d3.js
+++ /dev/null
@@ -1,56430 +0,0 @@
-/******/ (function(modules) { // webpackBootstrap
-/******/ // install a JSONP callback for chunk loading
-/******/ function webpackJsonpCallback(data) {
-/******/ var chunkIds = data[0];
-/******/ var moreModules = data[1];
-/******/
-/******/
-/******/ // add "moreModules" to the modules object,
-/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
-/******/ for(;i < chunkIds.length; i++) {
-/******/ chunkId = chunkIds[i];
-/******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
-/******/ }
-/******/ installedChunks[chunkId] = 0;
-/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
-/******/ modules[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(parentJsonpFunction) parentJsonpFunction(data);
-/******/
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
-/******/
-/******/ };
-/******/
-/******/
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // object to store loaded and loading chunks
-/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
-/******/ var installedChunks = {
-/******/ "application": 0
-/******/ };
-/******/
-/******/
-/******/
-/******/ // script path function
-/******/ function jsonpScriptSrc(chunkId) {
-/******/ return __webpack_require__.p + "js/" + ({}[chunkId]||chunkId) + "-" + {"0":"5b265227e36149553808","1":"73655457581318550520"}[chunkId] + ".chunk.js"
-/******/ }
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId]) {
-/******/ return installedModules[moduleId].exports;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ i: moduleId,
-/******/ l: false,
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.l = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/ // This file contains only the entry chunk.
-/******/ // The chunk loading function for additional chunks
-/******/ __webpack_require__.e = function requireEnsure(chunkId) {
-/******/ var promises = [];
-/******/
-/******/
-/******/ // JSONP chunk loading for javascript
-/******/
-/******/ var installedChunkData = installedChunks[chunkId];
-/******/ if(installedChunkData !== 0) { // 0 means "already installed".
-/******/
-/******/ // a Promise means "currently loading".
-/******/ if(installedChunkData) {
-/******/ promises.push(installedChunkData[2]);
-/******/ } else {
-/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise(function(resolve, reject) {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
-/******/ promises.push(installedChunkData[2] = promise);
-/******/
-/******/ // start chunk loading
-/******/ var script = document.createElement('script');
-/******/ var onScriptComplete;
-/******/
-/******/ script.charset = 'utf-8';
-/******/ script.timeout = 120;
-/******/ if (__webpack_require__.nc) {
-/******/ script.setAttribute("nonce", __webpack_require__.nc);
-/******/ }
-/******/ script.src = jsonpScriptSrc(chunkId);
-/******/
-/******/ // create error before stack unwound to get useful stacktrace later
-/******/ var error = new Error();
-/******/ onScriptComplete = function (event) {
-/******/ // avoid mem leaks in IE.
-/******/ script.onerror = script.onload = null;
-/******/ clearTimeout(timeout);
-/******/ var chunk = installedChunks[chunkId];
-/******/ if(chunk !== 0) {
-/******/ if(chunk) {
-/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
-/******/ var realSrc = event && event.target && event.target.src;
-/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
-/******/ error.name = 'ChunkLoadError';
-/******/ error.type = errorType;
-/******/ error.request = realSrc;
-/******/ chunk[1](error);
-/******/ }
-/******/ installedChunks[chunkId] = undefined;
-/******/ }
-/******/ };
-/******/ var timeout = setTimeout(function(){
-/******/ onScriptComplete({ type: 'timeout', target: script });
-/******/ }, 120000);
-/******/ script.onerror = script.onload = onScriptComplete;
-/******/ document.head.appendChild(script);
-/******/ }
-/******/ }
-/******/ return Promise.all(promises);
-/******/ };
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // define getter function for harmony exports
-/******/ __webpack_require__.d = function(exports, name, getter) {
-/******/ if(!__webpack_require__.o(exports, name)) {
-/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
-/******/ }
-/******/ };
-/******/
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/
-/******/ // create a fake namespace object
-/******/ // mode & 1: value is a module id, require it
-/******/ // mode & 2: merge all properties of value into the ns
-/******/ // mode & 4: return value when already ns object
-/******/ // mode & 8|1: behave like require
-/******/ __webpack_require__.t = function(value, mode) {
-/******/ if(mode & 1) value = __webpack_require__(value);
-/******/ if(mode & 8) return value;
-/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
-/******/ var ns = Object.create(null);
-/******/ __webpack_require__.r(ns);
-/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
-/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
-/******/ return ns;
-/******/ };
-/******/
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function getDefault() { return module['default']; } :
-/******/ function getModuleExports() { return module; };
-/******/ __webpack_require__.d(getter, 'a', getter);
-/******/ return getter;
-/******/ };
-/******/
-/******/ // Object.prototype.hasOwnProperty.call
-/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "/packs/";
-/******/
-/******/ // on error function for async loading
-/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };
-/******/
-/******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || [];
-/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray);
-/******/ jsonpArray.push = webpackJsonpCallback;
-/******/ jsonpArray = jsonpArray.slice();
-/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);
-/******/ var parentJsonpFunction = oldJsonpFunction;
-/******/
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = "./app/javascript/packs/application.js");
-/******/ })
-/************************************************************************/
-/******/ ({
-
-/***/ "./app/javascript/components/confirmation.js":
-/*!***************************************************!*\
- !*** ./app/javascript/components/confirmation.js ***!
- \***************************************************/
-/*! no exports provided */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var _rails_ujs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @rails/ujs */ "./node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js");
-/* harmony import */ var _rails_ujs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_rails_ujs__WEBPACK_IMPORTED_MODULE_0__);
- // Cache a copy of the old Rails.confirm since we'll override it when the modal opens
-
-var old_confirm = _rails_ujs__WEBPACK_IMPORTED_MODULE_0___default.a.confirm; // Elements we want to listen to for data-confirm
-
-var elements = ["a[data-confirm]", "button[data-confirm]", "input[type=submit][data-confirm]"];
-
-var createConfirmModal = function createConfirmModal(element) {
- var id = "confirm-modal-" + String(Math.random()).slice(2, -1);
- var confirm = element.dataset.confirm;
- var message = element.dataset.message;
- var commit = element.dataset.commit || "Je confirme";
- var cancel = element.dataset.cancel || "Annuler";
- var content = "\n
\n
\n
\n
\n
").concat(confirm, "
\n
").concat(message ? message : "", "
\n
\n
\n \n \n
\n
\n
\n
\n ");
- document.body.insertAdjacentHTML("afterend", content);
- var modal = document.getElementById(id);
- $("#".concat(id)).modal().show();
- element.dataset.confirmModal = "#".concat(id);
-
- var closeModal = function closeModal() {
- $("#".concat(id)).modal().hide();
- };
-
- $("#".concat(id)).on("hidden.bs.modal", function (e) {
- element.removeAttribute("data-confirm-modal");
- });
- document.addEventListener("keyup", function (event) {
- if (event.key === "Escape") {
- event.preventDefault();
- closeModal();
- }
- });
- modal.querySelector("[data-behavior='cancel']").addEventListener("click", function (event) {
- event.preventDefault();
- closeModal();
- });
- modal.querySelector("[data-behavior='commit']").addEventListener("click", function (event) {
- event.preventDefault(); // Allow the confirm to go through
-
- _rails_ujs__WEBPACK_IMPORTED_MODULE_0___default.a.confirm = function () {
- return true;
- }; // Close the modal first otherwise it conflicts with browser form
- // validations in chrome
-
-
- closeModal(); // Click the link again
-
- element.click(); // Restore the confirm behavior
-
- _rails_ujs__WEBPACK_IMPORTED_MODULE_0___default.a.confirm = old_confirm;
- });
- modal.querySelector("[data-behavior='commit']").focus();
- return modal;
-}; // Checks if confirm modal is open
-
-
-var confirmModalOpen = function confirmModalOpen(element) {
- return !!element.dataset.confirmModal;
-};
-
-var handleConfirm = function handleConfirm(event) {
- // If there is a modal open, let the second confirm click through
- if (confirmModalOpen(event.target)) {
- return true; // First click, we need to spawn the modal
- } else {
- createConfirmModal(event.target);
- return false;
- }
-}; // When a Rails confirm event fires, we'll handle it
-
-
-_rails_ujs__WEBPACK_IMPORTED_MODULE_0___default.a.delegate(document, elements.join(", "), "confirm", handleConfirm);
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")))
-
-/***/ }),
-
-/***/ "./app/javascript/components/smooth_scroll_anchor.js":
-/*!***********************************************************!*\
- !*** ./app/javascript/components/smooth_scroll_anchor.js ***!
- \***********************************************************/
-/*! exports provided: smoothScrollAnchor */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "smoothScrollAnchor", function() { return smoothScrollAnchor; });
-function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
-
-function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
-
-function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
-
-var smoothScrollAnchor = function smoothScrollAnchor() {
- var links = document.querySelectorAll("a[data-behavior='smooth-scroll-anchor']");
-
- var _iterator = _createForOfIteratorHelper(links),
- _step;
-
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var link = _step.value;
- link.addEventListener("click", clickHandler);
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
-
- function clickHandler(e) {
- e.preventDefault();
- var href = this.getAttribute("href");
- var offsetTop = document.querySelector(href).offsetTop;
- scroll({
- top: offsetTop,
- behavior: "smooth"
- });
- }
-};
-
-
-
-/***/ }),
-
-/***/ "./app/javascript/components/toggle_mobile_match_information.js":
-/*!**********************************************************************!*\
- !*** ./app/javascript/components/toggle_mobile_match_information.js ***!
- \**********************************************************************/
-/*! exports provided: toggleMobileMatchInformation */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toggleMobileMatchInformation", function() { return toggleMobileMatchInformation; });
-var toggleMobileMatchInformation = function toggleMobileMatchInformation() {
- var matchInfo = document.getElementById("mobile-match-info");
- var matchIdentity = document.getElementById("mobile-match-identity");
- var interestedButton = document.getElementById("interested-button");
- var backButton = document.getElementById("mobile-match-back");
-
- if (matchInfo) {
- interestedButton.addEventListener("click", function (e) {
- matchInfo.classList.add("d-none");
- matchIdentity.classList.remove("d-none", "d-md-block");
- backButton.classList.remove("d-none");
- });
- backButton.addEventListener("click", function (e) {
- matchInfo.classList.remove("d-none");
- matchIdentity.classList.add("d-none", "d-md-block");
- });
- }
-};
-
-
-
-/***/ }),
-
-/***/ "./app/javascript/components/toggle_password_visibility.js":
-/*!*****************************************************************!*\
- !*** ./app/javascript/components/toggle_password_visibility.js ***!
- \*****************************************************************/
-/*! exports provided: togglePasswordVisibility */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "togglePasswordVisibility", function() { return togglePasswordVisibility; });
-var togglePasswordVisibility = function togglePasswordVisibility() {
- var input = document.querySelector("[data-behavior='toggle-password-visibility'] input");
- var icon = document.querySelector("[data-behavior='toggle-password-visibility'] i");
- var passwordInput = document.querySelector("[data-behavior='toggle-password-visibility'] a");
-
- if (passwordInput) {
- passwordInput.addEventListener("click", function (e) {
- e.preventDefault();
- e.stopPropagation();
-
- if (input.getAttribute("type") === "text") {
- input.setAttribute("type", "password");
- icon.classList.add("fa-eye");
- icon.classList.remove("fa-eye-slash");
- } else if (input.getAttribute("type") === "password") {
- input.setAttribute("type", "text");
- icon.classList.add("fa-eye-slash");
- icon.classList.remove("fa-eye");
- }
- });
- }
-};
-
-
-
-/***/ }),
-
-/***/ "./app/javascript/controllers/application sync recursive _controller\\.js$":
-/*!**********************************************************************!*\
- !*** ./app/javascript/controllers/application sync _controller\.js$ ***!
- \**********************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-var map = {
- "./new_campaign_controller.js": "./app/javascript/controllers/application/new_campaign_controller.js",
- "./password_controller.js": "./app/javascript/controllers/application/password_controller.js"
-};
-
-
-function webpackContext(req) {
- var id = webpackContextResolve(req);
- return __webpack_require__(id);
-}
-function webpackContextResolve(req) {
- if(!__webpack_require__.o(map, req)) {
- var e = new Error("Cannot find module '" + req + "'");
- e.code = 'MODULE_NOT_FOUND';
- throw e;
- }
- return map[req];
-}
-webpackContext.keys = function webpackContextKeys() {
- return Object.keys(map);
-};
-webpackContext.resolve = webpackContextResolve;
-module.exports = webpackContext;
-webpackContext.id = "./app/javascript/controllers/application sync recursive _controller\\.js$";
-
-/***/ }),
-
-/***/ "./app/javascript/controllers/application/index.js":
-/*!*********************************************************!*\
- !*** ./app/javascript/controllers/application/index.js ***!
- \*********************************************************/
-/*! no exports provided */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var stimulus__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! stimulus */ "./node_modules/stimulus/index.js");
-/* harmony import */ var stimulus_webpack_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! stimulus/webpack-helpers */ "./node_modules/stimulus/webpack-helpers.js");
-// Load all the controllers within this directory and all subdirectories.
-// Controller files must be named *_controller.js.
-
-
-var application = stimulus__WEBPACK_IMPORTED_MODULE_0__["Application"].start();
-
-var context = __webpack_require__("./app/javascript/controllers/application sync recursive _controller\\.js$");
-
-application.load(Object(stimulus_webpack_helpers__WEBPACK_IMPORTED_MODULE_1__["definitionsFromContext"])(context));
-
-/***/ }),
-
-/***/ "./app/javascript/controllers/application/new_campaign_controller.js":
-/*!***************************************************************************!*\
- !*** ./app/javascript/controllers/application/new_campaign_controller.js ***!
- \***************************************************************************/
-/*! exports provided: default */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _default; });
-/* harmony import */ var stimulus__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! stimulus */ "./node_modules/stimulus/index.js");
-/* harmony import */ var _rails_ujs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @rails/ujs */ "./node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js");
-/* harmony import */ var _rails_ujs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_rails_ujs__WEBPACK_IMPORTED_MODULE_1__);
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
-
-function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
-
-function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
-
-function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
-
-function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
-
-function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
-
-function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
-
-function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
-
-
-
-
-var _default = /*#__PURE__*/function (_Controller) {
- _inherits(_default, _Controller);
-
- var _super = _createSuper(_default);
-
- function _default() {
- _classCallCheck(this, _default);
-
- return _super.apply(this, arguments);
- }
-
- _createClass(_default, [{
- key: "simulate",
- value: function simulate(e) {
- var _this = this;
-
- e.preventDefault();
-
- this._disableSubmit();
-
- this.simulationResultTarget.innerHTML = "";
- var minAge = parseInt(this.minAgeTarget.value, 10) || 0;
- var maxAge = parseInt(this.maxAgeTarget.value, 10) || 0;
- var availableDoses = parseInt(this.availableDosesTarget.value, 10) || 0;
- var vaccineType = this.vaccineTypeTarget.value || "";
- var maxDistance = parseInt(this.maxDistanceTarget.value, 10) || 0;
-
- if (minAge == 0 || maxAge == 0 || maxDistance == 0 || availableDoses == 0 || vaccineType.length == 0) {
- this.simulationResultTarget.innerHTML = "Simulation impossible ! Renseignez nb doses, vaccin, âge min + max et distance";
- return;
- }
-
- if (maxDistance > this.maxDistanceInKmValue) {
- this.simulationResultTarget.innerHTML = "Simulation impossible, merci de pr\xE9ciser une distance inf\xE9rieure ou \xE9gale \xE0 ".concat(this.maxDistanceInKmValue, " km");
- return;
- }
-
- if (vaccineType === "astrazeneca" && minAge < 55) {
- this.simulationResultTarget.innerHTML = "Simulation impossible, l'âge minimum requis pour le vaccin AstraZeneca est de 55 ans.";
- return;
- }
-
- if (vaccineType === "janssen" && minAge < 55) {
- this.simulationResultTarget.innerHTML = "Simulation impossible, l'âge minimum requis pour le vaccin Janssen est de 55 ans.";
- return;
- }
-
- var form = document.getElementById("new_campaign");
-
- if (form.checkValidity && !form.checkValidity() && form.reportValidity && form.reportValidity() === false) {
- this.simulationResultTarget.innerHTML = "Simulation impossible, certaines valeurs du formulaire sont incorrectes.";
- return;
- }
-
- fetch(this.simulatePathValue, {
- method: "POST",
- credentials: "same-origin",
- headers: {
- "X-CSRF-Token": _rails_ujs__WEBPACK_IMPORTED_MODULE_1___default.a.csrfToken(),
- "Content-Type": "application/json"
- },
- body: JSON.stringify({
- campaign: {
- min_age: minAge,
- max_age: maxAge,
- max_distance_in_meters: maxDistance * 1000,
- available_doses: availableDoses,
- vaccine_type: vaccineType
- }
- })
- }).then(function (data) {
- return data.json();
- }).then(function (result) {
- _this.simulationResultTarget.innerHTML = "Nous avons trouv\xE9 ".concat(result.reach, " volontaires avec ces crit\xE8res d'\xE2ge et de distance au centre.");
-
- if (!result.enough) {
- _this.simulationResultTarget.innerHTML += "
Au vu du nombre de volontaires trouv\xE9s et du nombre de doses de vaccin, nous vous conseillons d'\xE9largir vos crit\xE8res de s\xE9lections (\xE2ge et/ou distance).