First commit
40
README.md
Normal file
@ -0,0 +1,40 @@
|
||||
# ESI Crédit Direct
|
||||
|
||||
Plugin WordPress pour la gestion du simulateur de crédit.
|
||||
|
||||
## Mode Debug
|
||||
|
||||
Le plugin inclut un mode debug qui permet d'utiliser les templates de développement (newSteps) au lieu des templates standards.
|
||||
|
||||
### Activation du mode debug
|
||||
|
||||
Pour activer le mode debug, modifiez le fichier `app/config.php` et changez la valeur de `_CRED_DEBUG_MODE_` à `true` :
|
||||
|
||||
```php
|
||||
/**
|
||||
* Configuration du mode debug
|
||||
*
|
||||
* Mettre à true pour activer le mode debug et utiliser les templates de newSteps
|
||||
* Mettre à false pour utiliser les templates standards
|
||||
*/
|
||||
define('_CRED_DEBUG_MODE_', true);
|
||||
```
|
||||
|
||||
### Fonctionnement
|
||||
|
||||
Lorsque le mode debug est activé, le plugin cherchera d'abord les templates dans le dossier `templates/front/newSteps/` au lieu du dossier `templates/front/`. Si un template n'existe pas dans le dossier newSteps, le plugin utilisera le template standard.
|
||||
|
||||
### Utilisation dans le code
|
||||
|
||||
Pour utiliser cette fonctionnalité dans votre code, utilisez la méthode statique `CRED::getTemplatePath()` :
|
||||
|
||||
```php
|
||||
$template_path = CRED::getTemplatePath('/templates/front/credit-step2-a.php');
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect' . $template_path);
|
||||
```
|
||||
|
||||
Cette méthode retournera le chemin du template approprié en fonction du mode debug.
|
||||
|
||||
## Autres fonctionnalités
|
||||
|
||||
[À compléter avec d'autres informations sur le plugin]
|
||||
16
actions/actions.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
if(isset($_GET['sess']) && $_GET['sess'] == '8Fh71fChNMeyOQ7f') {
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once 'actions_autoloader.php';
|
||||
|
||||
$action = isset($_GET['action']) ? $_GET['action'] : 'reminder_email';
|
||||
|
||||
if($action == 'reminder_email') {
|
||||
$creditDirect = new CRED_Credit_Reminder();
|
||||
$creditDirect->send_reminder_email();
|
||||
|
||||
}
|
||||
}
|
||||
17
actions/actions_autoloader.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
define('WP_USE_THEMES', false);
|
||||
|
||||
include '../../../../wp-load.php';
|
||||
|
||||
if(!class_exists('CRED')) require_once _CRED_ABSPATH_ . 'cred_init.php';
|
||||
|
||||
$CRED = CRED::instance();
|
||||
|
||||
$CRED->init();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
36
app/config.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Fichier de configuration du plugin ESI Crédit Direct
|
||||
*/
|
||||
|
||||
// Vérification que le fichier est bien inclus depuis le plugin
|
||||
defined('_CREDEXEC_') or die();
|
||||
|
||||
/**
|
||||
* Configuration du mode debug
|
||||
*
|
||||
* Mettre à true pour activer le mode debug et utiliser les templates de newSteps
|
||||
* Mettre à false pour utiliser les templates standards
|
||||
*/
|
||||
define('_CRED_DEBUG_MODE_', false);
|
||||
|
||||
/**
|
||||
* Autres configurations du plugin
|
||||
*
|
||||
* Ajoutez ici d'autres constantes de configuration selon vos besoins
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration Cloudflare Turnstile
|
||||
*
|
||||
* Remplacez les valeurs par vos vraies clés depuis le dashboard Cloudflare
|
||||
*/
|
||||
define('_CRED_TURNSTILE_SITE_KEY_', '0x4AAAAAAB_Zqt4dR2T-YQU-'); // Clé du site (publique)
|
||||
define('_CRED_TURNSTILE_SECRET_KEY_', '0x4AAAAAAB_ZqmYIRIuNp-1RB2GaB4CHKII'); // Clé secrète (privée)
|
||||
|
||||
// Exemple de configuration pour les chemins de templates
|
||||
define('_CRED_TEMPLATES_PATH_', _CRED_ABSPATH_ . 'templates/front/');
|
||||
define('_CRED_EMAIL_TEMPLATES_PATH_', _CRED_ABSPATH_ . 'templates/email/');
|
||||
define('_CRED_ADMIN_TEMPLATES_PATH_', _CRED_ABSPATH_ . 'templates/admin/');
|
||||
define('_CRED_MODULES_PATH_', _CRED_ABSPATH_ . 'templates/modules/');
|
||||
define('_CRED_NEW_TEMPLATES_PATH_', _CRED_ABSPATH_ . 'templates/front/newSteps/');
|
||||
281
app/controllers/credit-step1.php
Normal file
@ -0,0 +1,281 @@
|
||||
<?php
|
||||
/*
|
||||
*Template Name: credit-step1
|
||||
*
|
||||
*/
|
||||
|
||||
use models\CRED_credit_step1;
|
||||
|
||||
|
||||
// Désactiver l'affichage des dépréciations pour cette page (tout en conservant la journalisation).
|
||||
ini_set('display_errors', '0'); // Masque l'affichage à l'écran
|
||||
ini_set('log_errors', '1'); // Journalise selon WP_DEBUG_LOG
|
||||
// Conserver le niveau d'erreur courant mais ignorer les DEPRECATED pour éviter l'avertissement visuel
|
||||
error_reporting((int) @ini_get('error_reporting') & ~E_DEPRECATED & ~E_USER_DEPRECATED);
|
||||
|
||||
$is_from_simulator = false;
|
||||
$is_from_back = false;
|
||||
|
||||
if(isset($_GET['credit-direct-token']) && !empty($_GET['credit-direct-token'])) {
|
||||
$is_from_back = true;
|
||||
}
|
||||
|
||||
if(isset($_POST['loan_type']) && !empty($_POST['loan_type'])) {
|
||||
$is_from_simulator = true;
|
||||
}
|
||||
|
||||
if (empty($_POST) && (!$is_from_simulator && !$is_from_back)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if(!class_exists('\models\CRED_credit')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\models\CRED_credit_step1')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit-step1.php');
|
||||
}
|
||||
|
||||
// Garde-fous précoces pour éviter que KSES/stripslashes ne reçoivent null.
|
||||
add_filter('pre_kses', function($content, $allowed_html, $allowed_protocols) {
|
||||
return (string) ($content ?? '');
|
||||
}, 1, 3);
|
||||
add_filter('the_title', function($title) { return (string) ($title ?? ''); }, 1, 2);
|
||||
add_filter('sanitize_title', function($title, $raw_title = '', $context = 'save') { return (string) (($title ?? $raw_title) ?? ''); }, 1, 3);
|
||||
|
||||
|
||||
get_header();
|
||||
|
||||
/* $currentUser = wp_get_current_user();
|
||||
$idUser = $currentUser->ID;
|
||||
if($idUser == 1) {
|
||||
echo '<pre>';
|
||||
print_r($_GET);
|
||||
echo '</pre>';
|
||||
die();
|
||||
} */
|
||||
|
||||
//try to load the model
|
||||
$post = $_POST;
|
||||
$one_step_form_send = false;
|
||||
$one_step_credits = ['am','amr','cied','frais_notaire','cdp'];
|
||||
|
||||
|
||||
|
||||
$model = new CRED_credit_step1();
|
||||
|
||||
if(isset($_POST['one_step_form']))
|
||||
$one_step_form_send = true;
|
||||
|
||||
//exemple credit : 8d0f45319ba2ebcfc708a7e6a19922c6a478b655
|
||||
|
||||
if(!$one_step_form_send && !isset($_GET['credit-direct-token'])) {
|
||||
$token = $model->save_step_0($post);
|
||||
} else if(isset($_POST['credit_token'])) {
|
||||
$token = $_POST['credit_token'];
|
||||
} else if(isset($_GET['credit-direct-token'])) {
|
||||
$token = $_GET['credit-direct-token'];
|
||||
} else {
|
||||
wp_redirect(home_url());
|
||||
}
|
||||
|
||||
|
||||
$currentCredit = $model->getCredit($token);
|
||||
|
||||
$exemple_info = $model->get_exemples_infos($currentCredit->type_credit);
|
||||
|
||||
if(!empty($exemple_info)) {
|
||||
$currentCredit->exemple_info = $exemple_info;
|
||||
}
|
||||
|
||||
if (!is_object($currentCredit)) {
|
||||
wp_redirect(home_url());
|
||||
}
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($_POST);
|
||||
echo '</pre>'; */
|
||||
/* die(); */
|
||||
|
||||
// Débogage
|
||||
/* error_log('POST one_step_form: ' . (isset($_POST['one_step_form']) ? $_POST['one_step_form'] : 'non défini'));
|
||||
error_log('one_step_credits: ' . print_r($one_step_credits, true)); */
|
||||
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit-step1.php') || file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit-one-step.php')) {
|
||||
|
||||
|
||||
|
||||
$in_one_step = false;
|
||||
$civilStatus = $model->getCivilStatus();
|
||||
$works = $model->getWorks();
|
||||
$existingCreditTypes = $model->getExistingCreditTypes();
|
||||
$contractTypes = $model->getContractTypes();
|
||||
|
||||
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($currentCredit);
|
||||
echo '</pre>'; */
|
||||
|
||||
if(in_array($currentCredit->type_credit, $one_step_credits))
|
||||
$in_one_step = true;
|
||||
|
||||
|
||||
if($one_step_form_send) {
|
||||
$model->save_one_step($post);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($_FILES);
|
||||
echo '</pre>'; */
|
||||
}
|
||||
|
||||
//try to load the view
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step1.php')) {
|
||||
|
||||
$agencies = $model->getAgencies();
|
||||
$map_credit_type = $model->getCreditTypes();
|
||||
$mapHouseCreditTypes = $model->getHouseCreditTypes();
|
||||
/*re-hydrate current credit*/
|
||||
$currentCredit = $model->getCredit($token);
|
||||
$message = null;
|
||||
|
||||
$type_credit_selected = '';
|
||||
|
||||
if(isset($currentCredit->sel_credit) && !empty($currentCredit->sel_credit)) {
|
||||
$type_credit_selected = $currentCredit->sel_credit;
|
||||
}
|
||||
|
||||
if(isset($_POST['type_credit_selected']) && !empty($_POST['type_credit_selected']) || isset($_POST['sub_loan_type']) && !empty($_POST['sub_loan_type']))
|
||||
$type_credit_selected = isset($_POST['sub_loan_type']) ? $_POST['sub_loan_type'] : $_POST['type_credit_selected'];
|
||||
|
||||
|
||||
$creditOptionsLabels = !empty($type_credit_selected) ? $model->getCreditLabel($type_credit_selected) : $map_credit_type[$currentCredit->type_credit];
|
||||
|
||||
//save the credit options labels in a cookie for 2 months
|
||||
/* $model->save_step($currentCredit); */
|
||||
|
||||
$attachments = [];
|
||||
$upload_errors = [];
|
||||
/*
|
||||
// Exemple d'utilisation de la fonction handleUploads
|
||||
$allowed_types = [
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // docx
|
||||
'application/msword', // doc
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/bmp',
|
||||
'image/webp'
|
||||
];
|
||||
$max_size = 2 * 1024 * 1024; // 2 Mo
|
||||
$result = $model->handleUploads($_FILES, $allowed_types, $max_size, $token);
|
||||
$attachments = $result['files'];
|
||||
$upload_errors = $result['errors'];
|
||||
$html_links = $result['html_links'];
|
||||
*/
|
||||
if(isset($_FILES)) {
|
||||
if ($one_step_form_send) { // 4 = no file uploaded
|
||||
$allowed_types = [
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // docx
|
||||
'application/msword', // doc
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/bmp',
|
||||
'image/webp'
|
||||
];
|
||||
|
||||
//remove all the empty file from $_FILE
|
||||
foreach($_FILES as $key => $value) {
|
||||
if($value['error'] === 4) {
|
||||
unset($_FILES[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$max_size = 4 * 1024 * 1024; // 4 Mo
|
||||
$result = $model->handleUploads($_FILES, $allowed_types, $max_size, $token);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($result);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
$attachments = $result['files'];
|
||||
$upload_errors = $result['errors'];
|
||||
}
|
||||
}
|
||||
|
||||
$borrower = $model->getBorrower($currentCredit);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($borrower);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
if($one_step_form_send) {
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/email/credit-one-step-mail.php')) {
|
||||
$currentCredit = $model->getCredit($token);
|
||||
|
||||
$coBorrower = $model->getCoBorrower($currentCredit);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($currentCredit);
|
||||
echo '</pre>';
|
||||
|
||||
echo '<pre>';
|
||||
print_r($borrower);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
ob_start();
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/email/credit-one-step-mail.php');
|
||||
$message = ob_get_clean();
|
||||
|
||||
ob_start();
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/email/clients_emails/credit-one-step-mail-client.php');
|
||||
$message_client = ob_get_clean();
|
||||
|
||||
// Ajout des en-têtes pour une meilleure compatibilité Outlook
|
||||
/* $headers = array(
|
||||
'Content-Type: text/html; charset=UTF-8',
|
||||
'X-Mailer: PHP/' . phpversion(),
|
||||
'MIME-Version: 1.0'
|
||||
); */
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($attachments);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
// Envoi de l'email au client
|
||||
$model->sendEmail('Demande de crédit', $message_client, $borrower, $currentCredit, [], true);
|
||||
|
||||
// Envoi de l'email à l'administrateur
|
||||
$model->sendEmail('Demande de crédit', $message, $borrower, $currentCredit, [], false);
|
||||
|
||||
// Nettoyage des fichiers temporaires
|
||||
/* foreach ($attachments as $file) {
|
||||
if (file_exists($file)) @unlink($file);
|
||||
} */
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step5.php');
|
||||
}
|
||||
if (!empty($upload_errors)) {
|
||||
foreach ($upload_errors as $err) {
|
||||
echo '<div class="alert alert-danger">' . htmlspecialchars((string) $err) . '</div>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if($in_one_step) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-one-step.php');
|
||||
} else {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step1.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get_footer();
|
||||
159
app/controllers/credit-step2.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/*
|
||||
*Template Name: credit-step2
|
||||
*
|
||||
*/
|
||||
/* ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL); */
|
||||
|
||||
use models\CRED_credit_step2;
|
||||
|
||||
$is_from_simulator = false;
|
||||
$is_from_back = false;
|
||||
|
||||
if(isset($_GET['credit-direct-token']) && !empty($_GET['credit-direct-token'])) {
|
||||
$is_from_back = true;
|
||||
}
|
||||
|
||||
/* if (empty($_POST) && (!$is_from_back)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
} */
|
||||
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step2.php')) {
|
||||
|
||||
if(!class_exists('\models\CRED_credit')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\libraries\FormValidator')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/libraries/FormValidator.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\models\CRED_credit_step2')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step2.php');
|
||||
}
|
||||
|
||||
$model = new CRED_credit_step2();
|
||||
|
||||
$ongoing_credit = $model->checkOngoingCreditRequest();
|
||||
|
||||
if(!$ongoing_credit && empty($_POST) && !$is_from_back) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
|
||||
// Vérifier le token soit en POST soit en GET
|
||||
$token = isset($_POST['credit-direct-token']) ? $_POST['credit-direct-token'] : (isset($_GET['credit-direct-token']) ? $_GET['credit-direct-token'] : null);
|
||||
|
||||
if(null === $token) {
|
||||
$token = $model->get_ongoing_credit_token();
|
||||
}
|
||||
|
||||
if (empty($token)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
|
||||
get_header();
|
||||
|
||||
//try to load the model
|
||||
$post = $_POST;
|
||||
if (empty($post)) {
|
||||
$post = array('credit-direct-token' => $token);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$currentCredit = $model->getCredit($token);
|
||||
$borrower = $model->getBorrower($currentCredit);
|
||||
$coBorrower = $model->getCoBorrower($currentCredit);
|
||||
|
||||
$hasCoBorrower = $model->hasCoBorrower($currentCredit);
|
||||
|
||||
$is_credit_auto = $model->is_credit_auto($currentCredit);
|
||||
|
||||
$type_credit_selected = '';
|
||||
|
||||
if(isset($currentCredit->sel_credit) && !empty($currentCredit->sel_credit)) {
|
||||
$type_credit_selected = $currentCredit->sel_credit;
|
||||
}
|
||||
|
||||
if(isset($_POST['type_credit_selected']) && !empty($_POST['type_credit_selected']) || isset($_POST['sub_loan_type']) && !empty($_POST['sub_loan_type']))
|
||||
$type_credit_selected = isset($_POST['sub_loan_type']) ? $_POST['sub_loan_type'] : $_POST['type_credit_selected'];
|
||||
|
||||
if(empty($type_credit_selected)) {
|
||||
$type_credit_selected = $currentCredit->type_credit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (is_object($currentCredit)) {
|
||||
// Sauvegarder l'étape 2 seulement si on vient du formulaire POST complet de step2
|
||||
if (!empty($_POST)) {
|
||||
// Vérifier si c'est une soumission complète du formulaire step2
|
||||
// (présence de champs clés de step2) ou champ 'step' explicite
|
||||
$is_step2_submission = isset($_POST['step']) && $_POST['step'] === '2';
|
||||
|
||||
if (!$is_step2_submission) {
|
||||
// Vérifier la présence de champs clés de step2 pour détecter automatiquement
|
||||
$step2_key_fields = ['civilstatus', 'job', 'salary', 'habitation_type'];
|
||||
$has_step2_fields = false;
|
||||
foreach ($step2_key_fields as $field) {
|
||||
if (isset($_POST[$field]) && !empty($_POST[$field])) {
|
||||
$has_step2_fields = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$is_step2_submission = $has_step2_fields;
|
||||
}
|
||||
|
||||
if ($is_step2_submission) {
|
||||
// Validation complète du formulaire step2
|
||||
$result = $model->save_step_1($post, true); // Avec validation
|
||||
|
||||
// Vérifier s'il y a des erreurs de validation
|
||||
if (is_array($result) && isset($result['success']) && !$result['success']) {
|
||||
$validation_errors = $result['formatted_errors'];
|
||||
} else {
|
||||
$model->save_step($currentCredit);
|
||||
}
|
||||
} else {
|
||||
// Simple transition de step1 : sauvegarder le borrower sans validation
|
||||
$model->save_step_1($post, false); // Sans validation
|
||||
$model->save_step($currentCredit); // Mettre à jour l'étape
|
||||
}
|
||||
}
|
||||
|
||||
$contractTypes = $model->getContractTypes();
|
||||
$mapHouseCreditTypes = $model->getHouseCreditTypes();
|
||||
|
||||
// Utilisation du mode debug pour charger les templates
|
||||
$template_a = CRED::getTemplatePath('/templates/front/credit-step2-a.php');
|
||||
$template_b = CRED::getTemplatePath('/templates/front/credit-step2-b.php');
|
||||
$template_c = CRED::getTemplatePath('/templates/front/credit-step2-c.php');
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($_COOKIE);
|
||||
echo '</pre>'; */
|
||||
|
||||
|
||||
//try to load the view
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect' . $template_a)) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect' . $template_a);
|
||||
}
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect' . $template_b)) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect' . $template_b);
|
||||
}
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect' . $template_c)) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect' . $template_c);
|
||||
}
|
||||
} else {
|
||||
// Si le crédit n'existe pas, rediriger vers la page d'accueil
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
get_footer();
|
||||
178
app/controllers/credit-step3.php
Normal file
@ -0,0 +1,178 @@
|
||||
<?php
|
||||
/*
|
||||
*Template Name: credit-step3
|
||||
*
|
||||
*/
|
||||
|
||||
use models\CRED_credit_step3;
|
||||
|
||||
// Ne pas afficher les avertissements/deprecations en production.
|
||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||
ini_set('display_errors', '0'); // Masque l'affichage à l'écran
|
||||
ini_set('log_errors', '1'); // Journalise selon WP_DEBUG_LOG
|
||||
error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
/* $is_from_simulator = false;
|
||||
$is_from_back = false;
|
||||
|
||||
if(isset($_GET['credit-direct-token']) && !empty($_GET['credit-direct-token'])) {
|
||||
$is_from_back = true;
|
||||
}
|
||||
|
||||
if (empty($_POST) && (!$is_from_back)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
} */
|
||||
|
||||
if(!class_exists('\models\CRED_credit')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\libraries\FormValidator')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/libraries/FormValidator.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\models\CRED_credit_step3')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step3.php');
|
||||
}
|
||||
|
||||
$model = new CRED_credit_step3();
|
||||
|
||||
// Vérifier le token soit en POST soit en GET
|
||||
$token = isset($_POST['credit-direct-token']) ? $_POST['credit-direct-token'] : (isset($_GET['credit-direct-token']) ? $_GET['credit-direct-token'] : null);
|
||||
|
||||
if(null === $token) {
|
||||
$token = $model->get_ongoing_credit_token();
|
||||
}
|
||||
|
||||
if (empty($token)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
|
||||
$currentCredit = $model->getCredit($token);
|
||||
|
||||
if(isset($_GET['debug'])) {
|
||||
echo '<pre>';
|
||||
print_r($token);
|
||||
print_r($currentCredit);
|
||||
echo '</pre>';
|
||||
//die();
|
||||
}
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($currentCredit);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
$is_credit_pat = $model->is_credit_pat($currentCredit);
|
||||
|
||||
$type_credit_selected = '';
|
||||
|
||||
if(isset($currentCredit->sel_credit) && !empty($currentCredit->sel_credit)) {
|
||||
$type_credit_selected = $currentCredit->sel_credit;
|
||||
}
|
||||
|
||||
if(isset($_POST['type_credit_selected']) && !empty($_POST['type_credit_selected']) || isset($_POST['sub_loan_type']) && !empty($_POST['sub_loan_type']))
|
||||
$type_credit_selected = isset($_POST['sub_loan_type']) ? $_POST['sub_loan_type'] : $_POST['type_credit_selected'];
|
||||
|
||||
if(empty($type_credit_selected)) {
|
||||
$type_credit_selected = $currentCredit->type_credit;
|
||||
}
|
||||
|
||||
get_header();
|
||||
|
||||
//try to load the model
|
||||
$post = $_POST;
|
||||
if (empty($post)) {
|
||||
$post = array('credit-direct-token' => $token);
|
||||
}
|
||||
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step3.php')) {
|
||||
|
||||
|
||||
if (is_object($currentCredit)) {
|
||||
// Sauvegarder l'étape 2 seulement si on vient du formulaire POST
|
||||
if (!empty($_POST)) {
|
||||
$result = $model->save_step_2($post,$currentCredit);
|
||||
|
||||
// Vérifier s'il y a des erreurs de validation
|
||||
if (is_array($result) && isset($result['success']) && !$result['success']) {
|
||||
$validation_errors = $result['formatted_errors'];
|
||||
}
|
||||
|
||||
// Gestion générique de l'upload de fichiers
|
||||
$attachments = [];
|
||||
$upload_errors = [];
|
||||
/*
|
||||
// Exemple d'utilisation de la fonction handleUploads
|
||||
$allowed_types = [
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // docx
|
||||
'application/msword', // doc
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/bmp',
|
||||
'image/webp'
|
||||
];
|
||||
$max_size = 2 * 1024 * 1024; // 2 Mo
|
||||
$result = $model->handleUploads($_FILES, $allowed_types, $max_size, $token);
|
||||
$attachments = $result['files'];
|
||||
$upload_errors = $result['errors'];
|
||||
$html_links = $result['html_links'];
|
||||
*/
|
||||
$allowed_types = [
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // docx
|
||||
'application/msword', // doc
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/bmp',
|
||||
'image/webp'
|
||||
];
|
||||
$max_size = 4 * 1024 * 1024; // 4 Mo
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($_FILES);
|
||||
echo '</pre>'; */
|
||||
|
||||
if(!empty($_FILES)) {
|
||||
foreach ($_FILES as $field => $file) {
|
||||
|
||||
// Traiter seulement les champs de fichiers qui ne sont pas vides
|
||||
if(empty($file['name']) || empty($file['name'][0]) || $file['error'] === 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($file['error']) && $file['error'] !== 4) { // 4 = pas de fichier uploadé
|
||||
$result = $model->handleUploads($file, $allowed_types, $max_size, $token);
|
||||
$attachments = array_merge($attachments, $result['files']);
|
||||
$upload_errors = array_merge($upload_errors, $result['errors']);
|
||||
}
|
||||
}
|
||||
// Affichage des erreurs d'upload
|
||||
if (!empty($upload_errors)) {
|
||||
foreach ($upload_errors as $err) {
|
||||
echo '<div class="alert alert-danger">' . htmlspecialchars((string) $err) . '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//try to load the view
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step3.php')) {
|
||||
$coBorrower = $model->getCoBorrower($currentCredit);
|
||||
$borrower = $model->getBorrower($currentCredit);
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step3.php');
|
||||
}
|
||||
} else {
|
||||
// Si le crédit n'existe pas, rediriger vers la page d'accueil
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
get_footer();
|
||||
90
app/controllers/credit-step4.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/*
|
||||
*Template Name: credit-step4
|
||||
*
|
||||
*/
|
||||
|
||||
use models\CRED_credit_step4;
|
||||
|
||||
/* $is_from_simulator = false;
|
||||
$is_from_back = false;
|
||||
|
||||
if(isset($_GET['credit-direct-token']) && !empty($_GET['credit-direct-token'])) {
|
||||
$is_from_back = true;
|
||||
}
|
||||
|
||||
if (empty($_POST) && (!$is_from_back)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
} */
|
||||
|
||||
if(!class_exists('\models\CRED_credit')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\models\CRED_credit_step4')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step4.php');
|
||||
}
|
||||
|
||||
$model = new CRED_credit_step4();
|
||||
|
||||
// Vérifier le token soit en POST soit en GET
|
||||
$token = isset($_POST['credit-direct-token']) ? $_POST['credit-direct-token'] : (isset($_GET['credit-direct-token']) ? $_GET['credit-direct-token'] : null);
|
||||
|
||||
if(null === $token) {
|
||||
$token = $model->get_ongoing_credit_token();
|
||||
}
|
||||
|
||||
if (empty($token)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
|
||||
get_header();
|
||||
|
||||
//try to load the model
|
||||
$post = $_POST;
|
||||
if (empty($post)) {
|
||||
$post = array('credit-direct-token' => $token);
|
||||
}
|
||||
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step4.php')) {
|
||||
|
||||
|
||||
$currentCredit = $model->getCredit($token);
|
||||
|
||||
$type_credit_selected = '';
|
||||
|
||||
$coBorrower = $model->getCoBorrower($currentCredit);
|
||||
$borrower = $model->getBorrower($currentCredit);
|
||||
|
||||
if(isset($currentCredit->sel_credit) && !empty($currentCredit->sel_credit)) {
|
||||
$type_credit_selected = $currentCredit->sel_credit;
|
||||
}
|
||||
|
||||
if(isset($_POST['type_credit_selected']) && !empty($_POST['type_credit_selected']) || isset($_POST['sub_loan_type']) && !empty($_POST['sub_loan_type']))
|
||||
$type_credit_selected = isset($_POST['sub_loan_type']) ? $_POST['sub_loan_type'] : $_POST['type_credit_selected'];
|
||||
|
||||
if(empty($type_credit_selected)) {
|
||||
$type_credit_selected = $currentCredit->type_credit;
|
||||
}
|
||||
|
||||
if (is_object($currentCredit)) {
|
||||
// Sauvegarder l'étape 3 seulement si on vient du formulaire POST
|
||||
if (!empty($_POST)) {
|
||||
|
||||
$model->save_step_3($post, $currentCredit);
|
||||
}
|
||||
|
||||
//try to load the view
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step4.php')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step4.php');
|
||||
}
|
||||
} else {
|
||||
// Si le crédit n'existe pas, rediriger vers la page d'accueil
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
get_footer();
|
||||
127
app/controllers/credit-step5.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/*
|
||||
*Template Name: credit-step5
|
||||
*
|
||||
*/
|
||||
|
||||
use models\CRED_credit_step5;
|
||||
|
||||
/* $is_from_simulator = false;
|
||||
$is_from_back = false;
|
||||
|
||||
if(isset($_GET['credit-direct-token']) && !empty($_GET['credit-direct-token'])) {
|
||||
$is_from_back = true;
|
||||
}
|
||||
|
||||
if(isset($_POST['loan_type']) && !empty($_POST['loan_type'])) {
|
||||
$is_from_simulator = true;
|
||||
}
|
||||
|
||||
if (empty($_POST) && (!$is_from_simulator || !$is_from_back)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
} */
|
||||
|
||||
|
||||
// Vérifier le token soit en POST soit en GET
|
||||
$token = isset($_POST['credit-direct-token']) ? $_POST['credit-direct-token'] : (isset($_GET['credit-direct-token']) ? $_GET['credit-direct-token'] : null);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($token);
|
||||
echo '</pre>'; */
|
||||
|
||||
if (empty($token)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
|
||||
get_header();
|
||||
|
||||
//try to load the model
|
||||
$post = $_POST;
|
||||
if (empty($post)) {
|
||||
$post = array('credit-direct-token' => $token);
|
||||
}
|
||||
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step5.php')) {
|
||||
|
||||
if(!class_exists('\models\CRED_credit')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\models\CRED_credit_step5')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step5.php');
|
||||
}
|
||||
|
||||
$model = new CRED_credit_step5();
|
||||
|
||||
$currentCredit = $model->getCredit($token);
|
||||
|
||||
|
||||
if (is_object($currentCredit)) {
|
||||
// Sauvegarder l'étape 4 seulement si on vient du formulaire POST
|
||||
|
||||
|
||||
if (!empty($_POST)) {
|
||||
$model->save_step_4($post, $currentCredit);
|
||||
}
|
||||
|
||||
$borrower = $model->getBorrower($currentCredit);
|
||||
$coBorrower = $model->getCoBorrower($currentCredit);
|
||||
$agencies = $model->getAgencies();
|
||||
$civilStatus = $model->getCivilStatus();
|
||||
$works = $model->getWorks();
|
||||
$existingCreditTypes = $model->getExistingCreditTypes();
|
||||
$map_credit_type = $model->getCreditTypes();
|
||||
$contractTypes = $model->getContractTypes();
|
||||
$mapHouseCreditTypes = $model->getHouseCreditTypes();
|
||||
|
||||
$type_credit_selected = '';
|
||||
|
||||
if(isset($currentCredit->sel_credit) && !empty($currentCredit->sel_credit)) {
|
||||
$type_credit_selected = $currentCredit->sel_credit;
|
||||
}
|
||||
|
||||
if(isset($_POST['type_credit_selected']) && !empty($_POST['type_credit_selected']) || isset($_POST['sub_loan_type']) && !empty($_POST['sub_loan_type']))
|
||||
$type_credit_selected = isset($_POST['sub_loan_type']) ? $_POST['sub_loan_type'] : $_POST['type_credit_selected'];
|
||||
|
||||
|
||||
$creditOptionsLabels = !empty($type_credit_selected) ? $model->getCreditLabel($type_credit_selected) : $map_credit_type[$currentCredit->type_credit];
|
||||
|
||||
$message = null;
|
||||
|
||||
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/email/credit-step4-mail.php')) {
|
||||
ob_start();
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/email/credit-step4-mail.php');
|
||||
$message = ob_get_clean();
|
||||
|
||||
ob_start();
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/email/clients_emails/credit-step4-mail-client.php');
|
||||
$message_client = ob_get_clean();
|
||||
|
||||
|
||||
// Ajout des en-têtes pour une meilleure compatibilité Outlook
|
||||
if(!isset($_GET['credit-direct-token'])) {
|
||||
|
||||
$model->sendEmail('Demande de crédit', $message, $borrower, $currentCredit, [], false);
|
||||
$model->sendEmail('Demande de crédit', $message_client, $borrower, $currentCredit, [], true);
|
||||
}
|
||||
}
|
||||
|
||||
//try to load the view
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step5.php')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step5.php');
|
||||
}
|
||||
|
||||
/* if (!is_null($message)) {
|
||||
echo $message;
|
||||
} */
|
||||
} else {
|
||||
// Si le crédit n'existe pas, rediriger vers la page d'accueil
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
get_footer();
|
||||
273
app/controllers/credit_mailchimp.php
Normal file
@ -0,0 +1,273 @@
|
||||
<?php
|
||||
|
||||
class CRED_credit_mailchimp extends CRED_base {
|
||||
|
||||
public function __construct() {
|
||||
// Le hook admin_menu est maintenant géré par le factory
|
||||
}
|
||||
|
||||
public function init() {
|
||||
|
||||
}
|
||||
|
||||
public function add_admin_menu() {
|
||||
add_submenu_page(
|
||||
'credit-manager',
|
||||
'Mailchimp',
|
||||
'Mailchimp',
|
||||
'manage_options',
|
||||
'credit-mailchimp',
|
||||
array($this, 'render_settings_page')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enregistre les réglages et champs via la Settings API
|
||||
*/
|
||||
public function register_settings() {
|
||||
register_setting(
|
||||
'cred_mailchimp_options_group',
|
||||
'cred_mailchimp_options',
|
||||
array(
|
||||
'type' => 'array',
|
||||
'sanitize_callback' => array($this, 'sanitize_options'),
|
||||
'default' => array(
|
||||
'api_key' => '',
|
||||
'server_prefix' => '',
|
||||
'primary_list_id' => ''
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'cred_mailchimp_main_section',
|
||||
__('Paramètres de connexion', 'esi-creditdirect'),
|
||||
function() {
|
||||
echo '<p>' . esc_html__('Renseignez la clé API et le préfixe serveur (ex: us19) comme indiqué par Mailchimp.', 'esi-creditdirect') . '</p>';
|
||||
},
|
||||
'credit-mailchimp'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'cred_mailchimp_api_key',
|
||||
__('Clé API', 'esi-creditdirect'),
|
||||
array($this, 'field_api_key_cb'),
|
||||
'credit-mailchimp',
|
||||
'cred_mailchimp_main_section'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'cred_mailchimp_server_prefix',
|
||||
__('Préfixe serveur', 'esi-creditdirect'),
|
||||
array($this, 'field_server_prefix_cb'),
|
||||
'credit-mailchimp',
|
||||
'cred_mailchimp_main_section'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'cred_mailchimp_primary_list',
|
||||
__('Liste principale (Audience)', 'esi-creditdirect'),
|
||||
array($this, 'field_primary_list_cb'),
|
||||
'credit-mailchimp',
|
||||
'cred_mailchimp_main_section'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche la page de réglages
|
||||
*/
|
||||
public function render_settings_page() {
|
||||
$options = $this->get_options();
|
||||
include plugin_dir_path(__FILE__) . '../../templates/admin/mailchimp_settings.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback du champ API Key
|
||||
*/
|
||||
public function field_api_key_cb() {
|
||||
$options = $this->get_options();
|
||||
$value = isset($options['api_key']) ? $options['api_key'] : '';
|
||||
echo '<input type="text" class="regular-text" id="cred_mailchimp_api_key" name="cred_mailchimp_options[api_key]" value="' . esc_attr($value) . '" placeholder="YOUR_API_KEY">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback du champ Server Prefix
|
||||
*/
|
||||
public function field_server_prefix_cb() {
|
||||
$options = $this->get_options();
|
||||
$value = isset($options['server_prefix']) ? $options['server_prefix'] : '';
|
||||
echo '<input type="text" class="regular-text" id="cred_mailchimp_server_prefix" name="cred_mailchimp_options[server_prefix]" value="' . esc_attr($value) . '" placeholder="us19">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback du champ Liste principale (audience)
|
||||
*/
|
||||
public function field_primary_list_cb() {
|
||||
$options = $this->get_options();
|
||||
$selected = isset($options['primary_list_id']) ? $options['primary_list_id'] : '';
|
||||
|
||||
$client = $this->get_client();
|
||||
if ($client === null) {
|
||||
echo '<em>' . esc_html__('Renseignez d\'abord la clé API et le préfixe serveur, puis enregistrez.', 'esi-creditdirect') . '</em>';
|
||||
echo '<br />';
|
||||
echo '<input type="text" class="regular-text" name="cred_mailchimp_options[primary_list_id]" value="' . esc_attr($selected) . '" placeholder="Audience ID (ex: a1b2c3d4)">';
|
||||
return;
|
||||
}
|
||||
|
||||
$lists = array();
|
||||
try {
|
||||
$resp = $client->lists->getAllLists(array('count' => 1000));
|
||||
if (is_array($resp) && isset($resp['lists']) && is_array($resp['lists'])) {
|
||||
foreach ($resp['lists'] as $list) {
|
||||
if (isset($list['id']) && isset($list['name'])) {
|
||||
$lists[] = array(
|
||||
'id' => (string) $list['id'],
|
||||
'name' => (string) $list['name']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
echo '<div class="notice notice-error"><p>' . esc_html(sprintf(__('Erreur lors du chargement des audiences: %s', 'esi-creditdirect'), $e->getMessage())) . '</p></div>';
|
||||
}
|
||||
|
||||
if (empty($lists)) {
|
||||
echo '<em>' . esc_html__('Aucune audience trouvée ou erreur. Vous pouvez saisir un ID manuellement.', 'esi-creditdirect') . '</em>';
|
||||
echo '<br />';
|
||||
echo '<input type="text" class="regular-text" name="cred_mailchimp_options[primary_list_id]" value="' . esc_attr($selected) . '" placeholder="Audience ID (ex: a1b2c3d4)">';
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<select id="cred_mailchimp_primary_list" name="cred_mailchimp_options[primary_list_id]">';
|
||||
echo '<option value="">' . esc_html__('— Sélectionner —', 'esi-creditdirect') . '</option>';
|
||||
foreach ($lists as $list) {
|
||||
$isSel = selected($selected, $list['id'], false);
|
||||
echo '<option value="' . esc_attr($list['id']) . '" ' . $isSel . '>' . esc_html($list['name'] . ' (' . $list['id'] . ')') . '</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize des options
|
||||
*/
|
||||
public function sanitize_options($options) {
|
||||
$sanitized = array();
|
||||
$sanitized['api_key'] = isset($options['api_key']) ? sanitize_text_field($options['api_key']) : '';
|
||||
$sanitized['server_prefix'] = isset($options['server_prefix']) ? sanitize_text_field($options['server_prefix']) : '';
|
||||
$sanitized['primary_list_id'] = isset($options['primary_list_id']) ? sanitize_text_field($options['primary_list_id']) : '';
|
||||
return $sanitized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère les options du plugin
|
||||
*/
|
||||
private function get_options() {
|
||||
$defaults = array(
|
||||
'api_key' => '',
|
||||
'server_prefix' => '',
|
||||
'primary_list_id' => ''
|
||||
);
|
||||
$options = get_option('cred_mailchimp_options', array());
|
||||
if (!is_array($options)) {
|
||||
$options = array();
|
||||
}
|
||||
return array_merge($defaults, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne une instance configurée du client Mailchimp Marketing
|
||||
* ou null si les informations de connexion sont incomplètes.
|
||||
*/
|
||||
public function get_client() {
|
||||
$options = $this->get_options();
|
||||
$apiKey = isset($options['api_key']) ? trim($options['api_key']) : '';
|
||||
$server = isset($options['server_prefix']) ? trim($options['server_prefix']) : '';
|
||||
|
||||
if ($apiKey === '' || $server === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('\\MailchimpMarketing\\ApiClient')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$client = new \MailchimpMarketing\ApiClient();
|
||||
$client->setConfig(array(
|
||||
'apiKey' => $apiKey,
|
||||
'server' => $server
|
||||
));
|
||||
|
||||
return $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: ping Mailchimp pour valider la connexion
|
||||
*/
|
||||
public function ajax_ping() {
|
||||
check_ajax_referer('cred_mailchimp_ping', 'nonce');
|
||||
if (!current_user_can('manage_options')) {
|
||||
wp_send_json_error(array('message' => __('Permissions insuffisantes', 'esi-creditdirect')), 403);
|
||||
}
|
||||
|
||||
$client = $this->get_client();
|
||||
if ($client === null) {
|
||||
wp_send_json_error(array('message' => __('Configuration incomplète (clé API/préfixe serveur).', 'esi-creditdirect')), 400);
|
||||
}
|
||||
|
||||
try {
|
||||
$resp = $client->ping->get();
|
||||
wp_send_json_success(array('response' => $resp));
|
||||
} catch (\Throwable $e) {
|
||||
wp_send_json_error(array('message' => $e->getMessage()), 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Abonne ou met à jour un contact à partir d'un objet crédit.
|
||||
* @param object $credit Objet avec au minimum les propriétés email, prenom, nom
|
||||
*/
|
||||
public function subscribe_from_credit($credit) {
|
||||
if (!$credit || !isset($credit->email)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$email = trim((string)$credit->email);
|
||||
if ($email === '' || !is_email($email)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$options = get_option('cred_mailchimp_options', array());
|
||||
$listId = isset($options['primary_list_id']) ? trim((string)$options['primary_list_id']) : '';
|
||||
if ($listId === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$client = $this->get_client();
|
||||
if ($client === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$firstName = isset($credit->prenom) ? (string)$credit->prenom : '';
|
||||
$lastName = isset($credit->nom) ? (string)$credit->nom : '';
|
||||
|
||||
$subscriberHash = md5(strtolower($email));
|
||||
$body = array(
|
||||
'email_address' => $email,
|
||||
'status' => 'subscribed',
|
||||
'status_if_new' => 'subscribed',
|
||||
'merge_fields' => array(
|
||||
'FNAME' => $firstName,
|
||||
'LNAME' => $lastName
|
||||
)
|
||||
);
|
||||
|
||||
try {
|
||||
$client->lists->setListMember($listId, $subscriberHash, $body);
|
||||
} catch (\Throwable $e) {
|
||||
error_log('Mailchimp subscribe error (from credit): ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
1101
app/controllers/credit_manager.php
Normal file
495
app/controllers/credit_sendy.php
Normal file
@ -0,0 +1,495 @@
|
||||
<?php
|
||||
|
||||
class CRED_credit_sendy extends CRED_base {
|
||||
|
||||
public function __construct() {
|
||||
// Le hook admin_menu est maintenant géré par le factory
|
||||
}
|
||||
|
||||
public function init() {
|
||||
|
||||
}
|
||||
|
||||
public function add_admin_menu() {
|
||||
add_submenu_page(
|
||||
'credit-manager',
|
||||
'Sendy',
|
||||
'Sendy',
|
||||
'manage_options',
|
||||
'credit-sendy',
|
||||
array($this, 'render_settings_page')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enregistre les réglages et champs via la Settings API
|
||||
*/
|
||||
public function register_settings() {
|
||||
register_setting(
|
||||
'cred_sendy_options_group',
|
||||
'cred_sendy_options',
|
||||
array(
|
||||
'type' => 'array',
|
||||
'sanitize_callback' => array($this, 'sanitize_options'),
|
||||
'default' => array(
|
||||
'api_url' => '',
|
||||
'api_key' => '',
|
||||
'brand_id' => '',
|
||||
'list_id' => ''
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'cred_sendy_main_section',
|
||||
__('Paramètres de connexion', 'esi-creditdirect'),
|
||||
function() {
|
||||
echo '<p>' . esc_html__('Renseignez l\'URL de votre installation Sendy et la clé API comme indiqué dans votre compte Sendy.', 'esi-creditdirect') . '</p>';
|
||||
},
|
||||
'credit-sendy'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'cred_sendy_api_url',
|
||||
__('URL Sendy', 'esi-creditdirect'),
|
||||
array($this, 'field_api_url_cb'),
|
||||
'credit-sendy',
|
||||
'cred_sendy_main_section'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'cred_sendy_api_key',
|
||||
__('Clé API', 'esi-creditdirect'),
|
||||
array($this, 'field_api_key_cb'),
|
||||
'credit-sendy',
|
||||
'cred_sendy_main_section'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'cred_sendy_brand_id',
|
||||
__('ID du Brand', 'esi-creditdirect'),
|
||||
array($this, 'field_brand_id_cb'),
|
||||
'credit-sendy',
|
||||
'cred_sendy_main_section'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'cred_sendy_list_id',
|
||||
__('ID de la liste', 'esi-creditdirect'),
|
||||
array($this, 'field_list_id_cb'),
|
||||
'credit-sendy',
|
||||
'cred_sendy_main_section'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche la page de réglages
|
||||
*/
|
||||
public function render_settings_page() {
|
||||
$options = $this->get_options();
|
||||
include plugin_dir_path(__FILE__) . '../../templates/admin/sendy_settings.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback du champ API URL
|
||||
*/
|
||||
public function field_api_url_cb() {
|
||||
$options = $this->get_options();
|
||||
$value = isset($options['api_url']) ? $options['api_url'] : '';
|
||||
echo '<input type="url" class="regular-text" id="cred_sendy_api_url" name="cred_sendy_options[api_url]" value="' . esc_attr($value) . '" placeholder="https://votre-domaine.com">';
|
||||
echo '<p class="description">' . esc_html__('URL complète de votre installation Sendy (ex: https://sendy.example.com)', 'esi-creditdirect') . '</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback du champ API Key
|
||||
*/
|
||||
public function field_api_key_cb() {
|
||||
$options = $this->get_options();
|
||||
$value = isset($options['api_key']) ? $options['api_key'] : '';
|
||||
echo '<input type="text" class="regular-text" id="cred_sendy_api_key" name="cred_sendy_options[api_key]" value="' . esc_attr($value) . '" placeholder="YOUR_API_KEY">';
|
||||
echo '<p class="description">' . esc_html__('Clé API disponible dans votre compte Sendy (Settings > API)', 'esi-creditdirect') . '</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback du champ Brand ID
|
||||
*/
|
||||
public function field_brand_id_cb() {
|
||||
$options = $this->get_options();
|
||||
$selected = isset($options['brand_id']) ? $options['brand_id'] : '';
|
||||
|
||||
$client = $this->get_client();
|
||||
if ($client === null) {
|
||||
echo '<em>' . esc_html__('Renseignez d\'abord l\'URL et la clé API, puis enregistrez.', 'esi-creditdirect') . '</em>';
|
||||
echo '<br />';
|
||||
echo '<input type="text" class="regular-text" name="cred_sendy_options[brand_id]" value="' . esc_attr($selected) . '" placeholder="Brand ID">';
|
||||
return;
|
||||
}
|
||||
|
||||
$brands = array();
|
||||
try {
|
||||
$brands = $this->get_brands();
|
||||
} catch (\Throwable $e) {
|
||||
echo '<div class="notice notice-error"><p>' . esc_html(sprintf(__('Erreur lors du chargement des brands: %s', 'esi-creditdirect'), $e->getMessage())) . '</p></div>';
|
||||
}
|
||||
|
||||
if (empty($brands)) {
|
||||
echo '<em>' . esc_html__('Aucun brand trouvé ou erreur. Vous pouvez saisir un ID manuellement.', 'esi-creditdirect') . '</em>';
|
||||
echo '<br />';
|
||||
echo '<input type="text" class="regular-text" name="cred_sendy_options[brand_id]" value="' . esc_attr($selected) . '" placeholder="Brand ID">';
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<select id="cred_sendy_brand_id" name="cred_sendy_options[brand_id]">';
|
||||
echo '<option value="">' . esc_html__('— Sélectionner —', 'esi-creditdirect') . '</option>';
|
||||
foreach ($brands as $brand) {
|
||||
$isSel = selected($selected, $brand['id'], false);
|
||||
echo '<option value="' . esc_attr($brand['id']) . '" ' . $isSel . '>' . esc_html($brand['name'] . ' (' . $brand['id'] . ')') . '</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
echo '<p class="description">' . esc_html__('Sélectionnez un brand pour filtrer les listes disponibles (optionnel)', 'esi-creditdirect') . '</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback du champ Liste ID
|
||||
*/
|
||||
public function field_list_id_cb() {
|
||||
$options = $this->get_options();
|
||||
$selected = isset($options['list_id']) ? $options['list_id'] : '';
|
||||
|
||||
$client = $this->get_client();
|
||||
if ($client === null) {
|
||||
echo '<em>' . esc_html__('Renseignez d\'abord l\'URL et la clé API, puis enregistrez.', 'esi-creditdirect') . '</em>';
|
||||
echo '<br />';
|
||||
echo '<input type="text" class="regular-text" name="cred_sendy_options[list_id]" value="' . esc_attr($selected) . '" placeholder="List ID">';
|
||||
return;
|
||||
}
|
||||
|
||||
$lists = array();
|
||||
try {
|
||||
$lists = $this->get_lists();
|
||||
} catch (\Throwable $e) {
|
||||
echo '<div class="notice notice-error"><p>' . esc_html(sprintf(__('Erreur lors du chargement des listes: %s', 'esi-creditdirect'), $e->getMessage())) . '</p></div>';
|
||||
}
|
||||
|
||||
if (empty($lists)) {
|
||||
echo '<em>' . esc_html__('Aucune liste trouvée ou erreur. Vous pouvez saisir un ID manuellement.', 'esi-creditdirect') . '</em>';
|
||||
echo '<br />';
|
||||
echo '<input type="text" class="regular-text" name="cred_sendy_options[list_id]" value="' . esc_attr($selected) . '" placeholder="List ID">';
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<select id="cred_sendy_list_id" name="cred_sendy_options[list_id]">';
|
||||
echo '<option value="">' . esc_html__('— Sélectionner —', 'esi-creditdirect') . '</option>';
|
||||
foreach ($lists as $list) {
|
||||
$isSel = selected($selected, $list['id'], false);
|
||||
$displayName = $list['name'];
|
||||
if (isset($list['brand_name'])) {
|
||||
$displayName = $list['brand_name'] . ' - ' . $list['name'];
|
||||
}
|
||||
echo '<option value="' . esc_attr($list['id']) . '" ' . $isSel . '>' . esc_html($displayName . ' (' . $list['id'] . ')') . '</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize des options
|
||||
*/
|
||||
public function sanitize_options($options) {
|
||||
$sanitized = array();
|
||||
$sanitized['api_url'] = isset($options['api_url']) ? esc_url_raw($options['api_url']) : '';
|
||||
$sanitized['api_key'] = isset($options['api_key']) ? sanitize_text_field($options['api_key']) : '';
|
||||
$sanitized['brand_id'] = isset($options['brand_id']) ? sanitize_text_field($options['brand_id']) : '';
|
||||
$sanitized['list_id'] = isset($options['list_id']) ? sanitize_text_field($options['list_id']) : '';
|
||||
return $sanitized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère les options du plugin
|
||||
*/
|
||||
private function get_options() {
|
||||
$defaults = array(
|
||||
'api_url' => '',
|
||||
'api_key' => '',
|
||||
'brand_id' => '',
|
||||
'list_id' => ''
|
||||
);
|
||||
$options = get_option('cred_sendy_options', array());
|
||||
if (!is_array($options)) {
|
||||
$options = array();
|
||||
}
|
||||
return array_merge($defaults, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne les informations de connexion Sendy
|
||||
* ou null si les informations de connexion sont incomplètes.
|
||||
*/
|
||||
public function get_client() {
|
||||
$options = $this->get_options();
|
||||
$apiUrl = isset($options['api_url']) ? trim($options['api_url']) : '';
|
||||
$apiKey = isset($options['api_key']) ? trim($options['api_key']) : '';
|
||||
|
||||
if ($apiUrl === '' || $apiKey === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Retourne un tableau avec les infos de connexion
|
||||
return array(
|
||||
'api_url' => rtrim($apiUrl, '/'),
|
||||
'api_key' => $apiKey
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère la liste des brands Sendy
|
||||
* @return array Tableau de brands avec id et name
|
||||
*/
|
||||
private function get_brands() {
|
||||
$client = $this->get_client();
|
||||
if ($client === null) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$apiUrl = $client['api_url'];
|
||||
$apiKey = $client['api_key'];
|
||||
|
||||
// Sendy API endpoint pour récupérer les brands
|
||||
$url = $apiUrl . '/api/brands/get-brands.php';
|
||||
|
||||
$response = wp_remote_post($url, array(
|
||||
'body' => array(
|
||||
'api_key' => $apiKey
|
||||
),
|
||||
'timeout' => 15
|
||||
));
|
||||
|
||||
if (is_wp_error($response)) {
|
||||
throw new \Exception($response->get_error_message());
|
||||
}
|
||||
|
||||
$body = wp_remote_retrieve_body($response);
|
||||
$data = json_decode($body, true);
|
||||
|
||||
if (!$data || !is_array($data)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$brands = array();
|
||||
foreach ($data as $id => $name) {
|
||||
$brands[] = array(
|
||||
'id' => (string) $id,
|
||||
'name' => (string) $name
|
||||
);
|
||||
}
|
||||
|
||||
return $brands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère la liste des listes Sendy pour un brand donné
|
||||
* @param string $brandId ID du brand
|
||||
* @return array Tableau de listes avec id et name
|
||||
*/
|
||||
private function get_lists_for_brand($brandId) {
|
||||
$client = $this->get_client();
|
||||
if ($client === null) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$apiUrl = $client['api_url'];
|
||||
$apiKey = $client['api_key'];
|
||||
|
||||
// Sendy API endpoint pour récupérer les listes
|
||||
$url = $apiUrl . '/api/lists/get-lists.php';
|
||||
|
||||
$response = wp_remote_post($url, array(
|
||||
'body' => array(
|
||||
'api_key' => $apiKey,
|
||||
'brand_id' => $brandId,
|
||||
'include_hidden' => 'no'
|
||||
),
|
||||
'timeout' => 15
|
||||
));
|
||||
|
||||
if (is_wp_error($response)) {
|
||||
throw new \Exception($response->get_error_message());
|
||||
}
|
||||
|
||||
$body = wp_remote_retrieve_body($response);
|
||||
$data = json_decode($body, true);
|
||||
|
||||
if (!$data || !is_array($data)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$lists = array();
|
||||
foreach ($data as $id => $name) {
|
||||
$lists[] = array(
|
||||
'id' => (string) $id,
|
||||
'name' => (string) $name
|
||||
);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère toutes les listes Sendy de tous les brands ou d'un brand spécifique
|
||||
* @return array Tableau de listes avec id, name et brand_name
|
||||
*/
|
||||
private function get_lists() {
|
||||
$client = $this->get_client();
|
||||
if ($client === null) {
|
||||
return array();
|
||||
}
|
||||
|
||||
try {
|
||||
$options = $this->get_options();
|
||||
$selectedBrandId = isset($options['brand_id']) ? trim($options['brand_id']) : '';
|
||||
|
||||
// Si un brand_id est sélectionné, ne récupérer que les listes de ce brand
|
||||
if ($selectedBrandId !== '') {
|
||||
$brands = $this->get_brands();
|
||||
$selectedBrand = null;
|
||||
foreach ($brands as $brand) {
|
||||
if ($brand['id'] === $selectedBrandId) {
|
||||
$selectedBrand = $brand;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($selectedBrand) {
|
||||
$lists = $this->get_lists_for_brand($selectedBrandId);
|
||||
$allLists = array();
|
||||
foreach ($lists as $list) {
|
||||
$allLists[] = array(
|
||||
'id' => $list['id'],
|
||||
'name' => $list['name'],
|
||||
'brand_name' => $selectedBrand['name']
|
||||
);
|
||||
}
|
||||
return $allLists;
|
||||
}
|
||||
}
|
||||
|
||||
// Sinon, récupérer toutes les listes de tous les brands
|
||||
$brands = $this->get_brands();
|
||||
if (empty($brands)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$allLists = array();
|
||||
foreach ($brands as $brand) {
|
||||
$lists = $this->get_lists_for_brand($brand['id']);
|
||||
foreach ($lists as $list) {
|
||||
$allLists[] = array(
|
||||
'id' => $list['id'],
|
||||
'name' => $list['name'],
|
||||
'brand_name' => $brand['name']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $allLists;
|
||||
} catch (\Throwable $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: ping Sendy pour valider la connexion
|
||||
*/
|
||||
public function ajax_ping() {
|
||||
check_ajax_referer('cred_sendy_ping', 'nonce');
|
||||
if (!current_user_can('manage_options')) {
|
||||
wp_send_json_error(array('message' => __('Permissions insuffisantes', 'esi-creditdirect')), 403);
|
||||
}
|
||||
|
||||
$client = $this->get_client();
|
||||
if ($client === null) {
|
||||
wp_send_json_error(array('message' => __('Configuration incomplète (URL/clé API).', 'esi-creditdirect')), 400);
|
||||
}
|
||||
|
||||
try {
|
||||
// Test de connexion en récupérant les brands
|
||||
$brands = $this->get_brands();
|
||||
$lists = $this->get_lists();
|
||||
wp_send_json_success(array(
|
||||
'message' => __('Connexion réussie', 'esi-creditdirect'),
|
||||
'brands_count' => count($brands),
|
||||
'lists_count' => count($lists)
|
||||
));
|
||||
} catch (\Throwable $e) {
|
||||
wp_send_json_error(array('message' => $e->getMessage()), 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Abonne ou met à jour un contact à partir d'un objet crédit.
|
||||
* @param object $credit Objet avec au minimum les propriétés email, prenom, nom
|
||||
*/
|
||||
public function subscribe_from_credit($credit) {
|
||||
if (!$credit || !isset($credit->email)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$email = trim((string)$credit->email);
|
||||
if ($email === '' || !is_email($email)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$options = $this->get_options();
|
||||
$listId = isset($options['list_id']) ? trim((string)$options['list_id']) : '';
|
||||
if ($listId === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$client = $this->get_client();
|
||||
if ($client === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$firstName = isset($credit->prenom) ? (string)$credit->prenom : '';
|
||||
$lastName = isset($credit->nom) ? (string)$credit->nom : '';
|
||||
|
||||
$apiUrl = $client['api_url'];
|
||||
$apiKey = $client['api_key'];
|
||||
|
||||
// Sendy API endpoint pour s'abonner
|
||||
$url = $apiUrl . '/subscribe';
|
||||
|
||||
$body = array(
|
||||
'api_key' => $apiKey,
|
||||
'email' => $email,
|
||||
'list' => $listId,
|
||||
'boolean' => 'true'
|
||||
);
|
||||
|
||||
// Ajouter le nom si disponible
|
||||
if ($firstName !== '' || $lastName !== '') {
|
||||
$name = trim($firstName . ' ' . $lastName);
|
||||
if ($name !== '') {
|
||||
$body['name'] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$response = wp_remote_post($url, array(
|
||||
'body' => $body,
|
||||
'timeout' => 15
|
||||
));
|
||||
|
||||
if (is_wp_error($response)) {
|
||||
throw new \Exception($response->get_error_message());
|
||||
}
|
||||
|
||||
$responseBody = wp_remote_retrieve_body($response);
|
||||
// Sendy retourne généralement "true" ou "1" en cas de succès
|
||||
if ($responseBody !== 'true' && $responseBody !== '1') {
|
||||
error_log('Sendy subscribe error (from credit): ' . $responseBody);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
error_log('Sendy subscribe error (from credit): ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
271
app/controllers/old/credit-step1.php
Normal file
@ -0,0 +1,271 @@
|
||||
<?php
|
||||
/*
|
||||
*Template Name: credit-step1
|
||||
*
|
||||
*/
|
||||
|
||||
use models\CRED_credit_step1;
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$is_from_simulator = false;
|
||||
$is_from_back = false;
|
||||
|
||||
if(isset($_GET['credit-direct-token']) && !empty($_GET['credit-direct-token'])) {
|
||||
$is_from_back = true;
|
||||
}
|
||||
|
||||
if(isset($_POST['loan_type']) && !empty($_POST['loan_type'])) {
|
||||
$is_from_simulator = true;
|
||||
}
|
||||
|
||||
if (empty($_POST) && (!$is_from_simulator && !$is_from_back)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if(!class_exists('\models\CRED_credit')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\models\CRED_credit_step1')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit-step1.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\libraries\TurnstileValidator')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/libraries/TurnstileValidator.php');
|
||||
}
|
||||
|
||||
get_header();
|
||||
//try to load the model
|
||||
$post = $_POST;
|
||||
$one_step_form_send = false;
|
||||
$one_step_credits = ['am','amr','cied','frais_notaire','cdp'];
|
||||
|
||||
$model = new CRED_credit_step1();
|
||||
|
||||
if(isset($_POST['one_step_form']))
|
||||
$one_step_form_send = true;
|
||||
|
||||
//exemple credit : 8d0f45319ba2ebcfc708a7e6a19922c6a478b655
|
||||
|
||||
// Validation Turnstile si configuré
|
||||
if (\libraries\TurnstileValidator::isConfigured() && !empty($_POST)) {
|
||||
$turnstileToken = isset($_POST['cf-turnstile-response']) ? $_POST['cf-turnstile-response'] : '';
|
||||
$turnstileValidator = new \libraries\TurnstileValidator();
|
||||
$turnstileResult = $turnstileValidator->validateForDisplay($turnstileToken, $_SERVER['REMOTE_ADDR'] ?? null);
|
||||
|
||||
if (!$turnstileResult['valid']) {
|
||||
$turnstile_error = $turnstileResult['message'];
|
||||
}
|
||||
}
|
||||
|
||||
// Ne traiter le formulaire que si Turnstile est valide (ou non configuré)
|
||||
if (!isset($turnstile_error) && !$one_step_form_send && !isset($_GET['credit-direct-token'])) {
|
||||
$token = $model->save_step_0($post);
|
||||
} else if(isset($_POST['credit_token'])) {
|
||||
$token = $_POST['credit_token'];
|
||||
} else if(isset($_GET['credit-direct-token'])) {
|
||||
$token = $_GET['credit-direct-token'];
|
||||
} else {
|
||||
wp_redirect(home_url());
|
||||
}
|
||||
|
||||
|
||||
$currentCredit = $model->getCredit($token);
|
||||
|
||||
if (!is_object($currentCredit)) {
|
||||
wp_redirect(home_url());
|
||||
}
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($_POST);
|
||||
echo '</pre>'; */
|
||||
/* die(); */
|
||||
|
||||
// Débogage
|
||||
/* error_log('POST one_step_form: ' . (isset($_POST['one_step_form']) ? $_POST['one_step_form'] : 'non défini'));
|
||||
error_log('one_step_credits: ' . print_r($one_step_credits, true)); */
|
||||
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit-step1.php') || file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit-one-step.php')) {
|
||||
|
||||
|
||||
|
||||
$in_one_step = false;
|
||||
$civilStatus = $model->getCivilStatus();
|
||||
$works = $model->getWorks();
|
||||
$existingCreditTypes = $model->getExistingCreditTypes();
|
||||
$contractTypes = $model->getContractTypes();
|
||||
|
||||
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($currentCredit);
|
||||
echo '</pre>'; */
|
||||
|
||||
if(in_array($currentCredit->type_credit, $one_step_credits))
|
||||
$in_one_step = true;
|
||||
|
||||
|
||||
if($one_step_form_send) {
|
||||
$model->save_one_step($post);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($_FILES);
|
||||
echo '</pre>'; */
|
||||
}
|
||||
|
||||
//try to load the view
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step1.php')) {
|
||||
|
||||
$agencies = $model->getAgencies();
|
||||
$map_credit_type = $model->getCreditTypes();
|
||||
$mapHouseCreditTypes = $model->getHouseCreditTypes();
|
||||
/*re-hydrate current credit*/
|
||||
$currentCredit = $model->getCredit($token);
|
||||
$message = null;
|
||||
|
||||
$type_credit_selected = '';
|
||||
|
||||
if(isset($currentCredit->sel_credit) && !empty($currentCredit->sel_credit)) {
|
||||
$type_credit_selected = $currentCredit->sel_credit;
|
||||
}
|
||||
|
||||
if(isset($_POST['type_credit_selected']) && !empty($_POST['type_credit_selected']) || isset($_POST['sub_loan_type']) && !empty($_POST['sub_loan_type']))
|
||||
$type_credit_selected = isset($_POST['sub_loan_type']) ? $_POST['sub_loan_type'] : $_POST['type_credit_selected'];
|
||||
|
||||
|
||||
$creditOptionsLabels = !empty($type_credit_selected) ? $model->getCreditLabel($type_credit_selected) : $map_credit_type[$currentCredit->type_credit];
|
||||
|
||||
//save the credit options labels in a cookie for 2 months
|
||||
/* $model->save_step($currentCredit); */
|
||||
|
||||
$attachments = [];
|
||||
$upload_errors = [];
|
||||
/*
|
||||
// Exemple d'utilisation de la fonction handleUploads
|
||||
$allowed_types = [
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // docx
|
||||
'application/msword', // doc
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/bmp',
|
||||
'image/webp'
|
||||
];
|
||||
$max_size = 2 * 1024 * 1024; // 2 Mo
|
||||
$result = $model->handleUploads($_FILES, $allowed_types, $max_size, $token);
|
||||
$attachments = $result['files'];
|
||||
$upload_errors = $result['errors'];
|
||||
$html_links = $result['html_links'];
|
||||
*/
|
||||
if(isset($_FILES)) {
|
||||
if ($one_step_form_send) { // 4 = no file uploaded
|
||||
$allowed_types = [
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // docx
|
||||
'application/msword', // doc
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/bmp',
|
||||
'image/webp'
|
||||
];
|
||||
|
||||
//remove all the empty file from $_FILE
|
||||
foreach($_FILES as $key => $value) {
|
||||
if($value['error'] === 4) {
|
||||
unset($_FILES[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$max_size = 4 * 1024 * 1024; // 4 Mo
|
||||
$result = $model->handleUploads($_FILES, $allowed_types, $max_size, $token);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($result);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
$attachments = $result['files'];
|
||||
$upload_errors = $result['errors'];
|
||||
}
|
||||
}
|
||||
|
||||
$borrower = $model->getBorrower($currentCredit);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($borrower);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
if($one_step_form_send) {
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/email/credit-one-step-mail.php')) {
|
||||
$currentCredit = $model->getCredit($token);
|
||||
|
||||
$coBorrower = $model->getCoBorrower($currentCredit);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($currentCredit);
|
||||
echo '</pre>';
|
||||
|
||||
echo '<pre>';
|
||||
print_r($borrower);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
ob_start();
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/email/credit-one-step-mail.php');
|
||||
$message = ob_get_clean();
|
||||
|
||||
ob_start();
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/email/clients_emails/credit-one-step-mail-client.php');
|
||||
$message_client = ob_get_clean();
|
||||
|
||||
// Ajout des en-têtes pour une meilleure compatibilité Outlook
|
||||
/* $headers = array(
|
||||
'Content-Type: text/html; charset=UTF-8',
|
||||
'X-Mailer: PHP/' . phpversion(),
|
||||
'MIME-Version: 1.0'
|
||||
); */
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($attachments);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
// Exception : ne pas envoyer de mail si l'utilisateur connecté a l'ID 1
|
||||
if (!is_user_logged_in() || get_current_user_id() != 1) {
|
||||
// Envoi de l'email au client
|
||||
$model->sendEmail('Demande de crédit', $message_client, $borrower, $currentCredit, [], true);
|
||||
|
||||
// Envoi de l'email à l'administrateur
|
||||
$model->sendEmail('Demande de crédit', $message, $borrower, $currentCredit, [], false);
|
||||
}
|
||||
|
||||
// Nettoyage des fichiers temporaires
|
||||
/* foreach ($attachments as $file) {
|
||||
if (file_exists($file)) @unlink($file);
|
||||
} */
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step5.php');
|
||||
}
|
||||
if (!empty($upload_errors)) {
|
||||
foreach ($upload_errors as $err) {
|
||||
echo '<div class="alert alert-danger">' . htmlspecialchars($err) . '</div>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if($in_one_step) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-one-step.php');
|
||||
} else {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step1.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get_footer();
|
||||
153
app/controllers/old/credit-step2.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/*
|
||||
*Template Name: credit-step2
|
||||
*
|
||||
*/
|
||||
/* ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL); */
|
||||
|
||||
use models\CRED_credit_step2;
|
||||
|
||||
$is_from_simulator = false;
|
||||
$is_from_back = false;
|
||||
|
||||
if(isset($_GET['credit-direct-token']) && !empty($_GET['credit-direct-token'])) {
|
||||
$is_from_back = true;
|
||||
}
|
||||
|
||||
/* if (empty($_POST) && (!$is_from_back)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
} */
|
||||
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step2.php')) {
|
||||
|
||||
if(!class_exists('\models\CRED_credit')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\libraries\FormValidator')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/libraries/FormValidator.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\libraries\TurnstileValidator')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/libraries/TurnstileValidator.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\models\CRED_credit_step2')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step2.php');
|
||||
}
|
||||
|
||||
$model = new CRED_credit_step2();
|
||||
|
||||
$ongoing_credit = $model->checkOngoingCreditRequest();
|
||||
|
||||
if(!$ongoing_credit && empty($_POST) && !$is_from_back) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
|
||||
// Vérifier le token soit en POST soit en GET
|
||||
$token = isset($_POST['credit-direct-token']) ? $_POST['credit-direct-token'] : (isset($_GET['credit-direct-token']) ? $_GET['credit-direct-token'] : null);
|
||||
|
||||
if(null === $token) {
|
||||
$token = $model->get_ongoing_credit_token();
|
||||
}
|
||||
|
||||
if (empty($token)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
|
||||
get_header();
|
||||
|
||||
//try to load the model
|
||||
$post = $_POST;
|
||||
if (empty($post)) {
|
||||
$post = array('credit-direct-token' => $token);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$currentCredit = $model->getCredit($token);
|
||||
$borrower = $model->getBorrower($currentCredit);
|
||||
$coBorrower = $model->getCoBorrower($currentCredit);
|
||||
|
||||
$hasCoBorrower = $model->hasCoBorrower($currentCredit);
|
||||
|
||||
$is_credit_auto = $model->is_credit_auto($currentCredit);
|
||||
|
||||
$type_credit_selected = '';
|
||||
|
||||
if(isset($currentCredit->sel_credit) && !empty($currentCredit->sel_credit)) {
|
||||
$type_credit_selected = $currentCredit->sel_credit;
|
||||
}
|
||||
|
||||
if(isset($_POST['type_credit_selected']) && !empty($_POST['type_credit_selected']) || isset($_POST['sub_loan_type']) && !empty($_POST['sub_loan_type']))
|
||||
$type_credit_selected = isset($_POST['sub_loan_type']) ? $_POST['sub_loan_type'] : $_POST['type_credit_selected'];
|
||||
|
||||
if(empty($type_credit_selected)) {
|
||||
$type_credit_selected = $currentCredit->type_credit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (is_object($currentCredit)) {
|
||||
// Sauvegarder l'étape 1 seulement si on vient du formulaire POST
|
||||
if (!empty($_POST)) {
|
||||
// Validation Turnstile si configuré
|
||||
if (\libraries\TurnstileValidator::isConfigured()) {
|
||||
$turnstileToken = isset($_POST['cf-turnstile-response']) ? $_POST['cf-turnstile-response'] : '';
|
||||
$turnstileValidator = new \libraries\TurnstileValidator();
|
||||
$turnstileResult = $turnstileValidator->validateForDisplay($turnstileToken, $_SERVER['REMOTE_ADDR'] ?? null);
|
||||
|
||||
if (!$turnstileResult['valid']) {
|
||||
$turnstile_error = $turnstileResult['message'];
|
||||
}
|
||||
}
|
||||
|
||||
// Ne traiter le formulaire que si Turnstile est valide (ou non configuré)
|
||||
if (!isset($turnstile_error)) {
|
||||
$result = $model->save_step_1($post);
|
||||
|
||||
// Vérifier s'il y a des erreurs de validation
|
||||
if (is_array($result) && isset($result['success']) && !$result['success']) {
|
||||
$validation_errors = $result['formatted_errors'];
|
||||
} else {
|
||||
$model->save_step($currentCredit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$contractTypes = $model->getContractTypes();
|
||||
$mapHouseCreditTypes = $model->getHouseCreditTypes();
|
||||
|
||||
// Utilisation du mode debug pour charger les templates
|
||||
$template_a = CRED::getTemplatePath('/templates/front/credit-step2-a.php');
|
||||
$template_b = CRED::getTemplatePath('/templates/front/credit-step2-b.php');
|
||||
$template_c = CRED::getTemplatePath('/templates/front/credit-step2-c.php');
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($_COOKIE);
|
||||
echo '</pre>'; */
|
||||
|
||||
|
||||
//try to load the view
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect' . $template_a)) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect' . $template_a);
|
||||
}
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect' . $template_b)) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect' . $template_b);
|
||||
}
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect' . $template_c)) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect' . $template_c);
|
||||
}
|
||||
} else {
|
||||
// Si le crédit n'existe pas, rediriger vers la page d'accueil
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
get_footer();
|
||||
193
app/controllers/old/credit-step3.php
Normal file
@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/*
|
||||
*Template Name: credit-step3
|
||||
*
|
||||
*/
|
||||
|
||||
use models\CRED_credit_step3;
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
/* $is_from_simulator = false;
|
||||
$is_from_back = false;
|
||||
|
||||
if(isset($_GET['credit-direct-token']) && !empty($_GET['credit-direct-token'])) {
|
||||
$is_from_back = true;
|
||||
}
|
||||
|
||||
if (empty($_POST) && (!$is_from_back)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
} */
|
||||
|
||||
if(!class_exists('\models\CRED_credit')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\libraries\FormValidator')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/libraries/FormValidator.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\libraries\TurnstileValidator')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/libraries/TurnstileValidator.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\models\CRED_credit_step3')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step3.php');
|
||||
}
|
||||
|
||||
$model = new CRED_credit_step3();
|
||||
|
||||
// Vérifier le token soit en POST soit en GET
|
||||
$token = isset($_POST['credit-direct-token']) ? $_POST['credit-direct-token'] : (isset($_GET['credit-direct-token']) ? $_GET['credit-direct-token'] : null);
|
||||
|
||||
if(null === $token) {
|
||||
$token = $model->get_ongoing_credit_token();
|
||||
}
|
||||
|
||||
if (empty($token)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
|
||||
$currentCredit = $model->getCredit($token);
|
||||
|
||||
if(isset($_GET['debug'])) {
|
||||
echo '<pre>';
|
||||
print_r($token);
|
||||
print_r($currentCredit);
|
||||
echo '</pre>';
|
||||
//die();
|
||||
}
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($currentCredit);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
$is_credit_pat = $model->is_credit_pat($currentCredit);
|
||||
|
||||
$type_credit_selected = '';
|
||||
|
||||
if(isset($currentCredit->sel_credit) && !empty($currentCredit->sel_credit)) {
|
||||
$type_credit_selected = $currentCredit->sel_credit;
|
||||
}
|
||||
|
||||
if(isset($_POST['type_credit_selected']) && !empty($_POST['type_credit_selected']) || isset($_POST['sub_loan_type']) && !empty($_POST['sub_loan_type']))
|
||||
$type_credit_selected = isset($_POST['sub_loan_type']) ? $_POST['sub_loan_type'] : $_POST['type_credit_selected'];
|
||||
|
||||
if(empty($type_credit_selected)) {
|
||||
$type_credit_selected = $currentCredit->type_credit;
|
||||
}
|
||||
|
||||
get_header();
|
||||
|
||||
//try to load the model
|
||||
$post = $_POST;
|
||||
if (empty($post)) {
|
||||
$post = array('credit-direct-token' => $token);
|
||||
}
|
||||
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step3.php')) {
|
||||
|
||||
|
||||
if (is_object($currentCredit)) {
|
||||
// Sauvegarder l'étape 2 seulement si on vient du formulaire POST
|
||||
if (!empty($_POST)) {
|
||||
// Validation Turnstile si configuré
|
||||
if (\libraries\TurnstileValidator::isConfigured()) {
|
||||
$turnstileToken = isset($_POST['cf-turnstile-response']) ? $_POST['cf-turnstile-response'] : '';
|
||||
$turnstileValidator = new \libraries\TurnstileValidator();
|
||||
$turnstileResult = $turnstileValidator->validateForDisplay($turnstileToken, $_SERVER['REMOTE_ADDR'] ?? null);
|
||||
|
||||
if (!$turnstileResult['valid']) {
|
||||
$turnstile_error = $turnstileResult['message'];
|
||||
}
|
||||
}
|
||||
|
||||
// Ne traiter le formulaire que si Turnstile est valide (ou non configuré)
|
||||
if (!isset($turnstile_error)) {
|
||||
$result = $model->save_step_2($post,$currentCredit);
|
||||
|
||||
// Vérifier s'il y a des erreurs de validation
|
||||
if (is_array($result) && isset($result['success']) && !$result['success']) {
|
||||
$validation_errors = $result['formatted_errors'];
|
||||
}
|
||||
}
|
||||
|
||||
// Gestion générique de l'upload de fichiers
|
||||
$attachments = [];
|
||||
$upload_errors = [];
|
||||
/*
|
||||
// Exemple d'utilisation de la fonction handleUploads
|
||||
$allowed_types = [
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // docx
|
||||
'application/msword', // doc
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/bmp',
|
||||
'image/webp'
|
||||
];
|
||||
$max_size = 2 * 1024 * 1024; // 2 Mo
|
||||
$result = $model->handleUploads($_FILES, $allowed_types, $max_size, $token);
|
||||
$attachments = $result['files'];
|
||||
$upload_errors = $result['errors'];
|
||||
$html_links = $result['html_links'];
|
||||
*/
|
||||
$allowed_types = [
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // docx
|
||||
'application/msword', // doc
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/bmp',
|
||||
'image/webp'
|
||||
];
|
||||
$max_size = 4 * 1024 * 1024; // 4 Mo
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($_FILES);
|
||||
echo '</pre>'; */
|
||||
|
||||
if(!empty($_FILES)) {
|
||||
foreach ($_FILES as $field => $file) {
|
||||
|
||||
// Traiter seulement les champs de fichiers qui ne sont pas vides
|
||||
if(empty($file['name']) || empty($file['name'][0]) || $file['error'] === 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($file['error']) && $file['error'] !== 4) { // 4 = pas de fichier uploadé
|
||||
$result = $model->handleUploads($file, $allowed_types, $max_size, $token);
|
||||
$attachments = array_merge($attachments, $result['files']);
|
||||
$upload_errors = array_merge($upload_errors, $result['errors']);
|
||||
}
|
||||
}
|
||||
// Affichage des erreurs d'upload
|
||||
if (!empty($upload_errors)) {
|
||||
foreach ($upload_errors as $err) {
|
||||
echo '<div class="alert alert-danger">' . htmlspecialchars($err) . '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//try to load the view
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step3.php')) {
|
||||
$coBorrower = $model->getCoBorrower($currentCredit);
|
||||
$borrower = $model->getBorrower($currentCredit);
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step3.php');
|
||||
}
|
||||
} else {
|
||||
// Si le crédit n'existe pas, rediriger vers la page d'accueil
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
get_footer();
|
||||
107
app/controllers/old/credit-step4.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/*
|
||||
*Template Name: credit-step4
|
||||
*
|
||||
*/
|
||||
|
||||
use models\CRED_credit_step4;
|
||||
|
||||
/* $is_from_simulator = false;
|
||||
$is_from_back = false;
|
||||
|
||||
if(isset($_GET['credit-direct-token']) && !empty($_GET['credit-direct-token'])) {
|
||||
$is_from_back = true;
|
||||
}
|
||||
|
||||
if (empty($_POST) && (!$is_from_back)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
} */
|
||||
|
||||
if(!class_exists('\models\CRED_credit')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\models\CRED_credit_step4')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step4.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\libraries\TurnstileValidator')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/libraries/TurnstileValidator.php');
|
||||
}
|
||||
|
||||
$model = new CRED_credit_step4();
|
||||
|
||||
// Vérifier le token soit en POST soit en GET
|
||||
$token = isset($_POST['credit-direct-token']) ? $_POST['credit-direct-token'] : (isset($_GET['credit-direct-token']) ? $_GET['credit-direct-token'] : null);
|
||||
|
||||
if(null === $token) {
|
||||
$token = $model->get_ongoing_credit_token();
|
||||
}
|
||||
|
||||
if (empty($token)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
|
||||
get_header();
|
||||
|
||||
//try to load the model
|
||||
$post = $_POST;
|
||||
if (empty($post)) {
|
||||
$post = array('credit-direct-token' => $token);
|
||||
}
|
||||
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step4.php')) {
|
||||
|
||||
|
||||
$currentCredit = $model->getCredit($token);
|
||||
|
||||
$type_credit_selected = '';
|
||||
|
||||
$coBorrower = $model->getCoBorrower($currentCredit);
|
||||
$borrower = $model->getBorrower($currentCredit);
|
||||
|
||||
if(isset($currentCredit->sel_credit) && !empty($currentCredit->sel_credit)) {
|
||||
$type_credit_selected = $currentCredit->sel_credit;
|
||||
}
|
||||
|
||||
if(isset($_POST['type_credit_selected']) && !empty($_POST['type_credit_selected']) || isset($_POST['sub_loan_type']) && !empty($_POST['sub_loan_type']))
|
||||
$type_credit_selected = isset($_POST['sub_loan_type']) ? $_POST['sub_loan_type'] : $_POST['type_credit_selected'];
|
||||
|
||||
if(empty($type_credit_selected)) {
|
||||
$type_credit_selected = $currentCredit->type_credit;
|
||||
}
|
||||
|
||||
if (is_object($currentCredit)) {
|
||||
// Sauvegarder l'étape 3 seulement si on vient du formulaire POST
|
||||
if (!empty($_POST)) {
|
||||
// Validation Turnstile si configuré
|
||||
if (\libraries\TurnstileValidator::isConfigured()) {
|
||||
$turnstileToken = isset($_POST['cf-turnstile-response']) ? $_POST['cf-turnstile-response'] : '';
|
||||
$turnstileValidator = new \libraries\TurnstileValidator();
|
||||
$turnstileResult = $turnstileValidator->validateForDisplay($turnstileToken, $_SERVER['REMOTE_ADDR'] ?? null);
|
||||
|
||||
if (!$turnstileResult['valid']) {
|
||||
$turnstile_error = $turnstileResult['message'];
|
||||
}
|
||||
}
|
||||
|
||||
// Ne traiter le formulaire que si Turnstile est valide (ou non configuré)
|
||||
if (!isset($turnstile_error)) {
|
||||
$model->save_step_3($post, $currentCredit);
|
||||
}
|
||||
}
|
||||
|
||||
//try to load the view
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step4.php')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step4.php');
|
||||
}
|
||||
} else {
|
||||
// Si le crédit n'existe pas, rediriger vers la page d'accueil
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
get_footer();
|
||||
128
app/controllers/old/credit-step5.php
Normal file
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/*
|
||||
*Template Name: credit-step5
|
||||
*
|
||||
*/
|
||||
|
||||
use models\CRED_credit_step5;
|
||||
|
||||
/* $is_from_simulator = false;
|
||||
$is_from_back = false;
|
||||
|
||||
if(isset($_GET['credit-direct-token']) && !empty($_GET['credit-direct-token'])) {
|
||||
$is_from_back = true;
|
||||
}
|
||||
|
||||
if(isset($_POST['loan_type']) && !empty($_POST['loan_type'])) {
|
||||
$is_from_simulator = true;
|
||||
}
|
||||
|
||||
if (empty($_POST) && (!$is_from_simulator || !$is_from_back)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
} */
|
||||
|
||||
|
||||
// Vérifier le token soit en POST soit en GET
|
||||
$token = isset($_POST['credit-direct-token']) ? $_POST['credit-direct-token'] : (isset($_GET['credit-direct-token']) ? $_GET['credit-direct-token'] : null);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($token);
|
||||
echo '</pre>'; */
|
||||
|
||||
if (empty($token)) {
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
|
||||
get_header();
|
||||
|
||||
//try to load the model
|
||||
$post = $_POST;
|
||||
if (empty($post)) {
|
||||
$post = array('credit-direct-token' => $token);
|
||||
}
|
||||
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step5.php')) {
|
||||
|
||||
if(!class_exists('\models\CRED_credit')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit.php');
|
||||
}
|
||||
|
||||
if(!class_exists('\models\CRED_credit_step5')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/app/models/credit_step5.php');
|
||||
}
|
||||
|
||||
$model = new CRED_credit_step5();
|
||||
|
||||
$currentCredit = $model->getCredit($token);
|
||||
|
||||
|
||||
if (is_object($currentCredit)) {
|
||||
// Sauvegarder l'étape 4 seulement si on vient du formulaire POST
|
||||
|
||||
|
||||
if (!empty($_POST)) {
|
||||
$model->save_step_4($post, $currentCredit);
|
||||
}
|
||||
|
||||
$borrower = $model->getBorrower($currentCredit);
|
||||
$coBorrower = $model->getCoBorrower($currentCredit);
|
||||
$agencies = $model->getAgencies();
|
||||
$civilStatus = $model->getCivilStatus();
|
||||
$works = $model->getWorks();
|
||||
$existingCreditTypes = $model->getExistingCreditTypes();
|
||||
$map_credit_type = $model->getCreditTypes();
|
||||
$contractTypes = $model->getContractTypes();
|
||||
$mapHouseCreditTypes = $model->getHouseCreditTypes();
|
||||
|
||||
$type_credit_selected = '';
|
||||
|
||||
if(isset($currentCredit->sel_credit) && !empty($currentCredit->sel_credit)) {
|
||||
$type_credit_selected = $currentCredit->sel_credit;
|
||||
}
|
||||
|
||||
if(isset($_POST['type_credit_selected']) && !empty($_POST['type_credit_selected']) || isset($_POST['sub_loan_type']) && !empty($_POST['sub_loan_type']))
|
||||
$type_credit_selected = isset($_POST['sub_loan_type']) ? $_POST['sub_loan_type'] : $_POST['type_credit_selected'];
|
||||
|
||||
|
||||
$creditOptionsLabels = !empty($type_credit_selected) ? $model->getCreditLabel($type_credit_selected) : $map_credit_type[$currentCredit->type_credit];
|
||||
|
||||
$message = null;
|
||||
|
||||
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/email/credit-step4-mail.php')) {
|
||||
ob_start();
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/email/credit-step4-mail.php');
|
||||
$message = ob_get_clean();
|
||||
|
||||
ob_start();
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/email/clients_emails/credit-step4-mail-client.php');
|
||||
$message_client = ob_get_clean();
|
||||
|
||||
|
||||
// Ajout des en-têtes pour une meilleure compatibilité Outlook
|
||||
|
||||
// Exception : ne pas envoyer de mail si l'utilisateur connecté a l'ID 1
|
||||
if (!is_user_logged_in() || get_current_user_id() != 1) {
|
||||
$model->sendEmail('Demande de crédit', $message, $borrower, $currentCredit, [], false);
|
||||
$model->sendEmail('Demande de crédit', $message_client, $borrower, $currentCredit, [], true);
|
||||
}
|
||||
}
|
||||
|
||||
//try to load the view
|
||||
if (file_exists(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step5.php')) {
|
||||
include(WP_PLUGIN_DIR . '/ESI_creditDirect/templates/front/credit-step5.php');
|
||||
}
|
||||
|
||||
/* if (!is_null($message)) {
|
||||
echo $message;
|
||||
} */
|
||||
} else {
|
||||
// Si le crédit n'existe pas, rediriger vers la page d'accueil
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
get_footer();
|
||||
273
app/controllers/old/credit_mailchimp.php
Normal file
@ -0,0 +1,273 @@
|
||||
<?php
|
||||
|
||||
class CRED_credit_mailchimp extends CRED_base {
|
||||
|
||||
public function __construct() {
|
||||
// Le hook admin_menu est maintenant géré par le factory
|
||||
}
|
||||
|
||||
public function init() {
|
||||
|
||||
}
|
||||
|
||||
public function add_admin_menu() {
|
||||
add_submenu_page(
|
||||
'credit-manager',
|
||||
'Mailchimp',
|
||||
'Mailchimp',
|
||||
'manage_options',
|
||||
'credit-mailchimp',
|
||||
array($this, 'render_settings_page')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enregistre les réglages et champs via la Settings API
|
||||
*/
|
||||
public function register_settings() {
|
||||
register_setting(
|
||||
'cred_mailchimp_options_group',
|
||||
'cred_mailchimp_options',
|
||||
array(
|
||||
'type' => 'array',
|
||||
'sanitize_callback' => array($this, 'sanitize_options'),
|
||||
'default' => array(
|
||||
'api_key' => '',
|
||||
'server_prefix' => '',
|
||||
'primary_list_id' => ''
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'cred_mailchimp_main_section',
|
||||
__('Paramètres de connexion', 'esi-creditdirect'),
|
||||
function() {
|
||||
echo '<p>' . esc_html__('Renseignez la clé API et le préfixe serveur (ex: us19) comme indiqué par Mailchimp.', 'esi-creditdirect') . '</p>';
|
||||
},
|
||||
'credit-mailchimp'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'cred_mailchimp_api_key',
|
||||
__('Clé API', 'esi-creditdirect'),
|
||||
array($this, 'field_api_key_cb'),
|
||||
'credit-mailchimp',
|
||||
'cred_mailchimp_main_section'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'cred_mailchimp_server_prefix',
|
||||
__('Préfixe serveur', 'esi-creditdirect'),
|
||||
array($this, 'field_server_prefix_cb'),
|
||||
'credit-mailchimp',
|
||||
'cred_mailchimp_main_section'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'cred_mailchimp_primary_list',
|
||||
__('Liste principale (Audience)', 'esi-creditdirect'),
|
||||
array($this, 'field_primary_list_cb'),
|
||||
'credit-mailchimp',
|
||||
'cred_mailchimp_main_section'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche la page de réglages
|
||||
*/
|
||||
public function render_settings_page() {
|
||||
$options = $this->get_options();
|
||||
include plugin_dir_path(__FILE__) . '../../templates/admin/mailchimp_settings.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback du champ API Key
|
||||
*/
|
||||
public function field_api_key_cb() {
|
||||
$options = $this->get_options();
|
||||
$value = isset($options['api_key']) ? $options['api_key'] : '';
|
||||
echo '<input type="text" class="regular-text" id="cred_mailchimp_api_key" name="cred_mailchimp_options[api_key]" value="' . esc_attr($value) . '" placeholder="YOUR_API_KEY">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback du champ Server Prefix
|
||||
*/
|
||||
public function field_server_prefix_cb() {
|
||||
$options = $this->get_options();
|
||||
$value = isset($options['server_prefix']) ? $options['server_prefix'] : '';
|
||||
echo '<input type="text" class="regular-text" id="cred_mailchimp_server_prefix" name="cred_mailchimp_options[server_prefix]" value="' . esc_attr($value) . '" placeholder="us19">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback du champ Liste principale (audience)
|
||||
*/
|
||||
public function field_primary_list_cb() {
|
||||
$options = $this->get_options();
|
||||
$selected = isset($options['primary_list_id']) ? $options['primary_list_id'] : '';
|
||||
|
||||
$client = $this->get_client();
|
||||
if ($client === null) {
|
||||
echo '<em>' . esc_html__('Renseignez d\'abord la clé API et le préfixe serveur, puis enregistrez.', 'esi-creditdirect') . '</em>';
|
||||
echo '<br />';
|
||||
echo '<input type="text" class="regular-text" name="cred_mailchimp_options[primary_list_id]" value="' . esc_attr($selected) . '" placeholder="Audience ID (ex: a1b2c3d4)">';
|
||||
return;
|
||||
}
|
||||
|
||||
$lists = array();
|
||||
try {
|
||||
$resp = $client->lists->getAllLists(array('count' => 1000));
|
||||
if (is_array($resp) && isset($resp['lists']) && is_array($resp['lists'])) {
|
||||
foreach ($resp['lists'] as $list) {
|
||||
if (isset($list['id']) && isset($list['name'])) {
|
||||
$lists[] = array(
|
||||
'id' => (string) $list['id'],
|
||||
'name' => (string) $list['name']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
echo '<div class="notice notice-error"><p>' . esc_html(sprintf(__('Erreur lors du chargement des audiences: %s', 'esi-creditdirect'), $e->getMessage())) . '</p></div>';
|
||||
}
|
||||
|
||||
if (empty($lists)) {
|
||||
echo '<em>' . esc_html__('Aucune audience trouvée ou erreur. Vous pouvez saisir un ID manuellement.', 'esi-creditdirect') . '</em>';
|
||||
echo '<br />';
|
||||
echo '<input type="text" class="regular-text" name="cred_mailchimp_options[primary_list_id]" value="' . esc_attr($selected) . '" placeholder="Audience ID (ex: a1b2c3d4)">';
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<select id="cred_mailchimp_primary_list" name="cred_mailchimp_options[primary_list_id]">';
|
||||
echo '<option value="">' . esc_html__('— Sélectionner —', 'esi-creditdirect') . '</option>';
|
||||
foreach ($lists as $list) {
|
||||
$isSel = selected($selected, $list['id'], false);
|
||||
echo '<option value="' . esc_attr($list['id']) . '" ' . $isSel . '>' . esc_html($list['name'] . ' (' . $list['id'] . ')') . '</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize des options
|
||||
*/
|
||||
public function sanitize_options($options) {
|
||||
$sanitized = array();
|
||||
$sanitized['api_key'] = isset($options['api_key']) ? sanitize_text_field($options['api_key']) : '';
|
||||
$sanitized['server_prefix'] = isset($options['server_prefix']) ? sanitize_text_field($options['server_prefix']) : '';
|
||||
$sanitized['primary_list_id'] = isset($options['primary_list_id']) ? sanitize_text_field($options['primary_list_id']) : '';
|
||||
return $sanitized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère les options du plugin
|
||||
*/
|
||||
private function get_options() {
|
||||
$defaults = array(
|
||||
'api_key' => '',
|
||||
'server_prefix' => '',
|
||||
'primary_list_id' => ''
|
||||
);
|
||||
$options = get_option('cred_mailchimp_options', array());
|
||||
if (!is_array($options)) {
|
||||
$options = array();
|
||||
}
|
||||
return array_merge($defaults, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne une instance configurée du client Mailchimp Marketing
|
||||
* ou null si les informations de connexion sont incomplètes.
|
||||
*/
|
||||
public function get_client() {
|
||||
$options = $this->get_options();
|
||||
$apiKey = isset($options['api_key']) ? trim($options['api_key']) : '';
|
||||
$server = isset($options['server_prefix']) ? trim($options['server_prefix']) : '';
|
||||
|
||||
if ($apiKey === '' || $server === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('\\MailchimpMarketing\\ApiClient')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$client = new \MailchimpMarketing\ApiClient();
|
||||
$client->setConfig(array(
|
||||
'apiKey' => $apiKey,
|
||||
'server' => $server
|
||||
));
|
||||
|
||||
return $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: ping Mailchimp pour valider la connexion
|
||||
*/
|
||||
public function ajax_ping() {
|
||||
check_ajax_referer('cred_mailchimp_ping', 'nonce');
|
||||
if (!current_user_can('manage_options')) {
|
||||
wp_send_json_error(array('message' => __('Permissions insuffisantes', 'esi-creditdirect')), 403);
|
||||
}
|
||||
|
||||
$client = $this->get_client();
|
||||
if ($client === null) {
|
||||
wp_send_json_error(array('message' => __('Configuration incomplète (clé API/préfixe serveur).', 'esi-creditdirect')), 400);
|
||||
}
|
||||
|
||||
try {
|
||||
$resp = $client->ping->get();
|
||||
wp_send_json_success(array('response' => $resp));
|
||||
} catch (\Throwable $e) {
|
||||
wp_send_json_error(array('message' => $e->getMessage()), 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Abonne ou met à jour un contact à partir d'un objet crédit.
|
||||
* @param object $credit Objet avec au minimum les propriétés email, prenom, nom
|
||||
*/
|
||||
public function subscribe_from_credit($credit) {
|
||||
if (!$credit || !isset($credit->email)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$email = trim((string)$credit->email);
|
||||
if ($email === '' || !is_email($email)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$options = get_option('cred_mailchimp_options', array());
|
||||
$listId = isset($options['primary_list_id']) ? trim((string)$options['primary_list_id']) : '';
|
||||
if ($listId === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$client = $this->get_client();
|
||||
if ($client === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$firstName = isset($credit->prenom) ? (string)$credit->prenom : '';
|
||||
$lastName = isset($credit->nom) ? (string)$credit->nom : '';
|
||||
|
||||
$subscriberHash = md5(strtolower($email));
|
||||
$body = array(
|
||||
'email_address' => $email,
|
||||
'status' => 'subscribed',
|
||||
'status_if_new' => 'subscribed',
|
||||
'merge_fields' => array(
|
||||
'FNAME' => $firstName,
|
||||
'LNAME' => $lastName
|
||||
)
|
||||
);
|
||||
|
||||
try {
|
||||
$client->lists->setListMember($listId, $subscriberHash, $body);
|
||||
} catch (\Throwable $e) {
|
||||
error_log('Mailchimp subscribe error (from credit): ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
1337
app/controllers/old/credit_manager.php
Normal file
202
app/controllers/old/shortcodes.php
Normal file
@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* Gestionnaire des shortcodes pour le plugin ESI_creditDirect
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class ESI_CreditDirect_Shortcodes {
|
||||
|
||||
public function __construct() {
|
||||
add_action('init', array($this, 'register_shortcodes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enregistrement de tous les shortcodes
|
||||
*/
|
||||
public function register_shortcodes() {
|
||||
add_shortcode('credit_manager_modal', array($this, 'credit_manager_modal_shortcode'));
|
||||
add_shortcode('credit_manager_table', array($this, 'credit_manager_table_shortcode'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcode pour afficher le modal de gestion des crédits
|
||||
* Usage: [credit_manager_modal]
|
||||
*/
|
||||
public function credit_manager_modal_shortcode($atts) {
|
||||
$atts = shortcode_atts(array(
|
||||
'mode' => 'create', // 'create' ou 'edit'
|
||||
'credit_id' => 0
|
||||
), $atts);
|
||||
|
||||
// Inclure le template du modal
|
||||
ob_start();
|
||||
include plugin_dir_path(__FILE__) . '../../templates/modules/credit-manager-edit-form.php';
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcode pour afficher le tableau de gestion des crédits
|
||||
* Usage: [credit_manager_table]
|
||||
*/
|
||||
public function credit_manager_table_shortcode($atts) {
|
||||
$atts = shortcode_atts(array(
|
||||
'show_actions' => 'true',
|
||||
'limit' => 50
|
||||
), $atts);
|
||||
|
||||
// Récupérer les crédits
|
||||
$credits = $this->get_credits($atts['limit']);
|
||||
|
||||
// Inclure le template du tableau
|
||||
ob_start();
|
||||
include plugin_dir_path(__FILE__) . '../../templates/admin/credit_manager_table.php';
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupérer la liste des crédits
|
||||
*/
|
||||
private function get_credits($limit = 50) {
|
||||
global $wpdb;
|
||||
|
||||
// TODO: Remplacer par la vraie table des crédits
|
||||
$table_name = $wpdb->prefix . 'credit_direct_credits';
|
||||
|
||||
$sql = $wpdb->prepare("
|
||||
SELECT * FROM {$table_name}
|
||||
ORDER BY date DESC
|
||||
LIMIT %d
|
||||
", $limit);
|
||||
|
||||
return $wpdb->get_results($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Traitement AJAX pour créer un crédit
|
||||
*/
|
||||
public function ajax_create_credit() {
|
||||
check_ajax_referer('credit_manager_action', 'nonce');
|
||||
|
||||
$data = array(
|
||||
'title' => sanitize_text_field($_POST['title']),
|
||||
'nom' => sanitize_text_field($_POST['nom']),
|
||||
'prenom' => sanitize_text_field($_POST['prenom']),
|
||||
'adresse' => sanitize_textarea_field($_POST['adresse']),
|
||||
'localite' => sanitize_text_field($_POST['localite']),
|
||||
'email' => sanitize_email($_POST['email']),
|
||||
'telephone' => sanitize_text_field($_POST['telephone']),
|
||||
'gsm' => sanitize_text_field($_POST['gsm']),
|
||||
'societe_credit' => sanitize_text_field($_POST['societe_credit']),
|
||||
'montant' => floatval($_POST['montant']),
|
||||
'date' => sanitize_text_field($_POST['date']),
|
||||
'signature' => sanitize_text_field($_POST['signature']),
|
||||
'numero_dossier' => sanitize_text_field($_POST['numero_dossier']),
|
||||
'code' => sanitize_text_field($_POST['code']),
|
||||
'remarques' => sanitize_textarea_field($_POST['remarques']),
|
||||
'created_at' => current_time('mysql')
|
||||
);
|
||||
|
||||
global $wpdb;
|
||||
$table_name = $wpdb->prefix . 'credit_direct_credits';
|
||||
|
||||
$result = $wpdb->insert($table_name, $data);
|
||||
|
||||
if ($result) {
|
||||
wp_send_json_success(array(
|
||||
'message' => 'Crédit créé avec succès',
|
||||
'credit_id' => $wpdb->insert_id
|
||||
));
|
||||
} else {
|
||||
wp_send_json_error(array(
|
||||
'message' => 'Erreur lors de la création du crédit'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Traitement AJAX pour mettre à jour un crédit
|
||||
*/
|
||||
public function ajax_update_credit() {
|
||||
check_ajax_referer('credit_manager_action', 'nonce');
|
||||
|
||||
$credit_id = intval($_POST['credit_id']);
|
||||
|
||||
if (!$credit_id) {
|
||||
wp_send_json_error(array('message' => 'ID de crédit invalide'));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'title' => sanitize_text_field($_POST['title']),
|
||||
'nom' => sanitize_text_field($_POST['nom']),
|
||||
'prenom' => sanitize_text_field($_POST['prenom']),
|
||||
'adresse' => sanitize_textarea_field($_POST['adresse']),
|
||||
'localite' => sanitize_text_field($_POST['localite']),
|
||||
'email' => sanitize_email($_POST['email']),
|
||||
'telephone' => sanitize_text_field($_POST['telephone']),
|
||||
'gsm' => sanitize_text_field($_POST['gsm']),
|
||||
'societe_credit' => sanitize_text_field($_POST['societe_credit']),
|
||||
'montant' => floatval($_POST['montant']),
|
||||
'date' => sanitize_text_field($_POST['date']),
|
||||
'signature' => sanitize_text_field($_POST['signature']),
|
||||
'numero_dossier' => sanitize_text_field($_POST['numero_dossier']),
|
||||
'code' => sanitize_text_field($_POST['code']),
|
||||
'remarques' => sanitize_textarea_field($_POST['remarques']),
|
||||
'updated_at' => current_time('mysql')
|
||||
);
|
||||
|
||||
global $wpdb;
|
||||
$table_name = $wpdb->prefix . 'credit_direct_credits';
|
||||
|
||||
$result = $wpdb->update(
|
||||
$table_name,
|
||||
$data,
|
||||
array('id' => $credit_id),
|
||||
array('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%f', '%s', '%s', '%s', '%s', '%s', '%s'),
|
||||
array('%d')
|
||||
);
|
||||
|
||||
if ($result !== false) {
|
||||
wp_send_json_success(array('message' => 'Crédit mis à jour avec succès'));
|
||||
} else {
|
||||
wp_send_json_error(array('message' => 'Erreur lors de la mise à jour du crédit'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Traitement AJAX pour récupérer un crédit
|
||||
*/
|
||||
public function ajax_get_credit() {
|
||||
check_ajax_referer('credit_manager_action', 'nonce');
|
||||
|
||||
$credit_id = intval($_POST['credit_id']);
|
||||
|
||||
if (!$credit_id) {
|
||||
wp_send_json_error(array('message' => 'ID de crédit invalide'));
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$table_name = $wpdb->prefix . 'credit_direct_credits';
|
||||
|
||||
$credit = $wpdb->get_row($wpdb->prepare(
|
||||
"SELECT * FROM {$table_name} WHERE id = %d",
|
||||
$credit_id
|
||||
));
|
||||
|
||||
if ($credit) {
|
||||
wp_send_json_success($credit);
|
||||
} else {
|
||||
wp_send_json_error(array('message' => 'Crédit non trouvé'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Initialiser la classe
|
||||
new ESI_CreditDirect_Shortcodes();
|
||||
|
||||
// Enregistrer les actions AJAX
|
||||
add_action('wp_ajax_create_credit', array('ESI_CreditDirect_Shortcodes', 'ajax_create_credit'));
|
||||
add_action('wp_ajax_update_credit', array('ESI_CreditDirect_Shortcodes', 'ajax_update_credit'));
|
||||
add_action('wp_ajax_get_credit', array('ESI_CreditDirect_Shortcodes', 'ajax_get_credit'));
|
||||
353
app/controllers/old/societes_credit_manager.php
Normal file
@ -0,0 +1,353 @@
|
||||
<?php
|
||||
|
||||
class CRED_societes_credit_manager extends CRED_base {
|
||||
public function __construct() {
|
||||
// Le hook admin_menu est maintenant géré par le factory
|
||||
}
|
||||
|
||||
public function init() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajouter le sous-menu d'administration sous Crédits
|
||||
*/
|
||||
public function add_admin_menu() {
|
||||
add_submenu_page(
|
||||
'credit-manager', // Slug du menu parent
|
||||
'Gestion des Sociétés de Crédit', // Titre de la page
|
||||
'Sociétés de Crédit', // Titre du sous-menu
|
||||
'edit_posts', // Capacité requise
|
||||
'societes-credit-manager', // Slug du sous-menu
|
||||
array($this, 'societes_credit_manager_interfaces') // Fonction de callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Afficher l'interface de gestion
|
||||
*/
|
||||
public function societes_credit_manager_interfaces() {
|
||||
// Récupérer les sociétés de crédit
|
||||
$societes_credit = $this->get_societes_credit();
|
||||
|
||||
// Inclure le template
|
||||
include plugin_dir_path(__FILE__) . '../../templates/admin/societes_credit_table.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupérer toutes les sociétés de crédit
|
||||
*/
|
||||
public function get_societes_credit($limit = 100) {
|
||||
global $wpdb;
|
||||
|
||||
$table_name = 'cdf_societes_credit';
|
||||
|
||||
// Vérifier si la table existe
|
||||
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
||||
return $this->get_test_societes();
|
||||
}
|
||||
|
||||
$sql = "SELECT id, nom, status FROM {$table_name} ORDER BY nom ASC";
|
||||
$results = $wpdb->get_results($sql);
|
||||
|
||||
// Si pas de résultats, retourner des données de test
|
||||
if (empty($results)) {
|
||||
return $this->get_test_societes();
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupérer une société spécifique par ID
|
||||
*/
|
||||
public function get_societe_by_id($societe_id) {
|
||||
global $wpdb;
|
||||
|
||||
$table_name = 'cdf_societes_credit';
|
||||
|
||||
// Vérifier si la table existe
|
||||
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$sql = $wpdb->prepare("
|
||||
SELECT id, nom, status
|
||||
FROM {$table_name}
|
||||
WHERE id = %d
|
||||
", $societe_id);
|
||||
|
||||
return $wpdb->get_row($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Données de test pour le développement
|
||||
*/
|
||||
private function get_test_societes() {
|
||||
return array(
|
||||
(object) array(
|
||||
'id' => 1,
|
||||
'nom' => 'Banque Exemple 1',
|
||||
'status' => 1
|
||||
),
|
||||
(object) array(
|
||||
'id' => 2,
|
||||
'nom' => 'Banque Exemple 2',
|
||||
'status' => 1
|
||||
),
|
||||
(object) array(
|
||||
'id' => 3,
|
||||
'nom' => 'Banque Désactivée',
|
||||
'status' => 0
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ========================================
|
||||
* FONCTIONS CRUD POUR SOCIETES DE CREDIT
|
||||
* ========================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* Créer une nouvelle société de crédit
|
||||
*/
|
||||
public function ajax_create_societe() {
|
||||
// Vérifier le nonce
|
||||
if (!wp_verify_nonce($_POST['nonce'], 'societes_credit_action')) {
|
||||
wp_die('Sécurité: Nonce invalide');
|
||||
}
|
||||
|
||||
// Vérifier les permissions
|
||||
if (!current_user_can('edit_posts')) {
|
||||
wp_die('Permissions insuffisantes');
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$table_name = 'cdf_societes_credit';
|
||||
|
||||
// Récupérer et valider les données
|
||||
$data = array(
|
||||
'nom' => sanitize_text_field($_POST['nom']),
|
||||
'status' => isset($_POST['status']) && $_POST['status'] === 'true' ? 1 : 0
|
||||
);
|
||||
|
||||
// Validation des champs obligatoires
|
||||
if (empty($data['nom'])) {
|
||||
wp_send_json_error('Le nom est obligatoire');
|
||||
}
|
||||
|
||||
// Vérifier si la table existe
|
||||
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
||||
wp_send_json_error('Table de base de données non trouvée');
|
||||
}
|
||||
|
||||
// Vérifier si le nom existe déjà
|
||||
$existing = $wpdb->get_var($wpdb->prepare(
|
||||
"SELECT COUNT(*) FROM {$table_name} WHERE nom = %s",
|
||||
$data['nom']
|
||||
));
|
||||
|
||||
if ($existing > 0) {
|
||||
wp_send_json_error('Une société avec ce nom existe déjà');
|
||||
}
|
||||
|
||||
// Insérer la nouvelle société
|
||||
$result = $wpdb->insert($table_name, $data);
|
||||
|
||||
if ($result === false) {
|
||||
wp_send_json_error('Erreur lors de la création de la société');
|
||||
}
|
||||
|
||||
$societe_id = $wpdb->insert_id;
|
||||
$new_societe = $this->get_societe_by_id($societe_id);
|
||||
|
||||
wp_send_json_success(array(
|
||||
'message' => 'Société créée avec succès',
|
||||
'societe' => $new_societe
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lire une société spécifique
|
||||
*/
|
||||
public function ajax_get_societe() {
|
||||
// Vérifier le nonce
|
||||
if (!wp_verify_nonce($_POST['nonce'], 'societes_credit_action')) {
|
||||
wp_die('Sécurité: Nonce invalide');
|
||||
}
|
||||
|
||||
// Vérifier les permissions
|
||||
if (!current_user_can('edit_posts')) {
|
||||
wp_die('Permissions insuffisantes');
|
||||
}
|
||||
|
||||
$societe_id = intval($_POST['societe_id']);
|
||||
|
||||
if ($societe_id <= 0) {
|
||||
wp_send_json_error('ID de société invalide');
|
||||
}
|
||||
|
||||
$societe = $this->get_societe_by_id($societe_id);
|
||||
|
||||
if (!$societe) {
|
||||
wp_send_json_error('Société non trouvée');
|
||||
}
|
||||
|
||||
wp_send_json_success(array(
|
||||
'societe' => $societe
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mettre à jour une société existante
|
||||
*/
|
||||
public function ajax_update_societe() {
|
||||
// Vérifier le nonce
|
||||
if (!wp_verify_nonce($_POST['nonce'], 'societes_credit_action')) {
|
||||
wp_die('Sécurité: Nonce invalide');
|
||||
}
|
||||
|
||||
// Vérifier les permissions
|
||||
if (!current_user_can('edit_posts')) {
|
||||
wp_die('Permissions insuffisantes');
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$table_name = 'cdf_societes_credit';
|
||||
$societe_id = intval($_POST['societe_id']);
|
||||
|
||||
if ($societe_id <= 0) {
|
||||
wp_send_json_error('ID de société invalide');
|
||||
}
|
||||
|
||||
// Vérifier si la société existe
|
||||
$existing_societe = $this->get_societe_by_id($societe_id);
|
||||
if (!$existing_societe) {
|
||||
wp_send_json_error('Société non trouvée');
|
||||
}
|
||||
|
||||
// Récupérer et valider les données
|
||||
$data = array(
|
||||
'nom' => sanitize_text_field($_POST['nom']),
|
||||
'status' => isset($_POST['status']) && $_POST['status'] === 'true' ? 1 : 0
|
||||
);
|
||||
|
||||
// Validation des champs obligatoires
|
||||
if (empty($data['nom'])) {
|
||||
wp_send_json_error('Le nom est obligatoire');
|
||||
}
|
||||
|
||||
// Vérifier si le nom existe déjà (sauf pour cette société)
|
||||
$existing = $wpdb->get_var($wpdb->prepare(
|
||||
"SELECT COUNT(*) FROM {$table_name} WHERE nom = %s AND id != %d",
|
||||
$data['nom'],
|
||||
$societe_id
|
||||
));
|
||||
|
||||
if ($existing > 0) {
|
||||
wp_send_json_error('Une autre société avec ce nom existe déjà');
|
||||
}
|
||||
|
||||
// Mettre à jour la société
|
||||
$result = $wpdb->update(
|
||||
$table_name,
|
||||
$data,
|
||||
array('id' => $societe_id),
|
||||
array('%s', '%d'),
|
||||
array('%d')
|
||||
);
|
||||
|
||||
if ($result === false) {
|
||||
wp_send_json_error('Erreur lors de la mise à jour de la société');
|
||||
}
|
||||
|
||||
$updated_societe = $this->get_societe_by_id($societe_id);
|
||||
|
||||
wp_send_json_success(array(
|
||||
'message' => 'Société mise à jour avec succès',
|
||||
'societe' => $updated_societe
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Supprimer une société
|
||||
*/
|
||||
public function ajax_delete_societe() {
|
||||
// Vérifier le nonce
|
||||
if (!wp_verify_nonce($_POST['nonce'], 'societes_credit_action')) {
|
||||
wp_die('Sécurité: Nonce invalide');
|
||||
}
|
||||
|
||||
// Vérifier les permissions
|
||||
if (!current_user_can('edit_posts')) {
|
||||
wp_die('Permissions insuffisantes');
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$table_name = 'cdf_societes_credit';
|
||||
$societe_id = intval($_POST['societe_id']);
|
||||
|
||||
if ($societe_id <= 0) {
|
||||
wp_send_json_error('ID de société invalide');
|
||||
}
|
||||
|
||||
// Vérifier si la société existe
|
||||
$existing_societe = $this->get_societe_by_id($societe_id);
|
||||
if (!$existing_societe) {
|
||||
wp_send_json_error('Société non trouvée');
|
||||
}
|
||||
|
||||
// Supprimer la société
|
||||
$result = $wpdb->delete(
|
||||
$table_name,
|
||||
array('id' => $societe_id),
|
||||
array('%d')
|
||||
);
|
||||
|
||||
if ($result === false) {
|
||||
wp_send_json_error('Erreur lors de la suppression de la société');
|
||||
}
|
||||
|
||||
wp_send_json_success(array(
|
||||
'message' => 'Société supprimée avec succès',
|
||||
'societe_id' => $societe_id
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lister toutes les sociétés avec pagination
|
||||
*/
|
||||
public function ajax_list_societes() {
|
||||
// Vérifier le nonce
|
||||
if (!wp_verify_nonce($_POST['nonce'], 'societes_credit_action')) {
|
||||
wp_die('Sécurité: Nonce invalide');
|
||||
}
|
||||
|
||||
// Vérifier les permissions
|
||||
if (!current_user_can('edit_posts')) {
|
||||
wp_die('Permissions insuffisantes');
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$table_name = 'cdf_societes_credit';
|
||||
|
||||
// Vérifier si la table existe
|
||||
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
||||
wp_send_json_error('Table de base de données non trouvée');
|
||||
}
|
||||
|
||||
// Compter le total
|
||||
$total = $wpdb->get_var("SELECT COUNT(*) FROM {$table_name}");
|
||||
|
||||
// Récupérer toutes les sociétés
|
||||
$sql = "SELECT id, nom, status FROM {$table_name} ORDER BY nom ASC";
|
||||
$societes = $wpdb->get_results($sql);
|
||||
|
||||
wp_send_json_success(array(
|
||||
'societes' => $societes,
|
||||
'total' => intval($total)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
392
app/controllers/societes_credit_manager.php
Normal file
@ -0,0 +1,392 @@
|
||||
<?php
|
||||
|
||||
class CRED_societes_credit_manager extends CRED_base {
|
||||
|
||||
/**
|
||||
* Traiter les valeurs multiples du type de crédit
|
||||
*/
|
||||
private function processTypeCredit($type_credit_data) {
|
||||
if (is_array($type_credit_data)) {
|
||||
// Nettoyer et valider chaque valeur
|
||||
$valid_types = array('PAT', 'CH', 'CA');
|
||||
$cleaned = array();
|
||||
foreach ($type_credit_data as $type) {
|
||||
$type = sanitize_text_field($type);
|
||||
if (in_array($type, $valid_types)) {
|
||||
$cleaned[] = $type;
|
||||
}
|
||||
}
|
||||
// Retourner un tableau PHP
|
||||
return array_unique($cleaned);
|
||||
} elseif (is_string($type_credit_data)) {
|
||||
// Si c'est une string (chargée depuis DB), la convertir en array
|
||||
if (!empty($type_credit_data)) {
|
||||
return explode(',', $type_credit_data);
|
||||
}
|
||||
return array();
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
// Le hook admin_menu est maintenant géré par le factory
|
||||
}
|
||||
|
||||
public function init() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajouter le sous-menu d'administration sous Crédits
|
||||
*/
|
||||
public function add_admin_menu() {
|
||||
add_submenu_page(
|
||||
'credit-manager', // Slug du menu parent
|
||||
'Gestion des Sociétés de Crédit', // Titre de la page
|
||||
'Sociétés de Crédit', // Titre du sous-menu
|
||||
'edit_posts', // Capacité requise
|
||||
'societes-credit-manager', // Slug du sous-menu
|
||||
array($this, 'societes_credit_manager_interfaces') // Fonction de callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Afficher l'interface de gestion
|
||||
*/
|
||||
public function societes_credit_manager_interfaces() {
|
||||
// Récupérer les sociétés de crédit
|
||||
$societes_credit = $this->get_societes_credit();
|
||||
|
||||
// Inclure le template
|
||||
include plugin_dir_path(__FILE__) . '../../templates/admin/societes_credit_table.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupérer toutes les sociétés de crédit
|
||||
*/
|
||||
public function get_societes_credit($limit = 100) {
|
||||
global $wpdb;
|
||||
|
||||
$table_name = 'cdf_societes_credit';
|
||||
|
||||
// Vérifier si la table existe
|
||||
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
||||
return $this->get_test_societes();
|
||||
}
|
||||
|
||||
$sql = "SELECT id, nom, status, type_credit FROM {$table_name} ORDER BY nom ASC";
|
||||
$results = $wpdb->get_results($sql);
|
||||
|
||||
// Si pas de résultats, retourner des données de test
|
||||
if (empty($results)) {
|
||||
return $this->get_test_societes();
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupérer une société spécifique par ID
|
||||
*/
|
||||
public function get_societe_by_id($societe_id) {
|
||||
global $wpdb;
|
||||
|
||||
$table_name = 'cdf_societes_credit';
|
||||
|
||||
// Vérifier si la table existe
|
||||
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$sql = $wpdb->prepare("
|
||||
SELECT id, nom, status, type_credit
|
||||
FROM {$table_name}
|
||||
WHERE id = %d
|
||||
", $societe_id);
|
||||
|
||||
return $wpdb->get_row($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Données de test pour le développement
|
||||
*/
|
||||
private function get_test_societes() {
|
||||
return array(
|
||||
(object) array(
|
||||
'id' => 1,
|
||||
'nom' => 'Banque Exemple 1',
|
||||
'status' => 1
|
||||
),
|
||||
(object) array(
|
||||
'id' => 2,
|
||||
'nom' => 'Banque Exemple 2',
|
||||
'status' => 1
|
||||
),
|
||||
(object) array(
|
||||
'id' => 3,
|
||||
'nom' => 'Banque Désactivée',
|
||||
'status' => 0
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ========================================
|
||||
* FONCTIONS CRUD POUR SOCIETES DE CREDIT
|
||||
* ========================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* Créer une nouvelle société de crédit
|
||||
*/
|
||||
public function ajax_create_societe() {
|
||||
// Vérifier le nonce
|
||||
if (!wp_verify_nonce($_POST['nonce'], 'societes_credit_action')) {
|
||||
wp_die('Sécurité: Nonce invalide');
|
||||
}
|
||||
|
||||
// Vérifier les permissions
|
||||
if (!current_user_can('edit_posts')) {
|
||||
wp_die('Permissions insuffisantes');
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$table_name = 'cdf_societes_credit';
|
||||
|
||||
// Récupérer et valider les données
|
||||
$type_credit_raw = isset($_POST['type_credit']) ? $_POST['type_credit'] : [];
|
||||
error_log('Type credit raw: ' . print_r($type_credit_raw, true));
|
||||
|
||||
$data = array(
|
||||
'nom' => sanitize_text_field($_POST['nom']),
|
||||
'status' => isset($_POST['status']) && $_POST['status'] === 'true' ? 1 : 0,
|
||||
'type_credit' => implode(',', $this->processTypeCredit($type_credit_raw))
|
||||
);
|
||||
|
||||
error_log('Type credit processed: ' . $data['type_credit']);
|
||||
|
||||
// Validation des champs obligatoires
|
||||
if (empty($data['nom'])) {
|
||||
wp_send_json_error('Le nom est obligatoire');
|
||||
}
|
||||
|
||||
// Vérifier si la table existe
|
||||
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
||||
wp_send_json_error('Table de base de données non trouvée');
|
||||
}
|
||||
|
||||
// Vérifier si le nom existe déjà
|
||||
$existing = $wpdb->get_var($wpdb->prepare(
|
||||
"SELECT COUNT(*) FROM {$table_name} WHERE nom = %s",
|
||||
$data['nom']
|
||||
));
|
||||
|
||||
if ($existing > 0) {
|
||||
wp_send_json_error('Une société avec ce nom existe déjà');
|
||||
}
|
||||
|
||||
// Insérer la nouvelle société
|
||||
$result = $wpdb->insert($table_name, $data);
|
||||
|
||||
if ($result === false) {
|
||||
wp_send_json_error('Erreur lors de la création de la société');
|
||||
}
|
||||
|
||||
$societe_id = $wpdb->insert_id;
|
||||
$new_societe = $this->get_societe_by_id($societe_id);
|
||||
|
||||
wp_send_json_success(array(
|
||||
'message' => 'Société créée avec succès',
|
||||
'societe' => $new_societe
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lire une société spécifique
|
||||
*/
|
||||
public function ajax_get_societe() {
|
||||
// Vérifier le nonce
|
||||
if (!wp_verify_nonce($_POST['nonce'], 'societes_credit_action')) {
|
||||
wp_die('Sécurité: Nonce invalide');
|
||||
}
|
||||
|
||||
// Vérifier les permissions
|
||||
if (!current_user_can('edit_posts')) {
|
||||
wp_die('Permissions insuffisantes');
|
||||
}
|
||||
|
||||
$societe_id = intval($_POST['societe_id']);
|
||||
|
||||
if ($societe_id <= 0) {
|
||||
wp_send_json_error('ID de société invalide');
|
||||
}
|
||||
|
||||
$societe = $this->get_societe_by_id($societe_id);
|
||||
|
||||
if (!$societe) {
|
||||
wp_send_json_error('Société non trouvée');
|
||||
}
|
||||
|
||||
wp_send_json_success(array(
|
||||
'societe' => $societe
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mettre à jour une société existante
|
||||
*/
|
||||
public function ajax_update_societe() {
|
||||
// Vérifier le nonce
|
||||
if (!wp_verify_nonce($_POST['nonce'], 'societes_credit_action')) {
|
||||
wp_die('Sécurité: Nonce invalide');
|
||||
}
|
||||
|
||||
// Vérifier les permissions
|
||||
if (!current_user_can('edit_posts')) {
|
||||
wp_die('Permissions insuffisantes');
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$table_name = 'cdf_societes_credit';
|
||||
$societe_id = intval($_POST['societe_id']);
|
||||
|
||||
if ($societe_id <= 0) {
|
||||
wp_send_json_error('ID de société invalide');
|
||||
}
|
||||
|
||||
// Vérifier si la société existe
|
||||
$existing_societe = $this->get_societe_by_id($societe_id);
|
||||
if (!$existing_societe) {
|
||||
wp_send_json_error('Société non trouvée');
|
||||
}
|
||||
|
||||
// Récupérer et valider les données
|
||||
$type_credit_raw = isset($_POST['type_credit']) ? $_POST['type_credit'] : [];
|
||||
error_log('Type credit raw: ' . print_r($type_credit_raw, true));
|
||||
|
||||
$data = array(
|
||||
'nom' => sanitize_text_field($_POST['nom']),
|
||||
'status' => isset($_POST['status']) && $_POST['status'] === 'true' ? 1 : 0,
|
||||
'type_credit' => implode(',', $this->processTypeCredit($type_credit_raw))
|
||||
);
|
||||
|
||||
error_log('Type credit processed: ' . $data['type_credit']);
|
||||
|
||||
// Validation des champs obligatoires
|
||||
if (empty($data['nom'])) {
|
||||
wp_send_json_error('Le nom est obligatoire');
|
||||
}
|
||||
|
||||
// Vérifier si le nom existe déjà (sauf pour cette société)
|
||||
$existing = $wpdb->get_var($wpdb->prepare(
|
||||
"SELECT COUNT(*) FROM {$table_name} WHERE nom = %s AND id != %d",
|
||||
$data['nom'],
|
||||
$societe_id
|
||||
));
|
||||
|
||||
if ($existing > 0) {
|
||||
wp_send_json_error('Une autre société avec ce nom existe déjà');
|
||||
}
|
||||
|
||||
// Mettre à jour la société
|
||||
$result = $wpdb->update(
|
||||
$table_name,
|
||||
$data,
|
||||
array('id' => $societe_id),
|
||||
array('%s', '%d'),
|
||||
array('%d')
|
||||
);
|
||||
|
||||
if ($result === false) {
|
||||
wp_send_json_error('Erreur lors de la mise à jour de la société');
|
||||
}
|
||||
|
||||
$updated_societe = $this->get_societe_by_id($societe_id);
|
||||
|
||||
wp_send_json_success(array(
|
||||
'message' => 'Société mise à jour avec succès',
|
||||
'societe' => $updated_societe
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Supprimer une société
|
||||
*/
|
||||
public function ajax_delete_societe() {
|
||||
// Vérifier le nonce
|
||||
if (!wp_verify_nonce($_POST['nonce'], 'societes_credit_action')) {
|
||||
wp_die('Sécurité: Nonce invalide');
|
||||
}
|
||||
|
||||
// Vérifier les permissions
|
||||
if (!current_user_can('edit_posts')) {
|
||||
wp_die('Permissions insuffisantes');
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$table_name = 'cdf_societes_credit';
|
||||
$societe_id = intval($_POST['societe_id']);
|
||||
|
||||
if ($societe_id <= 0) {
|
||||
wp_send_json_error('ID de société invalide');
|
||||
}
|
||||
|
||||
// Vérifier si la société existe
|
||||
$existing_societe = $this->get_societe_by_id($societe_id);
|
||||
if (!$existing_societe) {
|
||||
wp_send_json_error('Société non trouvée');
|
||||
}
|
||||
|
||||
// Supprimer la société
|
||||
$result = $wpdb->delete(
|
||||
$table_name,
|
||||
array('id' => $societe_id),
|
||||
array('%d')
|
||||
);
|
||||
|
||||
if ($result === false) {
|
||||
wp_send_json_error('Erreur lors de la suppression de la société');
|
||||
}
|
||||
|
||||
wp_send_json_success(array(
|
||||
'message' => 'Société supprimée avec succès',
|
||||
'societe_id' => $societe_id
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lister toutes les sociétés avec pagination
|
||||
*/
|
||||
public function ajax_list_societes() {
|
||||
// Vérifier le nonce
|
||||
if (!wp_verify_nonce($_POST['nonce'], 'societes_credit_action')) {
|
||||
wp_die('Sécurité: Nonce invalide');
|
||||
}
|
||||
|
||||
// Vérifier les permissions
|
||||
if (!current_user_can('edit_posts')) {
|
||||
wp_die('Permissions insuffisantes');
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$table_name = 'cdf_societes_credit';
|
||||
|
||||
// Vérifier si la table existe
|
||||
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
||||
wp_send_json_error('Table de base de données non trouvée');
|
||||
}
|
||||
|
||||
// Compter le total
|
||||
$total = $wpdb->get_var("SELECT COUNT(*) FROM {$table_name}");
|
||||
|
||||
// Récupérer toutes les sociétés
|
||||
$sql = "SELECT id, nom, status, type_credit FROM {$table_name} ORDER BY nom ASC";
|
||||
$societes = $wpdb->get_results($sql);
|
||||
|
||||
wp_send_json_success(array(
|
||||
'societes' => $societes,
|
||||
'total' => intval($total)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
1
app/init-buildings.php
Normal file
@ -0,0 +1 @@
|
||||
|
||||
1075
app/libraries/FormValidator.php
Normal file
184
app/libraries/TurnstileValidator.php
Normal file
@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
namespace libraries;
|
||||
|
||||
/**
|
||||
* Classe de validation Cloudflare Turnstile
|
||||
*/
|
||||
class TurnstileValidator
|
||||
{
|
||||
private $secretKey;
|
||||
private $timeout;
|
||||
|
||||
/**
|
||||
* Constructeur
|
||||
* @param string $secretKey Clé secrète Turnstile (optionnel, utilise la constante par défaut)
|
||||
* @param int $timeout Timeout en millisecondes (optionnel, défaut 10000ms)
|
||||
*/
|
||||
public function __construct($secretKey = null, $timeout = 10000)
|
||||
{
|
||||
$this->secretKey = $secretKey ?: _CRED_TURNSTILE_SECRET_KEY_;
|
||||
$this->timeout = $timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Valide un token Turnstile
|
||||
*
|
||||
* @param string $token Le token à valider
|
||||
* @param string $remoteip L'adresse IP du client (optionnel)
|
||||
* @param string $idempotencyKey Clé d'idempotence pour éviter les doublons (optionnel)
|
||||
* @return array Résultat de la validation
|
||||
*/
|
||||
public function validate($token, $remoteip = null, $idempotencyKey = null)
|
||||
{
|
||||
// Validation des paramètres d'entrée
|
||||
if (empty($token) || !is_string($token)) {
|
||||
return [
|
||||
'success' => false,
|
||||
'error' => 'Token manquant ou invalide',
|
||||
'error_codes' => ['missing-input-response']
|
||||
];
|
||||
}
|
||||
|
||||
if (strlen($token) > 2048) {
|
||||
return [
|
||||
'success' => false,
|
||||
'error' => 'Token trop long',
|
||||
'error_codes' => ['invalid-input-response']
|
||||
];
|
||||
}
|
||||
|
||||
// Préparation de la requête
|
||||
$url = 'https://challenges.cloudflare.com/turnstile/v0/siteverify';
|
||||
|
||||
$postData = [
|
||||
'secret' => $this->secretKey,
|
||||
'response' => $token
|
||||
];
|
||||
|
||||
if (!empty($remoteip)) {
|
||||
$postData['remoteip'] = $remoteip;
|
||||
}
|
||||
|
||||
if (!empty($idempotencyKey)) {
|
||||
$postData['idempotency_key'] = $idempotencyKey;
|
||||
}
|
||||
|
||||
// Configuration cURL
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->timeout);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Content-Type: application/x-www-form-urlencoded'
|
||||
]);
|
||||
|
||||
// Exécution de la requête
|
||||
$response = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$curlError = curl_error($ch);
|
||||
curl_close($ch);
|
||||
|
||||
// Gestion des erreurs cURL
|
||||
if ($response === false) {
|
||||
error_log('Turnstile validation cURL error: ' . $curlError);
|
||||
return [
|
||||
'success' => false,
|
||||
'error' => 'Erreur de connexion au service Turnstile',
|
||||
'error_codes' => ['internal-error']
|
||||
];
|
||||
}
|
||||
|
||||
// Vérification du code HTTP
|
||||
if ($httpCode !== 200) {
|
||||
error_log('Turnstile validation HTTP error: ' . $httpCode);
|
||||
return [
|
||||
'success' => false,
|
||||
'error' => 'Erreur du service Turnstile (HTTP ' . $httpCode . ')',
|
||||
'error_codes' => ['internal-error']
|
||||
];
|
||||
}
|
||||
|
||||
// Décodage de la réponse JSON
|
||||
$result = json_decode($response, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
error_log('Turnstile validation JSON decode error: ' . json_last_error_msg());
|
||||
return [
|
||||
'success' => false,
|
||||
'error' => 'Erreur de parsing de la réponse Turnstile',
|
||||
'error_codes' => ['internal-error']
|
||||
];
|
||||
}
|
||||
|
||||
// Validation du succès
|
||||
if (!isset($result['success'])) {
|
||||
error_log('Turnstile validation missing success field in response');
|
||||
return [
|
||||
'success' => false,
|
||||
'error' => 'Réponse invalide du service Turnstile',
|
||||
'error_codes' => ['internal-error']
|
||||
];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Valide un token avec gestion d'erreurs formatée pour l'affichage
|
||||
*
|
||||
* @param string $token Le token à valider
|
||||
* @param string $remoteip L'adresse IP du client (optionnel)
|
||||
* @return array Résultat formaté pour l'affichage
|
||||
*/
|
||||
public function validateForDisplay($token, $remoteip = null)
|
||||
{
|
||||
$result = $this->validate($token, $remoteip);
|
||||
|
||||
if ($result['success']) {
|
||||
return [
|
||||
'valid' => true,
|
||||
'message' => '',
|
||||
'data' => $result
|
||||
];
|
||||
}
|
||||
|
||||
// Mapping des erreurs pour l'affichage utilisateur
|
||||
$errorMessages = [
|
||||
'missing-input-secret' => 'Configuration Turnstile invalide.',
|
||||
'invalid-input-secret' => 'Configuration Turnstile invalide.',
|
||||
'missing-input-response' => 'Vérification de sécurité manquante. Veuillez cocher la case "Je ne suis pas un robot".',
|
||||
'invalid-input-response' => 'Vérification de sécurité invalide. Veuillez réessayer.',
|
||||
'bad-request' => 'Requête de vérification invalide.',
|
||||
'timeout-or-duplicate' => 'Vérification de sécurité expirée. Veuillez réessayer.',
|
||||
'internal-error' => 'Erreur temporaire du service de sécurité. Veuillez réessayer dans quelques instants.'
|
||||
];
|
||||
|
||||
$errorCodes = isset($result['error-codes']) ? $result['error-codes'] : ['internal-error'];
|
||||
$errorCode = reset($errorCodes); // Premier code d'erreur
|
||||
|
||||
$message = isset($errorMessages[$errorCode]) ? $errorMessages[$errorCode] : 'Erreur de vérification de sécurité inconnue.';
|
||||
|
||||
return [
|
||||
'valid' => false,
|
||||
'message' => $message,
|
||||
'error_codes' => $errorCodes,
|
||||
'data' => $result
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si Turnstile est correctement configuré
|
||||
*
|
||||
* @return bool True si configuré, false sinon
|
||||
*/
|
||||
public static function isConfigured()
|
||||
{
|
||||
return defined('_CRED_TURNSTILE_SECRET_KEY_') &&
|
||||
_CRED_TURNSTILE_SECRET_KEY_ !== '' &&
|
||||
_CRED_TURNSTILE_SECRET_KEY_ !== 'YOUR_SECRET_KEY_HERE' &&
|
||||
defined('_CRED_TURNSTILE_SITE_KEY_') &&
|
||||
_CRED_TURNSTILE_SITE_KEY_ !== '' &&
|
||||
_CRED_TURNSTILE_SITE_KEY_ !== 'YOUR_SITE_KEY_HERE';
|
||||
}
|
||||
}
|
||||
49
app/libraries/base.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
abstract class CRED_base extends CRED {
|
||||
|
||||
final public function getMain()
|
||||
{
|
||||
return CRED::getInstance('app.libraries.main');
|
||||
}
|
||||
|
||||
final public function getFactory()
|
||||
{
|
||||
return CRED::getInstance('app.libraries.factory');
|
||||
}
|
||||
|
||||
final public function getForms()
|
||||
{
|
||||
return CRED::getInstance('app.libraries.forms');
|
||||
}
|
||||
|
||||
final public function getSimulateur()
|
||||
{
|
||||
return CRED::getInstance('app.libraries.simulateur');
|
||||
}
|
||||
|
||||
final public function getCreditReminder()
|
||||
{
|
||||
return CRED::getInstance('app.libraries.credit-reminder');
|
||||
}
|
||||
|
||||
final public function getCreditManager()
|
||||
{
|
||||
return CRED::getInstance('app.controllers.credit_manager');
|
||||
}
|
||||
|
||||
final public function getSocietesCreditManager()
|
||||
{
|
||||
return CRED::getInstance('app.controllers.societes_credit_manager');
|
||||
}
|
||||
|
||||
final public function getCreditMailchimp()
|
||||
{
|
||||
return CRED::getInstance('app.controllers.credit_mailchimp');
|
||||
}
|
||||
|
||||
final public function getCreditSendy()
|
||||
{
|
||||
return CRED::getInstance('app.controllers.credit_sendy');
|
||||
}
|
||||
}
|
||||
224
app/libraries/credit-reminder.php
Normal file
@ -0,0 +1,224 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
/* use models\CRED_credit; */
|
||||
|
||||
if (!defined('_CREDEXEC_')) die();
|
||||
|
||||
if(!class_exists('CRED_credit')) {
|
||||
require_once _CRED_ABSPATH_ . 'app/models/credit.php';
|
||||
}
|
||||
/* require_once _CRED_ABSPATH_ . 'app/models/credit.php'; */
|
||||
|
||||
class CRED_Credit_Reminder extends CRED_base {
|
||||
private static $instance = null;
|
||||
|
||||
public static function instance() {
|
||||
if (!self::$instance) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
|
||||
// Ajouter le rappel dans le footer
|
||||
|
||||
|
||||
add_action('wp_footer', array($this, 'display_credit_reminder_btn'));
|
||||
add_action('get_footer', array($this, 'display_credit_reminder_modal'));
|
||||
|
||||
|
||||
// Ajouter des styles CSS personnalisés
|
||||
/* add_action('wp_head', array($this, 'add_custom_styles')); */
|
||||
}
|
||||
|
||||
public function add_custom_styles() {
|
||||
?>
|
||||
<style>
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.credit-reminder {
|
||||
position: relative;
|
||||
}
|
||||
.credit-reminder > div {
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
}
|
||||
.credit-reminder .button {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function display_credit_reminder() {
|
||||
// Ne pas afficher sur les pages de demande de crédit
|
||||
if (is_page('credit-step1') || is_page('credit-step2') ||
|
||||
is_page('credit-step3') || is_page('credit-step4') ||
|
||||
is_page('credit-step5')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$model = new \models\CRED_credit();
|
||||
$credit_request = $model->checkOngoingCreditRequest();
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($credit_request);
|
||||
echo '</pre>'; */
|
||||
|
||||
if ($credit_request) {
|
||||
$last_update = \Carbon\Carbon::parse($credit_request['last_update_date']);
|
||||
$now = \Carbon\Carbon::now();
|
||||
$interval = $now->diffInDays($last_update);
|
||||
|
||||
if ($interval <= 60) { // 2 mois maximum
|
||||
/* include(_CRED_MODULES_PATH_ . 'credit-reminder-btn.php'); */
|
||||
return true;
|
||||
} else {
|
||||
setcookie('credit_data', '', time() - 3600, '/');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function display_credit_reminder_modal() {
|
||||
if($this->display_credit_reminder()) {
|
||||
include(_CRED_MODULES_PATH_ . 'credit-reminder-modal.php');
|
||||
}
|
||||
}
|
||||
|
||||
public function display_credit_reminder_btn() {
|
||||
if($this->display_credit_reminder()) {
|
||||
include(_CRED_MODULES_PATH_ . 'credit-reminder-btn.php');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoie des rappels par email pour les crédits en attente.
|
||||
* Cette méthode doit être appelée dans un contexte WordPress où la fonction wp_mail est disponible.
|
||||
*/
|
||||
public function send_reminder_email() {
|
||||
global $wpdb;
|
||||
|
||||
$now = Carbon::now();
|
||||
|
||||
$model = new \models\CRED_credit();
|
||||
$credit_types = $model->getCreditTypes();
|
||||
|
||||
$one_day = 1; // Carbon gère la différence en jours directement
|
||||
$results = $wpdb->get_results("
|
||||
SELECT c.idCredit, c.type_credit, c.create_date, c.last_step, c.reminder_sent, c.last_reminder, c.token, e.email, e.nom, e.prenom
|
||||
FROM cdf_Credit c
|
||||
JOIN cdf_Emprunteur e ON e.FK_demande_creditdirect = c.idCredit
|
||||
WHERE e.email IS NOT NULL AND e.email <> ''
|
||||
AND c.create_date >= DATE_SUB(NOW(), INTERVAL 3 MONTH)
|
||||
AND (
|
||||
(c.type_credit = 'am' AND c.last_step = 1)
|
||||
OR
|
||||
(c.type_credit <> 'am' AND c.last_step < 4)
|
||||
)
|
||||
AND c.type_credit NOT IN ('am','amr','cied','frais_notaire','cdp')
|
||||
");
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($results);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
// getMain() est défini dans CRED_base et retourne l'instance de CRED_Main
|
||||
$main = $this->getMain();
|
||||
$template_path = $main::template('credit-reminder-mail.php', 'email', true);
|
||||
$mail_ar = [];
|
||||
|
||||
|
||||
foreach ($results as $row) {
|
||||
/* echo '<pre>';
|
||||
print_r($row);
|
||||
echo '</pre>'; */
|
||||
$send = false;
|
||||
$reminder_to_send = null;
|
||||
$create_date = Carbon::parse($row->create_date);
|
||||
$last_reminder = $row->last_reminder ? Carbon::parse($row->last_reminder) : null;
|
||||
|
||||
// Premier rappel : +3 heures
|
||||
$target1 = $create_date->copy()->addHours(3);
|
||||
|
||||
$limit_target1 = $create_date->copy()->addDays(1);
|
||||
// Deuxième rappel : +7 jours
|
||||
$target2 = $create_date->copy()->addDays(7);
|
||||
$limit_target2 = $create_date->copy()->addDays(8);
|
||||
// Troisième rappel : +1 mois
|
||||
$target3 = $create_date->copy()->addMonth();
|
||||
|
||||
if ((is_null($row->reminder_sent) || $row->reminder_sent == 0)) {
|
||||
|
||||
// Tolérance : 1h
|
||||
if ($now->greaterThanOrEqualTo($target1) && $now->lessThan($limit_target1) && ($last_reminder === null || $last_reminder->diffInHours($now) >= 1)) {
|
||||
$send = true;
|
||||
$reminder_to_send = 1;
|
||||
}
|
||||
} elseif ($row->reminder_sent == 1) {
|
||||
// Tolérance : 1 jour
|
||||
if ($now->greaterThanOrEqualTo($target2) && $now->lessThan($limit_target2) && ($last_reminder === null || $last_reminder->diffInDays($now) >= 1)) {
|
||||
$send = true;
|
||||
$reminder_to_send = 2;
|
||||
}
|
||||
} elseif ($row->reminder_sent == 2) {
|
||||
// Tolérance : 1 jour
|
||||
if ($now->greaterThanOrEqualTo($target3) && ($last_reminder === null || $last_reminder->diffInDays($now) >= 1)) {
|
||||
$send = true;
|
||||
$reminder_to_send = 3;
|
||||
}
|
||||
}
|
||||
|
||||
if ($send) {
|
||||
// Préparer l'email HTML via le template
|
||||
|
||||
if(empty($row->email))
|
||||
continue;
|
||||
|
||||
if(in_array($row->email, $mail_ar))
|
||||
continue;
|
||||
|
||||
$mail_ar[] = $row->email;
|
||||
|
||||
$vars = array(
|
||||
'main' => $main,
|
||||
'prenom' => $row->prenom,
|
||||
'nom' => $row->nom,
|
||||
'type_credit' => $credit_types[$row->type_credit],
|
||||
'reminder_num' => $reminder_to_send,
|
||||
'step' => $row->last_step,
|
||||
'token' => $row->token
|
||||
);
|
||||
$message = $main->renderTemplate($template_path, $vars);
|
||||
|
||||
/* echo 'message : ' . $message;
|
||||
die(); */
|
||||
|
||||
$to = $row->email;
|
||||
$subject = 'Rappel concernant votre demande de crédit';
|
||||
$headers = array('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
// Envoyer l'email
|
||||
/* $to = 'jps@esi-informatique.com'; */
|
||||
wp_mail($to, $subject, $message, $headers);
|
||||
|
||||
// Mettre à jour la base
|
||||
$wpdb->update(
|
||||
'cdf_Credit',
|
||||
array(
|
||||
'reminder_sent' => $reminder_to_send,
|
||||
'last_reminder' => $now->toDateTimeString()
|
||||
),
|
||||
array('idCredit' => $row->idCredit)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Initialiser le rappel
|
||||
CRED_Credit_Reminder::instance();
|
||||
522
app/libraries/factory.php
Normal file
@ -0,0 +1,522 @@
|
||||
<?php
|
||||
|
||||
class CRED_factory extends CRED_base {
|
||||
|
||||
public static $instance;
|
||||
public $main;
|
||||
public $forms;
|
||||
public $simulateur;
|
||||
public $creditReminder;
|
||||
public $creditManager;
|
||||
public $societesCreditManager;
|
||||
public $creditMailchimp;
|
||||
public $creditSendy;
|
||||
|
||||
public function __construct() {
|
||||
self::$instance = $this;
|
||||
|
||||
if($this->main === null)
|
||||
$this->main = $this->getMain();
|
||||
|
||||
if($this->forms === null)
|
||||
$this->forms = $this->getForms();
|
||||
|
||||
if($this->simulateur === null)
|
||||
$this->simulateur = $this->getSimulateur();
|
||||
|
||||
if($this->creditReminder === null)
|
||||
$this->creditReminder = $this->getCreditReminder();
|
||||
|
||||
if($this->creditManager === null)
|
||||
$this->creditManager = $this->getCreditManager();
|
||||
|
||||
if($this->societesCreditManager === null)
|
||||
$this->societesCreditManager = $this->getSocietesCreditManager();
|
||||
|
||||
if($this->creditMailchimp === null)
|
||||
$this->creditMailchimp = $this->getCreditMailchimp();
|
||||
|
||||
if($this->creditSendy === null)
|
||||
$this->creditSendy = $this->getCreditSendy();
|
||||
}
|
||||
|
||||
public function load_actions() {
|
||||
$this->action('template_redirect', array($this, 'load_frontend_assets'));
|
||||
|
||||
$this->action('init', array($this, 'init_hook'));
|
||||
|
||||
$this->action('init', array($this, 'load_shortcodes'));
|
||||
|
||||
$this->action('wp_ajax_ajax_regenerate_simulator', array($this->simulateur, 'ajax_regenerate_simulator'));
|
||||
$this->action('wp_ajax_nopriv_ajax_regenerate_simulator', array($this->simulateur, 'ajax_regenerate_simulator'));
|
||||
|
||||
// Hook pour le menu d'administration du Credit Manager
|
||||
$this->action('admin_menu', array($this, 'register_admin_menu'));
|
||||
|
||||
// Hook pour enregistrer les réglages Mailchimp (Settings API)
|
||||
$this->action('admin_init', array($this->creditMailchimp, 'register_settings'));
|
||||
|
||||
// Hook pour enregistrer les réglages Sendy (Settings API)
|
||||
$this->action('admin_init', array($this->creditSendy, 'register_settings'));
|
||||
|
||||
// Hook pour charger les assets du Credit Manager et Societes Credit Manager
|
||||
$this->action('admin_enqueue_scripts', array($this, 'enqueue_credit_manager_assets'));
|
||||
$this->action('admin_enqueue_scripts', array($this, 'enqueue_societes_credit_assets'));
|
||||
// Hook pour charger les assets de la page Mailchimp (admin)
|
||||
$this->action('admin_enqueue_scripts', array($this, 'enqueue_mailchimp_assets'));
|
||||
// Hook pour charger les assets de la page Sendy (admin)
|
||||
$this->action('admin_enqueue_scripts', array($this, 'enqueue_sendy_assets'));
|
||||
|
||||
// Hooks AJAX pour le Credit Manager
|
||||
$this->action('wp_ajax_credit_manager_create', array($this->creditManager, 'ajax_create_credit'));
|
||||
$this->action('wp_ajax_credit_manager_get', array($this->creditManager, 'ajax_get_credit'));
|
||||
$this->action('wp_ajax_credit_manager_update', array($this->creditManager, 'ajax_update_credit'));
|
||||
$this->action('wp_ajax_credit_manager_delete', array($this->creditManager, 'ajax_delete_credit'));
|
||||
$this->action('wp_ajax_credit_manager_list', array($this->creditManager, 'ajax_list_credits'));
|
||||
$this->action('wp_ajax_credit_manager_get_filter_options', array($this->creditManager, 'ajax_get_filter_options'));
|
||||
$this->action('wp_ajax_credit_manager_change_status', array($this->creditManager, 'ajax_change_credit_status'));
|
||||
$this->action('wp_ajax_credit_manager_update_status', array($this->creditManager, 'ajax_update_credit_status'));
|
||||
|
||||
// Hooks AJAX pour le Societes Credit Manager
|
||||
$this->action('wp_ajax_societes_credit_create', array($this->societesCreditManager, 'ajax_create_societe'));
|
||||
$this->action('wp_ajax_societes_credit_get', array($this->societesCreditManager, 'ajax_get_societe'));
|
||||
$this->action('wp_ajax_societes_credit_update', array($this->societesCreditManager, 'ajax_update_societe'));
|
||||
$this->action('wp_ajax_societes_credit_delete', array($this->societesCreditManager, 'ajax_delete_societe'));
|
||||
$this->action('wp_ajax_societes_credit_list', array($this->societesCreditManager, 'ajax_list_societes'));
|
||||
|
||||
// Hook AJAX pour tester la connexion Mailchimp
|
||||
$this->action('wp_ajax_cred_mailchimp_ping', array($this->creditMailchimp, 'ajax_ping'));
|
||||
|
||||
// Hook AJAX pour tester la connexion Sendy
|
||||
$this->action('wp_ajax_cred_sendy_ping', array($this->creditSendy, 'ajax_ping'));
|
||||
}
|
||||
|
||||
public function load_filters() {
|
||||
$this->filter('page_template',array($this->main,'CRED_page_template'));
|
||||
}
|
||||
|
||||
public function load_shortcodes() {
|
||||
|
||||
$this->shortcode('loan_simulator', array($this->simulateur,'simulateur_shortcode'));
|
||||
|
||||
}
|
||||
|
||||
public function action($hook, $function, $priority = 10, $accepted_args = 1) {
|
||||
// Check Parameters
|
||||
if(!trim($hook) or !$function) return false;
|
||||
|
||||
// Add it to WordPress actions
|
||||
return add_action($hook, $function, $priority, $accepted_args);
|
||||
}
|
||||
|
||||
public function filter($tag, $function, $priority = 10, $accepted_args = 1) {
|
||||
// Check Parameters
|
||||
if(!trim($tag) or !$function) return false;
|
||||
|
||||
// Add it to WordPress filters
|
||||
return add_filter($tag, $function, $priority, $accepted_args);
|
||||
}
|
||||
|
||||
public function load_frontend_assets() {
|
||||
|
||||
global $wpdb;
|
||||
global $post;
|
||||
|
||||
if (null === $post)
|
||||
return;
|
||||
|
||||
$includes_page = ['credit-step1', 'credit-step2', 'credit-step3', 'credit-step4', 'credit-step5', 'simulateur', 'simulateur-pret', 'accueil', 'page-daccueil', 'simulateur-pret-hypothecaire', 'pret-a-temperament-pret-personnel'];
|
||||
//includes posts
|
||||
$included_posts = ['simulation-pret-hypothecaire'];
|
||||
$ids_parents = [495,497,824,5359];
|
||||
$allooded_children = false;
|
||||
|
||||
if(null != $post && $post->post_pareent > 0) {
|
||||
if(in_array($post->post_parent, $ids_parents)) {
|
||||
$allooded_children = true;
|
||||
}
|
||||
}
|
||||
|
||||
$independent = $wpdb->get_results('SELECT * FROM cdf_Profession WHERE nom_profession IN ("Indépendant")');
|
||||
|
||||
//if page parent is not in the array, return
|
||||
/* if(!in_array($post->post_parent, $ids_parents)) return; */
|
||||
|
||||
$noEmployer = [];
|
||||
$info_pat = self::$instance->main->get_acf_audit_option('infos_pat_statut_maries_sans_separation_ds_biens');
|
||||
$noEmployerQuery = $wpdb->get_results(
|
||||
'SELECT * FROM cdf_Profession WHERE nom_profession IN (
|
||||
"Chômeur",
|
||||
"Invalide",
|
||||
"Pensionné",
|
||||
"Prépensionné",
|
||||
"Sans profession"
|
||||
)'
|
||||
);
|
||||
|
||||
foreach ($noEmployerQuery as $a) {
|
||||
$noEmployer[] = intval($a->idprofession);
|
||||
}
|
||||
|
||||
// Include css files
|
||||
|
||||
//if(is page parent in the array, include css files)
|
||||
|
||||
|
||||
if(!is_admin()) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(is_page($includes_page) || in_array($post->post_parent, $ids_parents) || is_single($included_posts)) {
|
||||
|
||||
wp_enqueue_style( 'bootstrap', $this->main->asset('css/bootstrap.min.css'), array(), '4.6.2' );
|
||||
wp_enqueue_style('cd-frontend-style', $this->main->asset('css/cd_main.css'));
|
||||
wp_enqueue_style('izimodal', $this->main->asset('css/iziModal.min.css'));
|
||||
|
||||
|
||||
/* wp_enqueue_script("bootstrap", $this->main->asset("/js/libraries/bootstrap.bundle.min.js"),array('jquery'),false,true);*/
|
||||
wp_enqueue_script("bootstrap-form", $this->main->asset("/js/libraries/jquery.bootstrap.wizard.min.js"),array('jquery'),false,true);
|
||||
wp_enqueue_script("izimodal", $this->main->asset("/js/libraries/iziModal.min.js"),array('jquery'),false,true);
|
||||
wp_enqueue_script("inputmask", $this->main->asset("/js/libraries/jquery.inputmask.min.js"),array('jquery'),false,true);
|
||||
|
||||
//include custom scripts
|
||||
/* wp_enqueue_script("cred_custom_js", $this->main->asset('js/cred_js.php'),array('jquery'),false,true); */
|
||||
//includes libraries scripts
|
||||
|
||||
wp_enqueue_script( 'jquery-ui-slider' );
|
||||
wp_enqueue_script("validate", $this->main->asset("/js/libraries/jquery.validate.min.js"),array('jquery'),false,true);
|
||||
wp_enqueue_script("additional-methods", $this->main->asset("/js/libraries/additional-methods.min.js"),array('jquery'),false,true);
|
||||
|
||||
wp_enqueue_script( 'jquery-ui-accordion' );
|
||||
wp_enqueue_script("jquery_repeater", $this->main->asset("/js/libraries/jquery.repeater.min.js"),array('jquery'),false,true);
|
||||
|
||||
//include main script
|
||||
wp_enqueue_script("cred_main_js", $this->main->asset('js/cd_main.js'),array('jquery'),'1.0.1',true);
|
||||
wp_enqueue_script("cred_form_js", $this->main->asset('js/form_main.js'),array('jquery'),'1.0.0',true);
|
||||
|
||||
// Cloudflare Turnstile script
|
||||
/* if (\libraries\TurnstileValidator::isConfigured()) {
|
||||
wp_enqueue_script("cloudflare-turnstile", "https://challenges.cloudflare.com/turnstile/v0/api.js", array(), null, true);
|
||||
} */
|
||||
|
||||
|
||||
wp_localize_script( 'cred_main_js', 'cd_js',
|
||||
array(
|
||||
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
|
||||
'groups' => CRED_Main::get_groups_vars(),
|
||||
'site_url' => site_url(),
|
||||
'nonce' => wp_create_nonce( "cd_47ax_412m" ),
|
||||
'independent' => intval($independent[0]->idprofession),
|
||||
'noEmployer' => $noEmployer,
|
||||
'info_pat' => $info_pat
|
||||
)
|
||||
);
|
||||
|
||||
// Enregistrement du script du simulateur
|
||||
wp_enqueue_script('cd-simulator', $this->main->asset('js/cd_simulator.js'), array('jquery'), '1.0.0', true);
|
||||
|
||||
// Localisation du script
|
||||
wp_localize_script('cd-simulator', 'cred_simulator', array(
|
||||
'ajax_url' => admin_url('admin-ajax.php'),
|
||||
'nonce' => wp_create_nonce('cred_simulator_nonce')
|
||||
));
|
||||
|
||||
// Charger les assets pour la gestion des bâtiments (credit-one-step)
|
||||
if(is_page('credit-step1')) {
|
||||
wp_enqueue_style('cd-buildings-style', $this->main->asset('css/buildings.css'), array(), '1.0.0');
|
||||
wp_enqueue_script('cd-buildings-manager', $this->main->asset('js/buildings-manager.js'), array('jquery'), '1.0.0', true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function load_backend_assets() {
|
||||
|
||||
if(is_admin()) {
|
||||
wp_dequeue_style('bootstrap');
|
||||
|
||||
wp_dequeue_script('bootstrap');
|
||||
wp_dequeue_script('bootstrap');
|
||||
wp_dequeue_script('validate');
|
||||
wp_dequeue_script('additional-methods');
|
||||
wp_dequeue_script('bootstrap-form');
|
||||
wp_dequeue_script('jquery_repeater');
|
||||
wp_dequeue_script('cred_main_js');
|
||||
wp_dequeue_script('cred_form_js');
|
||||
|
||||
// Enqueue des assets du credit manager pour l'administration
|
||||
$this->action('admin_enqueue_scripts', array($this, 'enqueue_credit_manager_assets'));
|
||||
$this->action('admin_enqueue_scripts', array($this, 'enqueue_societes_credit_assets'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue des assets du credit manager - limité à la page credit-manager
|
||||
*/
|
||||
public function enqueue_credit_manager_assets($hook) {
|
||||
// Charger seulement sur la page credit-manager (hook ou via le paramètre page)
|
||||
$should_enqueue = ($hook === 'toplevel_page_credit-manager');
|
||||
if (!$should_enqueue && isset($_GET['page']) && $_GET['page'] === 'credit-manager') {
|
||||
$should_enqueue = true;
|
||||
}
|
||||
if (!$should_enqueue) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Font Awesome 7 (Kit personnel)
|
||||
wp_enqueue_style(
|
||||
'font-awesome-kit',
|
||||
'https://kit.fontawesome.com/a029b5a0f4.css',
|
||||
array(),
|
||||
'7.0.0'
|
||||
);
|
||||
|
||||
// Enqueue des assets communs (DataTables + CSS personnalisé)
|
||||
$this->enqueue_common_credit_admin_assets();
|
||||
|
||||
// DataTables Buttons CSS
|
||||
wp_enqueue_style(
|
||||
'datatables-buttons-css',
|
||||
'https://cdn.datatables.net/buttons/2.4.2/css/buttons.dataTables.min.css',
|
||||
array('datatables-css'),
|
||||
'2.4.2'
|
||||
);
|
||||
|
||||
// JSZip (requis pour Excel)
|
||||
wp_enqueue_script(
|
||||
'jszip',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js',
|
||||
array(),
|
||||
'3.10.1',
|
||||
true
|
||||
);
|
||||
|
||||
// DataTables Buttons
|
||||
wp_enqueue_script(
|
||||
'datatables-buttons',
|
||||
'https://cdn.datatables.net/buttons/2.4.2/js/dataTables.buttons.min.js',
|
||||
array('datatables-js'),
|
||||
'2.4.2',
|
||||
true
|
||||
);
|
||||
|
||||
// Buttons HTML5 export
|
||||
wp_enqueue_script(
|
||||
'datatables-buttons-html5',
|
||||
'https://cdn.datatables.net/buttons/2.4.2/js/buttons.html5.min.js',
|
||||
array('datatables-buttons', 'jszip'),
|
||||
'2.4.2',
|
||||
true
|
||||
);
|
||||
|
||||
// JavaScript personnalisé
|
||||
wp_enqueue_script(
|
||||
'credit-manager-js',
|
||||
$this->main->asset('js/credit-manager.js'),
|
||||
array('datatables-js', 'datatables-buttons', 'datatables-buttons-html5', 'select2-js'),
|
||||
'1.0.0',
|
||||
true
|
||||
);
|
||||
|
||||
// Localiser les variables JavaScript
|
||||
wp_localize_script('credit-manager-js', 'creditManagerAjax', array(
|
||||
'ajaxurl' => admin_url('admin-ajax.php'),
|
||||
'nonce' => wp_create_nonce('credit_manager_action')
|
||||
));
|
||||
}
|
||||
|
||||
public function enqueue_mailchimp_assets($hook) {
|
||||
$should_enqueue = ($hook === 'credit-manager_page_credit-mailchimp');
|
||||
if (!$should_enqueue && isset($_GET['page']) && $_GET['page'] === 'credit-mailchimp') {
|
||||
$should_enqueue = true;
|
||||
}
|
||||
if (!$should_enqueue) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Charger uniquement le JS commun sans DataTables ni CSS lourds
|
||||
wp_enqueue_script(
|
||||
'credit-manager-js',
|
||||
$this->main->asset('js/credit-manager.js'),
|
||||
array('jquery', 'select2-js'),
|
||||
'1.0.0',
|
||||
true
|
||||
);
|
||||
|
||||
// Localiser uniquement ce qui est nécessaire pour le test Mailchimp
|
||||
wp_localize_script('credit-manager-js', 'creditManagerAjax', array(
|
||||
'ajaxurl' => admin_url('admin-ajax.php'),
|
||||
'mailchimpPingNonce' => wp_create_nonce('cred_mailchimp_ping')
|
||||
));
|
||||
}
|
||||
|
||||
public function enqueue_sendy_assets($hook) {
|
||||
$should_enqueue = ($hook === 'credit-manager_page_credit-sendy');
|
||||
if (!$should_enqueue && isset($_GET['page']) && $_GET['page'] === 'credit-sendy') {
|
||||
$should_enqueue = true;
|
||||
}
|
||||
if (!$should_enqueue) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Charger uniquement le JS commun sans DataTables ni CSS lourds
|
||||
wp_enqueue_script(
|
||||
'credit-manager-js',
|
||||
$this->main->asset('js/credit-manager.js'),
|
||||
array('jquery', 'select2-js'),
|
||||
'1.0.0',
|
||||
true
|
||||
);
|
||||
|
||||
// Localiser uniquement ce qui est nécessaire pour le test Sendy
|
||||
wp_localize_script('credit-manager-js', 'creditManagerAjax', array(
|
||||
'ajaxurl' => admin_url('admin-ajax.php'),
|
||||
'sendyPingNonce' => wp_create_nonce('cred_sendy_ping')
|
||||
));
|
||||
}
|
||||
|
||||
public function shortcode($shortcode, $function) {
|
||||
// Check Parameters
|
||||
if(!trim($shortcode) or !$function) return false;
|
||||
|
||||
// Add it to WordPress shortcodes
|
||||
return add_shortcode($shortcode, $function);
|
||||
}
|
||||
|
||||
public function init_hook() {
|
||||
|
||||
//create table
|
||||
/* CRED_Main::create_db_tables(); */
|
||||
|
||||
/* CRED_Main::create_uploadr_page();
|
||||
|
||||
CRED_Main::start_session(); */
|
||||
|
||||
//register post type
|
||||
CRED_Main::cred_register_post_type('agences','Agence Physique','Agence','Agences','dashicons-building','f');
|
||||
|
||||
//register agence taxonomy
|
||||
CRED_Main::cred_register_post_taxonomy('agences_email','agences','Emails agence','Email','Emails','','m');
|
||||
|
||||
//load shortcode
|
||||
$this->load_shortcodes();
|
||||
|
||||
//load frontend styles and scripts
|
||||
/* $this->load_frontend_assets(); */
|
||||
|
||||
//load backend styles and scripts
|
||||
$this->load_backend_assets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enregistrer le menu d'administration du Credit Manager
|
||||
*/
|
||||
public function register_admin_menu() {
|
||||
$creditManager = $this->creditManager;
|
||||
if ($creditManager) {
|
||||
$creditManager->add_admin_menu();
|
||||
}
|
||||
|
||||
$societesCreditManager = $this->societesCreditManager;
|
||||
if ($societesCreditManager) {
|
||||
$societesCreditManager->add_admin_menu();
|
||||
}
|
||||
|
||||
$creditMailchimp = $this->creditMailchimp;
|
||||
if ($creditMailchimp) {
|
||||
$creditMailchimp->add_admin_menu();
|
||||
}
|
||||
|
||||
$creditSendy = $this->creditSendy;
|
||||
if ($creditSendy) {
|
||||
$creditSendy->add_admin_menu();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue des assets du societes credit manager - limité à la page societes-credit-manager
|
||||
*/
|
||||
public function enqueue_societes_credit_assets($hook) {
|
||||
// Charger seulement sur la page societes-credit-manager (sous-menu de credit-manager)
|
||||
$should_enqueue = ($hook === 'credit-manager_page_societes-credit-manager');
|
||||
if (!$should_enqueue && isset($_GET['page']) && $_GET['page'] === 'societes-credit-manager') {
|
||||
$should_enqueue = true;
|
||||
}
|
||||
if (!$should_enqueue) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Enqueue des assets communs (DataTables + CSS personnalisé)
|
||||
$this->enqueue_common_credit_admin_assets();
|
||||
|
||||
// Script spécifique à la page Sociétés de Crédit
|
||||
wp_enqueue_script(
|
||||
'societes-credit-manager-js',
|
||||
$this->main->asset('js/societes-credit-manager.js'),
|
||||
array('datatables-js', 'select2-js'),
|
||||
'1.0.0',
|
||||
true
|
||||
);
|
||||
|
||||
// Variables JS pour AJAX (nonce aligné avec les contrôleurs)
|
||||
wp_localize_script('societes-credit-manager-js', 'societesCreditAjax', array(
|
||||
'ajaxurl' => admin_url('admin-ajax.php'),
|
||||
'nonce' => wp_create_nonce('societes_credit_action')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue des assets communs aux pages d'administration liées au Credit Manager
|
||||
* - DataTables CSS/JS
|
||||
* - CSS commun du Credit Manager
|
||||
*/
|
||||
private function enqueue_common_credit_admin_assets() {
|
||||
// Select2 CSS (CDN)
|
||||
wp_enqueue_style(
|
||||
'select2-css',
|
||||
'https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css',
|
||||
array(),
|
||||
'4.1.0-rc.0'
|
||||
);
|
||||
|
||||
// Select2 JS (CDN)
|
||||
wp_enqueue_script(
|
||||
'select2-js',
|
||||
'https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js',
|
||||
array('jquery'),
|
||||
'4.1.0-rc.0',
|
||||
true
|
||||
);
|
||||
|
||||
// DataTables CSS
|
||||
wp_enqueue_style(
|
||||
'datatables-css',
|
||||
$this->main->node_modules('datatables.net-dt/css/dataTables.dataTables.min.css'),
|
||||
array(),
|
||||
'1.13.7'
|
||||
);
|
||||
|
||||
// DataTables JS
|
||||
wp_enqueue_script(
|
||||
'datatables-js',
|
||||
$this->main->node_modules('datatables.net/js/dataTables.min.js'),
|
||||
array('jquery'),
|
||||
'1.13.7',
|
||||
true
|
||||
);
|
||||
|
||||
// CSS commun du Credit Manager
|
||||
wp_enqueue_style(
|
||||
'credit-manager-css',
|
||||
$this->main->asset('css/credit-manager.css'),
|
||||
array('datatables-css'),
|
||||
'1.0.0'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
5
app/libraries/forms.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class CRED_forms extends CRED_base {
|
||||
|
||||
}
|
||||
632
app/libraries/main.php
Normal file
@ -0,0 +1,632 @@
|
||||
<?php
|
||||
|
||||
class CRED_Main extends CRED_base {
|
||||
|
||||
public static $instance;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
self::$instance = $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns plugin absolute path
|
||||
* @return string
|
||||
*/
|
||||
public function get_plugin_path()
|
||||
{
|
||||
return _CRED_ABSPATH_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns full URL of an asset
|
||||
* @param string $asset
|
||||
* @return string
|
||||
*/
|
||||
public function asset($asset)
|
||||
{
|
||||
return self::URL('CRED') . 'assets/' . $asset;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the path of the node modules
|
||||
* @return string
|
||||
*/
|
||||
public function node_modules($module)
|
||||
{
|
||||
return self::URL('CRED') . 'node_modules/' . $module;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns full URL of a template
|
||||
* @params string $template, string $domain, boolean $is_email
|
||||
* @return string
|
||||
*/
|
||||
public static function template($template, $domain='admin', $is_email = false) {
|
||||
$template_url = self::full_path().'templates/admin/'.$template;
|
||||
|
||||
if($domain !== 'admin')
|
||||
$template_url = self::full_path().'templates/'.$domain.'/'.$template;
|
||||
|
||||
if($is_email)
|
||||
$template_url = self::full_path().'templates/email/'.$template;
|
||||
|
||||
return $template_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* return a template html
|
||||
* @param url
|
||||
* @return string
|
||||
* */
|
||||
public function renderTemplate($url, $vars = array(), $used_var_index = true) {
|
||||
|
||||
if(!empty($vars)) {
|
||||
if($used_var_index) {
|
||||
foreach ($vars as $key => $value) {
|
||||
$$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
include $url;
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns URL of WordPress items such as site, admin, plugins, ANA plugin etc.
|
||||
* @param string $type
|
||||
* @return string
|
||||
*/
|
||||
public static function URL($type = 'site')
|
||||
{
|
||||
// Make it lowercase
|
||||
$type = strtolower($type);
|
||||
$url = "";
|
||||
|
||||
// Frontend
|
||||
if(in_array($type, array('frontend','site'))) $url = site_url().'/';
|
||||
// Backend
|
||||
elseif(in_array($type, array('backend','admin'))) $url = admin_url();
|
||||
// WordPress Content directory URL
|
||||
elseif($type === 'content') $url = content_url().'/';
|
||||
// WordPress plugins directory URL
|
||||
elseif($type === 'plugin') $url = plugins_url().'/';
|
||||
// WordPress include directory URL
|
||||
elseif($type === 'include') $url = includes_url();
|
||||
// Webnus MEC plugin URL
|
||||
elseif($type === 'cred')
|
||||
{
|
||||
// If plugin installed regularly on plugins directory
|
||||
if(!defined('CRED_IN_THEME')) $url = plugins_url() .'/'._CRED_DIRNAME_.'/';
|
||||
// If plugin embeded into one theme
|
||||
else $url = get_template_directory_uri().'/plugins/'._CRED_DIRNAME_.'/';
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns absolute path of file
|
||||
* @param string $type
|
||||
* @return string
|
||||
*/
|
||||
public static function full_path() {
|
||||
|
||||
$path = WP_PLUGIN_DIR .'/'._CRED_DIRNAME_.'/';
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an acf option based on the field name
|
||||
* @return string, object or array depending on the field type
|
||||
* */
|
||||
public static function get_acf_audit_option($field_name) {
|
||||
|
||||
if(empty($field_name) && !isset($field_name)) return false;
|
||||
|
||||
$field = get_field($field_name, 'option');
|
||||
|
||||
if(!$field)
|
||||
return false;
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function get_groups_vars() {
|
||||
|
||||
$vars_groups = array(
|
||||
'pret_personnel__tous_motifs__achats_divers' => self::get_acf_audit_option('pret_personnel__tous_motifs__achats_divers'),
|
||||
'financement_frais_de_notaire' => self::get_acf_audit_option('financement_frais_de_notaire'),
|
||||
'credit_travaux__renovation__energie' => self::get_acf_audit_option('credit_travaux__renovation__energie'),
|
||||
'financement_vehicule_neuf' => self::get_acf_audit_option('financement_vehicule_neuf'),
|
||||
'financement_vehicule_doccasion_moins_de_3_ans' => self::get_acf_audit_option('financement_vehicule_d’occasion_moins_de_3_ans'),
|
||||
'financement_vehicule_doccasion_plus_de_3_ans' => self::get_acf_audit_option('financement_vehicule_d’occasion_plus_de_3_ans'),
|
||||
'financement_mobilhome_et_caravane_de_moins_de_3_ans' => self::get_acf_audit_option('financement_mobilhome_et_caravane_de_moins_de_3_ans'),
|
||||
'credit_hypothecaire_classique' => self::get_acf_audit_option('credit_hypothecaire_classique'),
|
||||
'credit_hypothecaire_social' => self::get_acf_audit_option('credit_hypothecaire_social'),
|
||||
'achat_maison_de_rapport' => self::get_acf_audit_option('achat_maison_de_rapport'),
|
||||
'credit_pont' => self::get_acf_audit_option('credit_pont'),
|
||||
'independants_et_entreprises_en_difficultes' => self::get_acf_audit_option('independants_et_entreprises_en_difficultes'),
|
||||
'regroupement_de_credit__rachats_de_credits' => self::get_acf_audit_option('regroupement_de_credit__rachats_de_credits'),
|
||||
'fonds_roulement_independants' => self::get_acf_audit_option('fonds_roulement_independants'),
|
||||
);
|
||||
|
||||
return $vars_groups;
|
||||
}
|
||||
|
||||
public static function create_db_tables() {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
||||
|
||||
$charset_collate = $wpdb->get_charset_collate();
|
||||
|
||||
/**
|
||||
* CREATE TABLE `$wpdb->dbname`.`cdf_Agences` (
|
||||
`idAgences` INT NOT NULL AUTO_INCREMENT,
|
||||
`Nom_agence` VARCHAR(45) NULL,
|
||||
`description_agence` VARCHAR(255) NULL,
|
||||
PRIMARY KEY (`idAgences`))
|
||||
ENGINE = InnoDB;
|
||||
CREATE TABLE `$wpdb->dbname`.`cdf_Emails` (
|
||||
`idEmails` INT NOT NULL AUTO_INCREMENT,
|
||||
`email` VARCHAR(45) NOT NULL,
|
||||
PRIMARY KEY (`idEmails`))
|
||||
ENGINE = InnoDB;
|
||||
CREATE TABLE `$wpdb->dbname`.`cdf_Agences_emails` (
|
||||
`FK_agence` INT NULL,
|
||||
`FK_email` INT NULL,
|
||||
`type_email` VARCHAR(45) NOT NULL,
|
||||
CONSTRAINT `FK_agence`
|
||||
FOREIGN KEY (`FK_agence`)
|
||||
REFERENCES `cdf_Agences` (`idAgences`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `FK_email`
|
||||
FOREIGN KEY (`FK_email`)
|
||||
REFERENCES `cdf_Emails` (`idEmails`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
||||
*/
|
||||
|
||||
$sql = "
|
||||
CREATE TABLE `$wpdb->dbname`.`cdf_Profession` (
|
||||
`idprofession` INT NOT NULL AUTO_INCREMENT,
|
||||
`nom_profession` VARCHAR(45) NULL,
|
||||
PRIMARY KEY (`idprofession`))
|
||||
ENGINE = InnoDB;
|
||||
CREATE TABLE `$wpdb->dbname`.`cdf_Options_credit_auto` (
|
||||
`idOptions_credit_auto` INT NOT NULL AUTO_INCREMENT,
|
||||
`marque` VARCHAR(45) NULL,
|
||||
`date_immatriculation` DATE NULL,
|
||||
`nom_vendeur` VARCHAR(45) NULL,
|
||||
`adresse_vendeur` VARCHAR(45) NULL,
|
||||
`prix_vehicule` FLOAT NULL,
|
||||
`montant_accompte` FLOAT NULL,
|
||||
`montant_reprise` FLOAT NULL,
|
||||
`montant_emprunt` FLOAT NULL,
|
||||
`duree` INT NULL,
|
||||
PRIMARY KEY (`idOptions_credit_auto`))
|
||||
ENGINE = InnoDB;
|
||||
CREATE TABLE `$wpdb->dbname`.`cdf_Options_credit_hypotecaire` (
|
||||
`idOptions_credit_hypotecaire` INT NOT NULL AUTO_INCREMENT,
|
||||
`type_credit` VARCHAR(45) NULL,
|
||||
`prix_achat` FLOAT NULL,
|
||||
`prix_construction_tvac` FLOAT NULL,
|
||||
`frais_notaire_pays` FLOAT NULL,
|
||||
`valeur_batiment` FLOAT NULL,
|
||||
`fonds_propre` FLOAT NULL,
|
||||
`compromis_signe` INT NULL,
|
||||
`montant_revenu_cadastral` FLOAT NULL,
|
||||
`montant_a_emprunter` FLOAT NULL,
|
||||
`duree` INT NULL,
|
||||
PRIMARY KEY (`idOptions_credit_hypotecaire`))
|
||||
ENGINE = InnoDB;
|
||||
CREATE TABLE `$wpdb->dbname`.`cdf_Credit` (
|
||||
`idCredit` INT NOT NULL AUTO_INCREMENT,
|
||||
`type_credit` VARCHAR(45) NULL,
|
||||
`capital` VARCHAR(45) NULL,
|
||||
`duree` VARCHAR(45) NULL,
|
||||
`cout_total` VARCHAR(45) NULL,
|
||||
`mensualite` VARCHAR(45) NULL,
|
||||
`taux_nominal_annuel` VARCHAR(45) NULL,
|
||||
`rgpd` VARCHAR(45) NULL,
|
||||
`create_date` DATETIME NULL DEFAULT NULL,
|
||||
`last_update_date` DATETIME NULL DEFAULT NULL,
|
||||
`last_step` TINYINT NOT NULL DEFAULT '1',
|
||||
`token` VARCHAR(45) NULL,
|
||||
`FK_credit_auto` INT NULL,
|
||||
`FK_credit_hypothecaire` INT NULL,
|
||||
PRIMARY KEY (`idCredit`),
|
||||
INDEX `FK_credit_auto_idx` (`FK_credit_auto` ASC),
|
||||
INDEX `FK_credit_hypothecaire_idx` (`FK_credit_hypothecaire` ASC),
|
||||
CONSTRAINT `FK_credit_auto`
|
||||
FOREIGN KEY (`FK_credit_auto`)
|
||||
REFERENCES `cdf_Options_credit_auto` (`idOptions_credit_auto`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `FK_credit_hypothecaire`
|
||||
FOREIGN KEY (`FK_credit_hypothecaire`)
|
||||
REFERENCES `cdf_Options_credit_hypotecaire` (`idOptions_credit_hypotecaire`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
||||
CREATE TABLE `$wpdb->dbname`.`cdf_Etat_civil` (
|
||||
`idetat_civil` INT NOT NULL AUTO_INCREMENT,
|
||||
`nom_etat_civil` VARCHAR(45) NULL,
|
||||
PRIMARY KEY (`idetat_civil`))
|
||||
ENGINE = InnoDB;
|
||||
CREATE TABLE `$wpdb->dbname`.`cdf_Emprunteur` (
|
||||
`idemprunteur` INT NOT NULL AUTO_INCREMENT,
|
||||
`nom` VARCHAR(45) NULL,
|
||||
`num_registre_national` VARCHAR(45) NULL,
|
||||
`prenom` VARCHAR(45) NULL,
|
||||
`telephone` VARCHAR(45) NULL,
|
||||
`email` VARCHAR(45) NULL,
|
||||
`date_naissance` DATE NULL,
|
||||
`lieu_naissance` VARCHAR(45) NULL,
|
||||
`nationalité` VARCHAR(45) NULL,
|
||||
`num_carte_identite` VARCHAR(45) NULL,
|
||||
`carte_identite_validite` DATE NULL,
|
||||
`num_compte_bancaire` VARCHAR(45) NULL,
|
||||
`adresse` VARCHAR(45) NULL,
|
||||
`code_postal` INT NULL,
|
||||
`localite` VARCHAR(45) NULL,
|
||||
`pays` VARCHAR(45) NULL,
|
||||
`date_emmenagement` DATE NULL,
|
||||
`enfant_charge` INT NULL,
|
||||
`contract_type` VARCHAR(45) NULL,
|
||||
`nom_employeur` VARCHAR(45) NULL,
|
||||
`numero_entreprise` VARCHAR(45) NULL,
|
||||
`adresse_employeur` VARCHAR(45) NULL,
|
||||
`code_postal_employeur` VARCHAR(45) NULL,
|
||||
`localite_employeur` VARCHAR(45) NULL,
|
||||
`pays_employeur` VARCHAR(45) NULL,
|
||||
`date_engagement` DATE NULL,
|
||||
`salaire` FLOAT NULL,
|
||||
`cheque_repas` FLOAT NULL,
|
||||
`revenus_locatifs` FLOAT NULL,
|
||||
`chomage` FLOAT NULL,
|
||||
`autre_revenu_montant` FLOAT NULL,
|
||||
`autre_revenu_type` VARCHAR(45) NULL,
|
||||
`parent_emprunteur` INT NULL,
|
||||
`habitation_type` VARCHAR(45) NULL,
|
||||
`habitation_loyer` FLOAT NULL,
|
||||
`habitation_charge_hypothecaire` VARCHAR(45) NULL,
|
||||
`habitation_sans_charge_locative` VARCHAR(45) NULL,
|
||||
`remarques` TEXT NULL,
|
||||
`FK_demande_creditdirect` INT NULL,
|
||||
`FK_agence` INT NULL,
|
||||
`FK_profession` INT NULL,
|
||||
`FK_etat_civil` INT NULL,
|
||||
PRIMARY KEY (`idemprunteur`),
|
||||
INDEX `FK_profession_idx` (`FK_profession` ASC),
|
||||
INDEX `FK_agences_idx` (`FK_agence` ASC),
|
||||
INDEX `FK_demande_credit_idx` (`FK_demande_creditdirect` ASC),
|
||||
INDEX `FK_etat_civil_idx` (`FK_etat_civil` ASC),
|
||||
CONSTRAINT `FK_profession`
|
||||
FOREIGN KEY (`FK_profession`)
|
||||
REFERENCES `cdf_Profession` (`idprofession`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `FK_agences`
|
||||
FOREIGN KEY (`FK_agence`)
|
||||
REFERENCES `cdf_Agences` (`idAgences`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `FK_demande_credit`
|
||||
FOREIGN KEY (`FK_demande_creditdirect`)
|
||||
REFERENCES `cdf_Credit` (`idCredit`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `FK_etat_civil`
|
||||
FOREIGN KEY (`FK_etat_civil`)
|
||||
REFERENCES `cdf_Etat_civil` (`idetat_civil`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
||||
CREATE TABLE `$wpdb->dbname`.`cdf_Type_creance` (
|
||||
`idtype_creance` INT NOT NULL AUTO_INCREMENT,
|
||||
`nom_creance` VARCHAR(45) NULL,
|
||||
PRIMARY KEY (`idtype_creance`))
|
||||
ENGINE = InnoDB;
|
||||
CREATE TABLE `$wpdb->dbname`.`cdf_Autre_credit` (
|
||||
`idautrecredit` INT NOT NULL AUTO_INCREMENT,
|
||||
`banque` VARCHAR(45) NULL,
|
||||
`montant` FLOAT NULL,
|
||||
`duree_credit` INT NULL,
|
||||
`mensualite` INT NULL,
|
||||
`date_premiere_echeance` DATE NULL,
|
||||
`solde_restant_du` FLOAT NULL,
|
||||
`cloture` INT NULL,
|
||||
`solde` FLOAT NULL,
|
||||
`FK_type_creance` INT NULL,
|
||||
`FK_emprunteur` INT NULL,
|
||||
PRIMARY KEY (`idautrecredit`),
|
||||
INDEX `FK_type_creance_idx` (`FK_type_creance` ASC),
|
||||
INDEX `FK_emprunteur_idx` (`FK_emprunteur` ASC),
|
||||
CONSTRAINT `FK_type_creance`
|
||||
FOREIGN KEY (`FK_type_creance`)
|
||||
REFERENCES `cdf_Type_creance` (`idtype_creance`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `FK_emprunteur`
|
||||
FOREIGN KEY (`FK_emprunteur`)
|
||||
REFERENCES `cdf_Emprunteur` (`idemprunteur`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
||||
";
|
||||
|
||||
dbDelta( $sql );
|
||||
|
||||
/**
|
||||
* Hydrate table Agence
|
||||
*/
|
||||
/* $result = $wpdb->get_results('SELECT * FROM cdf_Agences LIMIT 0,1');
|
||||
|
||||
if (empty($result)) {
|
||||
dbDelta(
|
||||
"INSERT INTO cdf_Agences (Nom_agence, description_agence) VALUES
|
||||
(\"Verviers\", NULL),
|
||||
(\"Mons\", NULL),
|
||||
(\"Liège\", NULL),
|
||||
(\"Arlon\", NULL);"
|
||||
);
|
||||
} */
|
||||
|
||||
/**
|
||||
* Hydrate table Email
|
||||
*/
|
||||
/* $result = $wpdb->get_results('SELECT * FROM cdf_Emails LIMIT 0,1');
|
||||
|
||||
if (empty($result)) {
|
||||
dbDelta(
|
||||
"INSERT INTO cdf_Emails (email) VALUES
|
||||
(\"pat@credit-direct.be\"),
|
||||
(\"sylviane@credit-direct.be\"),
|
||||
(\"annick@credit-direct.be\");"
|
||||
);
|
||||
} */
|
||||
|
||||
/**
|
||||
* Hydrate table Email
|
||||
*/
|
||||
/* $result = $wpdb->get_results('SELECT * FROM cdf_Agences_emails LIMIT 0,1');
|
||||
|
||||
if (empty($result)) {
|
||||
dbDelta(
|
||||
"INSERT INTO cdf_Agences_emails (FK_agence, FK_email, type_email) VALUES
|
||||
(1, 1, \"to\"),
|
||||
(2, 2, \"to\"),
|
||||
(2, 1, \"cc\"),
|
||||
(2, 3, \"cc\"),
|
||||
(3, 1, \"to\"),
|
||||
(4, 1, \"to\");"
|
||||
);
|
||||
} */
|
||||
|
||||
/**
|
||||
* Hydrate table Etat_civil
|
||||
*/
|
||||
$result = $wpdb->get_results('SELECT * FROM cdf_Etat_civil LIMIT 0,1');
|
||||
|
||||
if (empty($result)) {
|
||||
dbDelta(
|
||||
"INSERT INTO cdf_Etat_civil (nom_etat_civil) VALUES
|
||||
(\"Célibataire\"),
|
||||
(\"Divorcé(e)\"),
|
||||
(\"Marié(e) avec contract de séparation de biens\"),
|
||||
(\"Marié(e) sans contract de séparation de biens\"),
|
||||
(\"Séparé(e)\"),
|
||||
(\"Veuf(ve)\");"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hydrate table Profession
|
||||
*/
|
||||
$result = $wpdb->get_results('SELECT * FROM cdf_Profession LIMIT 0,1');
|
||||
|
||||
if (empty($result)) {
|
||||
dbDelta(
|
||||
"INSERT INTO cdf_Profession (nom_profession) VALUES
|
||||
(\"Chômeur\"),
|
||||
(\"Employé\"),
|
||||
(\"Enseignant\"),
|
||||
(\"Fonctionnaire\"),
|
||||
(\"Indépendant\"),
|
||||
(\"Invalide\"),
|
||||
(\"Militaire\"),
|
||||
(\"Ouvrier\"),
|
||||
(\"Pensionné\"),
|
||||
(\"Policier\"),
|
||||
(\"Prépensionné\"),
|
||||
(\"Sans profession\");"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hydrate table Profession
|
||||
*/
|
||||
$result = $wpdb->get_results('SELECT * FROM cdf_Type_creance LIMIT 0,1');
|
||||
|
||||
if (empty($result)) {
|
||||
dbDelta(
|
||||
"INSERT INTO cdf_Type_creance (nom_creance) VALUES
|
||||
(\"Carte de crédit\"),
|
||||
(\"Crédit ballon\"),
|
||||
(\"Découvert bancaire\"),
|
||||
(\"Financement véhicule\"),
|
||||
(\"Leasing\"),
|
||||
(\"Pension alimentaire à payer\"),
|
||||
(\"Prêt à tempérament\"),
|
||||
(\"Prêt hypothécaire\"),
|
||||
(\"Réserve d'argent\");"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static function create_uploadr_page() {
|
||||
// Setup custom vars
|
||||
$author_id = 1;
|
||||
$total_step = 4;
|
||||
for($i=1; $i<=$total_step; $i++){
|
||||
$possibleCurrentPage = get_page_by_path('credit-step' . $i);
|
||||
|
||||
if (is_null($possibleCurrentPage)) {
|
||||
$step = array(
|
||||
'comment_status' => 'closed',
|
||||
'ping_status' => 'closed',
|
||||
'post_author' => $author_id,
|
||||
'post_name' => "credit-step" . $i,
|
||||
'post_title' => "credit-step" . $i,
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'page',
|
||||
'page_template' => 'credit-step' . $i
|
||||
);
|
||||
$post_id = wp_insert_post($step);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function start_session() {
|
||||
if(!session_id()) {
|
||||
session_start();
|
||||
}
|
||||
}
|
||||
|
||||
public static function CRED_page_template($page_template) {
|
||||
|
||||
if (!defined('WP_CREDIT_FORM_PATH')) {
|
||||
define('WP_CREDIT_FORM_PATH', dirname(__FILE__));
|
||||
}
|
||||
|
||||
if ( is_page( 'credit-step1' ) ) {
|
||||
$page_template = _CRED_BASE_PATH_ . '/app/controllers/credit-step1.php';
|
||||
}elseif (is_page( 'credit-step2' )) {
|
||||
$page_template = _CRED_BASE_PATH_ . '/app/controllers/credit-step2.php';
|
||||
}elseif (is_page( 'credit-step3' )) {
|
||||
$page_template = _CRED_BASE_PATH_ . '/app/controllers/credit-step3.php';
|
||||
}elseif (is_page( 'credit-step4' )) {
|
||||
$page_template = _CRED_BASE_PATH_ . '/app/controllers/credit-step4.php';
|
||||
}elseif (is_page( 'credit-step5' )) {
|
||||
$page_template = _CRED_BASE_PATH_ . '/app/controllers/credit-step5.php';
|
||||
}
|
||||
|
||||
return $page_template;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static function cred_register_post_type($name, $label, $singular_label, $plural_label, $icon, $genre,$support=array()) {
|
||||
|
||||
$genre_labels = array(
|
||||
array('f' => 'Toutes', 'm' => 'Tous'),
|
||||
array('f' => 'Nouvelle', 'm' => 'Nouveau'),
|
||||
array('f' => 'trouvée', 'm' => 'trouvé'),
|
||||
array('f' => 'une', 'm' => 'un'),
|
||||
);
|
||||
|
||||
if(empty($support)) {
|
||||
$support = array(
|
||||
'title',
|
||||
);
|
||||
}
|
||||
|
||||
register_post_type(
|
||||
$name,
|
||||
array(
|
||||
'label' => $label,
|
||||
'labels' => array(
|
||||
'name' => $label,
|
||||
'singular_name' => $singular_label,
|
||||
'all_items' => $genre_labels[0][$genre].' les '.strtolower($plural_label),
|
||||
'add_new_item' => 'Ajouter une '.strtolower($singular_label),
|
||||
'edit_item' => 'Éditer '.$genre_labels[3][$genre].' '.strtolower($singular_label),
|
||||
'new_item' => $genre_labels[1][$genre].' '.strtolower($singular_label),
|
||||
'view_item' => 'Voir le '.strtolower($plural_label),
|
||||
'search_items' => 'Rechercher parmi les '.strtolower($plural_label),
|
||||
'not_found' => 'Pas de '.strtolower($plural_label).' trouvées',
|
||||
'not_found_in_trash'=> 'Pas de '.strtolower($singular_label).' dans la corbeille',
|
||||
),
|
||||
'public' => true,
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => true,
|
||||
'show_in_nav_menus' => true,
|
||||
'show_in_admin_bar' => true,
|
||||
'menu_position' => 5,
|
||||
'menu_icon' => $icon,
|
||||
'can_export' => true,
|
||||
'has_archive' => true,
|
||||
'exclude_from_search' => false,
|
||||
'publicly_queryable' => true,
|
||||
'capability_type' => 'page',
|
||||
'supports' => $support,
|
||||
'has_archive' => true
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static function cred_register_post_taxonomy($name,$post_type, $label, $singular_label, $plural_label, $icon, $genre, $link_to_post_type = true) {
|
||||
|
||||
$genre_labels = array(
|
||||
array('f' => 'Toutes', 'm' => 'Tous'),
|
||||
array('f' => 'Nouvelle', 'm' => 'Nouveau'),
|
||||
array('f' => 'trouvée', 'm' => 'trouvé'),
|
||||
array('f' => 'une', 'm' => 'un'),
|
||||
array('f' => 'utilisée', 'm' => 'utilisé'),
|
||||
);
|
||||
|
||||
register_taxonomy(
|
||||
$name,
|
||||
$post_type,
|
||||
array(
|
||||
'label' => $label,
|
||||
'labels' => array(
|
||||
'name' => $label,
|
||||
'singular_name' => $singular_label,
|
||||
'all_items' => strtolower($singular_label),
|
||||
'edit_item' => 'Éditer un '.strtolower($singular_label),
|
||||
'view_item' => 'Voir '.$genre_labels[3][$genre].' '.strtolower($singular_label),
|
||||
'update_item' => 'Mettre à jour '.$genre_labels[3][$genre].' '.strtolower($singular_label),
|
||||
'add_new_item' => 'Ajouter '.$genre_labels[3][$genre].' '.strtolower($singular_label),
|
||||
'new_item_name' => $genre_labels[1][$genre].' '.strtolower($singular_label),
|
||||
'search_items' => 'Rechercher parmi les '.strtolower($plural_label),
|
||||
'popular_items' => $singular_label.' les plus '.$genre_labels[4][$genre]
|
||||
),
|
||||
'hierarchical' => true,
|
||||
'public' => true,
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => true,
|
||||
'show_in_nav_menus' => true,
|
||||
'show_in_admin_bar' => true,
|
||||
'show_admin_column' => true,
|
||||
'menu_position' => 5,
|
||||
'menu_icon' => $icon,
|
||||
'can_export' => true,
|
||||
'has_archive' => true,
|
||||
'exclude_from_search' => false,
|
||||
'publicly_queryable' => true,
|
||||
)
|
||||
);
|
||||
|
||||
if($link_to_post_type) {
|
||||
register_taxonomy_for_object_type( $name, $post_type );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
380
app/libraries/simulateur.php
Normal file
@ -0,0 +1,380 @@
|
||||
<?php
|
||||
|
||||
class CRED_simulateur extends CRED_base {
|
||||
|
||||
public static $instance;
|
||||
|
||||
public function __construct() {
|
||||
self::$instance = $this;
|
||||
/* add_action('wp_ajax_cred_regenerate_simulator', array($this, 'ajax_regenerate_simulator'));
|
||||
add_action('wp_ajax_nopriv_cred_regenerate_simulator', array($this, 'ajax_regenerate_simulator')); */
|
||||
}
|
||||
|
||||
public static function post_simulateur_form() {
|
||||
|
||||
}
|
||||
|
||||
public static function ajax_regenerate_simulator() {
|
||||
error_log('POST data: ' . print_r($_POST, true));
|
||||
|
||||
if (!isset($_POST['nonce'])) {
|
||||
wp_send_json_error(array('message' => 'Nonce manquant'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wp_verify_nonce($_POST['nonce'], 'cd_47ax_412m')) {
|
||||
wp_send_json_error(array('message' => 'Nonce invalide'));
|
||||
return;
|
||||
}
|
||||
|
||||
$type = isset($_POST['type']) ? $_POST['type'] : 'pat';
|
||||
|
||||
$atts = array(
|
||||
'cd_default_loan_stimulator' => $type,
|
||||
'check_credit_type' => ''
|
||||
);
|
||||
|
||||
$content = self::simulateur_shortcode($atts);
|
||||
|
||||
wp_send_json_success(array(
|
||||
'html' => $content
|
||||
));
|
||||
}
|
||||
|
||||
/* public static function generate_loan_stimulator_with_vc() {
|
||||
vc_map( array(
|
||||
"name" => __( "Generate Loan Stimulator", "cd-loan-stimulator" ),
|
||||
"base" => "loan_simulator",
|
||||
"class" => "",
|
||||
"category" => __( "Credit Direct Custom Blocks", "cd-custom-blocks"),
|
||||
"params" => array(
|
||||
|
||||
array(
|
||||
"type" => "dropdown",
|
||||
"holder" => "div",
|
||||
"class" => "",
|
||||
"heading" => __( "Default Stimulator", "cd-loan-stimulator" ),
|
||||
"param_name" => "cd_default_loan_stimulator",
|
||||
"value" => array(
|
||||
__( "Prêt personnel / Tous motifs / Achats divers", "cd_loan_stimulator" ) => "pat",
|
||||
__( "Financement frais de notaire ", "cd_loan_stimulator" ) => "frais_notaire",
|
||||
__( "Crédit travaux / Rénovation / Energie", "cd_loan_stimulator" ) => "but_immo",
|
||||
__( "Financement véhicule NEUF", "cd_loan_stimulator" ) => "fin_neuve",
|
||||
__( "Financement véhicule d'occasion MOINS de 3 ans", "cd_loan_stimulator" ) => "fin_occ_m3a",
|
||||
__( "Financement véhicule d'occasion PLUS de 3 ans", "cd_loan_stimulator" ) => "fin_occ_p3a",
|
||||
__( "Crédit hypothécaire classique (achat maison, construction, refinancement, regroupement, travaux, achat à l'étranger)" ) => "am",
|
||||
__( "Crédit hypothécaire social (achat maison, construction)", "cd_loan_stimulator" ) => "ph",
|
||||
),
|
||||
"description" => __( "", "cd-loan-stimulator" )
|
||||
)
|
||||
)
|
||||
) );
|
||||
} */
|
||||
|
||||
|
||||
public static function simulateur_shortcode($atts) {
|
||||
|
||||
global $post;
|
||||
$current_post_id = $post->ID;
|
||||
|
||||
$vars = shortcode_atts(
|
||||
array(
|
||||
'cd_default_loan_stimulator' => '',
|
||||
'check_credit_type' => '',
|
||||
), $atts );
|
||||
|
||||
$options = array(
|
||||
array(
|
||||
'value' => 'pat',
|
||||
'heading' => 'Prêt personnel / Tous motifs / Achats divers',
|
||||
'short_title' => 'Prêt personnel',
|
||||
'page_slug' => 'pret-personnel',
|
||||
'page_id' => 55
|
||||
),
|
||||
array(
|
||||
'value' => 'financement_frais_de_notaire',
|
||||
'heading' => 'Financement frais de notaire',
|
||||
'short_title' => '',
|
||||
'page_slug' => 'financement-frais-de-notaire',
|
||||
'page_id' => 887
|
||||
),
|
||||
array(
|
||||
'value' => 'but_immo',
|
||||
'heading' => 'Crédit travaux / Rénovation / Energie',
|
||||
'short_title' => 'Prêt travaux',
|
||||
'page_slug' => 'credit-classique-achat-maison-travaux',
|
||||
'page_id' => 30
|
||||
),
|
||||
array(
|
||||
'value' => 'fin_neuve',
|
||||
'heading' => 'Financement véhicule NEUF',
|
||||
'short_title' => 'Crédit Auto',
|
||||
'page_id' => 'achat-vehicule-auto-moto-caravane',
|
||||
'page_slug' => 57
|
||||
),
|
||||
array(
|
||||
'value' => 'fin_occ_m3a',
|
||||
'heading' => 'Financement véhicule d\'occasion MOINS de 3 ans',
|
||||
'short_title' => '',
|
||||
'page_slug' => 'achat-vehicule-auto-moto-caravane',
|
||||
'page_id' => 57
|
||||
),
|
||||
array(
|
||||
'value' => 'fin_occ_p3a',
|
||||
'heading' => 'Financement véhicule d\'occasion PLUS de 3 ans',
|
||||
'short_title' => '',
|
||||
'page_slug' => 'achat-vehicule-auto-moto-caravane',
|
||||
'page_id' => 57
|
||||
),
|
||||
array(
|
||||
'value' => 'am',
|
||||
'heading' => 'Crédit hypothécaire classique (achat maison, construction, refinancement, regroupement, travaux, achat à l\'étranger)',
|
||||
'short_title' => 'Crédit hypothécaire',
|
||||
'page_slug' => 'credit-classique-achat-maison-travaux',
|
||||
'page_id' => 30
|
||||
)
|
||||
);
|
||||
|
||||
$fin_neuve_sub_credits = [
|
||||
'fin_neuve' => array('label' => 'Financement auto neuve', 'icon' => 'icon-toiturecar-neuve', 'page' => 'achat-vehicule-auto-moto-caravane','page_ids' => array(57),'checked' => 1, 'sub_class' => 'fin_neuve', 'hidden' => 1),
|
||||
'fin_occ_m3a' => array('label' => 'Financement auto d\'occasion < 3 ans', 'icon' => 'icon-toiturecar-light', 'page' => 'achat-vehicule-auto-moto-caravane','page_ids' => array(57),'checked' => 0, 'sub_class' => 'fin_occ_m3a', 'hidden' => 0),
|
||||
'fin_occ_p3a' => array('label' => 'Financement auto d\'occasion > 3 ans', 'icon' => 'icon-toiturecar-old', 'page' => 'achat-vehicule-auto-moto-caravane','page_ids' => array(57),'checked' => 0, 'sub_class' => 'fin_occ_p3a', 'hidden' => 0),
|
||||
'mobil_carav' => array('label' => 'Mobil-home et caravane', 'icon' => 'icon-toiturecar-light', 'page' => 'achat-mobilhome-caravane','page_ids' => array(57),'checked' => 0, 'sub_class' => 'mobil_carav', 'hidden' => 0),
|
||||
];
|
||||
|
||||
$travaux_sub_credits = [
|
||||
'but_immo' => array('label' => 'Travaux de rénovation', 'icon' => 'icon-toituretravaux-renovation', 'page' => 'travaux-de-renovation','page_ids' => array(800),'checked' => 0),
|
||||
'reno_energie' => array('label' => 'Rénovation énergétique', 'icon' => 'icon-toituretravaux-renovation', 'page' => 'renovation-energetique','page_ids' => array(800),'checked' => 0),
|
||||
];
|
||||
|
||||
$creditTypes = [
|
||||
'pat' => array('label' => 'Prêt personnel tous motifs', 'icon' => 'icon-toiturepret-tout-motif', 'page' => 'pret-personnel-tous-motifs', 'page_ids' => array(3187),'checked' => 1, 'insertAfter' => ''),
|
||||
'regrouping' => array('label' => 'Regroupement de crédits', 'icon' => 'icon-toitureregroupement-credit', 'page' => 'regroupement-de-credits','page_ids' => array(55),'checked' => 0, 'insertAfter' => ''),
|
||||
'fin_neuve' => array('label' => 'Financement auto', 'icon' => 'icon-toiturecar-neuve', 'page' => 'achat-vehicule-auto-moto-caravane','page_ids' => array(57),'checked' => 0, 'insertAfter' => ''),
|
||||
'fin_occ_m3a' => array('label' => 'Financement auto d\'occasion < 3 ans', 'icon' => 'icon-toiturecar-light', 'page' => 'achat-vehicule-auto-moto-caravane','page_ids' => array(57),'checked' => 0, 'insertAfter' => ''),
|
||||
'fin_occ_p3a' => array('label' => 'Financement auto d\'occasion > 3 ans', 'icon' => 'icon-toiturecar-old', 'page' => 'achat-vehicule-auto-moto-caravane','page_ids' => array(57),'checked' => 0, 'insertAfter' => ''),
|
||||
'mobil_carav' => array('label' => 'Mobil-home et caravane', 'icon' => 'icon-toiturecar-light', 'page' => 'achat-mobilhome-caravane','page_ids' => array(57),'checked' => 0, 'insertAfter' => ''),
|
||||
'but_immo' => array('label' => 'Crédits travaux, rénovation', 'icon' => 'icon-toituretravaux-renovation', 'page' => 'travaux-renovation','page_ids' => array(62),'checked' => 0, 'insertAfter' => ''),
|
||||
'reno_energie' => array('label' => 'Rénovation énergétique', 'icon' => 'icon-toituretravaux-renovation', 'page' => 'renovation-energetique','page_ids' => array(800),'checked' => 0, 'insertAfter' => ''),
|
||||
];
|
||||
|
||||
$houseCreditTypes = [
|
||||
'purchasehouse' => array('label' => 'Achat maison', 'icon' => 'icon-toitureachat-maison', 'page' => 'achat-maison','page_ids' => array(30),'checked' => 1),
|
||||
'construction' => array('label' => 'Nouvelle construction', 'icon' => 'icon-toiturenouvel-construction', 'page' => 'nouvelle-construction','page_ids' => array(33),'checked' => 0),
|
||||
'regrouping_immo' => array('label' => 'Regroupement de crédits', 'icon' => 'icon-toitureregroupement-credit', 'page' => 'regroupement-de-credit-hypothecaire-et-autre','page_ids' => array(838),'checked' => 0),
|
||||
'refinancing' => array('label' => 'Refinancement crédit(s) hypothécaire(s)', 'icon' => 'icon-toiturerefinancement', 'page' => 'refinancement-credit-hypothecaire','page_ids' => array(824),'checked' => 0),
|
||||
'purchaseabroad' => array('label' => 'Achat d\'une 2éme résidence (à l\'étranger, en belgique)', 'icon' => 'icon-toituremaison-vacances', 'page' => 'achat-seconde-residence','page_ids' => array(870),'checked' => 0),
|
||||
'but_immo_hypo' => array('label' => 'Travaux de rénovation', 'icon' => 'icon-toituretravaux-renovation', 'page' => 'travaux-de-renovation','page_ids' => array(800),'checked' => 0),
|
||||
'achat_maison_de_rapport' => array('label' => 'Achat maison de rapport', 'icon' => 'icon-toitureachat-maison', 'page' => 'achat-maison-de-rapport','page_ids' => array(871),'checked' => 0),
|
||||
'credit_pont' => array('label' => 'Crédit pont', 'icon' => 'icon-toiturerefinancement', 'page' => 'credit-pont','page_ids' => array(872),'checked' => 0),
|
||||
'independants_et_entreprises_en_difficultes' => array('label' => 'Indépendants et entreprises en difficultés', 'icon' => 'icon-toitureagrandissement-maison', 'page' => 'credit-pont-travaux','page_ids' => array(873),'checked' => 0),
|
||||
'regroupement_de_credit__rachats_de_credits' => array('label' => 'Rachats de crédits', 'icon' => 'icon-toitureregroupement-credit', 'page' => 'regroupement-de-credit-hypothecaire-et-autre','page_ids' => array(874),'checked' => 0),
|
||||
'financement_frais_de_notaire' => array('label' => 'Financement frais de notaire', 'icon' => 'icon-toituregavel-light', 'page' => 'financement-frais-de-notaire','page_ids' => array(875),'checked' => 0),
|
||||
'fonds_roulement_independants' => array('label' => 'Fonds de roulement pour indépendants', 'icon' => 'icon-toitureagrandissement-maison', 'page' => 'fonds-roulement-independants','page_ids' => array(876),'checked' => 0),
|
||||
];
|
||||
|
||||
$select_options = '';
|
||||
|
||||
$select_buttons = '';
|
||||
|
||||
$select_radio = '';
|
||||
$select_radio_orig = '';
|
||||
|
||||
$select_radio_immo = '';
|
||||
|
||||
$select_radio_pat = '';
|
||||
|
||||
$select_subradio_auto = '';
|
||||
|
||||
$select_subradio = '';
|
||||
|
||||
$after_select_tags = '';
|
||||
|
||||
$select_subradio_travaux = '';
|
||||
|
||||
$is_credit_hypothecaire = false;
|
||||
$is_credit_pat = false;
|
||||
$is_credit_auto = false;
|
||||
|
||||
$type_credit_grid_class = 'col-md-6';
|
||||
$type_credit_auto_class = 'col-md-6';
|
||||
$house_credit_grid_class = 'col-md-2';
|
||||
$start_column_counter = 1;
|
||||
|
||||
$type_credit_length = count($creditTypes);
|
||||
$house_credit_length = count($houseCreditTypes);
|
||||
$insertAfter = '';
|
||||
|
||||
$check_credit_type = $vars['check_credit_type'];
|
||||
|
||||
$cd_default_loan_stimulator = ($vars['cd_default_loan_stimulator'] == "ph")?'am':$vars['cd_default_loan_stimulator'];
|
||||
|
||||
if($vars['cd_default_loan_stimulator'] == 'am')
|
||||
$is_credit_hypothecaire = true;
|
||||
|
||||
if($vars['cd_default_loan_stimulator'] == 'fin_neuve')
|
||||
$is_credit_auto = true;
|
||||
|
||||
if(empty($cd_default_loan_stimulator))
|
||||
$cd_default_loan_stimulator = 'pat';
|
||||
|
||||
if($cd_default_loan_stimulator == 'pat')
|
||||
$is_credit_pat = true;
|
||||
|
||||
/* foreach($options as $option){
|
||||
|
||||
$cd_default_loan_stimulator = ($vars['cd_default_loan_stimulator'] == "ph")?'am':$vars['cd_default_loan_stimulator'];
|
||||
$selected = ($option['value'] == $cd_default_loan_stimulator)?'selected="selected" ':'';
|
||||
$select_options .= '<option '.$selected.'value="'.$option['value'].'" data-heading="'.$option["heading"].'">'.$option['heading'].'</option>';
|
||||
|
||||
if(!empty($option['short_title'])) {
|
||||
|
||||
$checked = '';
|
||||
|
||||
if($option['value'] == $cd_default_loan_stimulator || (empty($cd_default_loan_stimulator) && $option['value'] == 'pat'))
|
||||
$checked = ' checked ';
|
||||
|
||||
$url = get_permalink( $option['page_id'] );
|
||||
|
||||
$select_buttons .= '<li class="col-md-6"><a href="'.$url.'" data-heading="'.$option["heading"].'">'.$option['short_title'].'</a></li>';
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<div class="form_check col-md-6">
|
||||
<input class="form-check-input loan_type" type="radio" name="loan_type" id="<?= $option['value'] ?>"
|
||||
value="<?= $option['value'] ?>" <?= $checked ?>data-heading="<?= $option['heading'] ?>">
|
||||
<label class="form-check-label" for="<?= $option['value'] ?>"><?= $option['short_title'] ?></label>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
$select_radio_orig .= ob_get_clean();
|
||||
}
|
||||
|
||||
} */
|
||||
|
||||
|
||||
foreach($fin_neuve_sub_credits as $k => $v) {
|
||||
|
||||
$checked = '';
|
||||
$typeCreditPages = $v['page_ids'];
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<div class="form_check test col-md-6 <?php echo $v['hidden'] ? 'hidden' : ''; ?> icon-check">
|
||||
<input class="form-check-input <?= $v['sub_class'] ?>" type="radio" name="<?= $v['sub_class'] ?>" id="sub_<?= $k ?>"
|
||||
value="<?= $k ?>" <?= $checked ?> data-page="<?= $v['page'] ?>">
|
||||
<label class="form-check-label" for="sub_<?= $k ?>"><i class="glyphicon <?= $v['icon'] ?>" aria-hidden="true"></i>
|
||||
<span class="label_text"><?= $v['label'] ?></span></label>
|
||||
</div>
|
||||
<?php
|
||||
$select_subradio .= ob_get_clean();
|
||||
|
||||
}
|
||||
|
||||
foreach($creditTypes as $k => $v) {
|
||||
|
||||
$checked = '';
|
||||
$typeCreditPages = $v['page_ids'];
|
||||
|
||||
$hasInsertAfter = !empty($v['insertAfter']) ? true : false;
|
||||
|
||||
if($hasInsertAfter) {
|
||||
$insertAfter = $v['insertAfter'];
|
||||
} else {
|
||||
$insertAfter = '';
|
||||
}
|
||||
|
||||
if($hasInsertAfter) {
|
||||
|
||||
if($start_column_counter % 2 != 0) {
|
||||
$type_credit_grid_class = 'col-md-12';
|
||||
}
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<div id="<?= $insertAfter['id'] ?>" class="form_group row sub_radio_sel<?= empty($insertAfter['class']) ? '' : ' '.$insertAfter['class'] ?>">
|
||||
<?php
|
||||
if (is_array($insertAfter['value'])) {
|
||||
foreach($insertAfter['value'] as $key => $val) {
|
||||
?>
|
||||
<div class="form_check col-md-6 <?php echo $val['hidden'] ? 'hidden' : ''; ?> icon-check">
|
||||
<input class="form-check-input sub_auto_loan_type" type="radio" name="sub_auto_loan_type" id="sub_<?= $key ?>"
|
||||
value="<?= $key ?>" <?= $checked ?> data-page="<?= $val['page'] ?>">
|
||||
<label class="form-check-label" for="sub_<?= $key ?>"><i class="glyphicon <?= $val['icon'] ?>"
|
||||
aria-hidden="true"></i> <span class="label_text"><?= $val['label'] ?></span></label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
$after_select_tags = ob_get_clean();
|
||||
}
|
||||
|
||||
if(in_array($current_post_id, $typeCreditPages) || $v['checked'] == '1' || $check_credit_type == $k)
|
||||
$checked = ' checked';
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<div class="form_check <?= $type_credit_grid_class ?> icon-check">
|
||||
<input class="form-check-input sub_loan_type" type="radio" name="sub_loan_type" id="<?= $k ?>" value="<?= $k ?>"
|
||||
<?= $checked ?> data-page="<?= $v['page'] ?>">
|
||||
<label class="form-check-label" for="<?= $k ?>"><i class="glyphicon <?= $v['icon'] ?>" aria-hidden="true"></i> <span
|
||||
class="label_text"><?= $v['label'] ?></span></label>
|
||||
</div>
|
||||
<?php
|
||||
if($hasInsertAfter)
|
||||
echo $after_select_tags;
|
||||
|
||||
$select_radio_pat .= ob_get_clean();
|
||||
|
||||
$start_column_counter++;
|
||||
|
||||
}
|
||||
|
||||
foreach($houseCreditTypes as $k => $v) {
|
||||
|
||||
$checked = '';
|
||||
$typeCreditPages = $v['page_ids'];
|
||||
$type_credit_grid_class = 'col-md-6';
|
||||
|
||||
if(in_array($current_post_id, $typeCreditPages) || $v['checked'] == '1' || $check_credit_type == $k)
|
||||
$checked = ' checked';
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<div class="form_check <?= $type_credit_grid_class ?> icon-check">
|
||||
<input class="form-check-input sub_loan_type" type="radio" name="sub_loan_type" id="<?= $k ?>" value="<?= $k ?>"
|
||||
<?= $checked ?> data-page="<?= $v['page'] ?>">
|
||||
<label class="form-check-label" for="<?= $k ?>"><i class="glyphicon <?= $v['icon'] ?>" aria-hidden="true"></i> <span
|
||||
class="label_text"><?= $v['label'] ?></span></label>
|
||||
</div>
|
||||
<?php
|
||||
$select_radio_immo .= ob_get_clean();
|
||||
|
||||
}
|
||||
|
||||
if($is_credit_hypothecaire)
|
||||
$select_radio = $select_radio_immo;
|
||||
else
|
||||
$select_radio = $select_radio_pat;
|
||||
|
||||
|
||||
$template_url = CRED_Main::template('newSim.php','front');
|
||||
|
||||
if(isset($_GET['debug']))
|
||||
$template_url = CRED_Main::template('simulateur.php','front');
|
||||
|
||||
ob_start();
|
||||
|
||||
include $template_url;
|
||||
|
||||
$content = ob_get_clean();
|
||||
|
||||
return $content;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
456
app/models/credit-step1.php
Normal file
@ -0,0 +1,456 @@
|
||||
<?php
|
||||
|
||||
namespace models;
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
class CRED_credit_step1 extends CRED_credit
|
||||
{
|
||||
|
||||
protected $currentCredit;
|
||||
|
||||
public function save_step_0($data)
|
||||
{
|
||||
$save_all_form = 0;
|
||||
|
||||
|
||||
try {
|
||||
/**
|
||||
* Save data
|
||||
*/
|
||||
$this->wpdb->insert('cdf_Credit', array(
|
||||
'type_credit' => $data['loan_type'],
|
||||
'sel_credit' => $data['sub_loan_type'],
|
||||
'capital' => $data['selected_capital'],
|
||||
'duree' => $data['selected_months'],
|
||||
'cout_total' => $data['hidden_cout_total_value'],
|
||||
'mensualite' => $data['hidden_montant_total_value'],
|
||||
'taux_nominal_annuel' => $data['hidden_taeg_value'],
|
||||
'rgpd' => 'oui',
|
||||
'create_date' => (new \DateTime())->format('Y-m-d H:i:s')
|
||||
));
|
||||
|
||||
$current_credit_id = $this->wpdb->insert_id;
|
||||
$token = $this->generateToken($current_credit_id);
|
||||
|
||||
$currentCredit = $this->getCredit($token);
|
||||
|
||||
/* if($currentCredit->type_credit != 'pat')
|
||||
return $token;
|
||||
else
|
||||
$this->save_step_1_pat($data); */
|
||||
|
||||
return $token;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
die($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function save_step_1_all($data) {
|
||||
|
||||
if(isset($data['email']) && strpos($data['email'], '@example.com') !== false) {
|
||||
return false; // Rejeter la demande si l'adresse email contient @example.com
|
||||
}
|
||||
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
if (!is_object($currentCredit)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
$borrowerTableName = 'cdf_Emprunteur';
|
||||
$borrowerData = [
|
||||
'nom' => $data['lastname'],
|
||||
'prenom' => $data['firstname'],
|
||||
'telephone' => $data['phone'],
|
||||
'email' => $data['email'],
|
||||
'FK_agence' => $data['agency'],
|
||||
'FK_demande_creditdirect' => $currentCredit->idCredit
|
||||
];
|
||||
|
||||
if (is_object($borrower)) {
|
||||
$this->wpdb->update($borrowerTableName, $borrowerData, [
|
||||
'idemprunteur' => $borrower->idemprunteur
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($borrowerTableName, $borrowerData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-get the current credit to hydrate it
|
||||
*/
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
$this->update_emprunteur($data, $currentCredit);
|
||||
$this->save_autre_credit_emprunteur($data, $currentCredit);
|
||||
|
||||
if (array_key_exists('hascoborrower', $data) && $data['hascoborrower'] === '1') {
|
||||
$this->insert_co_emprunteur($data, $currentCredit);
|
||||
$this->save_autre_credit_co_emprunteur($data, $currentCredit);
|
||||
}
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array(
|
||||
'last_update_date' => (new \DateTime())->format('Y-m-d H:i:s'),
|
||||
'last_step' => '4'
|
||||
),
|
||||
array('idCredit' => $this->currentCredit->idCredit)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function save_one_step($data) {
|
||||
|
||||
$email_demande = $data['email'];
|
||||
|
||||
/* if($this->is_webdev_user()) {
|
||||
echo '<pre>';
|
||||
print_r($data);
|
||||
echo '</pre>';
|
||||
die();
|
||||
} */
|
||||
|
||||
if(strpos($email_demande, '@example.com') !== false) {
|
||||
return false; // Rejeter la demande si l'adresse email contient @example.com
|
||||
}
|
||||
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
$included_hypo_credits = ['am','amr','cied','frais_notaire','cdp'];
|
||||
|
||||
|
||||
|
||||
|
||||
if (!is_object($currentCredit)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* if($this->is_webdev_user()) {
|
||||
echo '<pre>';
|
||||
print_r($data);
|
||||
echo '</pre>';
|
||||
die();
|
||||
} */
|
||||
/* echo '<pre>';
|
||||
print_r($data);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
$ddn = null;
|
||||
if (!empty($data['birthdate'])) {
|
||||
$ddn = \DateTime::createFromFormat('d/m/Y', $data['birthdate']);
|
||||
if ($ddn) {
|
||||
$ddn = $ddn->format('Y-m-d');
|
||||
}
|
||||
}
|
||||
|
||||
// print_r($ddn);
|
||||
|
||||
$independent_since = \DateTime::createFromFormat('d/m/Y', $data['independent_since']);
|
||||
|
||||
if($independent_since) {
|
||||
$independent_since = $independent_since->format('Y-m-d');
|
||||
} else {
|
||||
$independent_since = '';
|
||||
}
|
||||
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
$borrowerTableName = 'cdf_Emprunteur';
|
||||
$borrowerData = [
|
||||
'nom' => $data['lastname'],
|
||||
'prenom' => $data['firstname'],
|
||||
'telephone' => $data['phone'],
|
||||
'email' => $data['email'],
|
||||
'date_naissance' => $ddn ?: '',
|
||||
'nationalité' => $data['nationality'],
|
||||
'adresse' => $data['address'],
|
||||
'code_postal' => $data['zip'],
|
||||
'localite' => $data['city'],
|
||||
'pays' => $data['country'],
|
||||
'contract_type' => $data['contract_type'],
|
||||
'independent_since' => $independent_since,
|
||||
'FK_profession' => $data['job'],
|
||||
'FK_etat_civil' => $data['civilstatus'],
|
||||
'salaire' => $data['salary'],
|
||||
'annual_taxable_income' => isset($data['annual_taxable_income']) ? $data['annual_taxable_income'] : null,
|
||||
'FK_demande_creditdirect' => $currentCredit->idCredit,
|
||||
];
|
||||
|
||||
/* if($this->is_webdev_user()) {
|
||||
echo '<pre>';
|
||||
print_r($borrowerData);
|
||||
echo '</pre>';
|
||||
die();
|
||||
} */
|
||||
|
||||
if (is_object($borrower)) {
|
||||
$this->wpdb->update($borrowerTableName, $borrowerData, [
|
||||
'idemprunteur' => $borrower->idemprunteur
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($borrowerTableName, $borrowerData);
|
||||
}
|
||||
|
||||
//has another batiment
|
||||
if(isset($data['isowner']) && $data['isowner'] === '1') {
|
||||
$this->save_another_batiment($data, $currentCredit);
|
||||
}
|
||||
|
||||
if(!empty($data['comment'])) {
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('commentaire' => $data['comment']),
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
|
||||
if (array_key_exists('hascoborrower', $data) && $data['hascoborrower'] === '1') {
|
||||
$this->insert_co_emprunteur_one_step($data);
|
||||
}
|
||||
|
||||
if (in_array($currentCredit->type_credit, $included_hypo_credits)) {
|
||||
$this->save_FK_credit_hypothecaire($currentCredit,$data);
|
||||
}
|
||||
|
||||
if (
|
||||
$currentCredit->type_credit == 'fin_neuve'
|
||||
|| $currentCredit->type_credit == 'fin_occ_m3a'
|
||||
|| $currentCredit->type_credit == 'fin_occ_p3a'
|
||||
) {
|
||||
$this->save_FK_credit_auto($currentCredit,$data);
|
||||
}
|
||||
|
||||
$this->save_to_credits_listing($currentCredit);
|
||||
|
||||
}
|
||||
|
||||
public function save_another_batiment($data, $currentCredit) {
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
|
||||
|
||||
if (!is_object($borrower)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Sauvegarder les bâtiments
|
||||
if (isset($data['isowner']) && $data['isowner'] === '1') {
|
||||
|
||||
if (isset($data['building']) && is_array($data['building'])) {
|
||||
|
||||
|
||||
$building_ids = []; // Pour stocker les IDs des bâtiments créés
|
||||
|
||||
foreach ($data['building'] as $index => $building) {
|
||||
// Ignorer les données fantômes des templates (clés __INDEX__)
|
||||
if ($index === '__INDEX__') {
|
||||
continue;
|
||||
}
|
||||
// Insertion du bâtiment
|
||||
$batiment_pays = '';
|
||||
if (isset($building['inbelgium']) && $building['inbelgium'] === '0' && isset($building['country'])) {
|
||||
$batiment_pays = sanitize_text_field($building['country']);
|
||||
}
|
||||
|
||||
$this->wpdb->insert(
|
||||
'cdf_Emprunteur_Batiments',
|
||||
array(
|
||||
'FK_emprunteur' => $borrower->idemprunteur,
|
||||
'is_habitation' => isset($building['ishabitation']) ? intval($building['ishabitation']) : 0,
|
||||
'Is_rapport' => isset($building['israpport']) ? intval($building['israpport']) : 0,
|
||||
'en_belgique' => isset($building['inbelgium']) ? intval($building['inbelgium']) : 1,
|
||||
'batiment_pays' => $batiment_pays,
|
||||
'revenu_locatif' => isset($building['hasrentalincome']) ? intval($building['hasrentalincome']) : 0,
|
||||
'montant_locatif' => isset($building['rentalamount']) ? floatval($building['rentalamount']) : 0
|
||||
)
|
||||
);
|
||||
|
||||
// Récupérer l'ID du bâtiment créé
|
||||
$building_id = $this->wpdb->insert_id;
|
||||
if ($building_id) {
|
||||
$building_ids[$index] = $building_id;
|
||||
}
|
||||
}
|
||||
|
||||
// Sauvegarder les crédits associés aux bâtiments
|
||||
if (isset($data['hasbuildingloans']) && $data['hasbuildingloans'] === '1') {
|
||||
if (isset($data['buildingloan']) && is_array($data['buildingloan'])) {
|
||||
|
||||
foreach ($data['buildingloan'] as $loanIndex => $loan) {
|
||||
// Ignorer les données fantômes des templates (clés __LOANINDEX__)
|
||||
if ($loanIndex === '__LOANINDEX__') {
|
||||
continue;
|
||||
}
|
||||
// Traiter la date première échéance
|
||||
$firstPaymentDate = null;
|
||||
if (!empty($loan['firstpayment'])) {
|
||||
// Format attendu : jj-mm-aaaa
|
||||
$date = \DateTime::createFromFormat('d-m-Y', $loan['firstpayment']);
|
||||
if ($date) {
|
||||
$firstPaymentDate = $date->format('Y-m-d');
|
||||
}
|
||||
}
|
||||
|
||||
// Utiliser le dernier bâtiment créé comme FK_autre_batiment
|
||||
// Dans une version plus avancée, on pourrait associer chaque crédit à un bâtiment spécifique
|
||||
$building_id = !empty($building_ids) ? end($building_ids) : 0;
|
||||
|
||||
// Convertir la durée d'années en mois
|
||||
$duree_mois = isset($loan['duration']) ? intval($loan['duration']) * 12 : 0;
|
||||
|
||||
$this->wpdb->insert(
|
||||
'cdf_Autre_credit',
|
||||
array(
|
||||
'FK_emprunteur' => $borrower->idemprunteur,
|
||||
'FK_autre_batiment' => $building_id,
|
||||
'FK_type_creance' => isset($loan['type']) ? intval($loan['type']) : null,
|
||||
'banque' => isset($loan['bankname']) ? sanitize_text_field($loan['bankname']) : '',
|
||||
'montant' => isset($loan['capital']) ? floatval($loan['capital']) : 0,
|
||||
'duree_credit' => $duree_mois,
|
||||
'mensualite' => isset($loan['monthly']) ? floatval($loan['monthly']) : 0,
|
||||
'date_premiere_echeance' => $firstPaymentDate,
|
||||
'cloture' => 0,
|
||||
'solde_restant_du' => 0
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Gérer les suppressions de crédits si nécessaire
|
||||
if (isset($data['delbuildingloans']) && !empty($data['delbuildingloans'])) {
|
||||
$kuids = explode(',', $data['delbuildingloans']);
|
||||
foreach ($kuids as $kuid) {
|
||||
$kuid = trim($kuid);
|
||||
if (!empty($kuid) && is_numeric($kuid)) {
|
||||
$this->wpdb->delete(
|
||||
'cdf_Autre_credit',
|
||||
array('idautrecredit' => intval($kuid))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function insert_co_emprunteur_one_step($data) {
|
||||
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
|
||||
$this->wpdb->insert('cdf_Emprunteur',array(
|
||||
'nom' => $data['colastname'],
|
||||
'prenom' => $data['cofirstname'],
|
||||
'date_naissance' => $data['cobirthdate'],
|
||||
'nationalité' => $data['conationality'],
|
||||
'adresse' => $data['coaddress'],
|
||||
'code_postal' => $data['cozip'],
|
||||
'localite' => $data['cocity'],
|
||||
'pays' => $data['cocountry'],
|
||||
'contract_type' => $data['cocontract_type'],
|
||||
'independent_since' => isset($data['coindependent_since']) ? $data['coindependent_since'] : null,
|
||||
'salaire' => $data['cosalary'],
|
||||
'annual_taxable_income' => isset($data['coannual_taxable_income']) ? $data['coannual_taxable_income'] : null,
|
||||
'parent_emprunteur' => $borrower->idemprunteur,
|
||||
'FK_demande_creditdirect' => $currentCredit->idCredit,
|
||||
'FK_etat_civil' => $data['cocivilstatus'],
|
||||
'FK_profession' => $data['cojob']
|
||||
));
|
||||
}
|
||||
|
||||
public function save_FK_credit_hypothecaire($currentCredit,$data) {
|
||||
|
||||
$included_hypo_credits = ['am','amr','cied','frais_notaire','cdp'];
|
||||
|
||||
if (in_array($currentCredit->type_credit, $included_hypo_credits)) {
|
||||
$optionsTableName = 'cdf_Options_credit_hypotecaire';
|
||||
$optionsData = [
|
||||
'type_credit' => $data['estateloantype'],
|
||||
'prix_achat' => $data['estatebuyingprice'],
|
||||
'fonds_propre' => $data['estateequity'],
|
||||
'compromis_signe' => $data['estatecompromise'],
|
||||
'montant_a_emprunter' => $data['batiment_emprunt'],
|
||||
'duree' => $data['batiment_duree'],
|
||||
];
|
||||
|
||||
/**
|
||||
* job,contract_type,salary
|
||||
*/
|
||||
|
||||
if (!is_null($currentCredit->FK_credit_hypothecaire)) {
|
||||
$this->wpdb->insert($optionsTableName, $optionsData, [
|
||||
'FK_credit_hypothecaire' => $currentCredit->FK_credit_hypothecaire
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($optionsTableName, $optionsData);
|
||||
|
||||
$optionId = $this->wpdb->insert_id;
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('FK_credit_hypothecaire' => $optionId),
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($currentCredit);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
}
|
||||
|
||||
return $currentCredit;
|
||||
}
|
||||
|
||||
public function save_FK_credit_auto($currentCredit,$data) {
|
||||
|
||||
if (
|
||||
$currentCredit->type_credit == 'fin_neuve'
|
||||
|| $currentCredit->type_credit == 'fin_occ_m3a'
|
||||
|| $currentCredit->type_credit == 'fin_occ_p3a'
|
||||
) {
|
||||
|
||||
$optionsTableName = 'cdf_Options_credit_auto';
|
||||
$optionsData = [
|
||||
'marque' => $data['marque'],
|
||||
'date_immatriculation' => $data['vehicleregistrationdate'],
|
||||
'nom_vendeur' => $data['sellername'],
|
||||
'adresse_vendeur' => $data['selleraddress'],
|
||||
'prix_vehicule' => $data['vehicleprice'],
|
||||
'montant_accompte' => $data['vehicule_accompte'],
|
||||
'montant_reprise' => $data['vehicule_reprise'],
|
||||
'montant_emprunt' => $data['vehicule_emprunt'],
|
||||
'duree' => $data['vehicule_duree']
|
||||
];
|
||||
|
||||
if (!is_null($currentCredit->FK_credit_auto)) {
|
||||
$this->wpdb->update($optionsTableName, $optionsData, [
|
||||
'idOptions_credit_auto' => $currentCredit->FK_credit_auto
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($optionsTableName, $optionsData);
|
||||
|
||||
$optionId = $this->wpdb->insert_id;
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('FK_credit_auto' => $optionId),
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
|
||||
/* $currentCredit = $this->getCredit($data['credit-direct-token']); */
|
||||
}
|
||||
|
||||
/* return $currentCredit; */
|
||||
}
|
||||
}
|
||||
2239
app/models/credit.php
Normal file
239
app/models/credit_step2.php
Normal file
@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
namespace models;
|
||||
|
||||
// Inclure FormValidator avant de l'utiliser
|
||||
if (!class_exists('\libraries\FormValidator')) {
|
||||
$formValidatorPath = WP_PLUGIN_DIR . '/ESI_creditDirect/app/libraries/FormValidator.php';
|
||||
if (file_exists($formValidatorPath)) {
|
||||
require_once $formValidatorPath;
|
||||
}
|
||||
}
|
||||
|
||||
use DateTime;
|
||||
use libraries\FormValidator;
|
||||
|
||||
class CRED_credit_step2 extends CRED_credit {
|
||||
|
||||
public function save_step_1($data, $validate = true) {
|
||||
|
||||
// Vérifier si l'adresse email contient @example.com
|
||||
if(isset($data['email']) && strpos($data['email'], '@example.com') !== false) {
|
||||
return [
|
||||
'success' => false,
|
||||
'errors' => ['email' => 'Adresse email invalide'],
|
||||
'formatted_errors' => 'Adresse email invalide'
|
||||
];
|
||||
}
|
||||
|
||||
// Validation des données seulement si demandé
|
||||
if ($validate) {
|
||||
$validator = new FormValidator($data);
|
||||
$errors = $validator->validateStep2($data);
|
||||
|
||||
if (!empty($errors)) {
|
||||
// Retourner les erreurs pour affichage
|
||||
return [
|
||||
'success' => false,
|
||||
'errors' => $errors,
|
||||
'formatted_errors' => $validator->getFormattedErrors()
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
$id_credit = $currentCredit->idCredit;
|
||||
|
||||
if (!is_object($currentCredit)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
$borrowerTableName = 'cdf_Emprunteur';
|
||||
$borrowerData = [
|
||||
'nom' => $data['lastname'],
|
||||
'prenom' => $data['firstname'],
|
||||
'telephone' => $data['phone'],
|
||||
'email' => $data['email'],
|
||||
'pays' => $data['country'],
|
||||
'code_postal' => $data['zip'],
|
||||
'FK_demande_creditdirect' => $currentCredit->idCredit
|
||||
];
|
||||
|
||||
/* $borrowerData = [
|
||||
'nom' => $data['lastname'],
|
||||
'prenom' => $data['firstname'],
|
||||
'telephone' => $data['phone'],
|
||||
'email' => $data['email'],
|
||||
'FK_agence' => $data['agency'],
|
||||
'FK_demande_creditdirect' => $currentCredit->idCredit
|
||||
]; */
|
||||
|
||||
if (is_object($borrower)) {
|
||||
$this->wpdb->update($borrowerTableName, $borrowerData, [
|
||||
'idemprunteur' => $borrower->idemprunteur
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($borrowerTableName, $borrowerData);
|
||||
}
|
||||
|
||||
if(!empty($data['comment'])) {
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('commentaire' => $data['comment']),
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
|
||||
if (in_array($currentCredit->type_credit, $this->creditAutos)) {
|
||||
$optionsTableName = 'cdf_Options_credit_auto';
|
||||
|
||||
|
||||
$optionsData = [
|
||||
'marque' => $data['marque'],
|
||||
'date_immatriculation' => $data['vehicleregistrationdate'],
|
||||
'nom_vendeur' => $data['sellername'],
|
||||
'date_immatriculation' => !empty($data['vehicleregistrationdate']) ? (DateTime::createFromFormat('d/m/Y', $data['vehicleregistrationdate']) ? DateTime::createFromFormat('d/m/Y', $data['vehicleregistrationdate'])->format('Y-m-d') : $data['vehicleregistrationdate']) : null,
|
||||
'adresse_vendeur' => $data['selleraddress'],
|
||||
'prix_vehicule' => $data['vehicleprice'],
|
||||
'montant_accompte' => $data['vehicule_accompte'],
|
||||
'montant_reprise' => $data['vehicule_reprise'],
|
||||
'montant_emprunt' => $data['vehicule_emprunt'],
|
||||
'duree' => $data['vehicule_duree']
|
||||
];
|
||||
|
||||
|
||||
if (!is_null($currentCredit->FK_credit_auto)) {
|
||||
$this->wpdb->update($optionsTableName, $optionsData, [
|
||||
'idOptions_credit_auto' => $currentCredit->FK_credit_auto
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($optionsTableName, $optionsData);
|
||||
|
||||
$optionId = $this->wpdb->insert_id;
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('FK_credit_auto' => $optionId),
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($currentCredit->type_credit, $this->one_step_credit_types)) {
|
||||
$optionsTableName = 'cdf_Options_credit_hypotecaire';
|
||||
$optionsData = [
|
||||
'type_credit' => $data['estateloantype'],
|
||||
'prix_achat' => $data['estatebuyingprice'],
|
||||
'prix_construction_tvac' => $data['prix_achat_tvac'],
|
||||
'valeur_batiment' => $data['valeur_batiment'],
|
||||
'fonds_propre' => $data['estateequity'],
|
||||
'compromis_signe' => $data['estatecompromise'],
|
||||
'montant_revenu_cadastral' => $data['estatcadastralincome'],
|
||||
'montant_a_emprunter' => $data['batiment_emprunt'],
|
||||
'duree' => $data['batiment_duree']
|
||||
];
|
||||
|
||||
if (!is_null($currentCredit->FK_credit_hypothecaire)) {
|
||||
$this->wpdb->insert($optionsTableName, $optionsData, [
|
||||
'FK_credit_hypothecaire' => $currentCredit->FK_credit_hypothecaire
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($optionsTableName, $optionsData);
|
||||
|
||||
$optionId = $this->wpdb->insert_id;
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('FK_credit_hypothecaire' => $optionId),
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-get the current credit to hydrate it
|
||||
*/
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
/**
|
||||
* Send mail
|
||||
*/
|
||||
if ($currentCredit->last_step < 2) {
|
||||
$agencies = $this->getAgencies();
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
$map_credit_type = $this->getCreditTypes();
|
||||
$mapHouseCreditTypes = $this->getHouseCreditTypes();
|
||||
|
||||
// S'assurer que le type de crédit est défini
|
||||
if (!isset($currentCredit->type_credit) || !array_key_exists($currentCredit->type_credit, $map_credit_type)) {
|
||||
error_log('Type de crédit inconnu: ' . $currentCredit->type_credit);
|
||||
}
|
||||
|
||||
$is_credit_auto = $this->is_credit_auto($currentCredit);
|
||||
$is_one_step_credit = in_array($currentCredit->type_credit, $this->one_step_credit_types);
|
||||
|
||||
|
||||
//update the credit id in the cdf_Credit with comment data
|
||||
|
||||
if(!empty($data['comment'])) {
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('commentaire' => $data['comment']),
|
||||
array('idCredit' => $id_credit)
|
||||
);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
include(_CRED_BASE_PATH_ . '/templates/email/credit-step2-mail.php');
|
||||
$message = ob_get_clean();
|
||||
|
||||
|
||||
ob_start();
|
||||
include(_CRED_BASE_PATH_ . '/templates/email/clients_emails/credit-step2-mail-client.php');
|
||||
$message_client = ob_get_clean();
|
||||
|
||||
$this->mailchimpSynchro($currentCredit, $borrower);
|
||||
|
||||
|
||||
if(!isset($data['isback']) || $data['isback'] != '1') {
|
||||
if(isset($data['type_credit_selected']) && !empty($data['type_credit_selected']) || isset($data['sub_loan_type']) && !empty($data['sub_loan_type']))
|
||||
$type_credit_selected = isset($data['sub_loan_type']) ? $data['sub_loan_type'] : $data['type_credit_selected'];
|
||||
|
||||
|
||||
$creditOptionsLabels = !empty($type_credit_selected) ? $this->getCreditLabel($type_credit_selected) : $map_credit_type[$currentCredit->type_credit];
|
||||
|
||||
// Exception : ne pas envoyer de mail si l'utilisateur connecté a l'ID 1
|
||||
if (!is_user_logged_in() || get_current_user_id() != 1) {
|
||||
// Envoyer l'email uniquement à l'administrateur (to_client = false)
|
||||
$this->sendEmail('Demande de crédit', $message, $borrower, $currentCredit, [], false);
|
||||
|
||||
// Envoyer l'email à l'emprunteur (to_client = true)
|
||||
$this->sendEmail('Demande de crédit', $message_client, $borrower, $currentCredit, [], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Credit info
|
||||
*/
|
||||
$updateInfos = [
|
||||
'last_update_date' => (new \DateTime())->format('Y-m-d H:i:s'),
|
||||
];
|
||||
|
||||
if (intval($currentCredit->last_step) === 1) {
|
||||
$updateInfos['last_step'] = '2';
|
||||
}
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
$updateInfos,
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
|
||||
$this->wpdb->suppress_errors = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
105
app/models/credit_step3.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
namespace models;
|
||||
|
||||
// Inclure FormValidator avant de l'utiliser
|
||||
if (!class_exists('\libraries\FormValidator')) {
|
||||
$formValidatorPath = WP_PLUGIN_DIR . '/ESI_creditDirect/app/libraries/FormValidator.php';
|
||||
if (file_exists($formValidatorPath)) {
|
||||
require_once $formValidatorPath;
|
||||
}
|
||||
}
|
||||
|
||||
use libraries\FormValidator;
|
||||
|
||||
class CRED_credit_step3 extends CRED_credit {
|
||||
|
||||
protected $currentCredit;
|
||||
|
||||
public function save_step_2($data, $currentCredit) {
|
||||
|
||||
// Validation des données
|
||||
$validator = new FormValidator($data);
|
||||
$errors = $validator->validateStep3($data);
|
||||
|
||||
if (!empty($errors)) {
|
||||
// Retourner les erreurs pour affichage
|
||||
return [
|
||||
'success' => false,
|
||||
'errors' => $errors,
|
||||
'formatted_errors' => $validator->getFormattedErrors()
|
||||
];
|
||||
}
|
||||
|
||||
$this->currentCredit = $currentCredit;
|
||||
|
||||
foreach ($data as $k => $d) {
|
||||
if ($d === '') {
|
||||
$data[$k] = null;
|
||||
}
|
||||
}
|
||||
|
||||
$curreentUser = wp_get_current_user();
|
||||
|
||||
if($curreentUser->ID == 1) {
|
||||
|
||||
echo '<pre>';
|
||||
echo 'data';
|
||||
print_r($data);
|
||||
echo '</pre>';
|
||||
|
||||
}
|
||||
|
||||
$this->update_emprunteur($data, $currentCredit);
|
||||
$this->save_autre_credit_emprunteur($data,$currentCredit);
|
||||
|
||||
// Vérifier si hascoborrower est présent dans les données
|
||||
// Note: pour les radio buttons, si aucun n'est coché, la clé peut être absente
|
||||
// On vérifie aussi s'il y a des données de co-emprunteur pour détecter sa présence
|
||||
$hasCoBorrowerInData = array_key_exists('hascoborrower', $data) && ($data['hascoborrower'] === '1' || $data['hascoborrower'] === 1);
|
||||
$hasCoBorrowerFields = !empty($data['cofirstname']) || !empty($data['colastname']) || !empty($data['coemail']) || !empty($data['cophone']);
|
||||
|
||||
// Si hascoborrower est à '1' OU si des champs co-emprunteur sont présents, traiter le co-emprunteur
|
||||
if ($hasCoBorrowerInData || $hasCoBorrowerFields) {
|
||||
// Vérifier si le co-emprunteur existe déjà
|
||||
$coBorrower = $this->getCoBorrower($currentCredit);
|
||||
if (is_object($coBorrower)) {
|
||||
// Le co-emprunteur existe, on le met à jour
|
||||
$this->update_co_emprunteur($data, $currentCredit);
|
||||
} else {
|
||||
// Le co-emprunteur n'existe pas, on le crée seulement si hascoborrower === '1'
|
||||
// (pour éviter de créer un co-emprunteur par erreur)
|
||||
if ($hasCoBorrowerInData) {
|
||||
// Vérifier que le borrower existe avant d'insérer le co-emprunteur
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
if (is_object($borrower)) {
|
||||
$insertId = $this->insert_co_emprunteur($data, $currentCredit);
|
||||
// Vérifier si l'insertion a réussi
|
||||
if ($insertId === false || $insertId === 0) {
|
||||
error_log('Erreur lors de l\'insertion du co-emprunteur pour le crédit ID: ' . $currentCredit->idCredit);
|
||||
error_log('Dernière erreur DB: ' . $this->wpdb->last_error);
|
||||
error_log('Dernière requête: ' . $this->wpdb->last_query);
|
||||
} else {
|
||||
// L'insertion a réussi, recharger le crédit pour que getCoBorrower trouve le nouveau co-emprunteur
|
||||
$currentCredit = $this->getCredit($currentCredit->token);
|
||||
}
|
||||
} else {
|
||||
error_log('Impossible de créer le co-emprunteur : borrower non trouvé pour le crédit ID: ' . $currentCredit->idCredit);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sauvegarder les autres crédits du co-emprunteur seulement si hascoborrower === '1'
|
||||
if ($hasCoBorrowerInData) {
|
||||
$this->save_autre_credit_co_emprunteur($data,$currentCredit);
|
||||
}
|
||||
}
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array(
|
||||
'last_update_date' => (new \DateTime())->format('Y-m-d H:i:s'),
|
||||
'last_step' => '3'
|
||||
),
|
||||
array('idCredit' => $this->currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
}
|
||||
49
app/models/credit_step4.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace models;
|
||||
|
||||
class CRED_credit_step4 extends CRED_credit {
|
||||
|
||||
protected $currentCredit;
|
||||
|
||||
public function save_step_3($data, $currentCredit) {
|
||||
$this->currentCredit = $currentCredit;
|
||||
|
||||
$this->save_autre_credit_emprunteur($data,$currentCredit);
|
||||
|
||||
$this->update_emprunteur($data,$currentCredit);
|
||||
|
||||
$curreentUser = wp_get_current_user();
|
||||
|
||||
if($curreentUser->ID == 1) {
|
||||
|
||||
echo '<pre>';
|
||||
echo 'data';
|
||||
print_r($data);
|
||||
echo '</pre>';
|
||||
|
||||
}
|
||||
|
||||
// Vérifier si le co-emprunteur existe et mettre à jour ses données
|
||||
$coBorrower = $this->getCoBorrower($currentCredit);
|
||||
if (is_object($coBorrower)) {
|
||||
// Mettre à jour les données du co-emprunteur
|
||||
$this->update_co_emprunteur($data, $currentCredit);
|
||||
|
||||
// Sauvegarder les autres crédits du co-emprunteur si nécessaire
|
||||
if (array_key_exists('cohometype', $data)) {
|
||||
$this->save_autre_credit_co_emprunteur($data,$currentCredit);
|
||||
}
|
||||
}
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array(
|
||||
'last_update_date' => (new \DateTime())->format('Y-m-d H:i:s'),
|
||||
'last_step' => '4',
|
||||
'token' => $this->currentCredit->token
|
||||
),
|
||||
array('idCredit' => $this->currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
}
|
||||
95
app/models/credit_step5.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace models;
|
||||
|
||||
class CRED_credit_step5 extends CRED_credit {
|
||||
|
||||
protected $currentCredit;
|
||||
|
||||
public function save_step_4($data, $currentCredit) {
|
||||
$this->currentCredit = $currentCredit;
|
||||
|
||||
// Sauvegarder les données de l'étape 4
|
||||
$this->save_emprunteur_address($data, $currentCredit);
|
||||
|
||||
if (array_key_exists('cohometype', $data)) {
|
||||
$this->save_co_emprunteur_address($data, $currentCredit);
|
||||
}
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array(
|
||||
'last_update_date' => (new \DateTime())->format('Y-m-d H:i:s'),
|
||||
'last_step' => '5',
|
||||
'token' => null
|
||||
),
|
||||
array('idCredit' => $this->currentCredit->idCredit)
|
||||
);
|
||||
|
||||
//save into cdf_Credits_listing
|
||||
$this->save_to_credits_listing($currentCredit);
|
||||
|
||||
return $this->wpdb->insert_id;
|
||||
}
|
||||
|
||||
// Méthode pour sauvegarder l'adresse de l'emprunteur
|
||||
private function save_emprunteur_address($data, $currentCredit) {
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($borrower);
|
||||
print_r($data);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
$datas_update = array(
|
||||
'adresse' => $data['address'],
|
||||
'code_postal' => $data['zip'],
|
||||
'localite' => $data['city'],
|
||||
'pays' => $data['country'],
|
||||
'date_emmenagement' => $data['movingdate'],
|
||||
'nom_employeur' => $data['emname'],
|
||||
'adresse_employeur' => $data['emaddress'],
|
||||
'code_postal_employeur' => $data['emzip'],
|
||||
'localite_employeur' => $data['emcity'],
|
||||
'date_engagement' => $data['commitmentdate']
|
||||
);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($datas_update);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
if ($borrower) {
|
||||
$this->wpdb->update(
|
||||
'cdf_Emprunteur',
|
||||
$datas_update,
|
||||
array('idemprunteur' => $borrower->idemprunteur)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Méthode pour sauvegarder l'adresse du co-emprunteur
|
||||
private function save_co_emprunteur_address($data, $currentCredit) {
|
||||
$coBorrower = $this->getCoBorrower($currentCredit);
|
||||
|
||||
if ($coBorrower) {
|
||||
$this->wpdb->update(
|
||||
'cdf_Emprunteur',
|
||||
array(
|
||||
'adresse' => $data['coaddress'],
|
||||
'code_postal' => $data['cozip'],
|
||||
'localite' => $data['cocity'],
|
||||
'pays' => $data['cocountry'],
|
||||
'date_emmenagement' => $data['comovingdate'],
|
||||
'nom_employeur' => $data['coemname'],
|
||||
'adresse_employeur' => $data['coemaddress'],
|
||||
'code_postal_employeur' => $data['coemzip'],
|
||||
'localite_employeur' => $data['coemcity'],
|
||||
'date_engagement' => $data['cocommitmentdate']
|
||||
),
|
||||
array('idemprunteur' => $coBorrower->idemprunteur)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
331
app/models/old/credit-step1.php
Normal file
@ -0,0 +1,331 @@
|
||||
<?php
|
||||
|
||||
namespace models;
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
class CRED_credit_step1 extends CRED_credit
|
||||
{
|
||||
|
||||
protected $currentCredit;
|
||||
|
||||
public function save_step_0($data)
|
||||
{
|
||||
$save_all_form = 0;
|
||||
|
||||
|
||||
try {
|
||||
/**
|
||||
* Save data
|
||||
*/
|
||||
$this->wpdb->insert('cdf_Credit', array(
|
||||
'type_credit' => $data['loan_type'],
|
||||
'sel_credit' => $data['sub_loan_type'],
|
||||
'capital' => $data['selected_capital'],
|
||||
'duree' => $data['selected_months'],
|
||||
'cout_total' => $data['hidden_cout_total_value'],
|
||||
'mensualite' => $data['hidden_montant_total_value'],
|
||||
'taux_nominal_annuel' => $data['hidden_taeg_value'],
|
||||
'rgpd' => 'oui',
|
||||
'create_date' => (new \DateTime())->format('Y-m-d H:i:s')
|
||||
));
|
||||
|
||||
$current_credit_id = $this->wpdb->insert_id;
|
||||
$token = $this->generateToken($current_credit_id);
|
||||
|
||||
$currentCredit = $this->getCredit($token);
|
||||
|
||||
/* if($currentCredit->type_credit != 'pat')
|
||||
return $token;
|
||||
else
|
||||
$this->save_step_1_pat($data); */
|
||||
|
||||
return $token;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
die($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function save_step_1_all($data) {
|
||||
|
||||
if(isset($data['email']) && strpos($data['email'], '@example.com') !== false) {
|
||||
return false; // Rejeter la demande si l'adresse email contient @example.com
|
||||
}
|
||||
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
if (!is_object($currentCredit)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
$borrowerTableName = 'cdf_Emprunteur';
|
||||
$borrowerData = [
|
||||
'nom' => $data['lastname'],
|
||||
'prenom' => $data['firstname'],
|
||||
'telephone' => $data['phone'],
|
||||
'email' => $data['email'],
|
||||
'FK_agence' => $data['agency'],
|
||||
'FK_demande_creditdirect' => $currentCredit->idCredit
|
||||
];
|
||||
|
||||
if (is_object($borrower)) {
|
||||
$this->wpdb->update($borrowerTableName, $borrowerData, [
|
||||
'idemprunteur' => $borrower->idemprunteur
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($borrowerTableName, $borrowerData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-get the current credit to hydrate it
|
||||
*/
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
$this->update_emprunteur($data, $currentCredit);
|
||||
$this->save_autre_credit_emprunteur($data, $currentCredit);
|
||||
|
||||
if (array_key_exists('hascoborrower', $data) && $data['hascoborrower'] === '1') {
|
||||
$this->insert_co_emprunteur($data, $currentCredit);
|
||||
$this->save_autre_credit_co_emprunteur($data, $currentCredit);
|
||||
}
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array(
|
||||
'last_update_date' => (new \DateTime())->format('Y-m-d H:i:s'),
|
||||
'last_step' => '4'
|
||||
),
|
||||
array('idCredit' => $this->currentCredit->idCredit)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function save_one_step($data) {
|
||||
|
||||
$email_demande = $data['email'];
|
||||
|
||||
if(strpos($email_demande, '@example.com') !== false) {
|
||||
return false; // Rejeter la demande si l'adresse email contient @example.com
|
||||
}
|
||||
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
$included_hypo_credits = ['am','amr','cied','frais_notaire','cdp'];
|
||||
|
||||
if (!is_object($currentCredit)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* if($this->is_webdev_user()) {
|
||||
echo '<pre>';
|
||||
print_r($data);
|
||||
echo '</pre>';
|
||||
die();
|
||||
} */
|
||||
/* echo '<pre>';
|
||||
print_r($data);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
$ddn = null;
|
||||
if (!empty($data['birthdate'])) {
|
||||
$ddn = \DateTime::createFromFormat('d/m/Y', $data['birthdate']);
|
||||
if ($ddn) {
|
||||
$ddn = $ddn->format('Y-m-d');
|
||||
}
|
||||
}
|
||||
|
||||
// print_r($ddn);
|
||||
|
||||
$independent_since = \DateTime::createFromFormat('d/m/Y', $data['independent_since']);
|
||||
|
||||
if($independent_since) {
|
||||
$independent_since = $independent_since->format('Y-m-d');
|
||||
} else {
|
||||
$independent_since = '';
|
||||
}
|
||||
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
$borrowerTableName = 'cdf_Emprunteur';
|
||||
$borrowerData = [
|
||||
'nom' => $data['lastname'],
|
||||
'prenom' => $data['firstname'],
|
||||
'telephone' => $data['phone'],
|
||||
'email' => $data['email'],
|
||||
'date_naissance' => $ddn ?: '',
|
||||
'nationalité' => $data['nationality'],
|
||||
'adresse' => $data['address'],
|
||||
'code_postal' => $data['zip'],
|
||||
'localite' => $data['city'],
|
||||
'pays' => $data['country'],
|
||||
'contract_type' => $data['contract_type'],
|
||||
'independent_since' => $independent_since,
|
||||
'FK_profession' => $data['job'],
|
||||
'FK_etat_civil' => $data['civilstatus'],
|
||||
'salaire' => $data['salary'],
|
||||
'annual_taxable_income' => isset($data['annual_taxable_income']) ? $data['annual_taxable_income'] : null,
|
||||
'FK_demande_creditdirect' => $currentCredit->idCredit,
|
||||
];
|
||||
|
||||
/* if($this->is_webdev_user()) {
|
||||
echo '<pre>';
|
||||
print_r($borrowerData);
|
||||
echo '</pre>';
|
||||
die();
|
||||
} */
|
||||
|
||||
if (is_object($borrower)) {
|
||||
$this->wpdb->update($borrowerTableName, $borrowerData, [
|
||||
'idemprunteur' => $borrower->idemprunteur
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($borrowerTableName, $borrowerData);
|
||||
}
|
||||
|
||||
if(!empty($data['comment'])) {
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('commentaire' => $data['comment']),
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
|
||||
if (array_key_exists('hascoborrower', $data) && $data['hascoborrower'] === '1') {
|
||||
$this->insert_co_emprunteur_one_step($data);
|
||||
}
|
||||
|
||||
if (in_array($currentCredit->type_credit, $included_hypo_credits)) {
|
||||
$this->save_FK_credit_hypothecaire($currentCredit,$data);
|
||||
}
|
||||
|
||||
if (
|
||||
$currentCredit->type_credit == 'fin_neuve'
|
||||
|| $currentCredit->type_credit == 'fin_occ_m3a'
|
||||
|| $currentCredit->type_credit == 'fin_occ_p3a'
|
||||
) {
|
||||
$this->save_FK_credit_auto($currentCredit,$data);
|
||||
}
|
||||
|
||||
$this->save_to_credits_listing($currentCredit);
|
||||
|
||||
}
|
||||
|
||||
public function insert_co_emprunteur_one_step($data) {
|
||||
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
|
||||
$this->wpdb->insert('cdf_Emprunteur',array(
|
||||
'nom' => $data['colastname'],
|
||||
'prenom' => $data['cofirstname'],
|
||||
'date_naissance' => $data['cobirthdate'],
|
||||
'nationalité' => $data['conationality'],
|
||||
'adresse' => $data['coaddress'],
|
||||
'code_postal' => $data['cozip'],
|
||||
'localite' => $data['cocity'],
|
||||
'pays' => $data['cocountry'],
|
||||
'contract_type' => $data['cocontract_type'],
|
||||
'independent_since' => isset($data['coindependent_since']) ? $data['coindependent_since'] : null,
|
||||
'salaire' => $data['cosalary'],
|
||||
'annual_taxable_income' => isset($data['coannual_taxable_income']) ? $data['coannual_taxable_income'] : null,
|
||||
'parent_emprunteur' => $borrower->idemprunteur,
|
||||
'FK_demande_creditdirect' => $currentCredit->idCredit,
|
||||
'FK_etat_civil' => $data['cocivilstatus'],
|
||||
'FK_profession' => $data['cojob']
|
||||
));
|
||||
}
|
||||
|
||||
public function save_FK_credit_hypothecaire($currentCredit,$data) {
|
||||
|
||||
$included_hypo_credits = ['am','amr','cied','frais_notaire','cdp'];
|
||||
|
||||
if (in_array($currentCredit->type_credit, $included_hypo_credits)) {
|
||||
$optionsTableName = 'cdf_Options_credit_hypotecaire';
|
||||
$optionsData = [
|
||||
'type_credit' => $data['estateloantype'],
|
||||
'prix_achat' => $data['estatebuyingprice'],
|
||||
'fonds_propre' => $data['estateequity'],
|
||||
'compromis_signe' => $data['estatecompromise'],
|
||||
'montant_a_emprunter' => $data['batiment_emprunt'],
|
||||
'duree' => $data['batiment_duree'],
|
||||
];
|
||||
|
||||
/**
|
||||
* job,contract_type,salary
|
||||
*/
|
||||
|
||||
if (!is_null($currentCredit->FK_credit_hypothecaire)) {
|
||||
$this->wpdb->insert($optionsTableName, $optionsData, [
|
||||
'FK_credit_hypothecaire' => $currentCredit->FK_credit_hypothecaire
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($optionsTableName, $optionsData);
|
||||
|
||||
$optionId = $this->wpdb->insert_id;
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('FK_credit_hypothecaire' => $optionId),
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($currentCredit);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
}
|
||||
|
||||
return $currentCredit;
|
||||
}
|
||||
|
||||
public function save_FK_credit_auto($currentCredit,$data) {
|
||||
|
||||
if (
|
||||
$currentCredit->type_credit == 'fin_neuve'
|
||||
|| $currentCredit->type_credit == 'fin_occ_m3a'
|
||||
|| $currentCredit->type_credit == 'fin_occ_p3a'
|
||||
) {
|
||||
|
||||
$optionsTableName = 'cdf_Options_credit_auto';
|
||||
$optionsData = [
|
||||
'marque' => $data['marque'],
|
||||
'date_immatriculation' => $data['vehicleregistrationdate'],
|
||||
'nom_vendeur' => $data['sellername'],
|
||||
'adresse_vendeur' => $data['selleraddress'],
|
||||
'prix_vehicule' => $data['vehicleprice'],
|
||||
'montant_accompte' => $data['vehicule_accompte'],
|
||||
'montant_reprise' => $data['vehicule_reprise'],
|
||||
'montant_emprunt' => $data['vehicule_emprunt'],
|
||||
'duree' => $data['vehicule_duree']
|
||||
];
|
||||
|
||||
if (!is_null($currentCredit->FK_credit_auto)) {
|
||||
$this->wpdb->update($optionsTableName, $optionsData, [
|
||||
'idOptions_credit_auto' => $currentCredit->FK_credit_auto
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($optionsTableName, $optionsData);
|
||||
|
||||
$optionId = $this->wpdb->insert_id;
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('FK_credit_auto' => $optionId),
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
|
||||
/* $currentCredit = $this->getCredit($data['credit-direct-token']); */
|
||||
}
|
||||
|
||||
/* return $currentCredit; */
|
||||
}
|
||||
}
|
||||
2275
app/models/old/credit.php
Normal file
237
app/models/old/credit_step2.php
Normal file
@ -0,0 +1,237 @@
|
||||
<?php
|
||||
|
||||
namespace models;
|
||||
|
||||
// Inclure FormValidator avant de l'utiliser
|
||||
if (!class_exists('\libraries\FormValidator')) {
|
||||
$formValidatorPath = WP_PLUGIN_DIR . '/ESI_creditDirect/app/libraries/FormValidator.php';
|
||||
if (file_exists($formValidatorPath)) {
|
||||
require_once $formValidatorPath;
|
||||
}
|
||||
}
|
||||
|
||||
use DateTime;
|
||||
use libraries\FormValidator;
|
||||
|
||||
class CRED_credit_step2 extends CRED_credit {
|
||||
|
||||
public function save_step_1($data) {
|
||||
|
||||
// Vérifier si l'adresse email contient @example.com
|
||||
if(isset($data['email']) && strpos($data['email'], '@example.com') !== false) {
|
||||
return [
|
||||
'success' => false,
|
||||
'errors' => ['email' => 'Adresse email invalide'],
|
||||
'formatted_errors' => 'Adresse email invalide'
|
||||
];
|
||||
}
|
||||
|
||||
// Validation des données
|
||||
$validator = new FormValidator($data, $this);
|
||||
$errors = $validator->validateStep2($data);
|
||||
|
||||
if (!empty($errors)) {
|
||||
// Retourner les erreurs pour affichage
|
||||
return [
|
||||
'success' => false,
|
||||
'errors' => $errors,
|
||||
'formatted_errors' => $validator->getFormattedErrors()
|
||||
];
|
||||
}
|
||||
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
$id_credit = $currentCredit->idCredit;
|
||||
|
||||
if (!is_object($currentCredit)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
$borrowerTableName = 'cdf_Emprunteur';
|
||||
$borrowerData = [
|
||||
'nom' => $data['lastname'],
|
||||
'prenom' => $data['firstname'],
|
||||
'telephone' => $data['phone'],
|
||||
'email' => $data['email'],
|
||||
'pays' => $data['country'],
|
||||
'code_postal' => $data['zip'],
|
||||
'FK_demande_creditdirect' => $currentCredit->idCredit
|
||||
];
|
||||
|
||||
/* $borrowerData = [
|
||||
'nom' => $data['lastname'],
|
||||
'prenom' => $data['firstname'],
|
||||
'telephone' => $data['phone'],
|
||||
'email' => $data['email'],
|
||||
'FK_agence' => $data['agency'],
|
||||
'FK_demande_creditdirect' => $currentCredit->idCredit
|
||||
]; */
|
||||
|
||||
if (is_object($borrower)) {
|
||||
$this->wpdb->update($borrowerTableName, $borrowerData, [
|
||||
'idemprunteur' => $borrower->idemprunteur
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($borrowerTableName, $borrowerData);
|
||||
}
|
||||
|
||||
if(!empty($data['comment'])) {
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('commentaire' => $data['comment']),
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
|
||||
if (in_array($currentCredit->type_credit, $this->creditAutos)) {
|
||||
$optionsTableName = 'cdf_Options_credit_auto';
|
||||
|
||||
|
||||
$optionsData = [
|
||||
'marque' => $data['marque'],
|
||||
'date_immatriculation' => $data['vehicleregistrationdate'],
|
||||
'nom_vendeur' => $data['sellername'],
|
||||
'date_immatriculation' => !empty($data['vehicleregistrationdate']) ? (DateTime::createFromFormat('d/m/Y', $data['vehicleregistrationdate']) ? DateTime::createFromFormat('d/m/Y', $data['vehicleregistrationdate'])->format('Y-m-d') : $data['vehicleregistrationdate']) : null,
|
||||
'adresse_vendeur' => $data['selleraddress'],
|
||||
'prix_vehicule' => $data['vehicleprice'],
|
||||
'montant_accompte' => $data['vehicule_accompte'],
|
||||
'montant_reprise' => $data['vehicule_reprise'],
|
||||
'montant_emprunt' => $data['vehicule_emprunt'],
|
||||
'duree' => $data['vehicule_duree']
|
||||
];
|
||||
|
||||
|
||||
if (!is_null($currentCredit->FK_credit_auto)) {
|
||||
$this->wpdb->update($optionsTableName, $optionsData, [
|
||||
'idOptions_credit_auto' => $currentCredit->FK_credit_auto
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($optionsTableName, $optionsData);
|
||||
|
||||
$optionId = $this->wpdb->insert_id;
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('FK_credit_auto' => $optionId),
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($currentCredit->type_credit, $this->one_step_credit_types)) {
|
||||
$optionsTableName = 'cdf_Options_credit_hypotecaire';
|
||||
$optionsData = [
|
||||
'type_credit' => $data['estateloantype'],
|
||||
'prix_achat' => $data['estatebuyingprice'],
|
||||
'prix_construction_tvac' => $data['prix_achat_tvac'],
|
||||
'valeur_batiment' => $data['valeur_batiment'],
|
||||
'fonds_propre' => $data['estateequity'],
|
||||
'compromis_signe' => $data['estatecompromise'],
|
||||
'montant_revenu_cadastral' => $data['estatcadastralincome'],
|
||||
'montant_a_emprunter' => $data['batiment_emprunt'],
|
||||
'duree' => $data['batiment_duree']
|
||||
];
|
||||
|
||||
if (!is_null($currentCredit->FK_credit_hypothecaire)) {
|
||||
$this->wpdb->insert($optionsTableName, $optionsData, [
|
||||
'FK_credit_hypothecaire' => $currentCredit->FK_credit_hypothecaire
|
||||
]);
|
||||
} else {
|
||||
$this->wpdb->insert($optionsTableName, $optionsData);
|
||||
|
||||
$optionId = $this->wpdb->insert_id;
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('FK_credit_hypothecaire' => $optionId),
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-get the current credit to hydrate it
|
||||
*/
|
||||
$currentCredit = $this->getCredit($data['credit-direct-token']);
|
||||
|
||||
/**
|
||||
* Send mail
|
||||
*/
|
||||
if ($currentCredit->last_step < 2) {
|
||||
$agencies = $this->getAgencies();
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
$map_credit_type = $this->getCreditTypes();
|
||||
$mapHouseCreditTypes = $this->getHouseCreditTypes();
|
||||
|
||||
// S'assurer que le type de crédit est défini
|
||||
if (!isset($currentCredit->type_credit) || !array_key_exists($currentCredit->type_credit, $map_credit_type)) {
|
||||
error_log('Type de crédit inconnu: ' . $currentCredit->type_credit);
|
||||
}
|
||||
|
||||
$is_credit_auto = $this->is_credit_auto($currentCredit);
|
||||
$is_one_step_credit = in_array($currentCredit->type_credit, $this->one_step_credit_types);
|
||||
|
||||
|
||||
//update the credit id in the cdf_Credit with comment data
|
||||
|
||||
if(!empty($data['comment'])) {
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array('commentaire' => $data['comment']),
|
||||
array('idCredit' => $id_credit)
|
||||
);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
include(_CRED_BASE_PATH_ . '/templates/email/credit-step2-mail.php');
|
||||
$message = ob_get_clean();
|
||||
|
||||
|
||||
ob_start();
|
||||
include(_CRED_BASE_PATH_ . '/templates/email/clients_emails/credit-step2-mail-client.php');
|
||||
$message_client = ob_get_clean();
|
||||
|
||||
$this->mailchimpSynchro($currentCredit, $borrower);
|
||||
|
||||
|
||||
if(!isset($data['isback']) || $data['isback'] != '1') {
|
||||
if(isset($data['type_credit_selected']) && !empty($data['type_credit_selected']) || isset($data['sub_loan_type']) && !empty($data['sub_loan_type']))
|
||||
$type_credit_selected = isset($data['sub_loan_type']) ? $data['sub_loan_type'] : $data['type_credit_selected'];
|
||||
|
||||
|
||||
$creditOptionsLabels = !empty($type_credit_selected) ? $this->getCreditLabel($type_credit_selected) : $map_credit_type[$currentCredit->type_credit];
|
||||
|
||||
// Exception : ne pas envoyer de mail si l'utilisateur connecté a l'ID 1
|
||||
if (!is_user_logged_in() || get_current_user_id() != 1) {
|
||||
// Envoyer l'email uniquement à l'administrateur (to_client = false)
|
||||
$this->sendEmail('Demande de crédit', $message, $borrower, $currentCredit, [], false);
|
||||
|
||||
// Envoyer l'email à l'emprunteur (to_client = true)
|
||||
$this->sendEmail('Demande de crédit', $message_client, $borrower, $currentCredit, [], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Credit info
|
||||
*/
|
||||
$updateInfos = [
|
||||
'last_update_date' => (new \DateTime())->format('Y-m-d H:i:s'),
|
||||
];
|
||||
|
||||
if (intval($currentCredit->last_step) === 1) {
|
||||
$updateInfos['last_step'] = '2';
|
||||
}
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
$updateInfos,
|
||||
array('idCredit' => $currentCredit->idCredit)
|
||||
);
|
||||
|
||||
$this->wpdb->suppress_errors = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
105
app/models/old/credit_step3.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
namespace models;
|
||||
|
||||
// Inclure FormValidator avant de l'utiliser
|
||||
if (!class_exists('\libraries\FormValidator')) {
|
||||
$formValidatorPath = WP_PLUGIN_DIR . '/ESI_creditDirect/app/libraries/FormValidator.php';
|
||||
if (file_exists($formValidatorPath)) {
|
||||
require_once $formValidatorPath;
|
||||
}
|
||||
}
|
||||
|
||||
use libraries\FormValidator;
|
||||
|
||||
class CRED_credit_step3 extends CRED_credit {
|
||||
|
||||
protected $currentCredit;
|
||||
|
||||
public function save_step_2($data, $currentCredit) {
|
||||
|
||||
// Validation des données
|
||||
$validator = new FormValidator($data, $this);
|
||||
$errors = $validator->validateStep3($data);
|
||||
|
||||
if (!empty($errors)) {
|
||||
// Retourner les erreurs pour affichage
|
||||
return [
|
||||
'success' => false,
|
||||
'errors' => $errors,
|
||||
'formatted_errors' => $validator->getFormattedErrors()
|
||||
];
|
||||
}
|
||||
|
||||
$this->currentCredit = $currentCredit;
|
||||
|
||||
foreach ($data as $k => $d) {
|
||||
if ($d === '') {
|
||||
$data[$k] = null;
|
||||
}
|
||||
}
|
||||
|
||||
/* $curreentUser = wp_get_current_user();
|
||||
|
||||
if($curreentUser->ID == 1) {
|
||||
|
||||
echo '<pre>';
|
||||
echo 'data';
|
||||
print_r($data);
|
||||
echo '</pre>';
|
||||
|
||||
} */
|
||||
|
||||
$this->update_emprunteur($data, $currentCredit);
|
||||
$this->save_autre_credit_emprunteur($data,$currentCredit);
|
||||
|
||||
// Vérifier si hascoborrower est présent dans les données
|
||||
// Note: pour les radio buttons, si aucun n'est coché, la clé peut être absente
|
||||
// On vérifie aussi s'il y a des données de co-emprunteur pour détecter sa présence
|
||||
$hasCoBorrowerInData = array_key_exists('hascoborrower', $data) && ($data['hascoborrower'] === '1' || $data['hascoborrower'] === 1);
|
||||
$hasCoBorrowerFields = !empty($data['cofirstname']) || !empty($data['colastname']) || !empty($data['coemail']) || !empty($data['cophone']);
|
||||
|
||||
// Si hascoborrower est à '1' OU si des champs co-emprunteur sont présents, traiter le co-emprunteur
|
||||
if ($hasCoBorrowerInData || $hasCoBorrowerFields) {
|
||||
// Vérifier si le co-emprunteur existe déjà
|
||||
$coBorrower = $this->getCoBorrower($currentCredit);
|
||||
if (is_object($coBorrower)) {
|
||||
// Le co-emprunteur existe, on le met à jour
|
||||
$this->update_co_emprunteur($data, $currentCredit);
|
||||
} else {
|
||||
// Le co-emprunteur n'existe pas, on le crée seulement si hascoborrower === '1'
|
||||
// (pour éviter de créer un co-emprunteur par erreur)
|
||||
if ($hasCoBorrowerInData) {
|
||||
// Vérifier que le borrower existe avant d'insérer le co-emprunteur
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
if (is_object($borrower)) {
|
||||
$insertId = $this->insert_co_emprunteur($data, $currentCredit);
|
||||
// Vérifier si l'insertion a réussi
|
||||
if ($insertId === false || $insertId === 0) {
|
||||
error_log('Erreur lors de l\'insertion du co-emprunteur pour le crédit ID: ' . $currentCredit->idCredit);
|
||||
error_log('Dernière erreur DB: ' . $this->wpdb->last_error);
|
||||
error_log('Dernière requête: ' . $this->wpdb->last_query);
|
||||
} else {
|
||||
// L'insertion a réussi, recharger le crédit pour que getCoBorrower trouve le nouveau co-emprunteur
|
||||
$currentCredit = $this->getCredit($currentCredit->token);
|
||||
}
|
||||
} else {
|
||||
error_log('Impossible de créer le co-emprunteur : borrower non trouvé pour le crédit ID: ' . $currentCredit->idCredit);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sauvegarder les autres crédits du co-emprunteur seulement si hascoborrower === '1'
|
||||
if ($hasCoBorrowerInData) {
|
||||
$this->save_autre_credit_co_emprunteur($data,$currentCredit);
|
||||
}
|
||||
}
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array(
|
||||
'last_update_date' => (new \DateTime())->format('Y-m-d H:i:s'),
|
||||
'last_step' => '3'
|
||||
),
|
||||
array('idCredit' => $this->currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
}
|
||||
49
app/models/old/credit_step4.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace models;
|
||||
|
||||
class CRED_credit_step4 extends CRED_credit {
|
||||
|
||||
protected $currentCredit;
|
||||
|
||||
public function save_step_3($data, $currentCredit) {
|
||||
$this->currentCredit = $currentCredit;
|
||||
|
||||
$this->save_autre_credit_emprunteur($data,$currentCredit);
|
||||
|
||||
$this->update_emprunteur($data,$currentCredit);
|
||||
|
||||
$curreentUser = wp_get_current_user();
|
||||
|
||||
if($curreentUser->ID == 1) {
|
||||
|
||||
echo '<pre>';
|
||||
echo 'data';
|
||||
print_r($data);
|
||||
echo '</pre>';
|
||||
|
||||
}
|
||||
|
||||
// Vérifier si le co-emprunteur existe et mettre à jour ses données
|
||||
$coBorrower = $this->getCoBorrower($currentCredit);
|
||||
if (is_object($coBorrower)) {
|
||||
// Mettre à jour les données du co-emprunteur
|
||||
$this->update_co_emprunteur($data, $currentCredit);
|
||||
|
||||
// Sauvegarder les autres crédits du co-emprunteur si nécessaire
|
||||
if (array_key_exists('cohometype', $data)) {
|
||||
$this->save_autre_credit_co_emprunteur($data,$currentCredit);
|
||||
}
|
||||
}
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array(
|
||||
'last_update_date' => (new \DateTime())->format('Y-m-d H:i:s'),
|
||||
'last_step' => '4',
|
||||
'token' => $this->currentCredit->token
|
||||
),
|
||||
array('idCredit' => $this->currentCredit->idCredit)
|
||||
);
|
||||
}
|
||||
}
|
||||
95
app/models/old/credit_step5.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace models;
|
||||
|
||||
class CRED_credit_step5 extends CRED_credit {
|
||||
|
||||
protected $currentCredit;
|
||||
|
||||
public function save_step_4($data, $currentCredit) {
|
||||
$this->currentCredit = $currentCredit;
|
||||
|
||||
// Sauvegarder les données de l'étape 4
|
||||
$this->save_emprunteur_address($data, $currentCredit);
|
||||
|
||||
if (array_key_exists('cohometype', $data)) {
|
||||
$this->save_co_emprunteur_address($data, $currentCredit);
|
||||
}
|
||||
|
||||
$this->wpdb->update(
|
||||
'cdf_Credit',
|
||||
array(
|
||||
'last_update_date' => (new \DateTime())->format('Y-m-d H:i:s'),
|
||||
'last_step' => '5',
|
||||
'token' => null
|
||||
),
|
||||
array('idCredit' => $this->currentCredit->idCredit)
|
||||
);
|
||||
|
||||
//save into cdf_Credits_listing
|
||||
$this->save_to_credits_listing($currentCredit);
|
||||
|
||||
return $this->wpdb->insert_id;
|
||||
}
|
||||
|
||||
// Méthode pour sauvegarder l'adresse de l'emprunteur
|
||||
private function save_emprunteur_address($data, $currentCredit) {
|
||||
$borrower = $this->getBorrower($currentCredit);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($borrower);
|
||||
print_r($data);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
$datas_update = array(
|
||||
'adresse' => $data['address'],
|
||||
'code_postal' => $data['zip'],
|
||||
'localite' => $data['city'],
|
||||
'pays' => $data['country'],
|
||||
'date_emmenagement' => $data['movingdate'],
|
||||
'nom_employeur' => $data['emname'],
|
||||
'adresse_employeur' => $data['emaddress'],
|
||||
'code_postal_employeur' => $data['emzip'],
|
||||
'localite_employeur' => $data['emcity'],
|
||||
'date_engagement' => $data['commitmentdate']
|
||||
);
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($datas_update);
|
||||
echo '</pre>';
|
||||
die(); */
|
||||
|
||||
if ($borrower) {
|
||||
$this->wpdb->update(
|
||||
'cdf_Emprunteur',
|
||||
$datas_update,
|
||||
array('idemprunteur' => $borrower->idemprunteur)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Méthode pour sauvegarder l'adresse du co-emprunteur
|
||||
private function save_co_emprunteur_address($data, $currentCredit) {
|
||||
$coBorrower = $this->getCoBorrower($currentCredit);
|
||||
|
||||
if ($coBorrower) {
|
||||
$this->wpdb->update(
|
||||
'cdf_Emprunteur',
|
||||
array(
|
||||
'adresse' => $data['coaddress'],
|
||||
'code_postal' => $data['cozip'],
|
||||
'localite' => $data['cocity'],
|
||||
'pays' => $data['cocountry'],
|
||||
'date_emmenagement' => $data['comovingdate'],
|
||||
'nom_employeur' => $data['coemname'],
|
||||
'adresse_employeur' => $data['coemaddress'],
|
||||
'code_postal_employeur' => $data['coemzip'],
|
||||
'localite_employeur' => $data['coemcity'],
|
||||
'date_engagement' => $data['cocommitmentdate']
|
||||
),
|
||||
array('idemprunteur' => $coBorrower->idemprunteur)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
7
assets/css/bootstrap.min.css
vendored
Normal file
112
assets/css/buildings.css
Normal file
@ -0,0 +1,112 @@
|
||||
/**
|
||||
* Styles pour la gestion des bâtiments
|
||||
* credit-one-step.php
|
||||
*/
|
||||
|
||||
.wpcf-buildings-section {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.building-block {
|
||||
background-color: #f8f9fa !important;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 20px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.building-block h5 {
|
||||
margin-bottom: 20px;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.building-label {
|
||||
color: #ff6b35;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.building-country-select,
|
||||
.building-rental-amount {
|
||||
animation: slideDown 0.3s ease;
|
||||
}
|
||||
|
||||
@keyframes slideDown {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.building-loan-block {
|
||||
background-color: #fff;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 6px;
|
||||
padding: 20px;
|
||||
margin-bottom: 15px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.wpcf-buildingloan-remove {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
z-index: 10;
|
||||
font-size: 0.875rem;
|
||||
padding: 0.375rem 0.75rem;
|
||||
}
|
||||
|
||||
.wpcf-buildingloan-add {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
/* Amélioration des radio buttons */
|
||||
.form-check-inline {
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.col-form-label {
|
||||
font-weight: 500;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.building-block {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.building-loan-block {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.wpcf-buildingloan-remove {
|
||||
position: relative;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin-bottom: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/* Style pour la section de crédits */
|
||||
.wpcf-buildingloans {
|
||||
margin-top: 30px;
|
||||
padding: 20px;
|
||||
background-color: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.wpcf-buildingloans h4 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#building-loans-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
1568
assets/css/cd_main.css
Normal file
1212
assets/css/credit-manager.css
Normal file
268
assets/css/datatables-credit-manager.css
Normal file
@ -0,0 +1,268 @@
|
||||
/* DataTables Credit Manager Styles */
|
||||
|
||||
/* Table styling */
|
||||
#credits-datatable {
|
||||
width: 100% !important;
|
||||
border-collapse: collapse;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#credits-datatable thead th {
|
||||
background-color: #f1f1f1;
|
||||
border: 1px solid #ddd;
|
||||
padding: 12px 8px;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#credits-datatable tbody td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#credits-datatable tbody tr:nth-child(even) {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
#credits-datatable tbody tr:hover {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
/* DataTables controls */
|
||||
.dataTables_wrapper {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.dataTables_length,
|
||||
.dataTables_filter,
|
||||
.dataTables_info,
|
||||
.dataTables_paginate {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.dataTables_filter input {
|
||||
margin-left: 10px;
|
||||
padding: 5px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* Export buttons styling */
|
||||
.dt-buttons {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.dt-button {
|
||||
background: #0073aa;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 8px 16px;
|
||||
margin-right: 5px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.dt-button:hover {
|
||||
background: #005a87;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.dt-button.buttons-excel {
|
||||
background: #1d6f42;
|
||||
}
|
||||
|
||||
.dt-button.buttons-csv {
|
||||
background: #f39c12;
|
||||
}
|
||||
|
||||
.dt-button.buttons-pdf {
|
||||
background: #e74c3c;
|
||||
}
|
||||
|
||||
.dt-button.buttons-print {
|
||||
background: #6c757d;
|
||||
}
|
||||
|
||||
/* Responsive table */
|
||||
@media (max-width: 768px) {
|
||||
.dataTables_wrapper .dataTables_length,
|
||||
.dataTables_wrapper .dataTables_filter {
|
||||
text-align: center;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.dt-buttons {
|
||||
text-align: center;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.dt-button {
|
||||
margin: 2px;
|
||||
font-size: 12px;
|
||||
padding: 6px 12px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Loading spinner */
|
||||
.dataTables_processing {
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
left: 50%;
|
||||
margin-left: -100px;
|
||||
margin-top: -20px;
|
||||
padding: 20px;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
top: 50%;
|
||||
width: 200px;
|
||||
z-index: 2000;
|
||||
}
|
||||
|
||||
/* Action buttons in table */
|
||||
.action-buttons {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.action-buttons .button {
|
||||
margin: 2px;
|
||||
padding: 4px 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* Modal styling for credit form */
|
||||
.credit-modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
z-index: 1000;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
.credit-modal-content {
|
||||
background-color: #fefefe;
|
||||
margin: 5% auto;
|
||||
padding: 20px;
|
||||
border: 1px solid #888;
|
||||
width: 90%;
|
||||
max-width: 800px;
|
||||
max-height: 80vh;
|
||||
overflow-y: auto;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.credit-modal-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.credit-modal-close {
|
||||
color: #aaa;
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.credit-modal-close:hover {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
/* Form styling */
|
||||
.credit-form {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.credit-form .form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.credit-form .form-group.full-width {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.credit-form label {
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.credit-form input,
|
||||
.credit-form textarea,
|
||||
.credit-form select {
|
||||
padding: 8px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.credit-form textarea {
|
||||
resize: vertical;
|
||||
min-height: 80px;
|
||||
}
|
||||
|
||||
.credit-form .required {
|
||||
color: #e74c3c;
|
||||
}
|
||||
|
||||
/* Success/Error messages */
|
||||
.credit-message {
|
||||
padding: 10px;
|
||||
margin: 10px 0;
|
||||
border-radius: 3px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.credit-message.success {
|
||||
background-color: #d4edda;
|
||||
color: #155724;
|
||||
border: 1px solid #c3e6cb;
|
||||
}
|
||||
|
||||
.credit-message.error {
|
||||
background-color: #f8d7da;
|
||||
color: #721c24;
|
||||
border: 1px solid #f5c6cb;
|
||||
}
|
||||
|
||||
/* Loading state */
|
||||
.loading {
|
||||
opacity: 0.6;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Custom scrollbar for modal */
|
||||
.credit-modal-content::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.credit-modal-content::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.credit-modal-content::-webkit-scrollbar-thumb {
|
||||
background: #c1c1c1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.credit-modal-content::-webkit-scrollbar-thumb:hover {
|
||||
background: #a8a8a8;
|
||||
}
|
||||
160
assets/css/fonts.css
Normal file
@ -0,0 +1,160 @@
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCAIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCkIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCIIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCMIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyC0ITw.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCAIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCkIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCIIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCMIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyC0ITw.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCAIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCkIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCIIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCMIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyC0ITw.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCAIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCkIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCIIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyCMIT5lu.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/raleway/v19/1Ptug8zYS_SKggPNyC0ITw.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
BIN
assets/css/fonts/glyphicons-halflings-regular.eot
Normal file
288
assets/css/fonts/glyphicons-halflings-regular.svg
Normal file
@ -0,0 +1,288 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata></metadata>
|
||||
<defs>
|
||||
<font id="glyphicons_halflingsregular" horiz-adv-x="1200" >
|
||||
<font-face units-per-em="1200" ascent="960" descent="-240" />
|
||||
<missing-glyph horiz-adv-x="500" />
|
||||
<glyph horiz-adv-x="0" />
|
||||
<glyph horiz-adv-x="400" />
|
||||
<glyph unicode=" " />
|
||||
<glyph unicode="*" d="M600 1100q15 0 34 -1.5t30 -3.5l11 -1q10 -2 17.5 -10.5t7.5 -18.5v-224l158 158q7 7 18 8t19 -6l106 -106q7 -8 6 -19t-8 -18l-158 -158h224q10 0 18.5 -7.5t10.5 -17.5q6 -41 6 -75q0 -15 -1.5 -34t-3.5 -30l-1 -11q-2 -10 -10.5 -17.5t-18.5 -7.5h-224l158 -158 q7 -7 8 -18t-6 -19l-106 -106q-8 -7 -19 -6t-18 8l-158 158v-224q0 -10 -7.5 -18.5t-17.5 -10.5q-41 -6 -75 -6q-15 0 -34 1.5t-30 3.5l-11 1q-10 2 -17.5 10.5t-7.5 18.5v224l-158 -158q-7 -7 -18 -8t-19 6l-106 106q-7 8 -6 19t8 18l158 158h-224q-10 0 -18.5 7.5 t-10.5 17.5q-6 41 -6 75q0 15 1.5 34t3.5 30l1 11q2 10 10.5 17.5t18.5 7.5h224l-158 158q-7 7 -8 18t6 19l106 106q8 7 19 6t18 -8l158 -158v224q0 10 7.5 18.5t17.5 10.5q41 6 75 6z" />
|
||||
<glyph unicode="+" d="M450 1100h200q21 0 35.5 -14.5t14.5 -35.5v-350h350q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-350v-350q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v350h-350q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5 h350v350q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode=" " />
|
||||
<glyph unicode="¥" d="M825 1100h250q10 0 12.5 -5t-5.5 -13l-364 -364q-6 -6 -11 -18h268q10 0 13 -6t-3 -14l-120 -160q-6 -8 -18 -14t-22 -6h-125v-100h275q10 0 13 -6t-3 -14l-120 -160q-6 -8 -18 -14t-22 -6h-125v-174q0 -11 -7.5 -18.5t-18.5 -7.5h-148q-11 0 -18.5 7.5t-7.5 18.5v174 h-275q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h125v100h-275q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h118q-5 12 -11 18l-364 364q-8 8 -5.5 13t12.5 5h250q25 0 43 -18l164 -164q8 -8 18 -8t18 8l164 164q18 18 43 18z" />
|
||||
<glyph unicode=" " horiz-adv-x="650" />
|
||||
<glyph unicode=" " horiz-adv-x="1300" />
|
||||
<glyph unicode=" " horiz-adv-x="650" />
|
||||
<glyph unicode=" " horiz-adv-x="1300" />
|
||||
<glyph unicode=" " horiz-adv-x="433" />
|
||||
<glyph unicode=" " horiz-adv-x="325" />
|
||||
<glyph unicode=" " horiz-adv-x="216" />
|
||||
<glyph unicode=" " horiz-adv-x="216" />
|
||||
<glyph unicode=" " horiz-adv-x="162" />
|
||||
<glyph unicode=" " horiz-adv-x="260" />
|
||||
<glyph unicode=" " horiz-adv-x="72" />
|
||||
<glyph unicode=" " horiz-adv-x="260" />
|
||||
<glyph unicode=" " horiz-adv-x="325" />
|
||||
<glyph unicode="€" d="M744 1198q242 0 354 -189q60 -104 66 -209h-181q0 45 -17.5 82.5t-43.5 61.5t-58 40.5t-60.5 24t-51.5 7.5q-19 0 -40.5 -5.5t-49.5 -20.5t-53 -38t-49 -62.5t-39 -89.5h379l-100 -100h-300q-6 -50 -6 -100h406l-100 -100h-300q9 -74 33 -132t52.5 -91t61.5 -54.5t59 -29 t47 -7.5q22 0 50.5 7.5t60.5 24.5t58 41t43.5 61t17.5 80h174q-30 -171 -128 -278q-107 -117 -274 -117q-206 0 -324 158q-36 48 -69 133t-45 204h-217l100 100h112q1 47 6 100h-218l100 100h134q20 87 51 153.5t62 103.5q117 141 297 141z" />
|
||||
<glyph unicode="₽" d="M428 1200h350q67 0 120 -13t86 -31t57 -49.5t35 -56.5t17 -64.5t6.5 -60.5t0.5 -57v-16.5v-16.5q0 -36 -0.5 -57t-6.5 -61t-17 -65t-35 -57t-57 -50.5t-86 -31.5t-120 -13h-178l-2 -100h288q10 0 13 -6t-3 -14l-120 -160q-6 -8 -18 -14t-22 -6h-138v-175q0 -11 -5.5 -18 t-15.5 -7h-149q-10 0 -17.5 7.5t-7.5 17.5v175h-267q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h117v100h-267q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h117v475q0 10 7.5 17.5t17.5 7.5zM600 1000v-300h203q64 0 86.5 33t22.5 119q0 84 -22.5 116t-86.5 32h-203z" />
|
||||
<glyph unicode="−" d="M250 700h800q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="⌛" d="M1000 1200v-150q0 -21 -14.5 -35.5t-35.5 -14.5h-50v-100q0 -91 -49.5 -165.5t-130.5 -109.5q81 -35 130.5 -109.5t49.5 -165.5v-150h50q21 0 35.5 -14.5t14.5 -35.5v-150h-800v150q0 21 14.5 35.5t35.5 14.5h50v150q0 91 49.5 165.5t130.5 109.5q-81 35 -130.5 109.5 t-49.5 165.5v100h-50q-21 0 -35.5 14.5t-14.5 35.5v150h800zM400 1000v-100q0 -60 32.5 -109.5t87.5 -73.5q28 -12 44 -37t16 -55t-16 -55t-44 -37q-55 -24 -87.5 -73.5t-32.5 -109.5v-150h400v150q0 60 -32.5 109.5t-87.5 73.5q-28 12 -44 37t-16 55t16 55t44 37 q55 24 87.5 73.5t32.5 109.5v100h-400z" />
|
||||
<glyph unicode="◼" horiz-adv-x="500" d="M0 0z" />
|
||||
<glyph unicode="☁" d="M503 1089q110 0 200.5 -59.5t134.5 -156.5q44 14 90 14q120 0 205 -86.5t85 -206.5q0 -121 -85 -207.5t-205 -86.5h-750q-79 0 -135.5 57t-56.5 137q0 69 42.5 122.5t108.5 67.5q-2 12 -2 37q0 153 108 260.5t260 107.5z" />
|
||||
<glyph unicode="⛺" d="M774 1193.5q16 -9.5 20.5 -27t-5.5 -33.5l-136 -187l467 -746h30q20 0 35 -18.5t15 -39.5v-42h-1200v42q0 21 15 39.5t35 18.5h30l468 746l-135 183q-10 16 -5.5 34t20.5 28t34 5.5t28 -20.5l111 -148l112 150q9 16 27 20.5t34 -5zM600 200h377l-182 112l-195 534v-646z " />
|
||||
<glyph unicode="✉" d="M25 1100h1150q10 0 12.5 -5t-5.5 -13l-564 -567q-8 -8 -18 -8t-18 8l-564 567q-8 8 -5.5 13t12.5 5zM18 882l264 -264q8 -8 8 -18t-8 -18l-264 -264q-8 -8 -13 -5.5t-5 12.5v550q0 10 5 12.5t13 -5.5zM918 618l264 264q8 8 13 5.5t5 -12.5v-550q0 -10 -5 -12.5t-13 5.5 l-264 264q-8 8 -8 18t8 18zM818 482l364 -364q8 -8 5.5 -13t-12.5 -5h-1150q-10 0 -12.5 5t5.5 13l364 364q8 8 18 8t18 -8l164 -164q8 -8 18 -8t18 8l164 164q8 8 18 8t18 -8z" />
|
||||
<glyph unicode="✏" d="M1011 1210q19 0 33 -13l153 -153q13 -14 13 -33t-13 -33l-99 -92l-214 214l95 96q13 14 32 14zM1013 800l-615 -614l-214 214l614 614zM317 96l-333 -112l110 335z" />
|
||||
<glyph unicode="" d="M700 650v-550h250q21 0 35.5 -14.5t14.5 -35.5v-50h-800v50q0 21 14.5 35.5t35.5 14.5h250v550l-500 550h1200z" />
|
||||
<glyph unicode="" d="M368 1017l645 163q39 15 63 0t24 -49v-831q0 -55 -41.5 -95.5t-111.5 -63.5q-79 -25 -147 -4.5t-86 75t25.5 111.5t122.5 82q72 24 138 8v521l-600 -155v-606q0 -42 -44 -90t-109 -69q-79 -26 -147 -5.5t-86 75.5t25.5 111.5t122.5 82.5q72 24 138 7v639q0 38 14.5 59 t53.5 34z" />
|
||||
<glyph unicode="" d="M500 1191q100 0 191 -39t156.5 -104.5t104.5 -156.5t39 -191l-1 -2l1 -5q0 -141 -78 -262l275 -274q23 -26 22.5 -44.5t-22.5 -42.5l-59 -58q-26 -20 -46.5 -20t-39.5 20l-275 274q-119 -77 -261 -77l-5 1l-2 -1q-100 0 -191 39t-156.5 104.5t-104.5 156.5t-39 191 t39 191t104.5 156.5t156.5 104.5t191 39zM500 1022q-88 0 -162 -43t-117 -117t-43 -162t43 -162t117 -117t162 -43t162 43t117 117t43 162t-43 162t-117 117t-162 43z" />
|
||||
<glyph unicode="" d="M649 949q48 68 109.5 104t121.5 38.5t118.5 -20t102.5 -64t71 -100.5t27 -123q0 -57 -33.5 -117.5t-94 -124.5t-126.5 -127.5t-150 -152.5t-146 -174q-62 85 -145.5 174t-150 152.5t-126.5 127.5t-93.5 124.5t-33.5 117.5q0 64 28 123t73 100.5t104 64t119 20 t120.5 -38.5t104.5 -104z" />
|
||||
<glyph unicode="" d="M407 800l131 353q7 19 17.5 19t17.5 -19l129 -353h421q21 0 24 -8.5t-14 -20.5l-342 -249l130 -401q7 -20 -0.5 -25.5t-24.5 6.5l-343 246l-342 -247q-17 -12 -24.5 -6.5t-0.5 25.5l130 400l-347 251q-17 12 -14 20.5t23 8.5h429z" />
|
||||
<glyph unicode="" d="M407 800l131 353q7 19 17.5 19t17.5 -19l129 -353h421q21 0 24 -8.5t-14 -20.5l-342 -249l130 -401q7 -20 -0.5 -25.5t-24.5 6.5l-343 246l-342 -247q-17 -12 -24.5 -6.5t-0.5 25.5l130 400l-347 251q-17 12 -14 20.5t23 8.5h429zM477 700h-240l197 -142l-74 -226 l193 139l195 -140l-74 229l192 140h-234l-78 211z" />
|
||||
<glyph unicode="" d="M600 1200q124 0 212 -88t88 -212v-250q0 -46 -31 -98t-69 -52v-75q0 -10 6 -21.5t15 -17.5l358 -230q9 -5 15 -16.5t6 -21.5v-93q0 -10 -7.5 -17.5t-17.5 -7.5h-1150q-10 0 -17.5 7.5t-7.5 17.5v93q0 10 6 21.5t15 16.5l358 230q9 6 15 17.5t6 21.5v75q-38 0 -69 52 t-31 98v250q0 124 88 212t212 88z" />
|
||||
<glyph unicode="" d="M25 1100h1150q10 0 17.5 -7.5t7.5 -17.5v-1050q0 -10 -7.5 -17.5t-17.5 -7.5h-1150q-10 0 -17.5 7.5t-7.5 17.5v1050q0 10 7.5 17.5t17.5 7.5zM100 1000v-100h100v100h-100zM875 1000h-550q-10 0 -17.5 -7.5t-7.5 -17.5v-350q0 -10 7.5 -17.5t17.5 -7.5h550 q10 0 17.5 7.5t7.5 17.5v350q0 10 -7.5 17.5t-17.5 7.5zM1000 1000v-100h100v100h-100zM100 800v-100h100v100h-100zM1000 800v-100h100v100h-100zM100 600v-100h100v100h-100zM1000 600v-100h100v100h-100zM875 500h-550q-10 0 -17.5 -7.5t-7.5 -17.5v-350q0 -10 7.5 -17.5 t17.5 -7.5h550q10 0 17.5 7.5t7.5 17.5v350q0 10 -7.5 17.5t-17.5 7.5zM100 400v-100h100v100h-100zM1000 400v-100h100v100h-100zM100 200v-100h100v100h-100zM1000 200v-100h100v100h-100z" />
|
||||
<glyph unicode="" d="M50 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM650 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400 q0 21 14.5 35.5t35.5 14.5zM50 500h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM650 500h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M50 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200 q0 21 14.5 35.5t35.5 14.5zM850 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM50 700h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200 q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 700h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM850 700h200q21 0 35.5 -14.5t14.5 -35.5v-200 q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM50 300h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 300h200 q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM850 300h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5 t35.5 14.5z" />
|
||||
<glyph unicode="" d="M50 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 1100h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v200 q0 21 14.5 35.5t35.5 14.5zM50 700h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 700h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700 q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM50 300h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 300h700q21 0 35.5 -14.5t14.5 -35.5v-200 q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M465 477l571 571q8 8 18 8t17 -8l177 -177q8 -7 8 -17t-8 -18l-783 -784q-7 -8 -17.5 -8t-17.5 8l-384 384q-8 8 -8 18t8 17l177 177q7 8 17 8t18 -8l171 -171q7 -7 18 -7t18 7z" />
|
||||
<glyph unicode="" d="M904 1083l178 -179q8 -8 8 -18.5t-8 -17.5l-267 -268l267 -268q8 -7 8 -17.5t-8 -18.5l-178 -178q-8 -8 -18.5 -8t-17.5 8l-268 267l-268 -267q-7 -8 -17.5 -8t-18.5 8l-178 178q-8 8 -8 18.5t8 17.5l267 268l-267 268q-8 7 -8 17.5t8 18.5l178 178q8 8 18.5 8t17.5 -8 l268 -267l268 268q7 7 17.5 7t18.5 -7z" />
|
||||
<glyph unicode="" d="M507 1177q98 0 187.5 -38.5t154.5 -103.5t103.5 -154.5t38.5 -187.5q0 -141 -78 -262l300 -299q8 -8 8 -18.5t-8 -18.5l-109 -108q-7 -8 -17.5 -8t-18.5 8l-300 299q-119 -77 -261 -77q-98 0 -188 38.5t-154.5 103t-103 154.5t-38.5 188t38.5 187.5t103 154.5 t154.5 103.5t188 38.5zM506.5 1023q-89.5 0 -165.5 -44t-120 -120.5t-44 -166t44 -165.5t120 -120t165.5 -44t166 44t120.5 120t44 165.5t-44 166t-120.5 120.5t-166 44zM425 900h150q10 0 17.5 -7.5t7.5 -17.5v-75h75q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5 t-17.5 -7.5h-75v-75q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v75h-75q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h75v75q0 10 7.5 17.5t17.5 7.5z" />
|
||||
<glyph unicode="" d="M507 1177q98 0 187.5 -38.5t154.5 -103.5t103.5 -154.5t38.5 -187.5q0 -141 -78 -262l300 -299q8 -8 8 -18.5t-8 -18.5l-109 -108q-7 -8 -17.5 -8t-18.5 8l-300 299q-119 -77 -261 -77q-98 0 -188 38.5t-154.5 103t-103 154.5t-38.5 188t38.5 187.5t103 154.5 t154.5 103.5t188 38.5zM506.5 1023q-89.5 0 -165.5 -44t-120 -120.5t-44 -166t44 -165.5t120 -120t165.5 -44t166 44t120.5 120t44 165.5t-44 166t-120.5 120.5t-166 44zM325 800h350q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-350q-10 0 -17.5 7.5 t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5z" />
|
||||
<glyph unicode="" d="M550 1200h100q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM800 975v166q167 -62 272 -209.5t105 -331.5q0 -117 -45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5 t-184.5 123t-123 184.5t-45.5 224q0 184 105 331.5t272 209.5v-166q-103 -55 -165 -155t-62 -220q0 -116 57 -214.5t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5q0 120 -62 220t-165 155z" />
|
||||
<glyph unicode="" d="M1025 1200h150q10 0 17.5 -7.5t7.5 -17.5v-1150q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v1150q0 10 7.5 17.5t17.5 7.5zM725 800h150q10 0 17.5 -7.5t7.5 -17.5v-750q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v750 q0 10 7.5 17.5t17.5 7.5zM425 500h150q10 0 17.5 -7.5t7.5 -17.5v-450q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v450q0 10 7.5 17.5t17.5 7.5zM125 300h150q10 0 17.5 -7.5t7.5 -17.5v-250q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5 v250q0 10 7.5 17.5t17.5 7.5z" />
|
||||
<glyph unicode="" d="M600 1174q33 0 74 -5l38 -152l5 -1q49 -14 94 -39l5 -2l134 80q61 -48 104 -105l-80 -134l3 -5q25 -44 39 -93l1 -6l152 -38q5 -43 5 -73q0 -34 -5 -74l-152 -38l-1 -6q-15 -49 -39 -93l-3 -5l80 -134q-48 -61 -104 -105l-134 81l-5 -3q-44 -25 -94 -39l-5 -2l-38 -151 q-43 -5 -74 -5q-33 0 -74 5l-38 151l-5 2q-49 14 -94 39l-5 3l-134 -81q-60 48 -104 105l80 134l-3 5q-25 45 -38 93l-2 6l-151 38q-6 42 -6 74q0 33 6 73l151 38l2 6q13 48 38 93l3 5l-80 134q47 61 105 105l133 -80l5 2q45 25 94 39l5 1l38 152q43 5 74 5zM600 815 q-89 0 -152 -63t-63 -151.5t63 -151.5t152 -63t152 63t63 151.5t-63 151.5t-152 63z" />
|
||||
<glyph unicode="" d="M500 1300h300q41 0 70.5 -29.5t29.5 -70.5v-100h275q10 0 17.5 -7.5t7.5 -17.5v-75h-1100v75q0 10 7.5 17.5t17.5 7.5h275v100q0 41 29.5 70.5t70.5 29.5zM500 1200v-100h300v100h-300zM1100 900v-800q0 -41 -29.5 -70.5t-70.5 -29.5h-700q-41 0 -70.5 29.5t-29.5 70.5 v800h900zM300 800v-700h100v700h-100zM500 800v-700h100v700h-100zM700 800v-700h100v700h-100zM900 800v-700h100v700h-100z" />
|
||||
<glyph unicode="" d="M18 618l620 608q8 7 18.5 7t17.5 -7l608 -608q8 -8 5.5 -13t-12.5 -5h-175v-575q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v375h-300v-375q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v575h-175q-10 0 -12.5 5t5.5 13z" />
|
||||
<glyph unicode="" d="M600 1200v-400q0 -41 29.5 -70.5t70.5 -29.5h300v-650q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v1100q0 21 14.5 35.5t35.5 14.5h450zM1000 800h-250q-21 0 -35.5 14.5t-14.5 35.5v250z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM525 900h50q10 0 17.5 -7.5t7.5 -17.5v-275h175q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5z" />
|
||||
<glyph unicode="" d="M1300 0h-538l-41 400h-242l-41 -400h-538l431 1200h209l-21 -300h162l-20 300h208zM515 800l-27 -300h224l-27 300h-170z" />
|
||||
<glyph unicode="" d="M550 1200h200q21 0 35.5 -14.5t14.5 -35.5v-450h191q20 0 25.5 -11.5t-7.5 -27.5l-327 -400q-13 -16 -32 -16t-32 16l-327 400q-13 16 -7.5 27.5t25.5 11.5h191v450q0 21 14.5 35.5t35.5 14.5zM1125 400h50q10 0 17.5 -7.5t7.5 -17.5v-350q0 -10 -7.5 -17.5t-17.5 -7.5 h-1050q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h50q10 0 17.5 -7.5t7.5 -17.5v-175h900v175q0 10 7.5 17.5t17.5 7.5z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM525 900h150q10 0 17.5 -7.5t7.5 -17.5v-275h137q21 0 26 -11.5t-8 -27.5l-223 -275q-13 -16 -32 -16t-32 16l-223 275q-13 16 -8 27.5t26 11.5h137v275q0 10 7.5 17.5t17.5 7.5z " />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM632 914l223 -275q13 -16 8 -27.5t-26 -11.5h-137v-275q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v275h-137q-21 0 -26 11.5t8 27.5l223 275q13 16 32 16 t32 -16z" />
|
||||
<glyph unicode="" d="M225 1200h750q10 0 19.5 -7t12.5 -17l186 -652q7 -24 7 -49v-425q0 -12 -4 -27t-9 -17q-12 -6 -37 -6h-1100q-12 0 -27 4t-17 8q-6 13 -6 38l1 425q0 25 7 49l185 652q3 10 12.5 17t19.5 7zM878 1000h-556q-10 0 -19 -7t-11 -18l-87 -450q-2 -11 4 -18t16 -7h150 q10 0 19.5 -7t11.5 -17l38 -152q2 -10 11.5 -17t19.5 -7h250q10 0 19.5 7t11.5 17l38 152q2 10 11.5 17t19.5 7h150q10 0 16 7t4 18l-87 450q-2 11 -11 18t-19 7z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM540 820l253 -190q17 -12 17 -30t-17 -30l-253 -190q-16 -12 -28 -6.5t-12 26.5v400q0 21 12 26.5t28 -6.5z" />
|
||||
<glyph unicode="" d="M947 1060l135 135q7 7 12.5 5t5.5 -13v-362q0 -10 -7.5 -17.5t-17.5 -7.5h-362q-11 0 -13 5.5t5 12.5l133 133q-109 76 -238 76q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5h150q0 -117 -45.5 -224 t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5q192 0 347 -117z" />
|
||||
<glyph unicode="" d="M947 1060l135 135q7 7 12.5 5t5.5 -13v-361q0 -11 -7.5 -18.5t-18.5 -7.5h-361q-11 0 -13 5.5t5 12.5l134 134q-110 75 -239 75q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5h-150q0 117 45.5 224t123 184.5t184.5 123t224 45.5q192 0 347 -117zM1027 600h150 q0 -117 -45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5q-192 0 -348 118l-134 -134q-7 -8 -12.5 -5.5t-5.5 12.5v360q0 11 7.5 18.5t18.5 7.5h360q10 0 12.5 -5.5t-5.5 -12.5l-133 -133q110 -76 240 -76q116 0 214.5 57t155.5 155.5t57 214.5z" />
|
||||
<glyph unicode="" d="M125 1200h1050q10 0 17.5 -7.5t7.5 -17.5v-1150q0 -10 -7.5 -17.5t-17.5 -7.5h-1050q-10 0 -17.5 7.5t-7.5 17.5v1150q0 10 7.5 17.5t17.5 7.5zM1075 1000h-850q-10 0 -17.5 -7.5t-7.5 -17.5v-850q0 -10 7.5 -17.5t17.5 -7.5h850q10 0 17.5 7.5t7.5 17.5v850 q0 10 -7.5 17.5t-17.5 7.5zM325 900h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 900h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5zM325 700h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 700h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5zM325 500h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 500h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5zM325 300h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 300h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5z" />
|
||||
<glyph unicode="" d="M900 800v200q0 83 -58.5 141.5t-141.5 58.5h-300q-82 0 -141 -59t-59 -141v-200h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-600q0 -41 29.5 -70.5t70.5 -29.5h900q41 0 70.5 29.5t29.5 70.5v600q0 41 -29.5 70.5t-70.5 29.5h-100zM400 800v150q0 21 15 35.5t35 14.5h200 q20 0 35 -14.5t15 -35.5v-150h-300z" />
|
||||
<glyph unicode="" d="M125 1100h50q10 0 17.5 -7.5t7.5 -17.5v-1075h-100v1075q0 10 7.5 17.5t17.5 7.5zM1075 1052q4 0 9 -2q16 -6 16 -23v-421q0 -6 -3 -12q-33 -59 -66.5 -99t-65.5 -58t-56.5 -24.5t-52.5 -6.5q-26 0 -57.5 6.5t-52.5 13.5t-60 21q-41 15 -63 22.5t-57.5 15t-65.5 7.5 q-85 0 -160 -57q-7 -5 -15 -5q-6 0 -11 3q-14 7 -14 22v438q22 55 82 98.5t119 46.5q23 2 43 0.5t43 -7t32.5 -8.5t38 -13t32.5 -11q41 -14 63.5 -21t57 -14t63.5 -7q103 0 183 87q7 8 18 8z" />
|
||||
<glyph unicode="" d="M600 1175q116 0 227 -49.5t192.5 -131t131 -192.5t49.5 -227v-300q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v300q0 127 -70.5 231.5t-184.5 161.5t-245 57t-245 -57t-184.5 -161.5t-70.5 -231.5v-300q0 -10 -7.5 -17.5t-17.5 -7.5h-50 q-10 0 -17.5 7.5t-7.5 17.5v300q0 116 49.5 227t131 192.5t192.5 131t227 49.5zM220 500h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14v460q0 8 6 14t14 6zM820 500h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14v460 q0 8 6 14t14 6z" />
|
||||
<glyph unicode="" d="M321 814l258 172q9 6 15 2.5t6 -13.5v-750q0 -10 -6 -13.5t-15 2.5l-258 172q-21 14 -46 14h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h250q25 0 46 14zM900 668l120 120q7 7 17 7t17 -7l34 -34q7 -7 7 -17t-7 -17l-120 -120l120 -120q7 -7 7 -17 t-7 -17l-34 -34q-7 -7 -17 -7t-17 7l-120 119l-120 -119q-7 -7 -17 -7t-17 7l-34 34q-7 7 -7 17t7 17l119 120l-119 120q-7 7 -7 17t7 17l34 34q7 8 17 8t17 -8z" />
|
||||
<glyph unicode="" d="M321 814l258 172q9 6 15 2.5t6 -13.5v-750q0 -10 -6 -13.5t-15 2.5l-258 172q-21 14 -46 14h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h250q25 0 46 14zM766 900h4q10 -1 16 -10q96 -129 96 -290q0 -154 -90 -281q-6 -9 -17 -10l-3 -1q-9 0 -16 6 l-29 23q-7 7 -8.5 16.5t4.5 17.5q72 103 72 229q0 132 -78 238q-6 8 -4.5 18t9.5 17l29 22q7 5 15 5z" />
|
||||
<glyph unicode="" d="M967 1004h3q11 -1 17 -10q135 -179 135 -396q0 -105 -34 -206.5t-98 -185.5q-7 -9 -17 -10h-3q-9 0 -16 6l-42 34q-8 6 -9 16t5 18q111 150 111 328q0 90 -29.5 176t-84.5 157q-6 9 -5 19t10 16l42 33q7 5 15 5zM321 814l258 172q9 6 15 2.5t6 -13.5v-750q0 -10 -6 -13.5 t-15 2.5l-258 172q-21 14 -46 14h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h250q25 0 46 14zM766 900h4q10 -1 16 -10q96 -129 96 -290q0 -154 -90 -281q-6 -9 -17 -10l-3 -1q-9 0 -16 6l-29 23q-7 7 -8.5 16.5t4.5 17.5q72 103 72 229q0 132 -78 238 q-6 8 -4.5 18.5t9.5 16.5l29 22q7 5 15 5z" />
|
||||
<glyph unicode="" d="M500 900h100v-100h-100v-100h-400v-100h-100v600h500v-300zM1200 700h-200v-100h200v-200h-300v300h-200v300h-100v200h600v-500zM100 1100v-300h300v300h-300zM800 1100v-300h300v300h-300zM300 900h-100v100h100v-100zM1000 900h-100v100h100v-100zM300 500h200v-500 h-500v500h200v100h100v-100zM800 300h200v-100h-100v-100h-200v100h-100v100h100v200h-200v100h300v-300zM100 400v-300h300v300h-300zM300 200h-100v100h100v-100zM1200 200h-100v100h100v-100zM700 0h-100v100h100v-100zM1200 0h-300v100h300v-100z" />
|
||||
<glyph unicode="" d="M100 200h-100v1000h100v-1000zM300 200h-100v1000h100v-1000zM700 200h-200v1000h200v-1000zM900 200h-100v1000h100v-1000zM1200 200h-200v1000h200v-1000zM400 0h-300v100h300v-100zM600 0h-100v91h100v-91zM800 0h-100v91h100v-91zM1100 0h-200v91h200v-91z" />
|
||||
<glyph unicode="" d="M500 1200l682 -682q8 -8 8 -18t-8 -18l-464 -464q-8 -8 -18 -8t-18 8l-682 682l1 475q0 10 7.5 17.5t17.5 7.5h474zM319.5 1024.5q-29.5 29.5 -71 29.5t-71 -29.5t-29.5 -71.5t29.5 -71.5t71 -29.5t71 29.5t29.5 71.5t-29.5 71.5z" />
|
||||
<glyph unicode="" d="M500 1200l682 -682q8 -8 8 -18t-8 -18l-464 -464q-8 -8 -18 -8t-18 8l-682 682l1 475q0 10 7.5 17.5t17.5 7.5h474zM800 1200l682 -682q8 -8 8 -18t-8 -18l-464 -464q-8 -8 -18 -8t-18 8l-56 56l424 426l-700 700h150zM319.5 1024.5q-29.5 29.5 -71 29.5t-71 -29.5 t-29.5 -71.5t29.5 -71.5t71 -29.5t71 29.5t29.5 71.5t-29.5 71.5z" />
|
||||
<glyph unicode="" d="M300 1200h825q75 0 75 -75v-900q0 -25 -18 -43l-64 -64q-8 -8 -13 -5.5t-5 12.5v950q0 10 -7.5 17.5t-17.5 7.5h-700q-25 0 -43 -18l-64 -64q-8 -8 -5.5 -13t12.5 -5h700q10 0 17.5 -7.5t7.5 -17.5v-950q0 -10 -7.5 -17.5t-17.5 -7.5h-850q-10 0 -17.5 7.5t-7.5 17.5v975 q0 25 18 43l139 139q18 18 43 18z" />
|
||||
<glyph unicode="" d="M250 1200h800q21 0 35.5 -14.5t14.5 -35.5v-1150l-450 444l-450 -445v1151q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M822 1200h-444q-11 0 -19 -7.5t-9 -17.5l-78 -301q-7 -24 7 -45l57 -108q6 -9 17.5 -15t21.5 -6h450q10 0 21.5 6t17.5 15l62 108q14 21 7 45l-83 301q-1 10 -9 17.5t-19 7.5zM1175 800h-150q-10 0 -21 -6.5t-15 -15.5l-78 -156q-4 -9 -15 -15.5t-21 -6.5h-550 q-10 0 -21 6.5t-15 15.5l-78 156q-4 9 -15 15.5t-21 6.5h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-650q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h750q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5 t7.5 17.5v650q0 10 -7.5 17.5t-17.5 7.5zM850 200h-500q-10 0 -19.5 -7t-11.5 -17l-38 -152q-2 -10 3.5 -17t15.5 -7h600q10 0 15.5 7t3.5 17l-38 152q-2 10 -11.5 17t-19.5 7z" />
|
||||
<glyph unicode="" d="M500 1100h200q56 0 102.5 -20.5t72.5 -50t44 -59t25 -50.5l6 -20h150q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v600q0 41 29.5 70.5t70.5 29.5h150q2 8 6.5 21.5t24 48t45 61t72 48t102.5 21.5zM900 800v-100 h100v100h-100zM600 730q-95 0 -162.5 -67.5t-67.5 -162.5t67.5 -162.5t162.5 -67.5t162.5 67.5t67.5 162.5t-67.5 162.5t-162.5 67.5zM600 603q43 0 73 -30t30 -73t-30 -73t-73 -30t-73 30t-30 73t30 73t73 30z" />
|
||||
<glyph unicode="" d="M681 1199l385 -998q20 -50 60 -92q18 -19 36.5 -29.5t27.5 -11.5l10 -2v-66h-417v66q53 0 75 43.5t5 88.5l-82 222h-391q-58 -145 -92 -234q-11 -34 -6.5 -57t25.5 -37t46 -20t55 -6v-66h-365v66q56 24 84 52q12 12 25 30.5t20 31.5l7 13l399 1006h93zM416 521h340 l-162 457z" />
|
||||
<glyph unicode="" d="M753 641q5 -1 14.5 -4.5t36 -15.5t50.5 -26.5t53.5 -40t50.5 -54.5t35.5 -70t14.5 -87q0 -67 -27.5 -125.5t-71.5 -97.5t-98.5 -66.5t-108.5 -40.5t-102 -13h-500v89q41 7 70.5 32.5t29.5 65.5v827q0 24 -0.5 34t-3.5 24t-8.5 19.5t-17 13.5t-28 12.5t-42.5 11.5v71 l471 -1q57 0 115.5 -20.5t108 -57t80.5 -94t31 -124.5q0 -51 -15.5 -96.5t-38 -74.5t-45 -50.5t-38.5 -30.5zM400 700h139q78 0 130.5 48.5t52.5 122.5q0 41 -8.5 70.5t-29.5 55.5t-62.5 39.5t-103.5 13.5h-118v-350zM400 200h216q80 0 121 50.5t41 130.5q0 90 -62.5 154.5 t-156.5 64.5h-159v-400z" />
|
||||
<glyph unicode="" d="M877 1200l2 -57q-83 -19 -116 -45.5t-40 -66.5l-132 -839q-9 -49 13 -69t96 -26v-97h-500v97q186 16 200 98l173 832q3 17 3 30t-1.5 22.5t-9 17.5t-13.5 12.5t-21.5 10t-26 8.5t-33.5 10q-13 3 -19 5v57h425z" />
|
||||
<glyph unicode="" d="M1300 900h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-200v-850q0 -22 25 -34.5t50 -13.5l25 -2v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v850h-200q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h1000v-300zM175 1000h-75v-800h75l-125 -167l-125 167h75v800h-75l125 167z" />
|
||||
<glyph unicode="" d="M1100 900h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-200v-650q0 -22 25 -34.5t50 -13.5l25 -2v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v650h-200q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h1000v-300zM1167 50l-167 -125v75h-800v-75l-167 125l167 125v-75h800v75z" />
|
||||
<glyph unicode="" d="M50 1100h600q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 800h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM50 500h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M250 1100h700q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 800h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM250 500h700q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M500 950v100q0 21 14.5 35.5t35.5 14.5h600q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5zM100 650v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000 q-21 0 -35.5 14.5t-14.5 35.5zM300 350v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5zM0 50v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100 q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5z" />
|
||||
<glyph unicode="" d="M50 1100h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 800h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM50 500h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M50 1100h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 1100h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM50 800h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 800h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 500h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 500h800q21 0 35.5 -14.5t14.5 -35.5v-100 q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 200h800 q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M400 0h-100v1100h100v-1100zM550 1100h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM550 800h500q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-500 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM267 550l-167 -125v75h-200v100h200v75zM550 500h300q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM550 200h600 q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M50 1100h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM900 0h-100v1100h100v-1100zM50 800h500q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-500 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM1100 600h200v-100h-200v-75l-167 125l167 125v-75zM50 500h300q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h600 q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M75 1000h750q31 0 53 -22t22 -53v-650q0 -31 -22 -53t-53 -22h-750q-31 0 -53 22t-22 53v650q0 31 22 53t53 22zM1200 300l-300 300l300 300v-600z" />
|
||||
<glyph unicode="" d="M44 1100h1112q18 0 31 -13t13 -31v-1012q0 -18 -13 -31t-31 -13h-1112q-18 0 -31 13t-13 31v1012q0 18 13 31t31 13zM100 1000v-737l247 182l298 -131l-74 156l293 318l236 -288v500h-1000zM342 884q56 0 95 -39t39 -94.5t-39 -95t-95 -39.5t-95 39.5t-39 95t39 94.5 t95 39z" />
|
||||
<glyph unicode="" d="M648 1169q117 0 216 -60t156.5 -161t57.5 -218q0 -115 -70 -258q-69 -109 -158 -225.5t-143 -179.5l-54 -62q-9 8 -25.5 24.5t-63.5 67.5t-91 103t-98.5 128t-95.5 148q-60 132 -60 249q0 88 34 169.5t91.5 142t137 96.5t166.5 36zM652.5 974q-91.5 0 -156.5 -65 t-65 -157t65 -156.5t156.5 -64.5t156.5 64.5t65 156.5t-65 157t-156.5 65z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 173v854q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57z" />
|
||||
<glyph unicode="" d="M554 1295q21 -72 57.5 -143.5t76 -130t83 -118t82.5 -117t70 -116t49.5 -126t18.5 -136.5q0 -71 -25.5 -135t-68.5 -111t-99 -82t-118.5 -54t-125.5 -23q-84 5 -161.5 34t-139.5 78.5t-99 125t-37 164.5q0 69 18 136.5t49.5 126.5t69.5 116.5t81.5 117.5t83.5 119 t76.5 131t58.5 143zM344 710q-23 -33 -43.5 -70.5t-40.5 -102.5t-17 -123q1 -37 14.5 -69.5t30 -52t41 -37t38.5 -24.5t33 -15q21 -7 32 -1t13 22l6 34q2 10 -2.5 22t-13.5 19q-5 4 -14 12t-29.5 40.5t-32.5 73.5q-26 89 6 271q2 11 -6 11q-8 1 -15 -10z" />
|
||||
<glyph unicode="" d="M1000 1013l108 115q2 1 5 2t13 2t20.5 -1t25 -9.5t28.5 -21.5q22 -22 27 -43t0 -32l-6 -10l-108 -115zM350 1100h400q50 0 105 -13l-187 -187h-368q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v182l200 200v-332 q0 -165 -93.5 -257.5t-256.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5zM1009 803l-362 -362l-161 -50l55 170l355 355z" />
|
||||
<glyph unicode="" d="M350 1100h361q-164 -146 -216 -200h-195q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5l200 153v-103q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5z M824 1073l339 -301q8 -7 8 -17.5t-8 -17.5l-340 -306q-7 -6 -12.5 -4t-6.5 11v203q-26 1 -54.5 0t-78.5 -7.5t-92 -17.5t-86 -35t-70 -57q10 59 33 108t51.5 81.5t65 58.5t68.5 40.5t67 24.5t56 13.5t40 4.5v210q1 10 6.5 12.5t13.5 -4.5z" />
|
||||
<glyph unicode="" d="M350 1100h350q60 0 127 -23l-178 -177h-349q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v69l200 200v-219q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5z M643 639l395 395q7 7 17.5 7t17.5 -7l101 -101q7 -7 7 -17.5t-7 -17.5l-531 -532q-7 -7 -17.5 -7t-17.5 7l-248 248q-7 7 -7 17.5t7 17.5l101 101q7 7 17.5 7t17.5 -7l111 -111q8 -7 18 -7t18 7z" />
|
||||
<glyph unicode="" d="M318 918l264 264q8 8 18 8t18 -8l260 -264q7 -8 4.5 -13t-12.5 -5h-170v-200h200v173q0 10 5 12t13 -5l264 -260q8 -7 8 -17.5t-8 -17.5l-264 -265q-8 -7 -13 -5t-5 12v173h-200v-200h170q10 0 12.5 -5t-4.5 -13l-260 -264q-8 -8 -18 -8t-18 8l-264 264q-8 8 -5.5 13 t12.5 5h175v200h-200v-173q0 -10 -5 -12t-13 5l-264 265q-8 7 -8 17.5t8 17.5l264 260q8 7 13 5t5 -12v-173h200v200h-175q-10 0 -12.5 5t5.5 13z" />
|
||||
<glyph unicode="" d="M250 1100h100q21 0 35.5 -14.5t14.5 -35.5v-438l464 453q15 14 25.5 10t10.5 -25v-1000q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v1000q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M50 1100h100q21 0 35.5 -14.5t14.5 -35.5v-438l464 453q15 14 25.5 10t10.5 -25v-438l464 453q15 14 25.5 10t10.5 -25v-1000q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5 t-14.5 35.5v1000q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M1200 1050v-1000q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -10.5 -25t-25.5 10l-492 480q-15 14 -15 35t15 35l492 480q15 14 25.5 10t10.5 -25v-438l464 453q15 14 25.5 10t10.5 -25z" />
|
||||
<glyph unicode="" d="M243 1074l814 -498q18 -11 18 -26t-18 -26l-814 -498q-18 -11 -30.5 -4t-12.5 28v1000q0 21 12.5 28t30.5 -4z" />
|
||||
<glyph unicode="" d="M250 1000h200q21 0 35.5 -14.5t14.5 -35.5v-800q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v800q0 21 14.5 35.5t35.5 14.5zM650 1000h200q21 0 35.5 -14.5t14.5 -35.5v-800q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v800 q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M1100 950v-800q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v800q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5z" />
|
||||
<glyph unicode="" d="M500 612v438q0 21 10.5 25t25.5 -10l492 -480q15 -14 15 -35t-15 -35l-492 -480q-15 -14 -25.5 -10t-10.5 25v438l-464 -453q-15 -14 -25.5 -10t-10.5 25v1000q0 21 10.5 25t25.5 -10z" />
|
||||
<glyph unicode="" d="M1048 1102l100 1q20 0 35 -14.5t15 -35.5l5 -1000q0 -21 -14.5 -35.5t-35.5 -14.5l-100 -1q-21 0 -35.5 14.5t-14.5 35.5l-2 437l-463 -454q-14 -15 -24.5 -10.5t-10.5 25.5l-2 437l-462 -455q-15 -14 -25.5 -9.5t-10.5 24.5l-5 1000q0 21 10.5 25.5t25.5 -10.5l466 -450 l-2 438q0 20 10.5 24.5t25.5 -9.5l466 -451l-2 438q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M850 1100h100q21 0 35.5 -14.5t14.5 -35.5v-1000q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v438l-464 -453q-15 -14 -25.5 -10t-10.5 25v1000q0 21 10.5 25t25.5 -10l464 -453v438q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M686 1081l501 -540q15 -15 10.5 -26t-26.5 -11h-1042q-22 0 -26.5 11t10.5 26l501 540q15 15 36 15t36 -15zM150 400h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M885 900l-352 -353l352 -353l-197 -198l-552 552l552 550z" />
|
||||
<glyph unicode="" d="M1064 547l-551 -551l-198 198l353 353l-353 353l198 198z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM650 900h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-150h-150 q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -21 14.5 -35.5t35.5 -14.5h150v-150q0 -21 14.5 -35.5t35.5 -14.5h100q21 0 35.5 14.5t14.5 35.5v150h150q21 0 35.5 14.5t14.5 35.5v100q0 21 -14.5 35.5t-35.5 14.5h-150v150q0 21 -14.5 35.5t-35.5 14.5z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM850 700h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -21 14.5 -35.5 t35.5 -14.5h500q21 0 35.5 14.5t14.5 35.5v100q0 21 -14.5 35.5t-35.5 14.5z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM741.5 913q-12.5 0 -21.5 -9l-120 -120l-120 120q-9 9 -21.5 9 t-21.5 -9l-141 -141q-9 -9 -9 -21.5t9 -21.5l120 -120l-120 -120q-9 -9 -9 -21.5t9 -21.5l141 -141q9 -9 21.5 -9t21.5 9l120 120l120 -120q9 -9 21.5 -9t21.5 9l141 141q9 9 9 21.5t-9 21.5l-120 120l120 120q9 9 9 21.5t-9 21.5l-141 141q-9 9 -21.5 9z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM546 623l-84 85q-7 7 -17.5 7t-18.5 -7l-139 -139q-7 -8 -7 -18t7 -18 l242 -241q7 -8 17.5 -8t17.5 8l375 375q7 7 7 17.5t-7 18.5l-139 139q-7 7 -17.5 7t-17.5 -7z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM588 941q-29 0 -59 -5.5t-63 -20.5t-58 -38.5t-41.5 -63t-16.5 -89.5 q0 -25 20 -25h131q30 -5 35 11q6 20 20.5 28t45.5 8q20 0 31.5 -10.5t11.5 -28.5q0 -23 -7 -34t-26 -18q-1 0 -13.5 -4t-19.5 -7.5t-20 -10.5t-22 -17t-18.5 -24t-15.5 -35t-8 -46q-1 -8 5.5 -16.5t20.5 -8.5h173q7 0 22 8t35 28t37.5 48t29.5 74t12 100q0 47 -17 83 t-42.5 57t-59.5 34.5t-64 18t-59 4.5zM675 400h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM675 1000h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5 t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5zM675 700h-250q-10 0 -17.5 -7.5t-7.5 -17.5v-50q0 -10 7.5 -17.5t17.5 -7.5h75v-200h-75q-10 0 -17.5 -7.5t-7.5 -17.5v-50q0 -10 7.5 -17.5t17.5 -7.5h350q10 0 17.5 7.5t7.5 17.5v50q0 10 -7.5 17.5 t-17.5 7.5h-75v275q0 10 -7.5 17.5t-17.5 7.5z" />
|
||||
<glyph unicode="" d="M525 1200h150q10 0 17.5 -7.5t7.5 -17.5v-194q103 -27 178.5 -102.5t102.5 -178.5h194q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-194q-27 -103 -102.5 -178.5t-178.5 -102.5v-194q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v194 q-103 27 -178.5 102.5t-102.5 178.5h-194q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h194q27 103 102.5 178.5t178.5 102.5v194q0 10 7.5 17.5t17.5 7.5zM700 893v-168q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v168q-68 -23 -119 -74 t-74 -119h168q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-168q23 -68 74 -119t119 -74v168q0 10 7.5 17.5t17.5 7.5h150q10 0 17.5 -7.5t7.5 -17.5v-168q68 23 119 74t74 119h-168q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h168 q-23 68 -74 119t-119 74z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM759 823l64 -64q7 -7 7 -17.5t-7 -17.5l-124 -124l124 -124q7 -7 7 -17.5t-7 -17.5l-64 -64q-7 -7 -17.5 -7t-17.5 7l-124 124l-124 -124q-7 -7 -17.5 -7t-17.5 7l-64 64 q-7 7 -7 17.5t7 17.5l124 124l-124 124q-7 7 -7 17.5t7 17.5l64 64q7 7 17.5 7t17.5 -7l124 -124l124 124q7 7 17.5 7t17.5 -7z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM782 788l106 -106q7 -7 7 -17.5t-7 -17.5l-320 -321q-8 -7 -18 -7t-18 7l-202 203q-8 7 -8 17.5t8 17.5l106 106q7 8 17.5 8t17.5 -8l79 -79l197 197q7 7 17.5 7t17.5 -7z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5q0 -120 65 -225 l587 587q-105 65 -225 65zM965 819l-584 -584q104 -62 219 -62q116 0 214.5 57t155.5 155.5t57 214.5q0 115 -62 219z" />
|
||||
<glyph unicode="" d="M39 582l522 427q16 13 27.5 8t11.5 -26v-291h550q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-550v-291q0 -21 -11.5 -26t-27.5 8l-522 427q-16 13 -16 32t16 32z" />
|
||||
<glyph unicode="" d="M639 1009l522 -427q16 -13 16 -32t-16 -32l-522 -427q-16 -13 -27.5 -8t-11.5 26v291h-550q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h550v291q0 21 11.5 26t27.5 -8z" />
|
||||
<glyph unicode="" d="M682 1161l427 -522q13 -16 8 -27.5t-26 -11.5h-291v-550q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v550h-291q-21 0 -26 11.5t8 27.5l427 522q13 16 32 16t32 -16z" />
|
||||
<glyph unicode="" d="M550 1200h200q21 0 35.5 -14.5t14.5 -35.5v-550h291q21 0 26 -11.5t-8 -27.5l-427 -522q-13 -16 -32 -16t-32 16l-427 522q-13 16 -8 27.5t26 11.5h291v550q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M639 1109l522 -427q16 -13 16 -32t-16 -32l-522 -427q-16 -13 -27.5 -8t-11.5 26v291q-94 -2 -182 -20t-170.5 -52t-147 -92.5t-100.5 -135.5q5 105 27 193.5t67.5 167t113 135t167 91.5t225.5 42v262q0 21 11.5 26t27.5 -8z" />
|
||||
<glyph unicode="" d="M850 1200h300q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -10.5 -25t-24.5 10l-94 94l-249 -249q-8 -7 -18 -7t-18 7l-106 106q-7 8 -7 18t7 18l249 249l-94 94q-14 14 -10 24.5t25 10.5zM350 0h-300q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 10.5 25t24.5 -10l94 -94l249 249 q8 7 18 7t18 -7l106 -106q7 -8 7 -18t-7 -18l-249 -249l94 -94q14 -14 10 -24.5t-25 -10.5z" />
|
||||
<glyph unicode="" d="M1014 1120l106 -106q7 -8 7 -18t-7 -18l-249 -249l94 -94q14 -14 10 -24.5t-25 -10.5h-300q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 10.5 25t24.5 -10l94 -94l249 249q8 7 18 7t18 -7zM250 600h300q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -10.5 -25t-24.5 10l-94 94 l-249 -249q-8 -7 -18 -7t-18 7l-106 106q-7 8 -7 18t7 18l249 249l-94 94q-14 14 -10 24.5t25 10.5z" />
|
||||
<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM704 900h-208q-20 0 -32 -14.5t-8 -34.5l58 -302q4 -20 21.5 -34.5 t37.5 -14.5h54q20 0 37.5 14.5t21.5 34.5l58 302q4 20 -8 34.5t-32 14.5zM675 400h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5z" />
|
||||
<glyph unicode="" d="M260 1200q9 0 19 -2t15 -4l5 -2q22 -10 44 -23l196 -118q21 -13 36 -24q29 -21 37 -12q11 13 49 35l196 118q22 13 45 23q17 7 38 7q23 0 47 -16.5t37 -33.5l13 -16q14 -21 18 -45l25 -123l8 -44q1 -9 8.5 -14.5t17.5 -5.5h61q10 0 17.5 -7.5t7.5 -17.5v-50 q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 -7.5t-7.5 -17.5v-175h-400v300h-200v-300h-400v175q0 10 -7.5 17.5t-17.5 7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5h61q11 0 18 3t7 8q0 4 9 52l25 128q5 25 19 45q2 3 5 7t13.5 15t21.5 19.5t26.5 15.5 t29.5 7zM915 1079l-166 -162q-7 -7 -5 -12t12 -5h219q10 0 15 7t2 17l-51 149q-3 10 -11 12t-15 -6zM463 917l-177 157q-8 7 -16 5t-11 -12l-51 -143q-3 -10 2 -17t15 -7h231q11 0 12.5 5t-5.5 12zM500 0h-375q-10 0 -17.5 7.5t-7.5 17.5v375h400v-400zM1100 400v-375 q0 -10 -7.5 -17.5t-17.5 -7.5h-375v400h400z" />
|
||||
<glyph unicode="" d="M1165 1190q8 3 21 -6.5t13 -17.5q-2 -178 -24.5 -323.5t-55.5 -245.5t-87 -174.5t-102.5 -118.5t-118 -68.5t-118.5 -33t-120 -4.5t-105 9.5t-90 16.5q-61 12 -78 11q-4 1 -12.5 0t-34 -14.5t-52.5 -40.5l-153 -153q-26 -24 -37 -14.5t-11 43.5q0 64 42 102q8 8 50.5 45 t66.5 58q19 17 35 47t13 61q-9 55 -10 102.5t7 111t37 130t78 129.5q39 51 80 88t89.5 63.5t94.5 45t113.5 36t129 31t157.5 37t182 47.5zM1116 1098q-8 9 -22.5 -3t-45.5 -50q-38 -47 -119 -103.5t-142 -89.5l-62 -33q-56 -30 -102 -57t-104 -68t-102.5 -80.5t-85.5 -91 t-64 -104.5q-24 -56 -31 -86t2 -32t31.5 17.5t55.5 59.5q25 30 94 75.5t125.5 77.5t147.5 81q70 37 118.5 69t102 79.5t99 111t86.5 148.5q22 50 24 60t-6 19z" />
|
||||
<glyph unicode="" d="M653 1231q-39 -67 -54.5 -131t-10.5 -114.5t24.5 -96.5t47.5 -80t63.5 -62.5t68.5 -46.5t65 -30q-4 7 -17.5 35t-18.5 39.5t-17 39.5t-17 43t-13 42t-9.5 44.5t-2 42t4 43t13.5 39t23 38.5q96 -42 165 -107.5t105 -138t52 -156t13 -159t-19 -149.5q-13 -55 -44 -106.5 t-68 -87t-78.5 -64.5t-72.5 -45t-53 -22q-72 -22 -127 -11q-31 6 -13 19q6 3 17 7q13 5 32.5 21t41 44t38.5 63.5t21.5 81.5t-6.5 94.5t-50 107t-104 115.5q10 -104 -0.5 -189t-37 -140.5t-65 -93t-84 -52t-93.5 -11t-95 24.5q-80 36 -131.5 114t-53.5 171q-2 23 0 49.5 t4.5 52.5t13.5 56t27.5 60t46 64.5t69.5 68.5q-8 -53 -5 -102.5t17.5 -90t34 -68.5t44.5 -39t49 -2q31 13 38.5 36t-4.5 55t-29 64.5t-36 75t-26 75.5q-15 85 2 161.5t53.5 128.5t85.5 92.5t93.5 61t81.5 25.5z" />
|
||||
<glyph unicode="" d="M600 1094q82 0 160.5 -22.5t140 -59t116.5 -82.5t94.5 -95t68 -95t42.5 -82.5t14 -57.5t-14 -57.5t-43 -82.5t-68.5 -95t-94.5 -95t-116.5 -82.5t-140 -59t-159.5 -22.5t-159.5 22.5t-140 59t-116.5 82.5t-94.5 95t-68.5 95t-43 82.5t-14 57.5t14 57.5t42.5 82.5t68 95 t94.5 95t116.5 82.5t140 59t160.5 22.5zM888 829q-15 15 -18 12t5 -22q25 -57 25 -119q0 -124 -88 -212t-212 -88t-212 88t-88 212q0 59 23 114q8 19 4.5 22t-17.5 -12q-70 -69 -160 -184q-13 -16 -15 -40.5t9 -42.5q22 -36 47 -71t70 -82t92.5 -81t113 -58.5t133.5 -24.5 t133.5 24t113 58.5t92.5 81.5t70 81.5t47 70.5q11 18 9 42.5t-14 41.5q-90 117 -163 189zM448 727l-35 -36q-15 -15 -19.5 -38.5t4.5 -41.5q37 -68 93 -116q16 -13 38.5 -11t36.5 17l35 34q14 15 12.5 33.5t-16.5 33.5q-44 44 -89 117q-11 18 -28 20t-32 -12z" />
|
||||
<glyph unicode="" d="M592 0h-148l31 120q-91 20 -175.5 68.5t-143.5 106.5t-103.5 119t-66.5 110t-22 76q0 21 14 57.5t42.5 82.5t68 95t94.5 95t116.5 82.5t140 59t160.5 22.5q61 0 126 -15l32 121h148zM944 770l47 181q108 -85 176.5 -192t68.5 -159q0 -26 -19.5 -71t-59.5 -102t-93 -112 t-129 -104.5t-158 -75.5l46 173q77 49 136 117t97 131q11 18 9 42.5t-14 41.5q-54 70 -107 130zM310 824q-70 -69 -160 -184q-13 -16 -15 -40.5t9 -42.5q18 -30 39 -60t57 -70.5t74 -73t90 -61t105 -41.5l41 154q-107 18 -178.5 101.5t-71.5 193.5q0 59 23 114q8 19 4.5 22 t-17.5 -12zM448 727l-35 -36q-15 -15 -19.5 -38.5t4.5 -41.5q37 -68 93 -116q16 -13 38.5 -11t36.5 17l12 11l22 86l-3 4q-44 44 -89 117q-11 18 -28 20t-32 -12z" />
|
||||
<glyph unicode="" d="M-90 100l642 1066q20 31 48 28.5t48 -35.5l642 -1056q21 -32 7.5 -67.5t-50.5 -35.5h-1294q-37 0 -50.5 34t7.5 66zM155 200h345v75q0 10 7.5 17.5t17.5 7.5h150q10 0 17.5 -7.5t7.5 -17.5v-75h345l-445 723zM496 700h208q20 0 32 -14.5t8 -34.5l-58 -252 q-4 -20 -21.5 -34.5t-37.5 -14.5h-54q-20 0 -37.5 14.5t-21.5 34.5l-58 252q-4 20 8 34.5t32 14.5z" />
|
||||
<glyph unicode="" d="M650 1200q62 0 106 -44t44 -106v-339l363 -325q15 -14 26 -38.5t11 -44.5v-41q0 -20 -12 -26.5t-29 5.5l-359 249v-263q100 -93 100 -113v-64q0 -21 -13 -29t-32 1l-205 128l-205 -128q-19 -9 -32 -1t-13 29v64q0 20 100 113v263l-359 -249q-17 -12 -29 -5.5t-12 26.5v41 q0 20 11 44.5t26 38.5l363 325v339q0 62 44 106t106 44z" />
|
||||
<glyph unicode="" d="M850 1200h100q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-150h-1100v150q0 21 14.5 35.5t35.5 14.5h50v50q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-50h500v50q0 21 14.5 35.5t35.5 14.5zM1100 800v-750q0 -21 -14.5 -35.5 t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v750h1100zM100 600v-100h100v100h-100zM300 600v-100h100v100h-100zM500 600v-100h100v100h-100zM700 600v-100h100v100h-100zM900 600v-100h100v100h-100zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400 v-100h100v100h-100zM700 400v-100h100v100h-100zM900 400v-100h100v100h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100zM500 200v-100h100v100h-100zM700 200v-100h100v100h-100zM900 200v-100h100v100h-100z" />
|
||||
<glyph unicode="" d="M1135 1165l249 -230q15 -14 15 -35t-15 -35l-249 -230q-14 -14 -24.5 -10t-10.5 25v150h-159l-600 -600h-291q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h209l600 600h241v150q0 21 10.5 25t24.5 -10zM522 819l-141 -141l-122 122h-209q-21 0 -35.5 14.5 t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h291zM1135 565l249 -230q15 -14 15 -35t-15 -35l-249 -230q-14 -14 -24.5 -10t-10.5 25v150h-241l-181 181l141 141l122 -122h159v150q0 21 10.5 25t24.5 -10z" />
|
||||
<glyph unicode="" d="M100 1100h1000q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-596l-304 -300v300h-100q-41 0 -70.5 29.5t-29.5 70.5v600q0 41 29.5 70.5t70.5 29.5z" />
|
||||
<glyph unicode="" d="M150 1200h200q21 0 35.5 -14.5t14.5 -35.5v-250h-300v250q0 21 14.5 35.5t35.5 14.5zM850 1200h200q21 0 35.5 -14.5t14.5 -35.5v-250h-300v250q0 21 14.5 35.5t35.5 14.5zM1100 800v-300q0 -41 -3 -77.5t-15 -89.5t-32 -96t-58 -89t-89 -77t-129 -51t-174 -20t-174 20 t-129 51t-89 77t-58 89t-32 96t-15 89.5t-3 77.5v300h300v-250v-27v-42.5t1.5 -41t5 -38t10 -35t16.5 -30t25.5 -24.5t35 -19t46.5 -12t60 -4t60 4.5t46.5 12.5t35 19.5t25 25.5t17 30.5t10 35t5 38t2 40.5t-0.5 42v25v250h300z" />
|
||||
<glyph unicode="" d="M1100 411l-198 -199l-353 353l-353 -353l-197 199l551 551z" />
|
||||
<glyph unicode="" d="M1101 789l-550 -551l-551 551l198 199l353 -353l353 353z" />
|
||||
<glyph unicode="" d="M404 1000h746q21 0 35.5 -14.5t14.5 -35.5v-551h150q21 0 25 -10.5t-10 -24.5l-230 -249q-14 -15 -35 -15t-35 15l-230 249q-14 14 -10 24.5t25 10.5h150v401h-381zM135 984l230 -249q14 -14 10 -24.5t-25 -10.5h-150v-400h385l215 -200h-750q-21 0 -35.5 14.5 t-14.5 35.5v550h-150q-21 0 -25 10.5t10 24.5l230 249q14 15 35 15t35 -15z" />
|
||||
<glyph unicode="" d="M56 1200h94q17 0 31 -11t18 -27l38 -162h896q24 0 39 -18.5t10 -42.5l-100 -475q-5 -21 -27 -42.5t-55 -21.5h-633l48 -200h535q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-50q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v50h-300v-50 q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v50h-31q-18 0 -32.5 10t-20.5 19l-5 10l-201 961h-54q-20 0 -35 14.5t-15 35.5t15 35.5t35 14.5z" />
|
||||
<glyph unicode="" d="M1200 1000v-100h-1200v100h200q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5h500zM0 800h1200v-800h-1200v800z" />
|
||||
<glyph unicode="" d="M200 800l-200 -400v600h200q0 41 29.5 70.5t70.5 29.5h300q42 0 71 -29.5t29 -70.5h500v-200h-1000zM1500 700l-300 -700h-1200l300 700h1200z" />
|
||||
<glyph unicode="" d="M635 1184l230 -249q14 -14 10 -24.5t-25 -10.5h-150v-601h150q21 0 25 -10.5t-10 -24.5l-230 -249q-14 -15 -35 -15t-35 15l-230 249q-14 14 -10 24.5t25 10.5h150v601h-150q-21 0 -25 10.5t10 24.5l230 249q14 15 35 15t35 -15z" />
|
||||
<glyph unicode="" d="M936 864l249 -229q14 -15 14 -35.5t-14 -35.5l-249 -229q-15 -15 -25.5 -10.5t-10.5 24.5v151h-600v-151q0 -20 -10.5 -24.5t-25.5 10.5l-249 229q-14 15 -14 35.5t14 35.5l249 229q15 15 25.5 10.5t10.5 -25.5v-149h600v149q0 21 10.5 25.5t25.5 -10.5z" />
|
||||
<glyph unicode="" d="M1169 400l-172 732q-5 23 -23 45.5t-38 22.5h-672q-20 0 -38 -20t-23 -41l-172 -739h1138zM1100 300h-1000q-41 0 -70.5 -29.5t-29.5 -70.5v-100q0 -41 29.5 -70.5t70.5 -29.5h1000q41 0 70.5 29.5t29.5 70.5v100q0 41 -29.5 70.5t-70.5 29.5zM800 100v100h100v-100h-100 zM1000 100v100h100v-100h-100z" />
|
||||
<glyph unicode="" d="M1150 1100q21 0 35.5 -14.5t14.5 -35.5v-850q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v850q0 21 14.5 35.5t35.5 14.5zM1000 200l-675 200h-38l47 -276q3 -16 -5.5 -20t-29.5 -4h-7h-84q-20 0 -34.5 14t-18.5 35q-55 337 -55 351v250v6q0 16 1 23.5t6.5 14 t17.5 6.5h200l675 250v-850zM0 750v-250q-4 0 -11 0.5t-24 6t-30 15t-24 30t-11 48.5v50q0 26 10.5 46t25 30t29 16t25.5 7z" />
|
||||
<glyph unicode="" d="M553 1200h94q20 0 29 -10.5t3 -29.5l-18 -37q83 -19 144 -82.5t76 -140.5l63 -327l118 -173h17q19 0 33 -14.5t14 -35t-13 -40.5t-31 -27q-8 -4 -23 -9.5t-65 -19.5t-103 -25t-132.5 -20t-158.5 -9q-57 0 -115 5t-104 12t-88.5 15.5t-73.5 17.5t-54.5 16t-35.5 12l-11 4 q-18 8 -31 28t-13 40.5t14 35t33 14.5h17l118 173l63 327q15 77 76 140t144 83l-18 32q-6 19 3.5 32t28.5 13zM498 110q50 -6 102 -6q53 0 102 6q-12 -49 -39.5 -79.5t-62.5 -30.5t-63 30.5t-39 79.5z" />
|
||||
<glyph unicode="" d="M800 946l224 78l-78 -224l234 -45l-180 -155l180 -155l-234 -45l78 -224l-224 78l-45 -234l-155 180l-155 -180l-45 234l-224 -78l78 224l-234 45l180 155l-180 155l234 45l-78 224l224 -78l45 234l155 -180l155 180z" />
|
||||
<glyph unicode="" d="M650 1200h50q40 0 70 -40.5t30 -84.5v-150l-28 -125h328q40 0 70 -40.5t30 -84.5v-100q0 -45 -29 -74l-238 -344q-16 -24 -38 -40.5t-45 -16.5h-250q-7 0 -42 25t-66 50l-31 25h-61q-45 0 -72.5 18t-27.5 57v400q0 36 20 63l145 196l96 198q13 28 37.5 48t51.5 20z M650 1100l-100 -212l-150 -213v-375h100l136 -100h214l250 375v125h-450l50 225v175h-50zM50 800h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v500q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M600 1100h250q23 0 45 -16.5t38 -40.5l238 -344q29 -29 29 -74v-100q0 -44 -30 -84.5t-70 -40.5h-328q28 -118 28 -125v-150q0 -44 -30 -84.5t-70 -40.5h-50q-27 0 -51.5 20t-37.5 48l-96 198l-145 196q-20 27 -20 63v400q0 39 27.5 57t72.5 18h61q124 100 139 100z M50 1000h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v500q0 21 14.5 35.5t35.5 14.5zM636 1000l-136 -100h-100v-375l150 -213l100 -212h50v175l-50 225h450v125l-250 375h-214z" />
|
||||
<glyph unicode="" d="M356 873l363 230q31 16 53 -6l110 -112q13 -13 13.5 -32t-11.5 -34l-84 -121h302q84 0 138 -38t54 -110t-55 -111t-139 -39h-106l-131 -339q-6 -21 -19.5 -41t-28.5 -20h-342q-7 0 -90 81t-83 94v525q0 17 14 35.5t28 28.5zM400 792v-503l100 -89h293l131 339 q6 21 19.5 41t28.5 20h203q21 0 30.5 25t0.5 50t-31 25h-456h-7h-6h-5.5t-6 0.5t-5 1.5t-5 2t-4 2.5t-4 4t-2.5 4.5q-12 25 5 47l146 183l-86 83zM50 800h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v500 q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M475 1103l366 -230q2 -1 6 -3.5t14 -10.5t18 -16.5t14.5 -20t6.5 -22.5v-525q0 -13 -86 -94t-93 -81h-342q-15 0 -28.5 20t-19.5 41l-131 339h-106q-85 0 -139.5 39t-54.5 111t54 110t138 38h302l-85 121q-11 15 -10.5 34t13.5 32l110 112q22 22 53 6zM370 945l146 -183 q17 -22 5 -47q-2 -2 -3.5 -4.5t-4 -4t-4 -2.5t-5 -2t-5 -1.5t-6 -0.5h-6h-6.5h-6h-475v-100h221q15 0 29 -20t20 -41l130 -339h294l106 89v503l-342 236zM1050 800h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5 v500q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M550 1294q72 0 111 -55t39 -139v-106l339 -131q21 -6 41 -19.5t20 -28.5v-342q0 -7 -81 -90t-94 -83h-525q-17 0 -35.5 14t-28.5 28l-9 14l-230 363q-16 31 6 53l112 110q13 13 32 13.5t34 -11.5l121 -84v302q0 84 38 138t110 54zM600 972v203q0 21 -25 30.5t-50 0.5 t-25 -31v-456v-7v-6v-5.5t-0.5 -6t-1.5 -5t-2 -5t-2.5 -4t-4 -4t-4.5 -2.5q-25 -12 -47 5l-183 146l-83 -86l236 -339h503l89 100v293l-339 131q-21 6 -41 19.5t-20 28.5zM450 200h500q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-500 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M350 1100h500q21 0 35.5 14.5t14.5 35.5v100q0 21 -14.5 35.5t-35.5 14.5h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -21 14.5 -35.5t35.5 -14.5zM600 306v-106q0 -84 -39 -139t-111 -55t-110 54t-38 138v302l-121 -84q-15 -12 -34 -11.5t-32 13.5l-112 110 q-22 22 -6 53l230 363q1 2 3.5 6t10.5 13.5t16.5 17t20 13.5t22.5 6h525q13 0 94 -83t81 -90v-342q0 -15 -20 -28.5t-41 -19.5zM308 900l-236 -339l83 -86l183 146q22 17 47 5q2 -1 4.5 -2.5t4 -4t2.5 -4t2 -5t1.5 -5t0.5 -6v-5.5v-6v-7v-456q0 -22 25 -31t50 0.5t25 30.5 v203q0 15 20 28.5t41 19.5l339 131v293l-89 100h-503z" />
|
||||
<glyph unicode="" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM914 632l-275 223q-16 13 -27.5 8t-11.5 -26v-137h-275 q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h275v-137q0 -21 11.5 -26t27.5 8l275 223q16 13 16 32t-16 32z" />
|
||||
<glyph unicode="" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM561 855l-275 -223q-16 -13 -16 -32t16 -32l275 -223q16 -13 27.5 -8 t11.5 26v137h275q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5h-275v137q0 21 -11.5 26t-27.5 -8z" />
|
||||
<glyph unicode="" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM855 639l-223 275q-13 16 -32 16t-32 -16l-223 -275q-13 -16 -8 -27.5 t26 -11.5h137v-275q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v275h137q21 0 26 11.5t-8 27.5z" />
|
||||
<glyph unicode="" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM675 900h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-275h-137q-21 0 -26 -11.5 t8 -27.5l223 -275q13 -16 32 -16t32 16l223 275q13 16 8 27.5t-26 11.5h-137v275q0 10 -7.5 17.5t-17.5 7.5z" />
|
||||
<glyph unicode="" d="M600 1176q116 0 222.5 -46t184 -123.5t123.5 -184t46 -222.5t-46 -222.5t-123.5 -184t-184 -123.5t-222.5 -46t-222.5 46t-184 123.5t-123.5 184t-46 222.5t46 222.5t123.5 184t184 123.5t222.5 46zM627 1101q-15 -12 -36.5 -20.5t-35.5 -12t-43 -8t-39 -6.5 q-15 -3 -45.5 0t-45.5 -2q-20 -7 -51.5 -26.5t-34.5 -34.5q-3 -11 6.5 -22.5t8.5 -18.5q-3 -34 -27.5 -91t-29.5 -79q-9 -34 5 -93t8 -87q0 -9 17 -44.5t16 -59.5q12 0 23 -5t23.5 -15t19.5 -14q16 -8 33 -15t40.5 -15t34.5 -12q21 -9 52.5 -32t60 -38t57.5 -11 q7 -15 -3 -34t-22.5 -40t-9.5 -38q13 -21 23 -34.5t27.5 -27.5t36.5 -18q0 -7 -3.5 -16t-3.5 -14t5 -17q104 -2 221 112q30 29 46.5 47t34.5 49t21 63q-13 8 -37 8.5t-36 7.5q-15 7 -49.5 15t-51.5 19q-18 0 -41 -0.5t-43 -1.5t-42 -6.5t-38 -16.5q-51 -35 -66 -12 q-4 1 -3.5 25.5t0.5 25.5q-6 13 -26.5 17.5t-24.5 6.5q1 15 -0.5 30.5t-7 28t-18.5 11.5t-31 -21q-23 -25 -42 4q-19 28 -8 58q6 16 22 22q6 -1 26 -1.5t33.5 -4t19.5 -13.5q7 -12 18 -24t21.5 -20.5t20 -15t15.5 -10.5l5 -3q2 12 7.5 30.5t8 34.5t-0.5 32q-3 18 3.5 29 t18 22.5t15.5 24.5q6 14 10.5 35t8 31t15.5 22.5t34 22.5q-6 18 10 36q8 0 24 -1.5t24.5 -1.5t20 4.5t20.5 15.5q-10 23 -31 42.5t-37.5 29.5t-49 27t-43.5 23q0 1 2 8t3 11.5t1.5 10.5t-1 9.5t-4.5 4.5q31 -13 58.5 -14.5t38.5 2.5l12 5q5 28 -9.5 46t-36.5 24t-50 15 t-41 20q-18 -4 -37 0zM613 994q0 -17 8 -42t17 -45t9 -23q-8 1 -39.5 5.5t-52.5 10t-37 16.5q3 11 16 29.5t16 25.5q10 -10 19 -10t14 6t13.5 14.5t16.5 12.5z" />
|
||||
<glyph unicode="" d="M756 1157q164 92 306 -9l-259 -138l145 -232l251 126q6 -89 -34 -156.5t-117 -110.5q-60 -34 -127 -39.5t-126 16.5l-596 -596q-15 -16 -36.5 -16t-36.5 16l-111 110q-15 15 -15 36.5t15 37.5l600 599q-34 101 5.5 201.5t135.5 154.5z" />
|
||||
<glyph unicode="" horiz-adv-x="1220" d="M100 1196h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 1096h-200v-100h200v100zM100 796h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000 q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 696h-500v-100h500v100zM100 396h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 296h-300v-100h300v100z " />
|
||||
<glyph unicode="" d="M150 1200h900q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM700 500v-300l-200 -200v500l-350 500h900z" />
|
||||
<glyph unicode="" d="M500 1200h200q41 0 70.5 -29.5t29.5 -70.5v-100h300q41 0 70.5 -29.5t29.5 -70.5v-400h-500v100h-200v-100h-500v400q0 41 29.5 70.5t70.5 29.5h300v100q0 41 29.5 70.5t70.5 29.5zM500 1100v-100h200v100h-200zM1200 400v-200q0 -41 -29.5 -70.5t-70.5 -29.5h-1000 q-41 0 -70.5 29.5t-29.5 70.5v200h1200z" />
|
||||
<glyph unicode="" d="M50 1200h300q21 0 25 -10.5t-10 -24.5l-94 -94l199 -199q7 -8 7 -18t-7 -18l-106 -106q-8 -7 -18 -7t-18 7l-199 199l-94 -94q-14 -14 -24.5 -10t-10.5 25v300q0 21 14.5 35.5t35.5 14.5zM850 1200h300q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -10.5 -25t-24.5 10l-94 94 l-199 -199q-8 -7 -18 -7t-18 7l-106 106q-7 8 -7 18t7 18l199 199l-94 94q-14 14 -10 24.5t25 10.5zM364 470l106 -106q7 -8 7 -18t-7 -18l-199 -199l94 -94q14 -14 10 -24.5t-25 -10.5h-300q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 10.5 25t24.5 -10l94 -94l199 199 q8 7 18 7t18 -7zM1071 271l94 94q14 14 24.5 10t10.5 -25v-300q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -25 10.5t10 24.5l94 94l-199 199q-7 8 -7 18t7 18l106 106q8 7 18 7t18 -7z" />
|
||||
<glyph unicode="" d="M596 1192q121 0 231.5 -47.5t190 -127t127 -190t47.5 -231.5t-47.5 -231.5t-127 -190.5t-190 -127t-231.5 -47t-231.5 47t-190.5 127t-127 190.5t-47 231.5t47 231.5t127 190t190.5 127t231.5 47.5zM596 1010q-112 0 -207.5 -55.5t-151 -151t-55.5 -207.5t55.5 -207.5 t151 -151t207.5 -55.5t207.5 55.5t151 151t55.5 207.5t-55.5 207.5t-151 151t-207.5 55.5zM454.5 905q22.5 0 38.5 -16t16 -38.5t-16 -39t-38.5 -16.5t-38.5 16.5t-16 39t16 38.5t38.5 16zM754.5 905q22.5 0 38.5 -16t16 -38.5t-16 -39t-38 -16.5q-14 0 -29 10l-55 -145 q17 -23 17 -51q0 -36 -25.5 -61.5t-61.5 -25.5t-61.5 25.5t-25.5 61.5q0 32 20.5 56.5t51.5 29.5l122 126l1 1q-9 14 -9 28q0 23 16 39t38.5 16zM345.5 709q22.5 0 38.5 -16t16 -38.5t-16 -38.5t-38.5 -16t-38.5 16t-16 38.5t16 38.5t38.5 16zM854.5 709q22.5 0 38.5 -16 t16 -38.5t-16 -38.5t-38.5 -16t-38.5 16t-16 38.5t16 38.5t38.5 16z" />
|
||||
<glyph unicode="" d="M546 173l469 470q91 91 99 192q7 98 -52 175.5t-154 94.5q-22 4 -47 4q-34 0 -66.5 -10t-56.5 -23t-55.5 -38t-48 -41.5t-48.5 -47.5q-376 -375 -391 -390q-30 -27 -45 -41.5t-37.5 -41t-32 -46.5t-16 -47.5t-1.5 -56.5q9 -62 53.5 -95t99.5 -33q74 0 125 51l548 548 q36 36 20 75q-7 16 -21.5 26t-32.5 10q-26 0 -50 -23q-13 -12 -39 -38l-341 -338q-15 -15 -35.5 -15.5t-34.5 13.5t-14 34.5t14 34.5q327 333 361 367q35 35 67.5 51.5t78.5 16.5q14 0 29 -1q44 -8 74.5 -35.5t43.5 -68.5q14 -47 2 -96.5t-47 -84.5q-12 -11 -32 -32 t-79.5 -81t-114.5 -115t-124.5 -123.5t-123 -119.5t-96.5 -89t-57 -45q-56 -27 -120 -27q-70 0 -129 32t-93 89q-48 78 -35 173t81 163l511 511q71 72 111 96q91 55 198 55q80 0 152 -33q78 -36 129.5 -103t66.5 -154q17 -93 -11 -183.5t-94 -156.5l-482 -476 q-15 -15 -36 -16t-37 14t-17.5 34t14.5 35z" />
|
||||
<glyph unicode="" d="M649 949q48 68 109.5 104t121.5 38.5t118.5 -20t102.5 -64t71 -100.5t27 -123q0 -57 -33.5 -117.5t-94 -124.5t-126.5 -127.5t-150 -152.5t-146 -174q-62 85 -145.5 174t-150 152.5t-126.5 127.5t-93.5 124.5t-33.5 117.5q0 64 28 123t73 100.5t104 64t119 20 t120.5 -38.5t104.5 -104zM896 972q-33 0 -64.5 -19t-56.5 -46t-47.5 -53.5t-43.5 -45.5t-37.5 -19t-36 19t-40 45.5t-43 53.5t-54 46t-65.5 19q-67 0 -122.5 -55.5t-55.5 -132.5q0 -23 13.5 -51t46 -65t57.5 -63t76 -75l22 -22q15 -14 44 -44t50.5 -51t46 -44t41 -35t23 -12 t23.5 12t42.5 36t46 44t52.5 52t44 43q4 4 12 13q43 41 63.5 62t52 55t46 55t26 46t11.5 44q0 79 -53 133.5t-120 54.5z" />
|
||||
<glyph unicode="" d="M776.5 1214q93.5 0 159.5 -66l141 -141q66 -66 66 -160q0 -42 -28 -95.5t-62 -87.5l-29 -29q-31 53 -77 99l-18 18l95 95l-247 248l-389 -389l212 -212l-105 -106l-19 18l-141 141q-66 66 -66 159t66 159l283 283q65 66 158.5 66zM600 706l105 105q10 -8 19 -17l141 -141 q66 -66 66 -159t-66 -159l-283 -283q-66 -66 -159 -66t-159 66l-141 141q-66 66 -66 159.5t66 159.5l55 55q29 -55 75 -102l18 -17l-95 -95l247 -248l389 389z" />
|
||||
<glyph unicode="" d="M603 1200q85 0 162 -15t127 -38t79 -48t29 -46v-953q0 -41 -29.5 -70.5t-70.5 -29.5h-600q-41 0 -70.5 29.5t-29.5 70.5v953q0 21 30 46.5t81 48t129 37.5t163 15zM300 1000v-700h600v700h-600zM600 254q-43 0 -73.5 -30.5t-30.5 -73.5t30.5 -73.5t73.5 -30.5t73.5 30.5 t30.5 73.5t-30.5 73.5t-73.5 30.5z" />
|
||||
<glyph unicode="" d="M902 1185l283 -282q15 -15 15 -36t-14.5 -35.5t-35.5 -14.5t-35 15l-36 35l-279 -267v-300l-212 210l-308 -307l-280 -203l203 280l307 308l-210 212h300l267 279l-35 36q-15 14 -15 35t14.5 35.5t35.5 14.5t35 -15z" />
|
||||
<glyph unicode="" d="M700 1248v-78q38 -5 72.5 -14.5t75.5 -31.5t71 -53.5t52 -84t24 -118.5h-159q-4 36 -10.5 59t-21 45t-40 35.5t-64.5 20.5v-307l64 -13q34 -7 64 -16.5t70 -32t67.5 -52.5t47.5 -80t20 -112q0 -139 -89 -224t-244 -97v-77h-100v79q-150 16 -237 103q-40 40 -52.5 93.5 t-15.5 139.5h139q5 -77 48.5 -126t117.5 -65v335l-27 8q-46 14 -79 26.5t-72 36t-63 52t-40 72.5t-16 98q0 70 25 126t67.5 92t94.5 57t110 27v77h100zM600 754v274q-29 -4 -50 -11t-42 -21.5t-31.5 -41.5t-10.5 -65q0 -29 7 -50.5t16.5 -34t28.5 -22.5t31.5 -14t37.5 -10 q9 -3 13 -4zM700 547v-310q22 2 42.5 6.5t45 15.5t41.5 27t29 42t12 59.5t-12.5 59.5t-38 44.5t-53 31t-66.5 24.5z" />
|
||||
<glyph unicode="" d="M561 1197q84 0 160.5 -40t123.5 -109.5t47 -147.5h-153q0 40 -19.5 71.5t-49.5 48.5t-59.5 26t-55.5 9q-37 0 -79 -14.5t-62 -35.5q-41 -44 -41 -101q0 -26 13.5 -63t26.5 -61t37 -66q6 -9 9 -14h241v-100h-197q8 -50 -2.5 -115t-31.5 -95q-45 -62 -99 -112 q34 10 83 17.5t71 7.5q32 1 102 -16t104 -17q83 0 136 30l50 -147q-31 -19 -58 -30.5t-55 -15.5t-42 -4.5t-46 -0.5q-23 0 -76 17t-111 32.5t-96 11.5q-39 -3 -82 -16t-67 -25l-23 -11l-55 145q4 3 16 11t15.5 10.5t13 9t15.5 12t14.5 14t17.5 18.5q48 55 54 126.5 t-30 142.5h-221v100h166q-23 47 -44 104q-7 20 -12 41.5t-6 55.5t6 66.5t29.5 70.5t58.5 71q97 88 263 88z" />
|
||||
<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM935 1184l230 -249q14 -14 10 -24.5t-25 -10.5h-150v-900h-200v900h-150q-21 0 -25 10.5t10 24.5l230 249q14 15 35 15t35 -15z" />
|
||||
<glyph unicode="" d="M1000 700h-100v100h-100v-100h-100v500h300v-500zM400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM801 1100v-200h100v200h-100zM1000 350l-200 -250h200v-100h-300v150l200 250h-200v100h300v-150z " />
|
||||
<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1000 1050l-200 -250h200v-100h-300v150l200 250h-200v100h300v-150zM1000 0h-100v100h-100v-100h-100v500h300v-500zM801 400v-200h100v200h-100z " />
|
||||
<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1000 700h-100v400h-100v100h200v-500zM1100 0h-100v100h-200v400h300v-500zM901 400v-200h100v200h-100z" />
|
||||
<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1100 700h-100v100h-200v400h300v-500zM901 1100v-200h100v200h-100zM1000 0h-100v400h-100v100h200v-500z" />
|
||||
<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM900 1000h-200v200h200v-200zM1000 700h-300v200h300v-200zM1100 400h-400v200h400v-200zM1200 100h-500v200h500v-200z" />
|
||||
<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1200 1000h-500v200h500v-200zM1100 700h-400v200h400v-200zM1000 400h-300v200h300v-200zM900 100h-200v200h200v-200z" />
|
||||
<glyph unicode="" d="M350 1100h400q162 0 256 -93.5t94 -256.5v-400q0 -165 -93.5 -257.5t-256.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5z" />
|
||||
<glyph unicode="" d="M350 1100h400q165 0 257.5 -92.5t92.5 -257.5v-400q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-163 0 -256.5 92.5t-93.5 257.5v400q0 163 94 256.5t256 93.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5zM440 770l253 -190q17 -12 17 -30t-17 -30l-253 -190q-16 -12 -28 -6.5t-12 26.5v400q0 21 12 26.5t28 -6.5z" />
|
||||
<glyph unicode="" d="M350 1100h400q163 0 256.5 -94t93.5 -256v-400q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 163 92.5 256.5t257.5 93.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5zM350 700h400q21 0 26.5 -12t-6.5 -28l-190 -253q-12 -17 -30 -17t-30 17l-190 253q-12 16 -6.5 28t26.5 12z" />
|
||||
<glyph unicode="" d="M350 1100h400q165 0 257.5 -92.5t92.5 -257.5v-400q0 -163 -92.5 -256.5t-257.5 -93.5h-400q-163 0 -256.5 94t-93.5 256v400q0 165 92.5 257.5t257.5 92.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5zM580 693l190 -253q12 -16 6.5 -28t-26.5 -12h-400q-21 0 -26.5 12t6.5 28l190 253q12 17 30 17t30 -17z" />
|
||||
<glyph unicode="" d="M550 1100h400q165 0 257.5 -92.5t92.5 -257.5v-400q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h450q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5h-450q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM338 867l324 -284q16 -14 16 -33t-16 -33l-324 -284q-16 -14 -27 -9t-11 26v150h-250q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h250v150q0 21 11 26t27 -9z" />
|
||||
<glyph unicode="" d="M793 1182l9 -9q8 -10 5 -27q-3 -11 -79 -225.5t-78 -221.5l300 1q24 0 32.5 -17.5t-5.5 -35.5q-1 0 -133.5 -155t-267 -312.5t-138.5 -162.5q-12 -15 -26 -15h-9l-9 8q-9 11 -4 32q2 9 42 123.5t79 224.5l39 110h-302q-23 0 -31 19q-10 21 6 41q75 86 209.5 237.5 t228 257t98.5 111.5q9 16 25 16h9z" />
|
||||
<glyph unicode="" d="M350 1100h400q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-450q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h450q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400 q0 165 92.5 257.5t257.5 92.5zM938 867l324 -284q16 -14 16 -33t-16 -33l-324 -284q-16 -14 -27 -9t-11 26v150h-250q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h250v150q0 21 11 26t27 -9z" />
|
||||
<glyph unicode="" d="M750 1200h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -10.5 -25t-24.5 10l-109 109l-312 -312q-15 -15 -35.5 -15t-35.5 15l-141 141q-15 15 -15 35.5t15 35.5l312 312l-109 109q-14 14 -10 24.5t25 10.5zM456 900h-156q-41 0 -70.5 -29.5t-29.5 -70.5v-500 q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v148l200 200v-298q0 -165 -93.5 -257.5t-256.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5h300z" />
|
||||
<glyph unicode="" d="M600 1186q119 0 227.5 -46.5t187 -125t125 -187t46.5 -227.5t-46.5 -227.5t-125 -187t-187 -125t-227.5 -46.5t-227.5 46.5t-187 125t-125 187t-46.5 227.5t46.5 227.5t125 187t187 125t227.5 46.5zM600 1022q-115 0 -212 -56.5t-153.5 -153.5t-56.5 -212t56.5 -212 t153.5 -153.5t212 -56.5t212 56.5t153.5 153.5t56.5 212t-56.5 212t-153.5 153.5t-212 56.5zM600 794q80 0 137 -57t57 -137t-57 -137t-137 -57t-137 57t-57 137t57 137t137 57z" />
|
||||
<glyph unicode="" d="M450 1200h200q21 0 35.5 -14.5t14.5 -35.5v-350h245q20 0 25 -11t-9 -26l-383 -426q-14 -15 -33.5 -15t-32.5 15l-379 426q-13 15 -8.5 26t25.5 11h250v350q0 21 14.5 35.5t35.5 14.5zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5z M900 200v-50h100v50h-100z" />
|
||||
<glyph unicode="" d="M583 1182l378 -435q14 -15 9 -31t-26 -16h-244v-250q0 -20 -17 -35t-39 -15h-200q-20 0 -32 14.5t-12 35.5v250h-250q-20 0 -25.5 16.5t8.5 31.5l383 431q14 16 33.5 17t33.5 -14zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5z M900 200v-50h100v50h-100z" />
|
||||
<glyph unicode="" d="M396 723l369 369q7 7 17.5 7t17.5 -7l139 -139q7 -8 7 -18.5t-7 -17.5l-525 -525q-7 -8 -17.5 -8t-17.5 8l-292 291q-7 8 -7 18t7 18l139 139q8 7 18.5 7t17.5 -7zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5zM900 200v-50h100v50 h-100z" />
|
||||
<glyph unicode="" d="M135 1023l142 142q14 14 35 14t35 -14l77 -77l-212 -212l-77 76q-14 15 -14 36t14 35zM655 855l210 210q14 14 24.5 10t10.5 -25l-2 -599q-1 -20 -15.5 -35t-35.5 -15l-597 -1q-21 0 -25 10.5t10 24.5l208 208l-154 155l212 212zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5 v-250h-1100v250q0 21 14.5 35.5t35.5 14.5zM900 200v-50h100v50h-100z" />
|
||||
<glyph unicode="" d="M350 1200l599 -2q20 -1 35 -15.5t15 -35.5l1 -597q0 -21 -10.5 -25t-24.5 10l-208 208l-155 -154l-212 212l155 154l-210 210q-14 14 -10 24.5t25 10.5zM524 512l-76 -77q-15 -14 -36 -14t-35 14l-142 142q-14 14 -14 35t14 35l77 77zM50 300h1000q21 0 35.5 -14.5 t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5zM900 200v-50h100v50h-100z" />
|
||||
<glyph unicode="" d="M1200 103l-483 276l-314 -399v423h-399l1196 796v-1096zM483 424v-230l683 953z" />
|
||||
<glyph unicode="" d="M1100 1000v-850q0 -21 -14.5 -35.5t-35.5 -14.5h-150v400h-700v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200z" />
|
||||
<glyph unicode="" d="M1100 1000l-2 -149l-299 -299l-95 95q-9 9 -21.5 9t-21.5 -9l-149 -147h-312v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM1132 638l106 -106q7 -7 7 -17.5t-7 -17.5l-420 -421q-8 -7 -18 -7 t-18 7l-202 203q-8 7 -8 17.5t8 17.5l106 106q7 8 17.5 8t17.5 -8l79 -79l297 297q7 7 17.5 7t17.5 -7z" />
|
||||
<glyph unicode="" d="M1100 1000v-269l-103 -103l-134 134q-15 15 -33.5 16.5t-34.5 -12.5l-266 -266h-329v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM1202 572l70 -70q15 -15 15 -35.5t-15 -35.5l-131 -131 l131 -131q15 -15 15 -35.5t-15 -35.5l-70 -70q-15 -15 -35.5 -15t-35.5 15l-131 131l-131 -131q-15 -15 -35.5 -15t-35.5 15l-70 70q-15 15 -15 35.5t15 35.5l131 131l-131 131q-15 15 -15 35.5t15 35.5l70 70q15 15 35.5 15t35.5 -15l131 -131l131 131q15 15 35.5 15 t35.5 -15z" />
|
||||
<glyph unicode="" d="M1100 1000v-300h-350q-21 0 -35.5 -14.5t-14.5 -35.5v-150h-500v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM850 600h100q21 0 35.5 -14.5t14.5 -35.5v-250h150q21 0 25 -10.5t-10 -24.5 l-230 -230q-14 -14 -35 -14t-35 14l-230 230q-14 14 -10 24.5t25 10.5h150v250q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M1100 1000v-400l-165 165q-14 15 -35 15t-35 -15l-263 -265h-402v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM935 565l230 -229q14 -15 10 -25.5t-25 -10.5h-150v-250q0 -20 -14.5 -35 t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35v250h-150q-21 0 -25 10.5t10 25.5l230 229q14 15 35 15t35 -15z" />
|
||||
<glyph unicode="" d="M50 1100h1100q21 0 35.5 -14.5t14.5 -35.5v-150h-1200v150q0 21 14.5 35.5t35.5 14.5zM1200 800v-550q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v550h1200zM100 500v-200h400v200h-400z" />
|
||||
<glyph unicode="" d="M935 1165l248 -230q14 -14 14 -35t-14 -35l-248 -230q-14 -14 -24.5 -10t-10.5 25v150h-400v200h400v150q0 21 10.5 25t24.5 -10zM200 800h-50q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h50v-200zM400 800h-100v200h100v-200zM18 435l247 230 q14 14 24.5 10t10.5 -25v-150h400v-200h-400v-150q0 -21 -10.5 -25t-24.5 10l-247 230q-15 14 -15 35t15 35zM900 300h-100v200h100v-200zM1000 500h51q20 0 34.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-34.5 -14.5h-51v200z" />
|
||||
<glyph unicode="" d="M862 1073l276 116q25 18 43.5 8t18.5 -41v-1106q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v397q-4 1 -11 5t-24 17.5t-30 29t-24 42t-11 56.5v359q0 31 18.5 65t43.5 52zM550 1200q22 0 34.5 -12.5t14.5 -24.5l1 -13v-450q0 -28 -10.5 -59.5 t-25 -56t-29 -45t-25.5 -31.5l-10 -11v-447q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v447q-4 4 -11 11.5t-24 30.5t-30 46t-24 55t-11 60v450q0 2 0.5 5.5t4 12t8.5 15t14.5 12t22.5 5.5q20 0 32.5 -12.5t14.5 -24.5l3 -13v-350h100v350v5.5t2.5 12 t7 15t15 12t25.5 5.5q23 0 35.5 -12.5t13.5 -24.5l1 -13v-350h100v350q0 2 0.5 5.5t3 12t7 15t15 12t24.5 5.5z" />
|
||||
<glyph unicode="" d="M1200 1100v-56q-4 0 -11 -0.5t-24 -3t-30 -7.5t-24 -15t-11 -24v-888q0 -22 25 -34.5t50 -13.5l25 -2v-56h-400v56q75 0 87.5 6.5t12.5 43.5v394h-500v-394q0 -37 12.5 -43.5t87.5 -6.5v-56h-400v56q4 0 11 0.5t24 3t30 7.5t24 15t11 24v888q0 22 -25 34.5t-50 13.5 l-25 2v56h400v-56q-75 0 -87.5 -6.5t-12.5 -43.5v-394h500v394q0 37 -12.5 43.5t-87.5 6.5v56h400z" />
|
||||
<glyph unicode="" d="M675 1000h375q21 0 35.5 -14.5t14.5 -35.5v-150h-105l-295 -98v98l-200 200h-400l100 100h375zM100 900h300q41 0 70.5 -29.5t29.5 -70.5v-500q0 -41 -29.5 -70.5t-70.5 -29.5h-300q-41 0 -70.5 29.5t-29.5 70.5v500q0 41 29.5 70.5t70.5 29.5zM100 800v-200h300v200 h-300zM1100 535l-400 -133v163l400 133v-163zM100 500v-200h300v200h-300zM1100 398v-248q0 -21 -14.5 -35.5t-35.5 -14.5h-375l-100 -100h-375l-100 100h400l200 200h105z" />
|
||||
<glyph unicode="" d="M17 1007l162 162q17 17 40 14t37 -22l139 -194q14 -20 11 -44.5t-20 -41.5l-119 -118q102 -142 228 -268t267 -227l119 118q17 17 42.5 19t44.5 -12l192 -136q19 -14 22.5 -37.5t-13.5 -40.5l-163 -162q-3 -1 -9.5 -1t-29.5 2t-47.5 6t-62.5 14.5t-77.5 26.5t-90 42.5 t-101.5 60t-111 83t-119 108.5q-74 74 -133.5 150.5t-94.5 138.5t-60 119.5t-34.5 100t-15 74.5t-4.5 48z" />
|
||||
<glyph unicode="" d="M600 1100q92 0 175 -10.5t141.5 -27t108.5 -36.5t81.5 -40t53.5 -37t31 -27l9 -10v-200q0 -21 -14.5 -33t-34.5 -9l-202 34q-20 3 -34.5 20t-14.5 38v146q-141 24 -300 24t-300 -24v-146q0 -21 -14.5 -38t-34.5 -20l-202 -34q-20 -3 -34.5 9t-14.5 33v200q3 4 9.5 10.5 t31 26t54 37.5t80.5 39.5t109 37.5t141 26.5t175 10.5zM600 795q56 0 97 -9.5t60 -23.5t30 -28t12 -24l1 -10v-50l365 -303q14 -15 24.5 -40t10.5 -45v-212q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v212q0 20 10.5 45t24.5 40l365 303v50 q0 4 1 10.5t12 23t30 29t60 22.5t97 10z" />
|
||||
<glyph unicode="" d="M1100 700l-200 -200h-600l-200 200v500h200v-200h200v200h200v-200h200v200h200v-500zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-12l137 -100h-950l137 100h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5 t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M700 1100h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-1000h300v1000q0 41 -29.5 70.5t-70.5 29.5zM1100 800h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-700h300v700q0 41 -29.5 70.5t-70.5 29.5zM400 0h-300v400q0 41 29.5 70.5t70.5 29.5h100q41 0 70.5 -29.5t29.5 -70.5v-400z " />
|
||||
<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 700h-200v-100h200v-300h-300v100h200v100h-200v300h300v-100zM900 700v-300l-100 -100h-200v500h200z M700 700v-300h100v300h-100z" />
|
||||
<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 300h-100v200h-100v-200h-100v500h100v-200h100v200h100v-500zM900 700v-300l-100 -100h-200v500h200z M700 700v-300h100v300h-100z" />
|
||||
<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 700h-200v-300h200v-100h-300v500h300v-100zM900 700h-200v-300h200v-100h-300v500h300v-100z" />
|
||||
<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 400l-300 150l300 150v-300zM900 550l-300 -150v300z" />
|
||||
<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM900 300h-700v500h700v-500zM800 700h-130q-38 0 -66.5 -43t-28.5 -108t27 -107t68 -42h130v300zM300 700v-300 h130q41 0 68 42t27 107t-28.5 108t-66.5 43h-130z" />
|
||||
<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 700h-200v-100h200v-300h-300v100h200v100h-200v300h300v-100zM900 300h-100v400h-100v100h200v-500z M700 300h-100v100h100v-100z" />
|
||||
<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM300 700h200v-400h-300v500h100v-100zM900 300h-100v400h-100v100h200v-500zM300 600v-200h100v200h-100z M700 300h-100v100h100v-100z" />
|
||||
<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 500l-199 -200h-100v50l199 200v150h-200v100h300v-300zM900 300h-100v400h-100v100h200v-500zM701 300h-100 v100h100v-100z" />
|
||||
<glyph unicode="" d="M600 1191q120 0 229.5 -47t188.5 -126t126 -188.5t47 -229.5t-47 -229.5t-126 -188.5t-188.5 -126t-229.5 -47t-229.5 47t-188.5 126t-126 188.5t-47 229.5t47 229.5t126 188.5t188.5 126t229.5 47zM600 1021q-114 0 -211 -56.5t-153.5 -153.5t-56.5 -211t56.5 -211 t153.5 -153.5t211 -56.5t211 56.5t153.5 153.5t56.5 211t-56.5 211t-153.5 153.5t-211 56.5zM800 700h-300v-200h300v-100h-300l-100 100v200l100 100h300v-100z" />
|
||||
<glyph unicode="" d="M600 1191q120 0 229.5 -47t188.5 -126t126 -188.5t47 -229.5t-47 -229.5t-126 -188.5t-188.5 -126t-229.5 -47t-229.5 47t-188.5 126t-126 188.5t-47 229.5t47 229.5t126 188.5t188.5 126t229.5 47zM600 1021q-114 0 -211 -56.5t-153.5 -153.5t-56.5 -211t56.5 -211 t153.5 -153.5t211 -56.5t211 56.5t153.5 153.5t56.5 211t-56.5 211t-153.5 153.5t-211 56.5zM800 700v-100l-50 -50l100 -100v-50h-100l-100 100h-150v-100h-100v400h300zM500 700v-100h200v100h-200z" />
|
||||
<glyph unicode="" d="M503 1089q110 0 200.5 -59.5t134.5 -156.5q44 14 90 14q120 0 205 -86.5t85 -207t-85 -207t-205 -86.5h-128v250q0 21 -14.5 35.5t-35.5 14.5h-300q-21 0 -35.5 -14.5t-14.5 -35.5v-250h-222q-80 0 -136 57.5t-56 136.5q0 69 43 122.5t108 67.5q-2 19 -2 37q0 100 49 185 t134 134t185 49zM525 500h150q10 0 17.5 -7.5t7.5 -17.5v-275h137q21 0 26 -11.5t-8 -27.5l-223 -244q-13 -16 -32 -16t-32 16l-223 244q-13 16 -8 27.5t26 11.5h137v275q0 10 7.5 17.5t17.5 7.5z" />
|
||||
<glyph unicode="" d="M502 1089q110 0 201 -59.5t135 -156.5q43 15 89 15q121 0 206 -86.5t86 -206.5q0 -99 -60 -181t-150 -110l-378 360q-13 16 -31.5 16t-31.5 -16l-381 -365h-9q-79 0 -135.5 57.5t-56.5 136.5q0 69 43 122.5t108 67.5q-2 19 -2 38q0 100 49 184.5t133.5 134t184.5 49.5z M632 467l223 -228q13 -16 8 -27.5t-26 -11.5h-137v-275q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v275h-137q-21 0 -26 11.5t8 27.5q199 204 223 228q19 19 31.5 19t32.5 -19z" />
|
||||
<glyph unicode="" d="M700 100v100h400l-270 300h170l-270 300h170l-300 333l-300 -333h170l-270 -300h170l-270 -300h400v-100h-50q-21 0 -35.5 -14.5t-14.5 -35.5v-50h400v50q0 21 -14.5 35.5t-35.5 14.5h-50z" />
|
||||
<glyph unicode="" d="M600 1179q94 0 167.5 -56.5t99.5 -145.5q89 -6 150.5 -71.5t61.5 -155.5q0 -61 -29.5 -112.5t-79.5 -82.5q9 -29 9 -55q0 -74 -52.5 -126.5t-126.5 -52.5q-55 0 -100 30v-251q21 0 35.5 -14.5t14.5 -35.5v-50h-300v50q0 21 14.5 35.5t35.5 14.5v251q-45 -30 -100 -30 q-74 0 -126.5 52.5t-52.5 126.5q0 18 4 38q-47 21 -75.5 65t-28.5 97q0 74 52.5 126.5t126.5 52.5q5 0 23 -2q0 2 -1 10t-1 13q0 116 81.5 197.5t197.5 81.5z" />
|
||||
<glyph unicode="" d="M1010 1010q111 -111 150.5 -260.5t0 -299t-150.5 -260.5q-83 -83 -191.5 -126.5t-218.5 -43.5t-218.5 43.5t-191.5 126.5q-111 111 -150.5 260.5t0 299t150.5 260.5q83 83 191.5 126.5t218.5 43.5t218.5 -43.5t191.5 -126.5zM476 1065q-4 0 -8 -1q-121 -34 -209.5 -122.5 t-122.5 -209.5q-4 -12 2.5 -23t18.5 -14l36 -9q3 -1 7 -1q23 0 29 22q27 96 98 166q70 71 166 98q11 3 17.5 13.5t3.5 22.5l-9 35q-3 13 -14 19q-7 4 -15 4zM512 920q-4 0 -9 -2q-80 -24 -138.5 -82.5t-82.5 -138.5q-4 -13 2 -24t19 -14l34 -9q4 -1 8 -1q22 0 28 21 q18 58 58.5 98.5t97.5 58.5q12 3 18 13.5t3 21.5l-9 35q-3 12 -14 19q-7 4 -15 4zM719.5 719.5q-49.5 49.5 -119.5 49.5t-119.5 -49.5t-49.5 -119.5t49.5 -119.5t119.5 -49.5t119.5 49.5t49.5 119.5t-49.5 119.5zM855 551q-22 0 -28 -21q-18 -58 -58.5 -98.5t-98.5 -57.5 q-11 -4 -17 -14.5t-3 -21.5l9 -35q3 -12 14 -19q7 -4 15 -4q4 0 9 2q80 24 138.5 82.5t82.5 138.5q4 13 -2.5 24t-18.5 14l-34 9q-4 1 -8 1zM1000 515q-23 0 -29 -22q-27 -96 -98 -166q-70 -71 -166 -98q-11 -3 -17.5 -13.5t-3.5 -22.5l9 -35q3 -13 14 -19q7 -4 15 -4 q4 0 8 1q121 34 209.5 122.5t122.5 209.5q4 12 -2.5 23t-18.5 14l-36 9q-3 1 -7 1z" />
|
||||
<glyph unicode="" d="M700 800h300v-380h-180v200h-340v-200h-380v755q0 10 7.5 17.5t17.5 7.5h575v-400zM1000 900h-200v200zM700 300h162l-212 -212l-212 212h162v200h100v-200zM520 0h-395q-10 0 -17.5 7.5t-7.5 17.5v395zM1000 220v-195q0 -10 -7.5 -17.5t-17.5 -7.5h-195z" />
|
||||
<glyph unicode="" d="M700 800h300v-520l-350 350l-550 -550v1095q0 10 7.5 17.5t17.5 7.5h575v-400zM1000 900h-200v200zM862 200h-162v-200h-100v200h-162l212 212zM480 0h-355q-10 0 -17.5 7.5t-7.5 17.5v55h380v-80zM1000 80v-55q0 -10 -7.5 -17.5t-17.5 -7.5h-155v80h180z" />
|
||||
<glyph unicode="" d="M1162 800h-162v-200h100l100 -100h-300v300h-162l212 212zM200 800h200q27 0 40 -2t29.5 -10.5t23.5 -30t7 -57.5h300v-100h-600l-200 -350v450h100q0 36 7 57.5t23.5 30t29.5 10.5t40 2zM800 400h240l-240 -400h-800l300 500h500v-100z" />
|
||||
<glyph unicode="" d="M650 1100h100q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h50v50q0 21 14.5 35.5t35.5 14.5zM1000 850v150q41 0 70.5 -29.5t29.5 -70.5v-800 q0 -41 -29.5 -70.5t-70.5 -29.5h-600q-1 0 -20 4l246 246l-326 326v324q0 41 29.5 70.5t70.5 29.5v-150q0 -62 44 -106t106 -44h300q62 0 106 44t44 106zM412 250l-212 -212v162h-200v100h200v162z" />
|
||||
<glyph unicode="" d="M450 1100h100q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h50v50q0 21 14.5 35.5t35.5 14.5zM800 850v150q41 0 70.5 -29.5t29.5 -70.5v-500 h-200v-300h200q0 -36 -7 -57.5t-23.5 -30t-29.5 -10.5t-40 -2h-600q-41 0 -70.5 29.5t-29.5 70.5v800q0 41 29.5 70.5t70.5 29.5v-150q0 -62 44 -106t106 -44h300q62 0 106 44t44 106zM1212 250l-212 -212v162h-200v100h200v162z" />
|
||||
<glyph unicode="" d="M658 1197l637 -1104q23 -38 7 -65.5t-60 -27.5h-1276q-44 0 -60 27.5t7 65.5l637 1104q22 39 54 39t54 -39zM704 800h-208q-20 0 -32 -14.5t-8 -34.5l58 -302q4 -20 21.5 -34.5t37.5 -14.5h54q20 0 37.5 14.5t21.5 34.5l58 302q4 20 -8 34.5t-32 14.5zM500 300v-100h200 v100h-200z" />
|
||||
<glyph unicode="" d="M425 1100h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM425 800h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5 t17.5 7.5zM825 800h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM25 500h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150 q0 10 7.5 17.5t17.5 7.5zM425 500h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM825 500h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5 v150q0 10 7.5 17.5t17.5 7.5zM25 200h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM425 200h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5 t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM825 200h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5z" />
|
||||
<glyph unicode="" d="M700 1200h100v-200h-100v-100h350q62 0 86.5 -39.5t-3.5 -94.5l-66 -132q-41 -83 -81 -134h-772q-40 51 -81 134l-66 132q-28 55 -3.5 94.5t86.5 39.5h350v100h-100v200h100v100h200v-100zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-12l137 -100 h-950l138 100h-13q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M600 1300q40 0 68.5 -29.5t28.5 -70.5h-194q0 41 28.5 70.5t68.5 29.5zM443 1100h314q18 -37 18 -75q0 -8 -3 -25h328q41 0 44.5 -16.5t-30.5 -38.5l-175 -145h-678l-178 145q-34 22 -29 38.5t46 16.5h328q-3 17 -3 25q0 38 18 75zM250 700h700q21 0 35.5 -14.5 t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-150v-200l275 -200h-950l275 200v200h-150q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M600 1181q75 0 128 -53t53 -128t-53 -128t-128 -53t-128 53t-53 128t53 128t128 53zM602 798h46q34 0 55.5 -28.5t21.5 -86.5q0 -76 39 -183h-324q39 107 39 183q0 58 21.5 86.5t56.5 28.5h45zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-13 l138 -100h-950l137 100h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M600 1300q47 0 92.5 -53.5t71 -123t25.5 -123.5q0 -78 -55.5 -133.5t-133.5 -55.5t-133.5 55.5t-55.5 133.5q0 62 34 143l144 -143l111 111l-163 163q34 26 63 26zM602 798h46q34 0 55.5 -28.5t21.5 -86.5q0 -76 39 -183h-324q39 107 39 183q0 58 21.5 86.5t56.5 28.5h45 zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-13l138 -100h-950l137 100h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M600 1200l300 -161v-139h-300q0 -57 18.5 -108t50 -91.5t63 -72t70 -67.5t57.5 -61h-530q-60 83 -90.5 177.5t-30.5 178.5t33 164.5t87.5 139.5t126 96.5t145.5 41.5v-98zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-13l138 -100h-950l137 100 h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M600 1300q41 0 70.5 -29.5t29.5 -70.5v-78q46 -26 73 -72t27 -100v-50h-400v50q0 54 27 100t73 72v78q0 41 29.5 70.5t70.5 29.5zM400 800h400q54 0 100 -27t72 -73h-172v-100h200v-100h-200v-100h200v-100h-200v-100h200q0 -83 -58.5 -141.5t-141.5 -58.5h-400 q-83 0 -141.5 58.5t-58.5 141.5v400q0 83 58.5 141.5t141.5 58.5z" />
|
||||
<glyph unicode="" d="M150 1100h900q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v500q0 21 14.5 35.5t35.5 14.5zM125 400h950q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-283l224 -224q13 -13 13 -31.5t-13 -32 t-31.5 -13.5t-31.5 13l-88 88h-524l-87 -88q-13 -13 -32 -13t-32 13.5t-13 32t13 31.5l224 224h-289q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM541 300l-100 -100h324l-100 100h-124z" />
|
||||
<glyph unicode="" d="M200 1100h800q83 0 141.5 -58.5t58.5 -141.5v-200h-100q0 41 -29.5 70.5t-70.5 29.5h-250q-41 0 -70.5 -29.5t-29.5 -70.5h-100q0 41 -29.5 70.5t-70.5 29.5h-250q-41 0 -70.5 -29.5t-29.5 -70.5h-100v200q0 83 58.5 141.5t141.5 58.5zM100 600h1000q41 0 70.5 -29.5 t29.5 -70.5v-300h-1200v300q0 41 29.5 70.5t70.5 29.5zM300 100v-50q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v50h200zM1100 100v-50q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v50h200z" />
|
||||
<glyph unicode="" d="M480 1165l682 -683q31 -31 31 -75.5t-31 -75.5l-131 -131h-481l-517 518q-32 31 -32 75.5t32 75.5l295 296q31 31 75.5 31t76.5 -31zM108 794l342 -342l303 304l-341 341zM250 100h800q21 0 35.5 -14.5t14.5 -35.5v-50h-900v50q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M1057 647l-189 506q-8 19 -27.5 33t-40.5 14h-400q-21 0 -40.5 -14t-27.5 -33l-189 -506q-8 -19 1.5 -33t30.5 -14h625v-150q0 -21 14.5 -35.5t35.5 -14.5t35.5 14.5t14.5 35.5v150h125q21 0 30.5 14t1.5 33zM897 0h-595v50q0 21 14.5 35.5t35.5 14.5h50v50 q0 21 14.5 35.5t35.5 14.5h48v300h200v-300h47q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-50z" />
|
||||
<glyph unicode="" d="M900 800h300v-575q0 -10 -7.5 -17.5t-17.5 -7.5h-375v591l-300 300v84q0 10 7.5 17.5t17.5 7.5h375v-400zM1200 900h-200v200zM400 600h300v-575q0 -10 -7.5 -17.5t-17.5 -7.5h-650q-10 0 -17.5 7.5t-7.5 17.5v950q0 10 7.5 17.5t17.5 7.5h375v-400zM700 700h-200v200z " />
|
||||
<glyph unicode="" d="M484 1095h195q75 0 146 -32.5t124 -86t89.5 -122.5t48.5 -142q18 -14 35 -20q31 -10 64.5 6.5t43.5 48.5q10 34 -15 71q-19 27 -9 43q5 8 12.5 11t19 -1t23.5 -16q41 -44 39 -105q-3 -63 -46 -106.5t-104 -43.5h-62q-7 -55 -35 -117t-56 -100l-39 -234q-3 -20 -20 -34.5 t-38 -14.5h-100q-21 0 -33 14.5t-9 34.5l12 70q-49 -14 -91 -14h-195q-24 0 -65 8l-11 -64q-3 -20 -20 -34.5t-38 -14.5h-100q-21 0 -33 14.5t-9 34.5l26 157q-84 74 -128 175l-159 53q-19 7 -33 26t-14 40v50q0 21 14.5 35.5t35.5 14.5h124q11 87 56 166l-111 95 q-16 14 -12.5 23.5t24.5 9.5h203q116 101 250 101zM675 1000h-250q-10 0 -17.5 -7.5t-7.5 -17.5v-50q0 -10 7.5 -17.5t17.5 -7.5h250q10 0 17.5 7.5t7.5 17.5v50q0 10 -7.5 17.5t-17.5 7.5z" />
|
||||
<glyph unicode="" d="M641 900l423 247q19 8 42 2.5t37 -21.5l32 -38q14 -15 12.5 -36t-17.5 -34l-139 -120h-390zM50 1100h106q67 0 103 -17t66 -71l102 -212h823q21 0 35.5 -14.5t14.5 -35.5v-50q0 -21 -14 -40t-33 -26l-737 -132q-23 -4 -40 6t-26 25q-42 67 -100 67h-300q-62 0 -106 44 t-44 106v200q0 62 44 106t106 44zM173 928h-80q-19 0 -28 -14t-9 -35v-56q0 -51 42 -51h134q16 0 21.5 8t5.5 24q0 11 -16 45t-27 51q-18 28 -43 28zM550 727q-32 0 -54.5 -22.5t-22.5 -54.5t22.5 -54.5t54.5 -22.5t54.5 22.5t22.5 54.5t-22.5 54.5t-54.5 22.5zM130 389 l152 130q18 19 34 24t31 -3.5t24.5 -17.5t25.5 -28q28 -35 50.5 -51t48.5 -13l63 5l48 -179q13 -61 -3.5 -97.5t-67.5 -79.5l-80 -69q-47 -40 -109 -35.5t-103 51.5l-130 151q-40 47 -35.5 109.5t51.5 102.5zM380 377l-102 -88q-31 -27 2 -65l37 -43q13 -15 27.5 -19.5 t31.5 6.5l61 53q19 16 14 49q-2 20 -12 56t-17 45q-11 12 -19 14t-23 -8z" />
|
||||
<glyph unicode="" d="M625 1200h150q10 0 17.5 -7.5t7.5 -17.5v-109q79 -33 131 -87.5t53 -128.5q1 -46 -15 -84.5t-39 -61t-46 -38t-39 -21.5l-17 -6q6 0 15 -1.5t35 -9t50 -17.5t53 -30t50 -45t35.5 -64t14.5 -84q0 -59 -11.5 -105.5t-28.5 -76.5t-44 -51t-49.5 -31.5t-54.5 -16t-49.5 -6.5 t-43.5 -1v-75q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v75h-100v-75q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v75h-175q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h75v600h-75q-10 0 -17.5 7.5t-7.5 17.5v150 q0 10 7.5 17.5t17.5 7.5h175v75q0 10 7.5 17.5t17.5 7.5h150q10 0 17.5 -7.5t7.5 -17.5v-75h100v75q0 10 7.5 17.5t17.5 7.5zM400 900v-200h263q28 0 48.5 10.5t30 25t15 29t5.5 25.5l1 10q0 4 -0.5 11t-6 24t-15 30t-30 24t-48.5 11h-263zM400 500v-200h363q28 0 48.5 10.5 t30 25t15 29t5.5 25.5l1 10q0 4 -0.5 11t-6 24t-15 30t-30 24t-48.5 11h-363z" />
|
||||
<glyph unicode="" d="M212 1198h780q86 0 147 -61t61 -147v-416q0 -51 -18 -142.5t-36 -157.5l-18 -66q-29 -87 -93.5 -146.5t-146.5 -59.5h-572q-82 0 -147 59t-93 147q-8 28 -20 73t-32 143.5t-20 149.5v416q0 86 61 147t147 61zM600 1045q-70 0 -132.5 -11.5t-105.5 -30.5t-78.5 -41.5 t-57 -45t-36 -41t-20.5 -30.5l-6 -12l156 -243h560l156 243q-2 5 -6 12.5t-20 29.5t-36.5 42t-57 44.5t-79 42t-105 29.5t-132.5 12zM762 703h-157l195 261z" />
|
||||
<glyph unicode="" d="M475 1300h150q103 0 189 -86t86 -189v-500q0 -41 -42 -83t-83 -42h-450q-41 0 -83 42t-42 83v500q0 103 86 189t189 86zM700 300v-225q0 -21 -27 -48t-48 -27h-150q-21 0 -48 27t-27 48v225h300z" />
|
||||
<glyph unicode="" d="M475 1300h96q0 -150 89.5 -239.5t239.5 -89.5v-446q0 -41 -42 -83t-83 -42h-450q-41 0 -83 42t-42 83v500q0 103 86 189t189 86zM700 300v-225q0 -21 -27 -48t-48 -27h-150q-21 0 -48 27t-27 48v225h300z" />
|
||||
<glyph unicode="" d="M1294 767l-638 -283l-378 170l-78 -60v-224l100 -150v-199l-150 148l-150 -149v200l100 150v250q0 4 -0.5 10.5t0 9.5t1 8t3 8t6.5 6l47 40l-147 65l642 283zM1000 380l-350 -166l-350 166v147l350 -165l350 165v-147z" />
|
||||
<glyph unicode="" d="M250 800q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM650 800q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM1050 800q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44z" />
|
||||
<glyph unicode="" d="M550 1100q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM550 700q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM550 300q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44z" />
|
||||
<glyph unicode="" d="M125 1100h950q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-950q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM125 700h950q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-950q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5 t17.5 7.5zM125 300h950q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-950q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5z" />
|
||||
<glyph unicode="" d="M350 1200h500q162 0 256 -93.5t94 -256.5v-500q0 -165 -93.5 -257.5t-256.5 -92.5h-500q-165 0 -257.5 92.5t-92.5 257.5v500q0 165 92.5 257.5t257.5 92.5zM900 1000h-600q-41 0 -70.5 -29.5t-29.5 -70.5v-600q0 -41 29.5 -70.5t70.5 -29.5h600q41 0 70.5 29.5 t29.5 70.5v600q0 41 -29.5 70.5t-70.5 29.5zM350 900h500q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -14.5 -35.5t-35.5 -14.5h-500q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 14.5 35.5t35.5 14.5zM400 800v-200h400v200h-400z" />
|
||||
<glyph unicode="" d="M150 1100h1000q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-200h50q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-200h50q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-200h50q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5 t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5h50v200h-50q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5h50v200h-50q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5h50v200h-50q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M650 1187q87 -67 118.5 -156t0 -178t-118.5 -155q-87 66 -118.5 155t0 178t118.5 156zM300 800q124 0 212 -88t88 -212q-124 0 -212 88t-88 212zM1000 800q0 -124 -88 -212t-212 -88q0 124 88 212t212 88zM300 500q124 0 212 -88t88 -212q-124 0 -212 88t-88 212z M1000 500q0 -124 -88 -212t-212 -88q0 124 88 212t212 88zM700 199v-144q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v142q40 -4 43 -4q17 0 57 6z" />
|
||||
<glyph unicode="" d="M745 878l69 19q25 6 45 -12l298 -295q11 -11 15 -26.5t-2 -30.5q-5 -14 -18 -23.5t-28 -9.5h-8q1 0 1 -13q0 -29 -2 -56t-8.5 -62t-20 -63t-33 -53t-51 -39t-72.5 -14h-146q-184 0 -184 288q0 24 10 47q-20 4 -62 4t-63 -4q11 -24 11 -47q0 -288 -184 -288h-142 q-48 0 -84.5 21t-56 51t-32 71.5t-16 75t-3.5 68.5q0 13 2 13h-7q-15 0 -27.5 9.5t-18.5 23.5q-6 15 -2 30.5t15 25.5l298 296q20 18 46 11l76 -19q20 -5 30.5 -22.5t5.5 -37.5t-22.5 -31t-37.5 -5l-51 12l-182 -193h891l-182 193l-44 -12q-20 -5 -37.5 6t-22.5 31t6 37.5 t31 22.5z" />
|
||||
<glyph unicode="" d="M1200 900h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-200v-850q0 -22 25 -34.5t50 -13.5l25 -2v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v850h-200q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h1000v-300zM500 450h-25q0 15 -4 24.5t-9 14.5t-17 7.5t-20 3t-25 0.5h-100v-425q0 -11 12.5 -17.5t25.5 -7.5h12v-50h-200v50q50 0 50 25v425h-100q-17 0 -25 -0.5t-20 -3t-17 -7.5t-9 -14.5t-4 -24.5h-25v150h500v-150z" />
|
||||
<glyph unicode="" d="M1000 300v50q-25 0 -55 32q-14 14 -25 31t-16 27l-4 11l-289 747h-69l-300 -754q-18 -35 -39 -56q-9 -9 -24.5 -18.5t-26.5 -14.5l-11 -5v-50h273v50q-49 0 -78.5 21.5t-11.5 67.5l69 176h293l61 -166q13 -34 -3.5 -66.5t-55.5 -32.5v-50h312zM412 691l134 342l121 -342 h-255zM1100 150v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5z" />
|
||||
<glyph unicode="" d="M50 1200h1100q21 0 35.5 -14.5t14.5 -35.5v-1100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v1100q0 21 14.5 35.5t35.5 14.5zM611 1118h-70q-13 0 -18 -12l-299 -753q-17 -32 -35 -51q-18 -18 -56 -34q-12 -5 -12 -18v-50q0 -8 5.5 -14t14.5 -6 h273q8 0 14 6t6 14v50q0 8 -6 14t-14 6q-55 0 -71 23q-10 14 0 39l63 163h266l57 -153q11 -31 -6 -55q-12 -17 -36 -17q-8 0 -14 -6t-6 -14v-50q0 -8 6 -14t14 -6h313q8 0 14 6t6 14v50q0 7 -5.5 13t-13.5 7q-17 0 -42 25q-25 27 -40 63h-1l-288 748q-5 12 -19 12zM639 611 h-197l103 264z" />
|
||||
<glyph unicode="" d="M1200 1100h-1200v100h1200v-100zM50 1000h400q21 0 35.5 -14.5t14.5 -35.5v-900q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v900q0 21 14.5 35.5t35.5 14.5zM650 1000h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM700 900v-300h300v300h-300z" />
|
||||
<glyph unicode="" d="M50 1200h400q21 0 35.5 -14.5t14.5 -35.5v-900q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v900q0 21 14.5 35.5t35.5 14.5zM650 700h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400 q0 21 14.5 35.5t35.5 14.5zM700 600v-300h300v300h-300zM1200 0h-1200v100h1200v-100z" />
|
||||
<glyph unicode="" d="M50 1000h400q21 0 35.5 -14.5t14.5 -35.5v-350h100v150q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-150h100v-100h-100v-150q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v150h-100v-350q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5v800q0 21 14.5 35.5t35.5 14.5zM700 700v-300h300v300h-300z" />
|
||||
<glyph unicode="" d="M100 0h-100v1200h100v-1200zM250 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM300 1000v-300h300v300h-300zM250 500h900q21 0 35.5 -14.5t14.5 -35.5v-400 q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M600 1100h150q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-150v-100h450q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5h350v100h-150q-21 0 -35.5 14.5 t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5h150v100h100v-100zM400 1000v-300h300v300h-300z" />
|
||||
<glyph unicode="" d="M1200 0h-100v1200h100v-1200zM550 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM600 1000v-300h300v300h-300zM50 500h900q21 0 35.5 -14.5t14.5 -35.5v-400 q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5z" />
|
||||
<glyph unicode="" d="M865 565l-494 -494q-23 -23 -41 -23q-14 0 -22 13.5t-8 38.5v1000q0 25 8 38.5t22 13.5q18 0 41 -23l494 -494q14 -14 14 -35t-14 -35z" />
|
||||
<glyph unicode="" d="M335 635l494 494q29 29 50 20.5t21 -49.5v-1000q0 -41 -21 -49.5t-50 20.5l-494 494q-14 14 -14 35t14 35z" />
|
||||
<glyph unicode="" d="M100 900h1000q41 0 49.5 -21t-20.5 -50l-494 -494q-14 -14 -35 -14t-35 14l-494 494q-29 29 -20.5 50t49.5 21z" />
|
||||
<glyph unicode="" d="M635 865l494 -494q29 -29 20.5 -50t-49.5 -21h-1000q-41 0 -49.5 21t20.5 50l494 494q14 14 35 14t35 -14z" />
|
||||
<glyph unicode="" d="M700 741v-182l-692 -323v221l413 193l-413 193v221zM1200 0h-800v200h800v-200z" />
|
||||
<glyph unicode="" d="M1200 900h-200v-100h200v-100h-300v300h200v100h-200v100h300v-300zM0 700h50q0 21 4 37t9.5 26.5t18 17.5t22 11t28.5 5.5t31 2t37 0.5h100v-550q0 -22 -25 -34.5t-50 -13.5l-25 -2v-100h400v100q-4 0 -11 0.5t-24 3t-30 7t-24 15t-11 24.5v550h100q25 0 37 -0.5t31 -2 t28.5 -5.5t22 -11t18 -17.5t9.5 -26.5t4 -37h50v300h-800v-300z" />
|
||||
<glyph unicode="" d="M800 700h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-100v-550q0 -22 25 -34.5t50 -14.5l25 -1v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v550h-100q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h800v-300zM1100 200h-200v-100h200v-100h-300v300h200v100h-200v100h300v-300z" />
|
||||
<glyph unicode="" d="M701 1098h160q16 0 21 -11t-7 -23l-464 -464l464 -464q12 -12 7 -23t-21 -11h-160q-13 0 -23 9l-471 471q-7 8 -7 18t7 18l471 471q10 9 23 9z" />
|
||||
<glyph unicode="" d="M339 1098h160q13 0 23 -9l471 -471q7 -8 7 -18t-7 -18l-471 -471q-10 -9 -23 -9h-160q-16 0 -21 11t7 23l464 464l-464 464q-12 12 -7 23t21 11z" />
|
||||
<glyph unicode="" d="M1087 882q11 -5 11 -21v-160q0 -13 -9 -23l-471 -471q-8 -7 -18 -7t-18 7l-471 471q-9 10 -9 23v160q0 16 11 21t23 -7l464 -464l464 464q12 12 23 7z" />
|
||||
<glyph unicode="" d="M618 993l471 -471q9 -10 9 -23v-160q0 -16 -11 -21t-23 7l-464 464l-464 -464q-12 -12 -23 -7t-11 21v160q0 13 9 23l471 471q8 7 18 7t18 -7z" />
|
||||
<glyph unicode="" d="M1000 1200q0 -124 -88 -212t-212 -88q0 124 88 212t212 88zM450 1000h100q21 0 40 -14t26 -33l79 -194q5 1 16 3q34 6 54 9.5t60 7t65.5 1t61 -10t56.5 -23t42.5 -42t29 -64t5 -92t-19.5 -121.5q-1 -7 -3 -19.5t-11 -50t-20.5 -73t-32.5 -81.5t-46.5 -83t-64 -70 t-82.5 -50q-13 -5 -42 -5t-65.5 2.5t-47.5 2.5q-14 0 -49.5 -3.5t-63 -3.5t-43.5 7q-57 25 -104.5 78.5t-75 111.5t-46.5 112t-26 90l-7 35q-15 63 -18 115t4.5 88.5t26 64t39.5 43.5t52 25.5t58.5 13t62.5 2t59.5 -4.5t55.5 -8l-147 192q-12 18 -5.5 30t27.5 12z" />
|
||||
<glyph unicode="🔑" d="M250 1200h600q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-150v-500l-255 -178q-19 -9 -32 -1t-13 29v650h-150q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM400 1100v-100h300v100h-300z" />
|
||||
<glyph unicode="🚪" d="M250 1200h750q39 0 69.5 -40.5t30.5 -84.5v-933l-700 -117v950l600 125h-700v-1000h-100v1025q0 23 15.5 49t34.5 26zM500 525v-100l100 20v100z" />
|
||||
</font>
|
||||
</defs></svg>
|
||||
|
After Width: | Height: | Size: 106 KiB |
BIN
assets/css/fonts/glyphicons-halflings-regular.ttf
Normal file
BIN
assets/css/fonts/glyphicons-halflings-regular.woff
Normal file
BIN
assets/css/fonts/glyphicons-halflings-regular.woff2
Normal file
9
assets/css/form_main.css
Normal file
@ -0,0 +1,9 @@
|
||||
.wpcf-prototype {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.warning-message {
|
||||
color: #f44336;
|
||||
font-weight: bold;
|
||||
margin-top: 1rem !important;
|
||||
}
|
||||
6
assets/css/iziModal.min.css
vendored
Normal file
68
assets/css/range-selector.css
Normal file
@ -0,0 +1,68 @@
|
||||
.ui-corner-all {
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
|
||||
/*.ui-widget-content {
|
||||
background: linear-gradient(#e9e9e9,#fff);
|
||||
border-color: #1c3050;
|
||||
color: #fff
|
||||
}*/
|
||||
|
||||
.ui-slider-horizontal {
|
||||
height: .8em;
|
||||
}
|
||||
|
||||
.ui-slider {
|
||||
position: relative;
|
||||
text-align: left;
|
||||
margin-right: 64px;
|
||||
margin-left: 10px;
|
||||
/*margin-top: 5px;*/
|
||||
}
|
||||
|
||||
.ui-state-default,
|
||||
.ui-widget-content .ui-state-default,
|
||||
.ui-widget-header .ui-state-default {
|
||||
border-color: #1c3050;
|
||||
background: linear-gradient(#284776, #1c3050);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.ui-slider-horizontal .ui-slider-handle {
|
||||
top: -.3em;
|
||||
margin-left: -.6em;
|
||||
}
|
||||
|
||||
.ui-slider .ui-slider-handle {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
min-width: 1.2em;
|
||||
min-height: 1.2em;
|
||||
cursor: grab;
|
||||
padding: 2px 6px;
|
||||
margin-top: -2px;
|
||||
display: table;
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
|
||||
.ui-slider .ui-slider-handle:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#selected_capital_range.ui-slider {
|
||||
/* margin-right: 86px; */
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.ui-slider .ui-slider-handle.ui-state-focus {
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.ui-slider .ui-slider-handle.ui-state-focus .slider_capital_box {
|
||||
/* box-sizing: border-box;
|
||||
border: 3px solid #fff; */
|
||||
}
|
||||
307
assets/css/societes-credit-manager.css
Normal file
@ -0,0 +1,307 @@
|
||||
/* ========================================
|
||||
SOCIETES CREDIT MANAGER - STYLES
|
||||
======================================== */
|
||||
|
||||
/* Actions Header */
|
||||
.credit-actions-header {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.credit-actions-header .button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
/* Table Styles */
|
||||
#societes-table {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#societes-table th {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
#societes-table td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Status Badges */
|
||||
.badge-active,
|
||||
.badge-inactive {
|
||||
display: inline-block;
|
||||
padding: 4px 12px;
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.badge-active {
|
||||
background-color: #46b450;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.badge-inactive {
|
||||
background-color: #dc3232;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Action Buttons */
|
||||
.button-small {
|
||||
padding: 4px 8px;
|
||||
height: auto;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.button-link-delete {
|
||||
color: #b32d2e;
|
||||
}
|
||||
|
||||
.button-link-delete:hover {
|
||||
color: #dc3232;
|
||||
border-color: #dc3232;
|
||||
}
|
||||
|
||||
/* Modal Styles */
|
||||
.societe-modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 999999;
|
||||
display: none;
|
||||
animation: fadeIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
.societe-modal.show {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
animation: fadeIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
.credit-modal-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.8));
|
||||
backdrop-filter: blur(5px);
|
||||
animation: fadeIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
.credit-modal-content {
|
||||
position: relative;
|
||||
background: linear-gradient(145deg, #ffffff, #f8f9fa);
|
||||
margin: 0;
|
||||
width: 90%;
|
||||
max-width: 600px;
|
||||
max-height: 90vh;
|
||||
overflow-y: auto;
|
||||
border-radius: 20px;
|
||||
box-shadow:
|
||||
0 20px 60px rgba(0, 0, 0, 0.3),
|
||||
0 0 0 1px rgba(255, 255, 255, 0.1),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.2);
|
||||
padding: 0;
|
||||
transform: scale(0.9);
|
||||
animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.credit-modal-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 25px 30px;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
background: linear-gradient(135deg, #001954 0%, #003580 100%);
|
||||
border-radius: 20px 20px 0 0;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.credit-modal-header::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.credit-modal-header h2 {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
color: white;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.credit-modal-close {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
font-size: 32px;
|
||||
font-weight: 300;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
line-height: 1;
|
||||
transition: all 0.3s ease;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.credit-modal-close:hover {
|
||||
opacity: 1;
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
/* Form Styles */
|
||||
.credit-form {
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
.form-group-full {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-group-full label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
color: #23282d;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.form-group-full input[type="text"] {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: 2px solid #ddd;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.form-group-full input[type="text"]:focus {
|
||||
outline: none;
|
||||
border-color: #0073aa;
|
||||
box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
|
||||
}
|
||||
|
||||
.form-group-full input[type="checkbox"] {
|
||||
margin-right: 8px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.required {
|
||||
color: #dc3232;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.description {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 0;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Form Actions */
|
||||
.form-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
justify-content: flex-end;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.form-actions .button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 10px 20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.form-actions .button-primary {
|
||||
background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
|
||||
border: none;
|
||||
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.form-actions .button-primary:hover {
|
||||
background: linear-gradient(135deg, #005a87 0%, #004466 100%);
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes modalSlideIn {
|
||||
from {
|
||||
transform: scale(0.9);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: scale(1);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.credit-modal-content {
|
||||
width: 95%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.credit-modal-header {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.credit-modal-header h2 {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.credit-form {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.form-actions .button {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
/* DataTables Customization */
|
||||
.dataTables_wrapper .dataTables_filter input {
|
||||
border: 2px solid #ddd;
|
||||
border-radius: 4px;
|
||||
padding: 6px 10px;
|
||||
}
|
||||
|
||||
.dataTables_wrapper .dataTables_length select {
|
||||
border: 2px solid #ddd;
|
||||
border-radius: 4px;
|
||||
padding: 6px 10px;
|
||||
}
|
||||
|
||||
BIN
assets/img/blug-abstract-bg.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
assets/img/cd-bullet.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
assets/img/cred_banniere.jpg
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
assets/img/credit-direct-embleme.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
assets/img/footer-bg.jpg
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
assets/img/header-bullet.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/img/icon-telephone-dk.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
assets/img/icon-telephone.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
117
assets/js/README.md
Normal file
@ -0,0 +1,117 @@
|
||||
# README – cd_main.js
|
||||
|
||||
## 1. Fonctions principales
|
||||
|
||||
### Fonctions de calcul de crédit
|
||||
- **calculate_pat, calculate_am, calculate_ph, calculate_fin_neuve, calculate_pao_m_3, calculate_pao_p_3, calculate_mobilhome, calculate_regroupement_de_credit, calculate_frais_notaire, calculate_but_immo, calculate_mono_rate_bt_10_30**
|
||||
- Calculent les paramètres d'un crédit (durée min/max, taux, etc.) selon le type de prêt et les valeurs saisies (capital, durée).
|
||||
- Chaque fonction correspond à un type de crédit spécifique.
|
||||
|
||||
### Fonctions d'orchestration et d'UI
|
||||
- **onchange_loan_type**
|
||||
- Fonction centrale appelée lors du changement de type de crédit (sélecteur, radio, sous-type).
|
||||
- Met à jour les sliders, les valeurs par défaut, l'affichage des champs, et déclenche le recalcul des mensualités.
|
||||
- **calculate_mensualite**
|
||||
- Calcule la mensualité et met à jour l'affichage (montant, durée, taux, etc.) selon les valeurs courantes.
|
||||
- Appelée à chaque modification pertinente (type, capital, durée).
|
||||
- **change_capital_slider, change_month_slider**
|
||||
- Initialisent et mettent à jour les sliders de capital et de durée, avec gestion des bornes, des steps, et de l'affichage dynamique.
|
||||
- **change_duree**
|
||||
- Met à jour la liste des durées disponibles selon le type de crédit et le capital.
|
||||
- **update_capital_input**
|
||||
- Met à jour les bornes et la valeur du champ capital lors d'un changement de type de crédit.
|
||||
|
||||
### Fonctions utilitaires
|
||||
- **number_format**
|
||||
- Formate les nombres pour l'affichage (séparateurs, décimales).
|
||||
- **validate_months_input, delayed_capital_chnage, delayed_months_change**
|
||||
- Gèrent la validation et l'arrondi des valeurs saisies dans les champs capital et durée.
|
||||
|
||||
### Gestionnaires d'événements
|
||||
- De nombreux gestionnaires jQuery déclenchent les fonctions ci-dessus lors des interactions utilisateur (changement de type, capital, durée, clics sur les boutons, etc.).
|
||||
|
||||
## 2. Scénarios d'interaction et enchaînement des fonctions
|
||||
|
||||
### Changement de type de crédit
|
||||
- L'utilisateur change le type de crédit (sélecteur ou radio).
|
||||
- **onchange_loan_type** est appelée :
|
||||
- Met à jour le type sélectionné.
|
||||
- Met à jour les sliders (capital, durée) via **change_capital_slider** et **change_month_slider**.
|
||||
- Met à jour l'affichage des champs spécifiques.
|
||||
- Appelle **calculate_mensualite** pour recalculer la mensualité.
|
||||
|
||||
### Changement du capital
|
||||
- L'utilisateur modifie le capital (slider ou input).
|
||||
- **on_slider_value_change** est appelée (directement ou via un timeout).
|
||||
- Appelle **calculate_mensualite** pour recalculer la mensualité.
|
||||
- Peut aussi mettre à jour la durée maximale possible via **change_duree** ou **change_month_slider**.
|
||||
|
||||
### Changement de la durée
|
||||
- L'utilisateur modifie la durée (slider, input, ou boutons + / -).
|
||||
- **calculate_mensualite** est appelée pour recalculer la mensualité.
|
||||
- **change_duree** ou **change_month_slider** peuvent être appelées pour ajuster les bornes et l'affichage.
|
||||
|
||||
### Changement de sous-type ou d'option spécifique
|
||||
- Peut déclencher **onchange_loan_type** ou des fonctions de calcul spécifiques selon le contexte.
|
||||
|
||||
### Soumission du formulaire
|
||||
- Validation via jQuery Validate.
|
||||
- Envoi AJAX, affichage d'un message de confirmation ou d'erreur.
|
||||
|
||||
### Autres interactions
|
||||
- De nombreux champs conditionnels (ex : profession, co-emprunteur, allocations) affichent ou masquent dynamiquement des sections du formulaire selon les choix de l'utilisateur.
|
||||
|
||||
---
|
||||
|
||||
## 3. Schéma des interactions principales
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A["Utilisateur interagit avec l'UI"]
|
||||
A --> B{"Type d'action"}
|
||||
B -->|Change le type de crédit| C[onchange_loan_type]
|
||||
B -->|Change le capital| D[on_slider_value_change]
|
||||
B -->|Change la durée| E[validate_months_input]
|
||||
C --> F[change_capital_slider]
|
||||
C --> G[change_month_slider]
|
||||
C --> H[calculate_mensualite]
|
||||
D --> H
|
||||
E --> H
|
||||
H --> I{"Type de crédit"}
|
||||
I -->|pat| J[calculate_pat]
|
||||
I -->|am| K[calculate_am]
|
||||
I -->|ph| L[calculate_ph]
|
||||
I -->|fin_neuve| M[calculate_fin_neuve]
|
||||
I -->|fin_occ_m3a| N[calculate_pao_m_3]
|
||||
I -->|fin_occ_p3a| O[calculate_pao_p_3]
|
||||
I -->|mobil_carav| P[calculate_mobilhome]
|
||||
I -->|regroup_cred| Q[calculate_regroupement_de_credit]
|
||||
I -->|frais_notaire| R[calculate_frais_notaire]
|
||||
I -->|but_immo| S[calculate_but_immo]
|
||||
I -->|amr/cdp/cied| T[calculate_mono_rate_bt_10_30]
|
||||
J --> U[Résultats de calcul]
|
||||
K --> U
|
||||
L --> U
|
||||
M --> U
|
||||
N --> U
|
||||
O --> U
|
||||
P --> U
|
||||
Q --> U
|
||||
R --> U
|
||||
S --> U
|
||||
T --> U
|
||||
U --> V[Affichage des résultats]
|
||||
V --> W[UI mise à jour]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Remarques :**
|
||||
- Le cœur de la logique métier repose sur l'enchaînement `onchange_loan_type` → `calculate_mensualite` → fonctions de calcul selon le type.
|
||||
- Les sliders et les champs sont synchronisés à chaque changement pour garantir la cohérence des valeurs.
|
||||
- Le code est fortement couplé à l'UI jQuery et à la structure HTML du simulateur.
|
||||
|
||||
**Questions restantes :**
|
||||
- Souhaitez-vous un schéma visuel des interactions ?
|
||||
- Faut-il détailler chaque fonction de calcul ou ce niveau de synthèse suffit-il ?
|
||||
- Voulez-vous une section sur l'extension AJAX et la structure des réponses serveur ?
|
||||
179
assets/js/buildings-manager.js
Normal file
@ -0,0 +1,179 @@
|
||||
/**
|
||||
* Gestion des bâtiments et crédits associés
|
||||
* Pour le formulaire credit-one-step.php
|
||||
*/
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
var buildingIndex = 0;
|
||||
var loanIndex = 0;
|
||||
|
||||
// Toggle de la section bâtiments
|
||||
$('input[name="isowner"]').on('change', function() {
|
||||
if ($(this).val() === '1') {
|
||||
$('.wpcf-buildings-section').removeClass('d-none');
|
||||
} else {
|
||||
$('.wpcf-buildings-section').addClass('d-none');
|
||||
$('#buildings-container').empty();
|
||||
$('#IDnumberofbuildings').val('');
|
||||
buildingIndex = 0;
|
||||
}
|
||||
});
|
||||
|
||||
// Génération des bâtiments selon le nombre sélectionné
|
||||
$('#IDnumberofbuildings').on('change', function() {
|
||||
var numberOfBuildings = parseInt($(this).val());
|
||||
var container = $('#buildings-container');
|
||||
|
||||
// Vider le container
|
||||
container.empty();
|
||||
buildingIndex = 0;
|
||||
|
||||
// Générer les bâtiments
|
||||
for (var i = 1; i <= numberOfBuildings; i++) {
|
||||
addBuilding(i);
|
||||
}
|
||||
});
|
||||
|
||||
// Fonction pour ajouter un bâtiment
|
||||
function addBuilding(index) {
|
||||
var template = $('#building-template').html();
|
||||
template = template.replace(/__INDEX__/g, index);
|
||||
|
||||
var $building = $(template);
|
||||
$building.removeClass('d-none');
|
||||
|
||||
// S'assurer que tous les champs clonés sont activés (pas disabled)
|
||||
$building.find('input, select, textarea').prop('disabled', false);
|
||||
|
||||
$('#buildings-container').append($building);
|
||||
|
||||
// Attacher les événements pour ce bâtiment
|
||||
attachBuildingEvents(index);
|
||||
}
|
||||
|
||||
// Attacher les événements spécifiques à un bâtiment
|
||||
function attachBuildingEvents(index) {
|
||||
// Gestion de l'affichage du select pays
|
||||
$('input[name="building[' + index + '][inbelgium]"]').on('change', function() {
|
||||
var $block = $(this).closest('.building-block');
|
||||
var $countrySelect = $block.find('.building-country-select');
|
||||
|
||||
if ($(this).val() === '0') {
|
||||
$countrySelect.removeClass('d-none');
|
||||
} else {
|
||||
$countrySelect.addClass('d-none');
|
||||
}
|
||||
});
|
||||
|
||||
// Gestion de l'affichage du montant des revenus locatifs
|
||||
$('input[name="building[' + index + '][hasrentalincome]"]').on('change', function() {
|
||||
var $block = $(this).closest('.building-block');
|
||||
var $rentalAmount = $block.find('.building-rental-amount');
|
||||
|
||||
if ($(this).val() === '1') {
|
||||
$rentalAmount.removeClass('d-none');
|
||||
} else {
|
||||
$rentalAmount.addClass('d-none');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Toggle de la section crédits pour bâtiments
|
||||
$('input[name="hasbuildingloans"]').on('change', function() {
|
||||
if ($(this).val() === '1') {
|
||||
$('.wpcf-buildingloans').removeClass('d-none');
|
||||
|
||||
// Si le container est vide, ajouter automatiquement un premier crédit
|
||||
if ($('#building-loans-container').children().length === 0) {
|
||||
loanIndex = 1;
|
||||
addBuildingLoan(loanIndex);
|
||||
}
|
||||
} else {
|
||||
$('.wpcf-buildingloans').addClass('d-none');
|
||||
$('#building-loans-container').empty();
|
||||
loanIndex = 0;
|
||||
}
|
||||
});
|
||||
|
||||
// Ajouter un crédit
|
||||
$('.wpcf-buildingloan-add').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
loanIndex++;
|
||||
addBuildingLoan(loanIndex);
|
||||
});
|
||||
|
||||
// Fonction pour ajouter un crédit
|
||||
function addBuildingLoan(index) {
|
||||
var template = $('#building-loan-template').html();
|
||||
template = template.replace(/__LOANINDEX__/g, index);
|
||||
|
||||
var $loan = $(template);
|
||||
$loan.removeClass('d-none');
|
||||
|
||||
// S'assurer que tous les champs clonés sont activés (pas disabled)
|
||||
$loan.find('input, select, textarea').prop('disabled', false);
|
||||
|
||||
$('#building-loans-container').append($loan);
|
||||
|
||||
// Attacher l'événement de suppression
|
||||
$loan.find('.wpcf-buildingloan-remove').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (confirm('Êtes-vous sûr de vouloir retirer ce crédit ?')) {
|
||||
var $loanBlock = $(this).closest('.building-loan-block');
|
||||
var kuid = $loanBlock.find('input[name*="[kuid]"]').val();
|
||||
|
||||
if (kuid) {
|
||||
// Ajouter le kuid à la liste des suppressions
|
||||
var delList = $('input[name="delbuildingloans"]').val();
|
||||
delList = delList ? delList + ',' + kuid : kuid;
|
||||
$('input[name="delbuildingloans"]').val(delList);
|
||||
}
|
||||
|
||||
$loanBlock.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Si des crédits existent déjà (en cas de modification), initialiser loanIndex
|
||||
var existingLoans = $('.building-loan-block').length;
|
||||
if (existingLoans > 0) {
|
||||
loanIndex = existingLoans;
|
||||
}
|
||||
|
||||
// Si hasbuildingloans est déjà coché au chargement et qu'aucun crédit n'existe, en ajouter un
|
||||
if ($('input[name="hasbuildingloans"]:checked').val() === '1' && $('#building-loans-container').children().length === 0) {
|
||||
loanIndex = 1;
|
||||
addBuildingLoan(loanIndex);
|
||||
}
|
||||
|
||||
// Animation et style pour les sections
|
||||
$('.building-block').each(function() {
|
||||
$(this).css({
|
||||
'background-color': '#f8f9fa',
|
||||
'border-radius': '8px',
|
||||
'margin-bottom': '20px',
|
||||
'padding': '20px',
|
||||
'box-shadow': '0 2px 4px rgba(0,0,0,0.1)'
|
||||
});
|
||||
});
|
||||
|
||||
// Style pour les labels des bâtiments
|
||||
$('.building-label').css({
|
||||
'color': '#ff6b35',
|
||||
'font-weight': 'bold'
|
||||
});
|
||||
|
||||
// Désactiver tous les champs des templates pour éviter leur soumission
|
||||
// Les templates contiennent __INDEX__ et __LOANINDEX__ dans les noms de champs
|
||||
$('#building-template input, #building-template select, #building-template textarea').prop('disabled', true);
|
||||
$('#building-loan-template input, #building-loan-template select, #building-loan-template textarea').prop('disabled', true);
|
||||
|
||||
// S'assurer que les templates restent désactivés avant chaque soumission
|
||||
$('form.form-submit').on('submit', function(e) {
|
||||
// Désactiver tous les champs contenant __INDEX__ ou __LOANINDEX__ dans leur nom
|
||||
$(this).find('input[name*="__INDEX__"], select[name*="__INDEX__"], textarea[name*="__INDEX__"]').prop('disabled', true);
|
||||
$(this).find('input[name*="__LOANINDEX__"], select[name*="__LOANINDEX__"], textarea[name*="__LOANINDEX__"]').prop('disabled', true);
|
||||
});
|
||||
});
|
||||
|
||||
2874
assets/js/cd_main - Copie.js
Normal file
3873
assets/js/cd_main.js
Normal file
42
assets/js/cred_js.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
$vars_groups = array(
|
||||
get_field_object('pret_personnel__tous_motifs__achats_divers','option'),
|
||||
get_field_object('financement_frais_de_notaire','option'),
|
||||
get_field_object('credit_travaux__renovation__energie','option'),
|
||||
get_field_object('financement_vehicule_neuf','option'),
|
||||
get_field_object('financement_vehicule_d’occasion_moins_de_3_ans','option'),
|
||||
get_field_object('financement_vehicule_d’occasion_plus_de_3_ans','option'),
|
||||
get_field_object('credit_hypothecaire_social','option')
|
||||
);
|
||||
|
||||
$vars_group_length = count($vars_groups);
|
||||
$vars_counter = 0;
|
||||
|
||||
header('Content-type: application/x-javascript');
|
||||
|
||||
foreach($vars_groups as $setting) {
|
||||
|
||||
$setting_name = $setting['name'];
|
||||
|
||||
$setting_value = $pret_personnel__tous_motifs__achats_divers = get_field($setting_name,'option');
|
||||
|
||||
if($vars_counter == 0)
|
||||
echo 'let ';
|
||||
|
||||
foreach($setting['sub_fields'] as $sub_setting) {
|
||||
$sub_setting_name = $sub_setting['name'];
|
||||
$sub_setting_value = $setting_value[$sub_setting_name];
|
||||
|
||||
$let_name = $setting_name.'_'.$sub_setting_name;
|
||||
|
||||
echo $let_name.' = '.$sub_setting_value;
|
||||
|
||||
}
|
||||
|
||||
if($vars_counter == ($vars_group_length)-1)
|
||||
echo ';';
|
||||
|
||||
$vars_counter++;
|
||||
|
||||
}
|
||||
740
assets/js/credit-manager.js
Normal file
@ -0,0 +1,740 @@
|
||||
/**
|
||||
* CREDIT MANAGER - JavaScript Functions
|
||||
* Gestion du modal et des interactions
|
||||
*/
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
'use strict';
|
||||
|
||||
// Variables globales
|
||||
let currentCreditId = null;
|
||||
|
||||
// Variables pour DataTables
|
||||
let creditsTable;
|
||||
|
||||
// Variables pour les filtres
|
||||
let currentFilters = {};
|
||||
|
||||
// Initialiser Select2
|
||||
function initSelect2() {
|
||||
if (typeof $.fn.select2 === 'function') {
|
||||
$('#credit-type').select2({
|
||||
placeholder: 'Sélectionnez un type de crédit',
|
||||
allowClear: true,
|
||||
width: '100%'
|
||||
});
|
||||
|
||||
// Initialiser Select2 sur les filtres
|
||||
$('#filter-societe, #filter-status, #filter-type, #filter-credit-code').select2({
|
||||
allowClear: true,
|
||||
width: '100%'
|
||||
});
|
||||
} else {
|
||||
// Si Select2 n'est pas encore disponible, réessayer dans 100ms
|
||||
setTimeout(initSelect2, 100);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialiser Select2 au chargement du document
|
||||
$(document).ready(function() {
|
||||
initSelect2();
|
||||
});
|
||||
|
||||
// Initialiser DataTables
|
||||
function initDataTable() {
|
||||
creditsTable = $('#credits-table').DataTable({
|
||||
processing: true,
|
||||
serverSide: false,
|
||||
responsive: true,
|
||||
pageLength: 25,
|
||||
lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "Tous"]],
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
text: '<i class="fa-solid fa-file-excel"></i> Excel',
|
||||
className: 'btn-export-excel',
|
||||
title: 'Export Crédits - ' + new Date().toLocaleDateString('fr-FR'),
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)' // Exclure la colonne Actions
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csvHtml5',
|
||||
text: '<i class="fa-solid fa-file-csv"></i> CSV',
|
||||
className: 'btn-export-csv',
|
||||
title: 'Export Crédits',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)' // Exclure la colonne Actions
|
||||
}
|
||||
}
|
||||
],
|
||||
language: {
|
||||
"sProcessing": "Traitement en cours...",
|
||||
"sSearch": "Rechercher:",
|
||||
"sLengthMenu": "Afficher _MENU_ éléments",
|
||||
"sInfo": "Affichage de l'élément _START_ à _END_ sur _TOTAL_ éléments",
|
||||
"sInfoEmpty": "Affichage de l'élément 0 à 0 sur 0 élément",
|
||||
"sInfoFiltered": "(filtré de _MAX_ éléments au total)",
|
||||
"sLoadingRecords": "Chargement en cours...",
|
||||
"sZeroRecords": "Aucun élément à afficher",
|
||||
"sEmptyTable": "Aucune donnée disponible dans le tableau",
|
||||
"paginate": {
|
||||
"sFirst": "Premier",
|
||||
"sPrevious": "Précédent",
|
||||
"sNext": "Suivant",
|
||||
"sLast": "Dernier"
|
||||
},
|
||||
"buttons": {
|
||||
"excel": "Excel",
|
||||
"csv": "CSV"
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{ data: 'id', title: 'ID', defaultContent: '' },
|
||||
{ data: 'type_credit', title: 'Type', defaultContent: '' },
|
||||
{ data: 'nom', title: 'Nom', defaultContent: '' },
|
||||
{ data: 'prenom', title: 'Prénom', defaultContent: '' },
|
||||
{ data: 'adresse', title: 'Adresse', defaultContent: '' },
|
||||
{ data: 'localite', title: 'Localité', defaultContent: '' },
|
||||
{ data: 'email', title: 'Email', defaultContent: '' },
|
||||
{
|
||||
data: null,
|
||||
title: 'Téléphone/GSM',
|
||||
render: function(data, type, row) {
|
||||
let phones = [];
|
||||
if (row.telephone) phones.push(row.telephone);
|
||||
if (row.gsm) phones.push(row.gsm);
|
||||
return phones.join('<br>');
|
||||
}
|
||||
},
|
||||
{ data: 'societe_credit', title: 'Société', defaultContent: '' },
|
||||
{
|
||||
data: 'montant',
|
||||
title: 'Montant',
|
||||
render: function(data, type, row) {
|
||||
return formatCurrency(row.montant);
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'date',
|
||||
title: 'Date',
|
||||
render: function(data, type, row) {
|
||||
return formatDate(row.date);
|
||||
}
|
||||
},
|
||||
{ data: 'date_signature', title: 'Date Signature', defaultContent: '' },
|
||||
{ data: 'numero_dossier', title: 'N° Dossier', defaultContent: '' },
|
||||
{ data: 'code', title: 'Code', defaultContent: '' },
|
||||
{
|
||||
data: null,
|
||||
title: 'Statut',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
render: function(data, type, row) {
|
||||
const map = {
|
||||
'-1': { label: 'Refusé', cls: 'status-refused' },
|
||||
'0': { label: 'À valider', cls: 'status-pending' },
|
||||
'1': { label: 'Validé non signé', cls: 'status-accepted-unsigned' },
|
||||
'2': { label: 'Validé classé', cls: 'status-accepted-filed' }
|
||||
};
|
||||
const key = String(row.status ?? '0');
|
||||
const conf = map[key] || map['0'];
|
||||
return '<span class="status-badge ' + conf.cls + '">' + conf.label + '</span>';
|
||||
}
|
||||
},
|
||||
{
|
||||
data: null,
|
||||
title: 'Actions',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
render: function(data, type, row) {
|
||||
// Récupérer le statut actuel
|
||||
const currentStatus = parseInt(row.status ?? '0');
|
||||
|
||||
return `
|
||||
<div class="credit-actions-grid">
|
||||
<button type="button" class="credit-action-btn btn-edit" onclick="editCredit(${row.id})" title="Modifier">
|
||||
<i class="fa-solid fa-pen-to-square"></i>
|
||||
</button>
|
||||
<button type="button" class="credit-action-btn btn-accepted-unsigned" onclick="updateCreditStatus(${row.id}, 'accepte_non_signe')" title="Accepté non signé" ${currentStatus === 1 ? 'disabled' : ''}>
|
||||
<i class="fa-solid fa-check"></i>
|
||||
</button>
|
||||
<button type="button" class="credit-action-btn btn-accepted-filed" onclick="updateCreditStatus(${row.id}, 'accepte_classe')" title="Accepté classé" ${currentStatus === 2 ? 'disabled' : ''}>
|
||||
<i class="fa-solid fa-box-archive"></i>
|
||||
</button>
|
||||
<button type="button" class="credit-action-btn btn-refused" onclick="updateCreditStatus(${row.id}, 'refuse')" title="Refusé" ${currentStatus === -1 ? 'disabled' : ''}>
|
||||
<i class="fa-solid fa-xmark"></i>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
// Charger les données des crédits
|
||||
function loadCredits(options = {}) {
|
||||
const silent = !!options.silent;
|
||||
// Vérifier que creditManagerAjax est défini
|
||||
if (typeof creditManagerAjax === 'undefined') {
|
||||
console.error('ERROR: creditManagerAjax is not defined!');
|
||||
showNotification('Erreur de configuration JavaScript', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Vérifier que le nonce est défini
|
||||
if (!creditManagerAjax.nonce) {
|
||||
console.error('ERROR: Nonce is not defined in creditManagerAjax!');
|
||||
console.log('creditManagerAjax object:', creditManagerAjax);
|
||||
showNotification('Erreur: Nonce manquant', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Afficher une notification de chargement (si non silencieux)
|
||||
if (!silent) {
|
||||
showNotification('Chargement des crédits...', 'saving');
|
||||
}
|
||||
|
||||
// Préparer les données avec les filtres
|
||||
let ajaxData = {
|
||||
action: 'credit_manager_list',
|
||||
nonce: creditManagerAjax.nonce
|
||||
};
|
||||
|
||||
// Ajouter les filtres s'ils existent
|
||||
Object.assign(ajaxData, currentFilters);
|
||||
|
||||
// Debug: Afficher les données envoyées
|
||||
console.log('=== AJAX Request ===');
|
||||
console.log('URL:', creditManagerAjax.ajaxurl);
|
||||
console.log('Nonce:', creditManagerAjax.nonce);
|
||||
console.log('Filters:', currentFilters);
|
||||
console.log('Ajax Data:', ajaxData);
|
||||
|
||||
$.ajax({
|
||||
url: creditManagerAjax.ajaxurl,
|
||||
type: 'POST',
|
||||
data: ajaxData,
|
||||
success: function(response) {
|
||||
console.log('=== AJAX Response ===');
|
||||
console.log('Response:', response);
|
||||
|
||||
if (response.success) {
|
||||
console.log('Success! Credits count:', response.data.credits ? response.data.credits.length : 0);
|
||||
console.log('Status counts:', response.data.status_counts);
|
||||
|
||||
// Détruire la table existante si elle existe
|
||||
if (creditsTable) {
|
||||
creditsTable.destroy();
|
||||
}
|
||||
|
||||
// Réinitialiser le tableau HTML
|
||||
$('#credits-table tbody').empty();
|
||||
|
||||
// Réinitialiser DataTables
|
||||
initDataTable();
|
||||
|
||||
// Ajouter les données
|
||||
if (response.data.credits && response.data.credits.length > 0) {
|
||||
// Assainir les lignes pour correspondre aux colonnes attendues
|
||||
const requiredFields = ['id','type_credit','nom','prenom','adresse','localite','email','telephone','gsm','societe_credit','montant','date','date_signature','numero_dossier','code'];
|
||||
const sanitized = response.data.credits.map(function(row, idx){
|
||||
if (typeof row !== 'object' || row === null) {
|
||||
console.warn('Row is not an object at index', idx);
|
||||
row = {};
|
||||
}
|
||||
requiredFields.forEach(function(k){
|
||||
if (typeof row[k] === 'undefined') {
|
||||
row[k] = (k === 'montant') ? 0 : '';
|
||||
}
|
||||
});
|
||||
return row;
|
||||
});
|
||||
creditsTable.clear();
|
||||
creditsTable.rows.add(sanitized);
|
||||
creditsTable.draw();
|
||||
if (!silent) {
|
||||
showNotification(response.data.credits.length + ' crédit(s) chargé(s)', 'success');
|
||||
}
|
||||
} else {
|
||||
if (!silent) {
|
||||
showNotification('Aucun crédit trouvé', 'info');
|
||||
}
|
||||
}
|
||||
|
||||
// Mettre à jour les compteurs avec les données du serveur
|
||||
if (response.data.status_counts) {
|
||||
updateStatusCountsFromData(response.data.status_counts, response.data.total_all);
|
||||
}
|
||||
} else {
|
||||
console.error('AJAX Error:', response.data);
|
||||
showNotification('Erreur: ' + response.data, 'error');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('=== AJAX Connection Error ===');
|
||||
console.error('Status:', status);
|
||||
console.error('Error:', error);
|
||||
console.error('Response:', xhr.responseText);
|
||||
showNotification('Erreur de connexion: ' + error, 'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Formater la devise
|
||||
function formatCurrency(amount) {
|
||||
return new Intl.NumberFormat('fr-FR', {
|
||||
style: 'currency',
|
||||
currency: 'EUR'
|
||||
}).format(amount || 0);
|
||||
}
|
||||
|
||||
// Formater la date
|
||||
function formatDate(dateString) {
|
||||
if (!dateString) return '';
|
||||
return new Date(dateString).toLocaleDateString('fr-FR');
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche une notification moderne (style toast)
|
||||
* @param {string} message - Le message à afficher
|
||||
* @param {string} type - Le type de notification: 'success', 'saving', 'error', 'info'
|
||||
*/
|
||||
function showNotification(message, type = 'success') {
|
||||
let indicator = $('.auto-save-indicator');
|
||||
|
||||
// Créer l'indicateur s'il n'existe pas
|
||||
if (indicator.length === 0) {
|
||||
indicator = $('<div class="auto-save-indicator"></div>');
|
||||
$('body').append(indicator);
|
||||
}
|
||||
|
||||
// Mapper le type 'info' vers 'saving' pour une meilleure visibilité
|
||||
if (type === 'info') {
|
||||
type = 'saving';
|
||||
}
|
||||
|
||||
// Retirer toutes les classes de type et ajouter la nouvelle
|
||||
indicator.removeClass('show saving error').addClass('show ' + type);
|
||||
indicator.text(message);
|
||||
|
||||
// Masquer après 3 secondes (5 secondes pour les erreurs)
|
||||
const duration = type === 'error' ? 5000 : 3000;
|
||||
setTimeout(() => {
|
||||
indicator.removeClass('show');
|
||||
}, duration);
|
||||
}
|
||||
|
||||
// Alias pour compatibilité avec l'ancien code
|
||||
function showMessage(message, type) {
|
||||
showNotification(message, type);
|
||||
}
|
||||
|
||||
// Ouvrir le modal
|
||||
window.openCreditModal = function(creditId = null) {
|
||||
currentCreditId = creditId;
|
||||
|
||||
if (creditId) {
|
||||
loadCreditData(creditId);
|
||||
} else {
|
||||
$('#credit-form')[0].reset();
|
||||
$('.credit-modal-header h2').text('Nouveau crédit');
|
||||
// Réinitialiser Select2
|
||||
$('#credit-type').val([]).trigger('change');
|
||||
}
|
||||
|
||||
$('.credit-modal').addClass('show').show();
|
||||
// Réinitialiser Select2 après ouverture de la modal
|
||||
setTimeout(function() {
|
||||
if (typeof $.fn.select2 === 'function') {
|
||||
// Détruire l'instance existante si elle existe
|
||||
if ($('#credit-type').hasClass('select2-hidden-accessible')) {
|
||||
$('#credit-type').select2('destroy');
|
||||
}
|
||||
initSelect2();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
|
||||
// Fermer le modal
|
||||
window.closeCreditModal = function() {
|
||||
$('.credit-modal').addClass('closing');
|
||||
|
||||
setTimeout(function() {
|
||||
$('.credit-modal').removeClass('show closing').hide();
|
||||
currentCreditId = null;
|
||||
}, 300);
|
||||
};
|
||||
|
||||
// Charger les données d'un crédit
|
||||
function loadCreditData(creditId) {
|
||||
$.ajax({
|
||||
url: creditManagerAjax.ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'credit_manager_get',
|
||||
nonce: creditManagerAjax.nonce,
|
||||
credit_id: creditId
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
const credit = response.data.credit;
|
||||
$('.credit-modal-header h2').text('Modifier le crédit');
|
||||
|
||||
// Remplir le formulaire
|
||||
if (credit.type_credit) {
|
||||
const typeCreditArray = typeof credit.type_credit === 'string'
|
||||
? credit.type_credit.split(',')
|
||||
: credit.type_credit;
|
||||
$('#credit-type').val(typeCreditArray);
|
||||
} else {
|
||||
$('#credit-type').val([]);
|
||||
}
|
||||
$('#credit-nom').val(credit.nom || '');
|
||||
$('#credit-prenom').val(credit.prenom || '');
|
||||
$('#credit-adresse').val(credit.adresse || '');
|
||||
$('#credit-localite').val(credit.localite || '');
|
||||
$('#credit-email').val(credit.email || '');
|
||||
$('#credit-telephone').val(credit.telephone || '');
|
||||
$('#credit-gsm').val(credit.gsm || '');
|
||||
$('#credit-type-habitation').val(credit.type_habitation || '');
|
||||
$('#credit-societe').val(credit.societe_credit || '');
|
||||
$('#credit-montant').val(credit.montant || '');
|
||||
$('#credit-date').val(credit.date || '');
|
||||
$('#credit-signature').val(credit.date_signature || '');
|
||||
$('#credit-numero-dossier').val(credit.numero_dossier || '');
|
||||
$('#credit-code').val(credit.code || '');
|
||||
$('#credit-remarques').val(credit.remarques || '');
|
||||
|
||||
showNotification('Crédit chargé avec succès', 'success');
|
||||
} else {
|
||||
showNotification('✕ Erreur lors du chargement: ' + response.data, 'error');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
showNotification('✕ Erreur de connexion lors du chargement: ' + error, 'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Sauvegarder le crédit
|
||||
window.saveCredit = function() {
|
||||
// Afficher la notification de sauvegarde
|
||||
showNotification('Sauvegarde en cours...', 'saving');
|
||||
|
||||
const formData = {
|
||||
action: currentCreditId ? 'credit_manager_update' : 'credit_manager_create',
|
||||
nonce: creditManagerAjax.nonce,
|
||||
type_credit: $('#credit-type').val(),
|
||||
nom: $('#credit-nom').val(),
|
||||
prenom: $('#credit-prenom').val(),
|
||||
adresse: $('#credit-adresse').val(),
|
||||
localite: $('#credit-localite').val(),
|
||||
email: $('#credit-email').val(),
|
||||
telephone: $('#credit-telephone').val(),
|
||||
gsm: $('#credit-gsm').val(),
|
||||
type_habitation: $('#credit-type-habitation').val(),
|
||||
societe_credit: $('#credit-societe').val(),
|
||||
montant: $('#credit-montant').val(),
|
||||
date: $('#credit-date').val(),
|
||||
signature: $('#credit-signature').val(),
|
||||
numero_dossier: $('#credit-numero-dossier').val(),
|
||||
code: $('#credit-code').val(),
|
||||
remarques: $('#credit-remarques').val()
|
||||
};
|
||||
|
||||
if (currentCreditId) {
|
||||
formData.credit_id = currentCreditId;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: creditManagerAjax.ajaxurl,
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showNotification('✓ ' + response.data.message, 'success');
|
||||
closeCreditModal();
|
||||
loadCredits({ silent: true });
|
||||
} else {
|
||||
showNotification('✕ Erreur: ' + response.data, 'error');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
showNotification('✕ Erreur de connexion: ' + error, 'error');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Supprimer un crédit
|
||||
window.deleteCredit = function(creditId) {
|
||||
// Confirmation plus détaillée
|
||||
const confirmMessage = '⚠️ ATTENTION ⚠️\n\n' +
|
||||
'Vous êtes sur le point de supprimer définitivement ce crédit.\n\n' +
|
||||
'Cette action est IRRÉVERSIBLE et supprimera toutes les données associées.\n\n' +
|
||||
'Êtes-vous absolument certain de vouloir continuer ?';
|
||||
|
||||
if (!confirm(confirmMessage)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Double confirmation pour plus de sécurité
|
||||
if (!confirm('Dernière chance !\n\nConfirmez-vous la suppression définitive de ce crédit ?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Afficher un message de chargement
|
||||
showNotification('Suppression en cours...', 'saving');
|
||||
|
||||
$.ajax({
|
||||
url: creditManagerAjax.ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'credit_manager_delete',
|
||||
nonce: creditManagerAjax.nonce,
|
||||
credit_id: creditId
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showNotification('✓ ' + response.data.message, 'success');
|
||||
loadCredits({ silent: true });
|
||||
} else {
|
||||
showNotification('✕ Erreur: ' + response.data, 'error');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
showNotification('✕ Erreur de connexion lors de la suppression: ' + error, 'error');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Modifier un crédit
|
||||
window.editCredit = function(creditId) {
|
||||
openCreditModal(creditId);
|
||||
};
|
||||
|
||||
// Mettre à jour le statut d'un crédit
|
||||
window.updateCreditStatus = function(creditId, status) {
|
||||
let statusLabel = '';
|
||||
let confirmMessage = '';
|
||||
|
||||
switch(status) {
|
||||
case 'accepte_non_signe':
|
||||
statusLabel = 'Accepté non signé';
|
||||
confirmMessage = 'Êtes-vous sûr de vouloir marquer ce crédit comme "Accepté non signé" ?';
|
||||
break;
|
||||
case 'accepte_classe':
|
||||
statusLabel = 'Accepté classé';
|
||||
confirmMessage = 'Êtes-vous sûr de vouloir marquer ce crédit comme "Accepté classé" ?';
|
||||
break;
|
||||
case 'refuse':
|
||||
statusLabel = 'Refusé';
|
||||
confirmMessage = 'Êtes-vous sûr de vouloir marquer ce crédit comme "Refusé" ?';
|
||||
break;
|
||||
}
|
||||
|
||||
if (!confirm(confirmMessage)) {
|
||||
return;
|
||||
}
|
||||
|
||||
showNotification('Mise à jour du statut en cours...', 'saving');
|
||||
|
||||
$.ajax({
|
||||
url: creditManagerAjax.ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'credit_manager_update_status',
|
||||
nonce: creditManagerAjax.nonce,
|
||||
credit_id: creditId,
|
||||
status: status
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showNotification('✓ Statut mis à jour : ' + statusLabel, 'success');
|
||||
loadCredits({ silent: true });
|
||||
} else {
|
||||
showNotification('✕ Erreur: ' + response.data, 'error');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
showNotification('✕ Erreur de connexion lors de la mise à jour: ' + error, 'error');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Fermer le modal en cliquant à l'extérieur
|
||||
$(document).on('click', '.credit-modal', function(e) {
|
||||
if (e.target === this) {
|
||||
closeCreditModal();
|
||||
}
|
||||
});
|
||||
|
||||
// Toggle des filtres
|
||||
$('#toggle-filters').on('click', function() {
|
||||
$('#credit-filters-form').slideToggle(300);
|
||||
$(this).find('.dashicons').toggleClass('dashicons-arrow-down-alt2 dashicons-arrow-up-alt2');
|
||||
});
|
||||
|
||||
// Soumission du formulaire de filtres
|
||||
$('#credit-filters-form').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Récupérer les valeurs du formulaire
|
||||
currentFilters = {
|
||||
societe_credit: $('#filter-societe').val(),
|
||||
code_postal: $('#filter-code-postal').val(),
|
||||
status: $('#filter-status').val(),
|
||||
type_credit: $('#filter-type').val(),
|
||||
credit_code_select: $('#filter-credit-code').val(),
|
||||
montant_min: $('#filter-montant-min').val(),
|
||||
montant_max: $('#filter-montant-max').val(),
|
||||
date_signature_debut: $('#filter-date-debut').val(),
|
||||
date_signature_fin: $('#filter-date-fin').val()
|
||||
};
|
||||
|
||||
// Compter le nombre de filtres actifs
|
||||
let activeFiltersCount = 0;
|
||||
Object.keys(currentFilters).forEach(key => {
|
||||
if (currentFilters[key] !== '' && currentFilters[key] !== null) {
|
||||
activeFiltersCount++;
|
||||
}
|
||||
});
|
||||
|
||||
if (activeFiltersCount > 0) {
|
||||
showNotification('Application de ' + activeFiltersCount + ' filtre(s)...', 'saving');
|
||||
}
|
||||
|
||||
// Recharger les données avec les filtres
|
||||
loadCredits();
|
||||
});
|
||||
|
||||
// Réinitialiser les filtres
|
||||
$('#reset-filters').on('click', function() {
|
||||
$('#credit-filters-form')[0].reset();
|
||||
currentFilters = {};
|
||||
showNotification('Filtres réinitialisés', 'success');
|
||||
loadCredits();
|
||||
});
|
||||
|
||||
// Fonction pour mettre à jour les compteurs depuis les données du serveur
|
||||
function updateStatusCountsFromData(statusCounts, totalAll) {
|
||||
// Mettre à jour les affichages avec les compteurs reçus du serveur
|
||||
$('[data-count-status="0"]').text('(' + (statusCounts['0'] || 0) + ')');
|
||||
$('[data-count-status="1"]').text('(' + (statusCounts['1'] || 0) + ')');
|
||||
$('[data-count-status="2"]').text('(' + (statusCounts['2'] || 0) + ')');
|
||||
$('[data-count-status="-1"]').text('(' + (statusCounts['-1'] || 0) + ')');
|
||||
$('#total-count').text('(' + (totalAll || 0) + ')');
|
||||
|
||||
console.log('Status counts updated from server:', statusCounts, 'Total:', totalAll);
|
||||
}
|
||||
|
||||
// Gestionnaire pour les boutons de filtre rapide par statut
|
||||
$('.status-filter-btn').on('click', function() {
|
||||
const status = $(this).data('status');
|
||||
|
||||
// Retirer la classe active de tous les boutons
|
||||
$('.status-filter-btn').removeClass('active');
|
||||
|
||||
// Ajouter la classe active au bouton cliqué
|
||||
$(this).addClass('active');
|
||||
|
||||
// Réinitialiser les autres filtres du formulaire
|
||||
$('#credit-filters-form')[0].reset();
|
||||
|
||||
// Appliquer le filtre de statut
|
||||
if (status === '') {
|
||||
// Bouton "Tous" - réinitialiser les filtres
|
||||
currentFilters = {};
|
||||
showNotification('Affichage de tous les crédits', 'success');
|
||||
} else {
|
||||
// Filtre par statut spécifique
|
||||
currentFilters = {
|
||||
status: status
|
||||
};
|
||||
|
||||
const statusLabels = {
|
||||
'0': 'À valider',
|
||||
'1': 'Validé non signé',
|
||||
'2': 'Validé classé',
|
||||
'-1': 'Refusé'
|
||||
};
|
||||
|
||||
showNotification('Filtre : ' + statusLabels[status], 'saving');
|
||||
}
|
||||
|
||||
// Recharger les crédits
|
||||
loadCredits();
|
||||
});
|
||||
|
||||
// Mailchimp - tester la connexion (page admin Mailchimp)
|
||||
$('#cred-mailchimp-test').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var $out = $('#cred-mailchimp-test-result');
|
||||
if ($out.length) {
|
||||
$out.text('Test en cours…');
|
||||
} else {
|
||||
showNotification('Test de connexion en cours…', 'saving');
|
||||
}
|
||||
$.post(creditManagerAjax.ajaxurl, {
|
||||
action: 'cred_mailchimp_ping',
|
||||
nonce: creditManagerAjax.mailchimpPingNonce || ''
|
||||
}).done(function(resp){
|
||||
if ($out.length) {
|
||||
$out.text(resp && resp.success ? 'Connexion OK' : ('Échec: ' + ((resp && resp.data && resp.data.message) ? resp.data.message : 'Error')));
|
||||
} else {
|
||||
if (resp && resp.success) {
|
||||
showNotification('Connexion Mailchimp OK', 'success');
|
||||
} else {
|
||||
showNotification('Échec: ' + ((resp && resp.data && resp.data.message) ? resp.data.message : 'Error'), 'error');
|
||||
}
|
||||
}
|
||||
}).fail(function(xhr){
|
||||
var msg = (xhr && xhr.responseJSON && xhr.responseJSON.data && xhr.responseJSON.data.message) ? xhr.responseJSON.data.message : xhr.statusText;
|
||||
if ($out.length) {
|
||||
$out.text('Échec: ' + msg);
|
||||
} else {
|
||||
showNotification('Échec: ' + msg, 'error');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Sendy - tester la connexion (page admin Sendy)
|
||||
$('#cred-sendy-test').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var $out = $('#cred-sendy-test-result');
|
||||
if ($out.length) {
|
||||
$out.text('Test en cours…');
|
||||
} else {
|
||||
showNotification('Test de connexion en cours…', 'saving');
|
||||
}
|
||||
$.post(creditManagerAjax.ajaxurl, {
|
||||
action: 'cred_sendy_ping',
|
||||
nonce: creditManagerAjax.sendyPingNonce || ''
|
||||
}).done(function(resp){
|
||||
if ($out.length) {
|
||||
$out.text(resp && resp.success ? 'Connexion OK' : ('Échec: ' + ((resp && resp.data && resp.data.message) ? resp.data.message : 'Error')));
|
||||
} else {
|
||||
if (resp && resp.success) {
|
||||
showNotification('Connexion Sendy OK', 'success');
|
||||
} else {
|
||||
showNotification('Échec: ' + ((resp && resp.data && resp.data.message) ? resp.data.message : 'Error'), 'error');
|
||||
}
|
||||
}
|
||||
}).fail(function(xhr){
|
||||
var msg = (xhr && xhr.responseJSON && xhr.responseJSON.data && xhr.responseJSON.data.message) ? xhr.responseJSON.data.message : xhr.statusText;
|
||||
if ($out.length) {
|
||||
$out.text('Échec: ' + msg);
|
||||
} else {
|
||||
showNotification('Échec: ' + msg, 'error');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Initialiser uniquement sur la page Crédit (évite le chargement sur Mailchimp/Sendy)
|
||||
if (jQuery('#credits-table').length > 0) {
|
||||
loadCredits();
|
||||
}
|
||||
});
|
||||
27
assets/js/exp/README.md
Normal file
@ -0,0 +1,27 @@
|
||||
# README – Version modulaire du simulateur de crédit
|
||||
|
||||
Ce dossier contient une version refactorisée et modulaire du simulateur, avec séparation claire des responsabilités.
|
||||
|
||||
## Fichiers et logique
|
||||
|
||||
- **calculs.js** :
|
||||
Contient toutes les fonctions de calcul de crédit (calculate_pat, calculate_am, etc.). Chaque fonction prend en entrée le capital, la durée, et retourne les paramètres du crédit selon le type.
|
||||
|
||||
- **utils.js** :
|
||||
Fonctions utilitaires réutilisables (number_format, getStepForValue, etc.).
|
||||
|
||||
- **ui.js** :
|
||||
Gère l'affichage, les sliders, la synchronisation des champs, et les interactions utilisateur (change_capital_slider, change_month_slider, change_duree, update_capital_input, etc.).
|
||||
|
||||
- **main.js** :
|
||||
Point d'entrée du simulateur. Importe les modules, initialise l'application, gère les événements, et orchestre la logique entre calculs, UI et utilitaires.
|
||||
|
||||
## Logique générale
|
||||
|
||||
- La logique métier (calculs) est totalement séparée de la gestion de l'UI.
|
||||
- Les utilitaires sont accessibles à tous les modules.
|
||||
- Le fichier main.js centralise l'initialisation et la gestion des interactions.
|
||||
|
||||
---
|
||||
|
||||
Pour toute évolution, ajoutez vos nouveaux modules dans ce dossier et documentez-les ici.
|
||||
482
assets/js/exp/calculs.js
Normal file
@ -0,0 +1,482 @@
|
||||
// Module des fonctions de calcul de crédit
|
||||
|
||||
// On suppose que cd_js et map_values sont passés en paramètre ou importés dans main.js
|
||||
|
||||
export function calculate_pat(cd_js, selected_capital, selected_duration = '') {
|
||||
let annual_rate, min_duration, max_duration, duree_in_range = true, display_observation_pat = false,
|
||||
add_message = '';
|
||||
min_duration = 24;
|
||||
if (1500 <= parseInt(selected_capital) && parseInt(selected_capital) <= 2500) {
|
||||
annual_rate = cd_js.groups.pret_personnel__tous_motifs__achats_divers._1500_a_2500;
|
||||
max_duration = 24;
|
||||
} else if ((2500 < parseInt(selected_capital) && parseInt(selected_capital) <= 3700)) {
|
||||
annual_rate = cd_js.groups.pret_personnel__tous_motifs__achats_divers._2501_a_3700;
|
||||
max_duration = 30;
|
||||
} else if ((3700 < parseInt(selected_capital) && parseInt(selected_capital) <= 5000)) {
|
||||
annual_rate = cd_js.groups.pret_personnel__tous_motifs__achats_divers._3701_a_5000;
|
||||
max_duration = 30;
|
||||
} else if ((5000 < parseInt(selected_capital) && parseInt(selected_capital) <= 5600)) {
|
||||
annual_rate = cd_js.groups.pret_personnel__tous_motifs__achats_divers._5001_a_5600;
|
||||
max_duration = 36;
|
||||
} else if ((5600 < parseInt(selected_capital) && parseInt(selected_capital) <= 7500)) {
|
||||
annual_rate = cd_js.groups.pret_personnel__tous_motifs__achats_divers._5601_a_7500;
|
||||
max_duration = 42;
|
||||
} else if ((7500 < parseInt(selected_capital) && parseInt(selected_capital) <= 10000)) {
|
||||
max_duration = 48;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {
|
||||
} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration == 48) {
|
||||
annual_rate = cd_js.groups.pret_personnel__tous_motifs__achats_divers._7501_a_10000_48_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.pret_personnel__tous_motifs__achats_divers._7501_a_10000_24_a_42_mois;
|
||||
}
|
||||
} else if ((10000 < parseInt(selected_capital) && parseInt(selected_capital) <= 15000)) {
|
||||
if (selected_duration < 48) {
|
||||
annual_rate = cd_js.groups.pret_personnel__tous_motifs__achats_divers._10001_a_15000_24_a_42_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.pret_personnel__tous_motifs__achats_divers._10001_a_15000_48_a_60_mois;
|
||||
}
|
||||
max_duration = 60;
|
||||
} else if ((15000 < parseInt(selected_capital) && parseInt(selected_capital) <= 20000)) {
|
||||
if (24 <= parseInt(selected_duration) && parseInt(selected_duration) <= 42) {
|
||||
annual_rate = cd_js.groups.pret_personnel__tous_motifs__achats_divers.a_partir_de_15001_24_a_42_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.pret_personnel__tous_motifs__achats_divers.a_partir_de_15001_48_a_84_mois;
|
||||
}
|
||||
max_duration = 84;
|
||||
} else if((20000 < parseInt(selected_capital) && parseInt(selected_capital) <= 75001)) {
|
||||
annual_rate = cd_js.groups.pret_personnel__tous_motifs__achats_divers.a_partir_de_20001_a_75000;
|
||||
max_duration = 120;
|
||||
} else if((75001 <= parseInt(selected_capital))) {
|
||||
annual_rate = cd_js.groups.pret_personnel__tous_motifs__achats_divers.a_partir_de_75000;
|
||||
display_observation_pat = true;
|
||||
max_duration = 240;
|
||||
selected_duration = 240;
|
||||
}
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {
|
||||
} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
return [min_duration, max_duration, selected_duration, duree_in_range, annual_rate, add_message];
|
||||
}
|
||||
|
||||
export function calculate_ph(cd_js, selected_capital, selected_duration) {
|
||||
var annual_rate, min_duration, max_duration;
|
||||
var duree_in_range = true;
|
||||
var add_message = '';
|
||||
min_duration = 5;
|
||||
max_duration = 30;
|
||||
annual_rate = cd_js.groups.credit_hypothecaire_social.de_10_a_30_ans;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
selected_duration = selected_duration * 12;
|
||||
return [min_duration, max_duration, selected_duration, duree_in_range, annual_rate, add_message];
|
||||
}
|
||||
|
||||
export function calculate_am(cd_js, selected_capital, selected_duration) {
|
||||
var annual_rate, min_duration, max_duration;
|
||||
var duree_in_range = true;
|
||||
var add_message = '';
|
||||
for (var i = 10; i <= 30; i++) {
|
||||
if (parseInt(selected_duration) == i) {
|
||||
annual_rate = cd_js.groups.credit_hypothecaire_classique['des_' + i + '_ans'];
|
||||
}
|
||||
}
|
||||
min_duration = 10;
|
||||
max_duration = 30;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
selected_duration = selected_duration * 12;
|
||||
return [min_duration, max_duration, selected_duration, duree_in_range, annual_rate, add_message];
|
||||
}
|
||||
|
||||
export function calculate_mono_rate_bt_10_30(cd_js, map_values, selected_loan_type, selected_capital, selected_duration) {
|
||||
var annual_rate, min_duration, max_duration, add_message;
|
||||
var duree_in_range = true;
|
||||
min_duration = 10;
|
||||
max_duration = 30;
|
||||
function findRate(type) {
|
||||
if (cd_js.groups[type] && cd_js.groups[type].de_10_a_30_ans) {
|
||||
return cd_js.groups[type].de_10_a_30_ans;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var possible_types = [
|
||||
selected_loan_type,
|
||||
map_values[selected_loan_type],
|
||||
selected_loan_type.toLowerCase(),
|
||||
selected_loan_type.replace(/_/g, ''),
|
||||
selected_loan_type.replace(/^credit_/, '')
|
||||
];
|
||||
possible_types = possible_types.filter(type => type);
|
||||
for (var type of possible_types) {
|
||||
var rate = findRate(type);
|
||||
if (rate !== null) {
|
||||
annual_rate = rate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (annual_rate === undefined) {
|
||||
return [min_duration, max_duration, selected_duration * 12, false, 0, 'Type de crédit non disponible'];
|
||||
}
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {
|
||||
} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
selected_duration = selected_duration * 12;
|
||||
return [min_duration, max_duration, selected_duration, duree_in_range, annual_rate, add_message];
|
||||
}
|
||||
|
||||
export function calculate_fin_neuve(cd_js, selected_capital, selected_duration) {
|
||||
var annual_rate, min_duration, max_duration, add_message;
|
||||
var duree_in_range = true;
|
||||
min_duration = 24;
|
||||
if (2500 == parseInt(selected_capital)) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_neuf._2500_24_mois;
|
||||
max_duration = 24;
|
||||
} else if ((2500 < parseInt(selected_capital) && parseInt(selected_capital) <= 3700)) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_neuf._2501_a_3700_24_a_30_mois;
|
||||
max_duration = 30;
|
||||
} else if ((3700 < parseInt(selected_capital) && parseInt(selected_capital) <= 5600)) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_neuf._3701_a_5600_24_a_36_mois;
|
||||
max_duration = 36;
|
||||
} else if ((5600 < parseInt(selected_capital) && parseInt(selected_capital) <= 7500)) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_neuf._5601_a_7500_24_a_42_mois;
|
||||
max_duration = 42;
|
||||
} else if ((7500 < parseInt(selected_capital) && parseInt(selected_capital) <= 10000)) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_neuf._7501_a_10000_24_a_48_mois;
|
||||
max_duration = 48;
|
||||
} else if ((10000 < parseInt(selected_capital) && parseInt(selected_capital) <= 15000)) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_neuf.a_partir_de_10001_24_a_60_mois;
|
||||
max_duration = 60;
|
||||
} else if ((15000 < parseInt(selected_capital) && parseInt(selected_capital) <= 100000)) {
|
||||
max_duration = 84;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration < 72) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_neuf.a_partir_de_15001_24_a_60_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.financement_vehicule_neuf.a_partir_de_15001_72_a_84_mois;
|
||||
}
|
||||
}
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
return [min_duration, max_duration, selected_duration, duree_in_range, annual_rate, add_message];
|
||||
}
|
||||
|
||||
export function calculate_pao_m_3(cd_js, selected_capital, selected_duration) {
|
||||
var annual_rate, min_duration, max_duration;
|
||||
var duree_in_range = true;
|
||||
var add_message = '';
|
||||
min_duration = 24;
|
||||
if (2500 == parseInt(selected_capital)) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_moins_de_3_ans._2500_24_mois;
|
||||
max_duration = 24;
|
||||
} else if ((2500 < parseInt(selected_capital) && parseInt(selected_capital) <= 3700)) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_moins_de_3_ans._2501_a_3700_24_a_30_mois;
|
||||
max_duration = 30;
|
||||
} else if ((3700 < parseInt(selected_capital) && parseInt(selected_capital) <= 5600)) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_neuf._3701_a_5600_24_a_36_mois;
|
||||
max_duration = 36;
|
||||
} else if ((5600 < parseInt(selected_capital) && parseInt(selected_capital) <= 7500)) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_moins_de_3_ans._5601_a_7500_24_a_42_mois;
|
||||
max_duration = 42;
|
||||
} else if ((7500 < parseInt(selected_capital) && parseInt(selected_capital) <= 10000)) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_moins_de_3_ans._7501_a_10000_24_a_48_mois;
|
||||
max_duration = 48;
|
||||
} else if ((10000 < parseInt(selected_capital) && parseInt(selected_capital) <= 15000)) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_moins_de_3_ans.a_partir_de_10001_24_a_60_mois;
|
||||
max_duration = 60;
|
||||
} else if ((15000 < parseInt(selected_capital) && parseInt(selected_capital) <= 100000)) {
|
||||
max_duration = 84;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration < 60) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_moins_de_3_ans.a_partir_de_15001_24_a_60_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_moins_de_3_ans.a_partir_de_15001_72_a_84_mois;
|
||||
}
|
||||
}
|
||||
if (!(min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
return [min_duration, max_duration, selected_duration, duree_in_range, annual_rate, add_message];
|
||||
}
|
||||
|
||||
export function calculate_pao_p_3(cd_js, selected_capital, selected_duration) {
|
||||
var annual_rate, min_duration, max_duration;
|
||||
var duree_in_range = true;
|
||||
var add_message = '';
|
||||
min_duration = 24;
|
||||
if (parseInt(selected_capital) <= 2500) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans._2500_24_mois;
|
||||
max_duration = 24;
|
||||
} else if ((2500 < parseInt(selected_capital) && parseInt(selected_capital) <= 3700)) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans._2501_a_3700_24_a_30_mois;
|
||||
max_duration = 30;
|
||||
} else if ((3700 < parseInt(selected_capital) && parseInt(selected_capital) <= 5000)) {
|
||||
max_duration = 36;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration == 36) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans._3701_a_5000_36_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans._3701_a_5000_24_a_30_mois;
|
||||
}
|
||||
} else if ((5000 < parseInt(selected_capital) && parseInt(selected_capital) <= 5600)) {
|
||||
max_duration = 36;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration == 36) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans._5001_a_5600_36_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans._5001_a_5600_24_a_30_mois;
|
||||
}
|
||||
} else if ((5600 < parseInt(selected_capital) && parseInt(selected_capital) <= 7500)) {
|
||||
max_duration = 42;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration == 36) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans._5601_a_7500_36_mois;
|
||||
} else if (selected_duration == 42) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans._5601_a_7500_42_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans._5601_a_7500_24_a_30_mois;
|
||||
}
|
||||
} else if ((7500 < parseInt(selected_capital) && parseInt(selected_capital) <= 10000)) {
|
||||
max_duration = 48;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration < 36) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans._7501_a_10000_24_a_30_mois;
|
||||
} else if (selected_duration < 42) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans._7501_a_10000_36_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans._7501_a_10000_42_a_48_mois;
|
||||
}
|
||||
} else if ((10000 < parseInt(selected_capital) && parseInt(selected_capital) <= 100000)) {
|
||||
max_duration = 60;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration < 36) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans.a_partir_de_10001_24_a_30_mois;
|
||||
} else if (selected_duration < 42) {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans.a_partir_de_10001_36_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.financement_vehicule_doccasion_plus_de_3_ans.a_partir_de_10001_42_a_48_mois;
|
||||
}
|
||||
}
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
return [min_duration, max_duration, selected_duration, duree_in_range, annual_rate, add_message]
|
||||
}
|
||||
|
||||
export function calculate_mobilhome(cd_js, selected_capital, selected_duration) {
|
||||
var annual_rate, min_duration, max_duration;
|
||||
var duree_in_range = true;
|
||||
var add_message = '';
|
||||
min_duration = 24;
|
||||
if(selected_capital <= 10000){
|
||||
annual_rate = cd_js.groups.financement_mobilhome_et_caravane_de_moins_de_3_ans.max_10000;
|
||||
max_duration = 48;
|
||||
} else if(selected_capital > 10000 && selected_capital <= 15000){
|
||||
annual_rate = cd_js.groups.financement_mobilhome_et_caravane_de_moins_de_3_ans.de_10001_a_15000;
|
||||
max_duration = 60;
|
||||
} else if(selected_capital > 15000 && selected_capital <= 37000){
|
||||
annual_rate = cd_js.groups.financement_mobilhome_et_caravane_de_moins_de_3_ans.de_15001_a_37000;
|
||||
max_duration = 120;
|
||||
} else if(selected_capital > 37000 && selected_capital <= 100000){
|
||||
annual_rate = cd_js.groups.financement_mobilhome_et_caravane_de_moins_de_3_ans.de_37001_a_100000;
|
||||
max_duration = 144;
|
||||
}
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
return [min_duration, max_duration, selected_duration, duree_in_range, annual_rate, add_message];
|
||||
}
|
||||
|
||||
export function calculate_regroupement_de_credit(cd_js, selected_capital, selected_duration) {
|
||||
var annual_rate, min_duration, max_duration;
|
||||
var duree_in_range = true;
|
||||
var add_message = '';
|
||||
min_duration = 24;
|
||||
if(selected_capital >= 5000 && selected_capital <= 5600){
|
||||
annual_rate = cd_js.groups.regroupement_de_credit__rachats_de_credits.de_5000_a_5600;
|
||||
max_duration = 36;
|
||||
} else if(selected_capital > 5600 && selected_capital <= 7500){
|
||||
annual_rate = cd_js.groups.regroupement_de_credit__rachats_de_credits.de_5601_a_7500;
|
||||
max_duration = 42;
|
||||
} else if(selected_capital > 7500 && selected_capital <= 10000){
|
||||
annual_rate = cd_js.groups.regroupement_de_credit__rachats_de_credits.de_7501_a_10000;
|
||||
max_duration = 48;
|
||||
} else if(selected_capital > 10000 && selected_capital <= 15000){
|
||||
annual_rate = cd_js.groups.regroupement_de_credit__rachats_de_credits.de_10001_a_15000;
|
||||
max_duration = 60;
|
||||
} else if(selected_capital > 15000 && selected_capital <= 20000){
|
||||
annual_rate = cd_js.groups.regroupement_de_credit__rachats_de_credits.de_15001_a_20000;
|
||||
max_duration = 84;
|
||||
} else if(selected_capital > 20000 && selected_capital <= 60000){
|
||||
annual_rate = cd_js.groups.regroupement_de_credit__rachats_de_credits.de_20001_a_60000;
|
||||
max_duration = 120;
|
||||
} else if(selected_capital > 60000 && selected_capital <= 75000){
|
||||
annual_rate = cd_js.groups.regroupement_de_credit__rachats_de_credits.de_60001_a_75000;
|
||||
max_duration = 120;
|
||||
} else if(selected_capital > 75000 && selected_capital <= 100000){
|
||||
annual_rate = cd_js.groups.regroupement_de_credit__rachats_de_credits.de_75001_a_100000;
|
||||
max_duration = 144;
|
||||
}
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
return [min_duration, max_duration, selected_duration, duree_in_range, annual_rate, add_message];
|
||||
}
|
||||
|
||||
export function calculate_frais_notaire(cd_js, selected_capital, selected_duration) {
|
||||
var annual_rate, min_duration, max_duration;
|
||||
var duree_in_range = true;
|
||||
var add_message = '';
|
||||
min_duration = 24;
|
||||
if ((2500 < parseInt(selected_capital) && parseInt(selected_capital) <= 15000)) {
|
||||
annual_rate = cd_js.groups.financement_frais_de_notaire.de_2500_a_15000_24_a_60_mois;
|
||||
max_duration = 60;
|
||||
} else if ((15000 < parseInt(selected_capital) && parseInt(selected_capital) <= 40000)) {
|
||||
annual_rate = cd_js.groups.financement_frais_de_notaire.de_15001_a_40000_24_a_120_mois;
|
||||
max_duration = 120;
|
||||
}
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
return [min_duration, max_duration, selected_duration, duree_in_range, annual_rate, add_message];
|
||||
}
|
||||
|
||||
export function calculate_but_immo(cd_js, selected_capital, selected_duration) {
|
||||
var annual_rate, min_duration, max_duration;
|
||||
var duree_in_range = true;
|
||||
var add_message = '';
|
||||
min_duration = 24;
|
||||
if (2500 == parseInt(selected_capital)) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._2500_24_mois;
|
||||
max_duration = 24;
|
||||
} else if ((2500 < parseInt(selected_capital) && parseInt(selected_capital) <= 3700)) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._2501_a_3700_24_a_30_mois;
|
||||
max_duration = 30;
|
||||
} else if ((3700 < parseInt(selected_capital) && parseInt(selected_capital) <= 5600)) {
|
||||
max_duration = 36;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration == 36) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._3701_a_5600_36_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._3701_a_5600_24_a_30_mois;
|
||||
}
|
||||
} else if ((5600 < parseInt(selected_capital) && parseInt(selected_capital) <= 7500)) {
|
||||
max_duration = 42;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration == 42) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._5601_a_7500_42_mois;
|
||||
} else if (selected_duration == 36) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._3701_a_5600_36_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._5601_a_7500_24_a_30_mois;
|
||||
}
|
||||
} else if ((7500 < parseInt(selected_capital) && parseInt(selected_capital) <= 10000)) {
|
||||
max_duration = 48;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration < 36) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._7501_a_10000_24_a_30_mois;
|
||||
} else if (selected_duration < 42) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._7501_a_10000_36_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._7501_a_10000_42_a_48_mois;
|
||||
}
|
||||
} else if ((10000 < parseInt(selected_capital) && parseInt(selected_capital) <= 15000)) {
|
||||
max_duration = 60;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration < 36) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._10001_a_15000_24_a_30_mois;
|
||||
} else if (selected_duration < 42) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._10001_a_15000_36_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._10001_a_15000_42_a_60_mois;
|
||||
}
|
||||
} else if ((15000 < parseInt(selected_capital) && parseInt(selected_capital) <= 20000)) {
|
||||
max_duration = 84;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration < 36) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie.a_partir_de_15001_24_a_30_mois;
|
||||
} else if (selected_duration < 42) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._a_partir_de_15001_36_mois;
|
||||
} else if (selected_duration < 72) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie._a_partir_de_15001_42_a_60_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie.a_partir_de_15001_72_a_84_mois;
|
||||
}
|
||||
} else if ((20000) < parseInt(selected_capital)) {
|
||||
max_duration = 120;
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
if (selected_duration < 36) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie.a_partir_de_20001_24_a_30_mois;
|
||||
} else if (selected_duration < 42) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie.a_partir_de_20001_36_mois;
|
||||
} else if (selected_duration < 72) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie.a_partir_de_20001_42_a_60_mois;
|
||||
} else if (selected_duration < 96) {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie.a_partir_de_20001_72_a_84_mois;
|
||||
} else {
|
||||
annual_rate = cd_js.groups.credit_travaux__renovation__energie.a_partir_de_20001_96_a_120_mois;
|
||||
}
|
||||
}
|
||||
if ((min_duration <= parseInt(selected_duration) && parseInt(selected_duration) <= max_duration)) {} else {
|
||||
duree_in_range = false;
|
||||
selected_duration = max_duration;
|
||||
}
|
||||
return [min_duration, max_duration, selected_duration, duree_in_range, annual_rate, add_message];
|
||||
}
|
||||
153
assets/js/exp/main.js
Normal file
@ -0,0 +1,153 @@
|
||||
// Point d'entrée du simulateur modulaire
|
||||
import * as calculs from './calculs.js';
|
||||
import * as utils from './utils.js';
|
||||
import * as ui from './ui.js';
|
||||
|
||||
// --- Exemples de données (à remplacer par les vraies données dynamiques) ---
|
||||
const form_sliders = {
|
||||
but_immo: { capital_selected: 20000, capital_max: 90000, capital_step: 100, capital_min: 2500, duree_min: 24, duree_max: 120, durees: [24, 30, 36, 42, 48, 60, 72, 84], pivot_value: 0, sub_pivot_value: 0, title: 'Crédit travaux / Rénovation / Energie', description: 'Exemple crédit travaux.' },
|
||||
fin_neuve: { capital_selected: 20000, capital_max: 100000, capital_step: 500, capital_min: 5000, duree_min: 24, duree_max: 84, durees: [24, 30, 36, 42, 48, 60, 72, 84], pivot_value: 0, sub_pivot_value: 5000, title: 'Financement véhicule NEUF', description: 'Exemple véhicule neuf.' },
|
||||
fin_occ_p3a: { capital_selected: 20000, capital_max: 100000, capital_step: 500, capital_min: 5000, duree_min: 24, duree_max: 60, durees: [24, 30, 36, 42, 48, 60], pivot_value: 0, sub_pivot_value: 5000, title: 'Financement véhicule d\'occasion PLUS de 3 ans', description: 'Exemple véhicule +3 ans.' },
|
||||
fin_occ_m3a: { capital_selected: 20000, capital_max: 100000, capital_step: 500, capital_min: 5000, duree_min: 24, duree_max: 84, durees: [24, 30, 36, 42, 48, 60, 72, 84], pivot_value: 0, sub_pivot_value: 5000, title: 'Financement véhicule d\'occasion MOINS de 3 ans', description: 'Exemple véhicule -3 ans.' },
|
||||
mobil_carav: { capital_selected: 20000, capital_max: 100000, capital_step: 500, capital_min: 10000, duree_min: 24, duree_max: 144, durees: [24, 30, 36, 42, 48, 60, 72, 84, 96, 108, 120, 144], pivot_value: 75000, sub_pivot_value: 0, title: 'Financement mobilhome et caravane', description: 'Exemple mobilhome.' },
|
||||
frais_notaire: { capital_selected: 20000, capital_max: 40000, capital_step: 100, capital_min: 2500, duree_min: 24, duree_max: 120, durees: [24, 30, 36, 42, 48, 60, 72, 84, 96, 108, 120], pivot_value: 0, sub_pivot_value: 0, title: 'Financement frais de notaire', description: 'Exemple frais notaire.' },
|
||||
pat: { capital_selected: 10000, capital_max: 200000, capital_min: 1500, capital_step: 100, duree_min: 24, duree_max: 240, durees: [24, 30, 36, 42, 48, 60, 72, 84, 96, 108, 120, 144, 180, 240], pivot_value: 75000, sub_pivot_value: 0, title: 'Prêt personnel / Tous motifs / Achats divers', description: 'Exemple prêt personnel.' },
|
||||
ph: { capital_selected: 100000, capital_max: 1000000, capital_min: 25000, capital_step: 1000, duree_min: 10, duree_max: 30, durees: [5, 10, 15, 20, 25, 30], pivot_value: 0, sub_pivot_value: 0, title: 'Crédit hypothécaire', description: 'Exemple crédit hypo social.' },
|
||||
am: { capital_selected: 100000, capital_max: 1000000, capital_min: 25000, capital_step: 1000, duree_min: 10, duree_max: 30, durees: [10, 15, 20, 25, 30], pivot_value: 0, sub_pivot_value: 0, title: 'Crédit hypothécaire classique', description: 'Exemple crédit hypo classique.' },
|
||||
amr: { capital_selected: 100000, capital_max: 1000000, capital_min: 25000, capital_step: 1000, duree_min: 10, duree_max: 30, durees: [10, 15, 20, 25, 30], pivot_value: 0, sub_pivot_value: 0, title: 'Crédit hypothécaire maison rapport', description: 'Exemple maison rapport.' },
|
||||
cdp: { capital_selected: 100000, capital_max: 1000000, capital_min: 25000, capital_step: 1000, duree_min: 10, duree_max: 30, durees: [10, 15, 20, 25, 30], pivot_value: 0, sub_pivot_value: 0, title: 'Crédit pont', description: 'Exemple crédit pont.' },
|
||||
cied: { capital_selected: 100000, capital_max: 1000000, capital_min: 25000, capital_step: 1000, duree_min: 10, duree_max: 30, durees: [10, 15, 20, 25, 30], pivot_value: 0, sub_pivot_value: 0, title: 'Crédit Indépendants et entreprises en difficultés', description: 'Exemple crédit indépendants.' },
|
||||
regroup_cred: { capital_selected: 20000, capital_max: 200000, capital_step: 500, capital_min: 5000, duree_min: 24, duree_max: 144, durees: [24, 30, 36, 42, 48, 60, 72, 84, 96, 108, 120, 144], pivot_value: 75000, sub_pivot_value: 0, title: 'Regroupement de crédit / rachat de crédit', description: 'Exemple regroupement.' },
|
||||
};
|
||||
const map_values = { pat: 'pat', am: 'am' };
|
||||
const authorized_value = ['pat', 'am'];
|
||||
|
||||
// --- Etat global du simulateur ---
|
||||
let selected_type = 'pat';
|
||||
let selected_capital = form_sliders[selected_type].capital_selected;
|
||||
let selected_duree = form_sliders[selected_type].duree_max;
|
||||
|
||||
// --- Création des éléments d'affichage si besoin ---
|
||||
function ensureResultElements() {
|
||||
if (!document.getElementById('mensualite_result')) {
|
||||
const res = document.createElement('div');
|
||||
res.id = 'mensualite_result';
|
||||
res.style.margin = '1em 0';
|
||||
document.body.appendChild(res);
|
||||
}
|
||||
if (!document.getElementById('taux_result')) {
|
||||
const res = document.createElement('div');
|
||||
res.id = 'taux_result';
|
||||
res.style.margin = '1em 0';
|
||||
document.body.appendChild(res);
|
||||
}
|
||||
if (!document.getElementById('duree_result')) {
|
||||
const res = document.createElement('div');
|
||||
res.id = 'duree_result';
|
||||
res.style.margin = '1em 0';
|
||||
document.body.appendChild(res);
|
||||
}
|
||||
}
|
||||
|
||||
// --- Fonction de recalcul centralisée et affichage ---
|
||||
function recalculate() {
|
||||
let result;
|
||||
switch (selected_type) {
|
||||
case 'pat':
|
||||
result = calculs.calculate_pat(form_sliders, selected_capital, selected_duree);
|
||||
break;
|
||||
case 'am':
|
||||
result = calculs.calculate_am(form_sliders, selected_capital, selected_duree);
|
||||
break;
|
||||
case 'fin_neuve':
|
||||
if (typeof calculs.calculate_fin_neuve === 'function') {
|
||||
result = calculs.calculate_fin_neuve(form_sliders, selected_capital, selected_duree);
|
||||
}
|
||||
break;
|
||||
case 'fin_occ_m3a':
|
||||
if (typeof calculs.calculate_pao_m_3 === 'function') {
|
||||
result = calculs.calculate_pao_m_3(form_sliders, selected_capital, selected_duree);
|
||||
}
|
||||
break;
|
||||
case 'fin_occ_p3a':
|
||||
if (typeof calculs.calculate_pao_p_3 === 'function') {
|
||||
result = calculs.calculate_pao_p_3(form_sliders, selected_capital, selected_duree);
|
||||
}
|
||||
break;
|
||||
case 'ph':
|
||||
if (typeof calculs.calculate_ph === 'function') {
|
||||
result = calculs.calculate_ph(form_sliders, selected_capital, selected_duree);
|
||||
}
|
||||
break;
|
||||
case 'frais_notaire':
|
||||
if (typeof calculs.calculate_frais_notaire === 'function') {
|
||||
result = calculs.calculate_frais_notaire(form_sliders, selected_capital, selected_duree);
|
||||
}
|
||||
break;
|
||||
case 'but_immo':
|
||||
if (typeof calculs.calculate_but_immo === 'function') {
|
||||
result = calculs.calculate_but_immo(form_sliders, selected_capital, selected_duree);
|
||||
}
|
||||
break;
|
||||
case 'mobil_carav':
|
||||
if (typeof calculs.calculate_mobilhome === 'function') {
|
||||
result = calculs.calculate_mobilhome(form_sliders, selected_capital, selected_duree);
|
||||
}
|
||||
break;
|
||||
case 'regroup_cred':
|
||||
if (typeof calculs.calculate_regroupement_de_credit === 'function') {
|
||||
result = calculs.calculate_regroupement_de_credit(form_sliders, selected_capital, selected_duree);
|
||||
}
|
||||
break;
|
||||
// Ajouter ici d'autres types de crédits selon le module calculs.js
|
||||
default:
|
||||
result = null;
|
||||
}
|
||||
if (result) {
|
||||
// result = [min_duration, max_duration, selected_duration, duree_in_range, annual_rate, add_message]
|
||||
const mensualite = (selected_capital * (result[4] / 100) / 12).toFixed(2); // Simplifié pour démo
|
||||
const taux = result[4];
|
||||
const duree = result[2];
|
||||
document.getElementById('mensualite_result').textContent = `Mensualité estimée : ${utils.number_format(mensualite, 2, ',', ' ')} €`;
|
||||
document.getElementById('taux_result').textContent = `Taux annuel : ${taux} %`;
|
||||
document.getElementById('duree_result').textContent = `Durée sélectionnée : ${duree}`;
|
||||
} else {
|
||||
document.getElementById('mensualite_result').textContent = 'Mensualité : --';
|
||||
document.getElementById('taux_result').textContent = 'Taux : --';
|
||||
document.getElementById('duree_result').textContent = 'Durée : --';
|
||||
}
|
||||
}
|
||||
|
||||
// --- Initialisation des sliders au chargement ---
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
ensureResultElements();
|
||||
// Initialisation sliders capital et durée
|
||||
ui.change_capital_slider(form_sliders, map_values, authorized_value, utils.number_format, form_sliders[selected_type].capital_min, form_sliders[selected_type].capital_max, form_sliders[selected_type].capital_selected);
|
||||
ui.change_month_slider(form_sliders, map_values, authorized_value, utils.number_format, ui.getStepForValue, form_sliders[selected_type].duree_min, form_sliders[selected_type].duree_max, form_sliders[selected_type].duree_max);
|
||||
recalculate();
|
||||
|
||||
// --- Gestion des événements ---
|
||||
document.getElementById('loan_type')?.addEventListener('change', (e) => {
|
||||
selected_type = e.target.value;
|
||||
selected_capital = form_sliders[selected_type].capital_selected;
|
||||
selected_duree = form_sliders[selected_type].duree_max;
|
||||
ui.change_capital_slider(form_sliders, map_values, authorized_value, utils.number_format, form_sliders[selected_type].capital_min, form_sliders[selected_type].capital_max, selected_capital);
|
||||
ui.change_month_slider(form_sliders, map_values, authorized_value, utils.number_format, ui.getStepForValue, form_sliders[selected_type].duree_min, form_sliders[selected_type].duree_max, selected_duree);
|
||||
recalculate();
|
||||
});
|
||||
document.getElementById('selected_capital')?.addEventListener('input', (e) => {
|
||||
selected_capital = parseInt(e.target.value, 10) || form_sliders[selected_type].capital_selected;
|
||||
recalculate();
|
||||
});
|
||||
document.getElementById('selected_months')?.addEventListener('input', (e) => {
|
||||
selected_duree = parseInt(e.target.value, 10) || form_sliders[selected_type].duree_max;
|
||||
recalculate();
|
||||
});
|
||||
});
|
||||
|
||||
// TODO : Gérer l'état global du simulateur, les valeurs sélectionnées, et l'intégration complète des modules
|
||||
|
||||
// Ici, on gérera l'initialisation, les événements, et l'orchestration des modules
|
||||
// Exemple :
|
||||
// ui.change_capital_slider(...);
|
||||
// calculs.calculate_pat(...);
|
||||
489
assets/js/exp/ui.js
Normal file
@ -0,0 +1,489 @@
|
||||
// Module de gestion de l'UI et des sliders
|
||||
|
||||
// Les fonctions ci-dessous supposent que form_sliders, map_values, authorized_value sont passés en paramètre ou importés
|
||||
|
||||
export function change_duree(form_sliders, map_values, authorized_value, default_min, default_max, selected_value) {
|
||||
var list = '';
|
||||
var list_class = '',
|
||||
loan_type = jQuery('#loan_type').val(),
|
||||
loan_radio_type = jQuery('.loan_type:checked').length ? jQuery('.loan_type:checked').val() : '',
|
||||
sub_loan_radio_type = jQuery('.sub_loan_type:checked').length ? jQuery('.sub_loan_type:checked').val() : '',
|
||||
class_name = 'mens_',
|
||||
selected_capital = jQuery('#selected_capital').val(),
|
||||
monthly_low = 0,
|
||||
monthly_high = 0,
|
||||
capital_min = 0,
|
||||
capital_max = 0,
|
||||
selected_duree_box = jQuery('#selected_months_range').parents('.selected_duree');
|
||||
|
||||
var loan_type_in_years = ['am', 'amr', 'cdp', 'cied'];
|
||||
|
||||
if (loan_radio_type != '')
|
||||
loan_type = loan_radio_type;
|
||||
|
||||
if (selected_capital == '') {
|
||||
selected_capital = form_sliders[loan_type]['capital_selected'];
|
||||
}
|
||||
|
||||
if (sub_loan_radio_type != '') {
|
||||
if (authorized_value.includes(sub_loan_radio_type)) {
|
||||
loan_type = sub_loan_radio_type;
|
||||
} else if (map_values[sub_loan_radio_type] !== 'undefined') {
|
||||
loan_type = map_values[sub_loan_radio_type];
|
||||
}
|
||||
}
|
||||
|
||||
capital_min = form_sliders[loan_type]['capital_min'];
|
||||
capital_max = form_sliders[loan_type]['capital_max'];
|
||||
|
||||
// Ici, il faudrait injecter les fonctions de calcul en paramètre ou via import
|
||||
// Pour l'instant, on laisse un placeholder pour results
|
||||
let results = [default_min, default_max];
|
||||
// ... (à compléter avec l'appel à la bonne fonction de calcul)
|
||||
|
||||
monthly_low = results[0];
|
||||
monthly_high = results[1];
|
||||
|
||||
var validDurees = [];
|
||||
for (var j = 0; j < duree_range.length; j++) {
|
||||
if ((monthly_low <= parseInt(duree_range[j]) && parseInt(duree_range[j]) <= monthly_high)) {
|
||||
validDurees.push(duree_range[j]);
|
||||
}
|
||||
}
|
||||
var startIndex = Math.max(0, validDurees.length - 4);
|
||||
|
||||
if (jQuery('#selected_capital').val() < capital_min) {
|
||||
list = '<li>La somme minimale est de ' + capital_min + '€</li>';
|
||||
} else if (jQuery('#selected_capital').val() > capital_max) {
|
||||
list = '<li>La somme maximale est de ' + capital_max + '€</li>';
|
||||
} else {
|
||||
for (var i = startIndex; i < validDurees.length; i++) {
|
||||
var periodicite = ' mois';
|
||||
if (loan_type_in_years.includes(loan_type)) {
|
||||
class_name = validDurees[i] + '_ans';
|
||||
periodicite = ' ans';
|
||||
} else {
|
||||
class_name = 'mens_' + validDurees[i];
|
||||
}
|
||||
if ((default_min <= parseInt(validDurees[i]) && parseInt(validDurees[i]) <= default_max)) {
|
||||
if (selected_value == validDurees[i]) {
|
||||
list_class = ' selected';
|
||||
}
|
||||
if (validDurees[i] <= monthly_high) {
|
||||
list = list + '<li data-duree="' + validDurees[i] + '" class="duree-btn months-active' + list_class + '"><span class="mensualite ' + class_name + '"></span>' + validDurees[i] + periodicite + '</li>';
|
||||
}
|
||||
} else {
|
||||
list = list + '<li data-duree="' + validDurees[i] + '" class="duree-btn months-inactive" style="display: none;"><span class="mensualite ' + class_name + '"></span>' + validDurees[i] + periodicite + '</li>';
|
||||
}
|
||||
list_class = '';
|
||||
}
|
||||
}
|
||||
jQuery('#date-range-selector').html(list);
|
||||
var periodicite = loan_type_in_years.includes(loan_type) ? ' ans' : ' mois';
|
||||
jQuery('.slider_duree_box').text(selected_value + periodicite);
|
||||
jQuery(selected_duree_box).find('.outside_slider_duree_box').text(selected_value + periodicite);
|
||||
}
|
||||
|
||||
export function change_capital_slider(form_sliders, map_values, authorized_value, number_format, default_min, default_max, default_selected_value) {
|
||||
var selected_capital_range = '#selected_capital_range';
|
||||
var selected_capital = '#selected_capital';
|
||||
var selected_capital_box = jQuery(selected_capital_range).parents('.selected_capital');
|
||||
var stepUpdateTimeout = null;
|
||||
var isInputChange = false;
|
||||
|
||||
var loan_type = jQuery('#loan_type').val(),
|
||||
loan_radio_type = jQuery('.loan_type:checked').length ? jQuery('.loan_type:checked').val() : '',
|
||||
sub_loan_radio_type = jQuery('.sub_loan_type:checked').length ? jQuery('.sub_loan_type:checked').val() : '';
|
||||
|
||||
if (loan_radio_type != '')
|
||||
loan_type = loan_radio_type;
|
||||
|
||||
if (sub_loan_radio_type != '') {
|
||||
if (authorized_value.includes(sub_loan_radio_type)) {
|
||||
loan_type = sub_loan_radio_type;
|
||||
} else if (map_values[sub_loan_radio_type] !== 'undefined') {
|
||||
loan_type = map_values[sub_loan_radio_type];
|
||||
}
|
||||
}
|
||||
|
||||
var pivot_value = form_sliders[loan_type].pivot_value;
|
||||
var sub_pivot_value = form_sliders[loan_type].sub_pivot_value;
|
||||
var pivot_percent = ((pivot_value - default_min) / (default_max - default_min)) * 100;
|
||||
var sub_pivot_percent = ((sub_pivot_value - default_min) / (default_max - default_min)) * 100;
|
||||
|
||||
jQuery('.pivot-zone').remove();
|
||||
if (pivot_value > 0) {
|
||||
var pivotZone = jQuery('<div class="pivot-zone"></div>');
|
||||
pivotZone.css({
|
||||
'position': 'absolute',
|
||||
'left': pivot_percent + '%',
|
||||
'right': '0',
|
||||
'top': '0',
|
||||
'bottom': '0',
|
||||
'background-color': 'rgba(255, 0, 0, 0.2)',
|
||||
'pointer-events': 'none'
|
||||
});
|
||||
jQuery(selected_capital_range).append(pivotZone);
|
||||
}
|
||||
|
||||
function calculateStep(value) {
|
||||
return value < 10000 ? 500 : 250;
|
||||
}
|
||||
function roundToStep(value) {
|
||||
var step = calculateStep(value);
|
||||
return Math.round(value / step) * step;
|
||||
}
|
||||
|
||||
jQuery(selected_capital)
|
||||
.attr('step', calculateStep(default_selected_value))
|
||||
.on('input', function() {
|
||||
var $input = jQuery(this);
|
||||
var value = Number($input.val());
|
||||
if (!value) return;
|
||||
if (stepUpdateTimeout) {
|
||||
clearTimeout(stepUpdateTimeout);
|
||||
}
|
||||
stepUpdateTimeout = setTimeout(function() {
|
||||
var newStep = calculateStep(value);
|
||||
$input.attr('step', newStep);
|
||||
}, 500);
|
||||
isInputChange = true;
|
||||
jQuery(selected_capital_range).slider('value', value);
|
||||
jQuery(selected_capital_range).find('.slider_capital_box')
|
||||
.text(number_format(value, 2, ',', '.') + ' €');
|
||||
selected_capital_box.find('.outside_box').text(number_format(value, 2, ',', '.') + ' €');
|
||||
});
|
||||
|
||||
jQuery(selected_capital_range).slider({
|
||||
min: default_min,
|
||||
max: default_max,
|
||||
value: default_selected_value,
|
||||
step: calculateStep(default_selected_value),
|
||||
slide: function(event, ui) {
|
||||
if (isInputChange) return;
|
||||
var orange_bar = jQuery('.slider_capital_wrapper .after_bar'),
|
||||
elem = jQuery(ui.handle),
|
||||
left_css = parseInt(elem.css('left'), 10);
|
||||
orange_bar.css('width', left_css + 10);
|
||||
if (pivot_value > 0 && ui.value >= pivot_value) {
|
||||
jQuery(selected_capital_range).find('.slider_capital_box').addClass('pivot-value');
|
||||
if (!jQuery('#acceptConditions').is(':checked')) {
|
||||
jQuery('.stimulator_result_btn').prop('disabled', true).addClass('disabled');
|
||||
}
|
||||
} else {
|
||||
jQuery(selected_capital_range).find('.slider_capital_box').removeClass('pivot-value');
|
||||
jQuery('.stimulator_result_btn').prop('disabled', false).removeClass('disabled');
|
||||
}
|
||||
jQuery(selected_capital).val(ui.value);
|
||||
jQuery(selected_capital_range).find('.slider_capital_box').text(number_format((ui.value), 2, ',', '.') + ' €');
|
||||
selected_capital_box.find('.outside_box').text(number_format(ui.value, 2, ',', '.') + ' €');
|
||||
if (pivot_value > 0) {
|
||||
if (ui.value >= pivot_value) {
|
||||
jQuery('.pat_plus75000').slideDown(300);
|
||||
} else {
|
||||
jQuery('.pat_plus75000').slideUp(300);
|
||||
}
|
||||
} else {
|
||||
jQuery('.pat_plus75000').hide();
|
||||
}
|
||||
},
|
||||
stop: function(event, ui) {
|
||||
// Les callbacks de recalcul et de sliders seront injectés dans main.js
|
||||
},
|
||||
change: function(event, ui) {
|
||||
var orange_bar = jQuery('.slider_capital_wrapper .after_bar'),
|
||||
elem = jQuery(ui.handle),
|
||||
left_css = parseInt(elem.css('left'), 10);
|
||||
orange_bar.css('width', left_css + 10);
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('#acceptConditions').on('change', function() {
|
||||
var currentValue = jQuery(selected_capital).val();
|
||||
if (pivot_value > 0 && currentValue >= pivot_value) {
|
||||
if (jQuery(this).is(':checked')) {
|
||||
jQuery('.stimulator_result_btn').prop('disabled', false).removeClass('disabled');
|
||||
} else {
|
||||
jQuery('.stimulator_result_btn').prop('disabled', true).addClass('disabled');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var appended_elem = '<span class="slider_capital_box">test</span>';
|
||||
if (!jQuery('.ui-slider-handle .fa-angle-right').length)
|
||||
jQuery(selected_capital_range).find('.ui-slider-handle').append('<i class="fa-angle-left fas" data-name="angle-right" aria-hidden="true"></i><i class="fa-angle-right fas" data-name="angle-right" aria-hidden="true"></i>');
|
||||
if (!jQuery(selected_capital_range).find('.slider_capital_box').length) {
|
||||
jQuery(selected_capital_range).find('.ui-slider-handle').append(appended_elem);
|
||||
}
|
||||
jQuery(selected_capital_range).find('.slider_capital_box').text(number_format((jQuery(selected_capital_range).slider('value')), 2, ',', '.') + ' €');
|
||||
selected_capital_box.find('.outside_box').text(number_format((jQuery(selected_capital_range).slider('value')), 2, ',', '.') + ' €');
|
||||
|
||||
if (sub_pivot_value > 0) {
|
||||
var subPivotZone = jQuery('<div class="sub-pivot-zone"></div>');
|
||||
subPivotZone.css({
|
||||
'position': 'absolute',
|
||||
'left': '0',
|
||||
'width': sub_pivot_percent + '%',
|
||||
'top': '0',
|
||||
'bottom': '0',
|
||||
'background-color': 'rgba(0, 0, 255, 0.15)',
|
||||
'pointer-events': 'none'
|
||||
});
|
||||
if(jQuery('.sub-pivot-zone').length == 0)
|
||||
jQuery(selected_capital_range).append(subPivotZone);
|
||||
}
|
||||
}
|
||||
|
||||
export function change_month_slider(form_sliders, map_values, authorized_value, number_format, getStepForValue, default_min, default_max, default_selected_value) {
|
||||
var selected_months_range = '#selected_months_range';
|
||||
var selected_months = '#selected_months';
|
||||
var loan_type_in_years = ['am', 'amr', 'cdp', 'cied', 'ph'];
|
||||
var sel_duree = jQuery(selected_months).val(),
|
||||
selected_duree_box = jQuery(selected_months_range).parents('.selected_duree');
|
||||
|
||||
var loan_type = jQuery('#loan_type').val(),
|
||||
loan_radio_type = jQuery('.loan_type:checked').length ? jQuery('.loan_type:checked').val() : '',
|
||||
sub_loan_radio_type = jQuery('.sub_loan_type:checked').length ? jQuery('.sub_loan_type:checked').val() : '';
|
||||
|
||||
if (loan_radio_type != '')
|
||||
loan_type = loan_radio_type;
|
||||
|
||||
if (sub_loan_radio_type != '') {
|
||||
if (authorized_value.includes(sub_loan_radio_type)) {
|
||||
loan_type = sub_loan_radio_type;
|
||||
} else if (map_values[sub_loan_radio_type] !== 'undefined') {
|
||||
loan_type = map_values[sub_loan_radio_type];
|
||||
}
|
||||
}
|
||||
|
||||
var selected_capital = jQuery('#selected_capital').val();
|
||||
if (selected_capital == '')
|
||||
selected_capital = form_sliders[loan_type]['capital_selected'];
|
||||
|
||||
// Les résultats de calcul sont à injecter via callback dans main.js si besoin
|
||||
let results = [default_min, default_max]; // À remplacer par l'appel à la bonne fonction de calcul
|
||||
var max_duration = results[1];
|
||||
var dynamic_max = max_duration;
|
||||
var available_durations = form_sliders[loan_type].durees;
|
||||
for (var i = available_durations.length - 1; i >= 0; i--) {
|
||||
if (available_durations[i] <= max_duration) {
|
||||
dynamic_max = available_durations[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(selected_months_range).slider({
|
||||
min: default_min,
|
||||
max: dynamic_max,
|
||||
value: dynamic_max,
|
||||
step: getStepForValue(loan_type, dynamic_max),
|
||||
slide: function(event, ui) {
|
||||
var newStep = getStepForValue(loan_type, ui.value);
|
||||
if (newStep !== jQuery(this).slider('option', 'step')) {
|
||||
jQuery(this).slider('option', 'step', newStep);
|
||||
}
|
||||
var orange_bar = jQuery('.slider_duree_wrapper .after_bar_month'),
|
||||
elem = jQuery(ui.handle),
|
||||
left_css = parseInt(elem.css('left'), 10);
|
||||
orange_bar.css('width', left_css + 10);
|
||||
jQuery(selected_months).val(ui.value);
|
||||
if (loan_type_in_years.includes(loan_type)) {
|
||||
jQuery(selected_months_range).find('.slider_duree_box').text(ui.value + ' ans');
|
||||
jQuery(selected_duree_box).find('.outside_slider_duree_box').text(ui.value + ' ans');
|
||||
} else {
|
||||
jQuery(selected_months_range).find('.slider_duree_box').text(ui.value + ' mois');
|
||||
jQuery(selected_duree_box).find('.outside_slider_duree_box').text(ui.value + ' mois');
|
||||
}
|
||||
},
|
||||
stop: function(event, ui) {
|
||||
// Les callbacks de recalcul seront injectés dans main.js
|
||||
},
|
||||
change: function(event, ui) {
|
||||
var orange_bar = jQuery('.slider_duree_wrapper .after_bar_month'),
|
||||
elem = jQuery(ui.handle),
|
||||
left_css = parseInt(elem.css('left'), 10);
|
||||
orange_bar.css('width', left_css + 10);
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(selected_months).val(jQuery(selected_months_range).slider('value'));
|
||||
var periodicite = loan_type_in_years.includes(loan_type) ? ' ans' : ' mois';
|
||||
var appended_elem = '<span class="slider_duree_box">' + jQuery(selected_months_range).slider('value') + periodicite + '</span>';
|
||||
jQuery(selected_duree_box).find('.outside_slider_duree_box').text(jQuery(selected_months_range).slider('value') + periodicite);
|
||||
if (!jQuery(selected_months_range).find('.ui-slider-handle .fa-angle-right').length) {
|
||||
jQuery(selected_months_range).find('.ui-slider-handle').append('<i class="fa-angle-left fas" data-name="angle-right" aria-hidden="true"></i><i class="fa-angle-right fas" data-name="angle-right" aria-hidden="true"></i>');
|
||||
}
|
||||
if (!jQuery(selected_months_range).find('.slider_duree_box').length) {
|
||||
jQuery(selected_months_range).find('.ui-slider-handle').append(appended_elem);
|
||||
}
|
||||
}
|
||||
|
||||
export function update_capital_input(form_sliders, map_values, authorized_value) {
|
||||
if (jQuery('#selected_capital').length) {
|
||||
var selected = jQuery('#loan_type').val(),
|
||||
selected_radio = jQuery('.loan_type:checked').length ? jQuery('.loan_type:checked').val() : '',
|
||||
sub_loan_radio_type = jQuery('.sub_loan_type:checked').length ? jQuery('.sub_loan_type:checked').val() : '';
|
||||
|
||||
if (selected_radio != '')
|
||||
selected = selected_radio;
|
||||
|
||||
if (sub_loan_radio_type != '' && authorized_value.includes(sub_loan_radio_type)) {
|
||||
selected = sub_loan_radio_type;
|
||||
} else if (map_values[sub_loan_radio_type] !== 'undefined') {
|
||||
selected = map_values[sub_loan_radio_type];
|
||||
}
|
||||
|
||||
var capital_max = form_sliders[selected].capital_max;
|
||||
var capital_min = form_sliders[selected].capital_min;
|
||||
var capital_selected = form_sliders[selected].capital_selected;
|
||||
|
||||
jQuery('#selected_capital').prop('min', capital_min);
|
||||
jQuery('#selected_capital').prop('max', capital_max);
|
||||
jQuery('#selected_capital').val(capital_selected);
|
||||
}
|
||||
}
|
||||
|
||||
export function validate_months_input(form_sliders, map_values, authorized_value, getStepForValue, calculate_mensualite) {
|
||||
var selected_months_range = '#selected_months_range';
|
||||
var selected_months = '#selected_months';
|
||||
var selected = jQuery('#loan_type').val(),
|
||||
loan_radio_type = jQuery('.loan_type:checked').length ? jQuery('.loan_type:checked').val() : '',
|
||||
sub_loan_radio_type = jQuery('.sub_loan_type:checked').length ? jQuery('.sub_loan_type:checked').val() : '',
|
||||
selected_duree_box = jQuery(selected_months_range).parents('.selected_duree');
|
||||
|
||||
if (loan_radio_type != '') {
|
||||
selected = loan_radio_type;
|
||||
}
|
||||
|
||||
if (sub_loan_radio_type != '') {
|
||||
if (authorized_value.includes(sub_loan_radio_type)) {
|
||||
selected = sub_loan_radio_type;
|
||||
} else if (map_values[sub_loan_radio_type] !== 'undefined') {
|
||||
selected = map_values[sub_loan_radio_type];
|
||||
}
|
||||
}
|
||||
|
||||
var duree_max = form_sliders[selected].duree_max;
|
||||
var duree_min = form_sliders[selected].duree_min;
|
||||
var loan_type_in_years = ['am', 'amr', 'cdp', 'cied', 'ph'];
|
||||
var current_value = parseInt(jQuery(selected_months).val());
|
||||
|
||||
// Utiliser la fonction getStepForValue passée en paramètre
|
||||
var step = getStepForValue(selected, current_value);
|
||||
|
||||
// Arrondir à la valeur la plus proche selon le step
|
||||
var rounded_value = Math.round(current_value / step) * step;
|
||||
|
||||
// Appliquer les limites min/max
|
||||
if (rounded_value < duree_min) {
|
||||
rounded_value = duree_min;
|
||||
} else if (rounded_value > duree_max) {
|
||||
rounded_value = duree_max;
|
||||
}
|
||||
|
||||
// Mettre à jour le champ et le slider
|
||||
jQuery(selected_months).val(rounded_value);
|
||||
jQuery(selected_months_range).slider('value', rounded_value);
|
||||
|
||||
// Mettre à jour l'affichage
|
||||
var periodicite = loan_type_in_years.includes(selected) ? ' ans' : ' mois';
|
||||
jQuery(selected_months_range).find('.slider_duree_box').text(rounded_value + periodicite);
|
||||
jQuery(selected_duree_box).find('.outside_slider_duree_box').text(rounded_value + periodicite);
|
||||
// Recalculer la mensualité
|
||||
calculate_mensualite();
|
||||
}
|
||||
|
||||
export function getStepForValue(loan_type, value) {
|
||||
let loan_type_in_years = ['am', 'amr', 'cdp', 'cied', 'ph'];
|
||||
let dynamic_step = 1;
|
||||
if (loan_type_in_years.includes(loan_type)) {
|
||||
dynamic_step = 1; // Step de 1 an pour les prêts en années
|
||||
} else {
|
||||
if (value <= 48) {
|
||||
dynamic_step = 6; // Step de 6 mois jusqu'à 48 mois
|
||||
} else {
|
||||
dynamic_step = 12; // Step de 12 mois au-delà de 48 mois
|
||||
}
|
||||
}
|
||||
return dynamic_step;
|
||||
}
|
||||
|
||||
export function display_alert_capital(form_sliders, map_values, authorized_value) {
|
||||
var selected_capital = jQuery('#selected_capital').val();
|
||||
var selected = jQuery('#loan_type').val(),
|
||||
selected_radio = jQuery('.loan_type:checked').length ? jQuery('.loan_type:checked').val() : '',
|
||||
sub_loan_radio_type = jQuery('.sub_loan_type:checked').length ? jQuery('.sub_loan_type:checked').val() : '';
|
||||
|
||||
if (selected_radio != '')
|
||||
selected = selected_radio;
|
||||
|
||||
if (sub_loan_radio_type != '') {
|
||||
if (authorized_value.includes(sub_loan_radio_type)) {
|
||||
selected = sub_loan_radio_type;
|
||||
} else if (map_values[sub_loan_radio_type] !== 'undefined') {
|
||||
selected = map_values[sub_loan_radio_type];
|
||||
}
|
||||
}
|
||||
|
||||
var capital_max = form_sliders[selected].capital_max;
|
||||
var capital_min = form_sliders[selected].capital_min;
|
||||
|
||||
if (jQuery('.limit-warning').length) {
|
||||
jQuery('.limit-warning').slideUp();
|
||||
jQuery('.limit-warning').remove();
|
||||
}
|
||||
|
||||
if (!((selected_capital > capital_min) && (selected_capital < capital_max))) {
|
||||
if ((selected_capital <= capital_min)) {
|
||||
jQuery('.second-col').prepend('<div class="alert alert-warning limit-warning">Le montant minimum requis est de ' + capital_min + '€</div>');
|
||||
} else {
|
||||
jQuery('.second-col').prepend('<div class="alert alert-warning limit-warning">Le montant maximum est de ' + capital_max + '€</div>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function delayed_capital_chnage(form_sliders, map_values, authorized_value, on_slider_value_change) {
|
||||
var selected_capital_range = '#selected_capital_range';
|
||||
var selected = jQuery('#loan_type').val(),
|
||||
loan_radio_type = jQuery('.loan_type:checked').length ? jQuery('.loan_type:checked').val() : '',
|
||||
sub_loan_radio_type = jQuery('.sub_loan_type:checked').length ? jQuery('.sub_loan_type:checked').val() : '';
|
||||
var selected_capital = jQuery('#selected_capital').val();
|
||||
|
||||
if (loan_radio_type != '') {
|
||||
selected = loan_radio_type;
|
||||
}
|
||||
|
||||
if (sub_loan_radio_type != '') {
|
||||
if (authorized_value.includes(sub_loan_radio_type)) {
|
||||
selected = sub_loan_radio_type;
|
||||
} else if (map_values[sub_loan_radio_type] !== 'undefined') {
|
||||
selected = map_values[sub_loan_radio_type];
|
||||
}
|
||||
}
|
||||
|
||||
var capital_max = form_sliders[selected].capital_max;
|
||||
var capital_min = form_sliders[selected].capital_min;
|
||||
var simu_button = document.querySelector('.stimulator_result_btn');
|
||||
|
||||
if (jQuery('.limit-warning').length) {
|
||||
jQuery('.limit-warning').slideUp();
|
||||
jQuery('.limit-warning').remove();
|
||||
}
|
||||
|
||||
if ((selected_capital >= capital_min) && (selected_capital <= capital_max)) {
|
||||
if (jQuery('.stimulator_result_btn').is(':disabled'))
|
||||
jQuery('.stimulator_result_btn').removeAttr('disabled');
|
||||
on_slider_value_change();
|
||||
} else {
|
||||
if (!((selected_capital > capital_min) && (selected_capital < capital_max))) {
|
||||
if ((selected_capital <= capital_min)) {
|
||||
let elem = '<p class="limit-warning">Le montant minimum requis est de ' + capital_min + '€</p>';
|
||||
jQuery(elem).insertBefore('.stimulator_result_btn');
|
||||
} else {
|
||||
jQuery('<p class="limit-warning">Le montant maximum requis est de ' + capital_max + '€</p>').insertBefore('.stimulator_result_btn');
|
||||
}
|
||||
jQuery('.stimulator_result_btn').prop('disabled', true);
|
||||
on_slider_value_change();
|
||||
}
|
||||
}
|
||||
}
|
||||
32
assets/js/exp/utils.js
Normal file
@ -0,0 +1,32 @@
|
||||
// Module des fonctions utilitaires
|
||||
|
||||
export function number_format(number, decimals, decPoint, thousandsSep) {
|
||||
number = (number + '').replace(/[^0-9+\-Ee.]/g, '')
|
||||
var n = !isFinite(+number) ? 0 : +number
|
||||
var prec = !isFinite(+decimals) ? 0 : Math.abs(decimals)
|
||||
var sep = (typeof thousandsSep === 'undefined') ? ',' : thousandsSep
|
||||
var dec = (typeof decPoint === 'undefined') ? '.' : decPoint
|
||||
var s = ''
|
||||
|
||||
var toFixedFix = function(n, prec) {
|
||||
var k = Math.pow(10, prec)
|
||||
return '' + (Math.round(n * k) / k)
|
||||
.toFixed(prec)
|
||||
}
|
||||
|
||||
// @todo: for IE parseFloat(0.55).toFixed(0) = 0;
|
||||
s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.')
|
||||
if (s[0].length > 3) {
|
||||
s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep)
|
||||
}
|
||||
if ((s[1] || '').length < prec) {
|
||||
s[1] = s[1] || ''
|
||||
s[1] += new Array(prec - s[1].length + 1).join('0')
|
||||
}
|
||||
|
||||
return s.join(dec)
|
||||
}
|
||||
|
||||
export function getStepForValue(loan_type, value) {
|
||||
// ...
|
||||
}
|
||||
2082
assets/js/form_main.js
Normal file
1438
assets/js/form_main.old.js
Normal file
4
assets/js/libraries/additional-methods.min.js
vendored
Normal file
7
assets/js/libraries/bootstrap.bundle.min.js
vendored
Normal file
7
assets/js/libraries/bootstrap.min.js
vendored
Normal file
6
assets/js/libraries/iziModal.min.js
vendored
Normal file
24
assets/js/libraries/jquery.bootstrap.wizard.min.js
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
jQuery twitter bootstrap wizard plugin
|
||||
Examples and documentation at: http://github.com/VinceG/twitter-bootstrap-wizard
|
||||
version 1.4.2
|
||||
Requires jQuery v1.3.2 or later
|
||||
Supports Bootstrap 2.2.x, 2.3.x, 3.0
|
||||
Dual licensed under the MIT and GPL licenses:
|
||||
http://www.opensource.org/licenses/mit-license.php
|
||||
http://www.gnu.org/licenses/gpl.html
|
||||
Authors: Vadim Vincent Gabriel (http://vadimg.com), Jason Gill (www.gilluminate.com)
|
||||
*/
|
||||
(function(c){var n=function(d,k){d=c(d);var a=this,h=[],b=c.extend({},c.fn.bootstrapWizard.defaults,k),f=null,e=null;this.rebindClick=function(b,a){b.unbind("click",a).bind("click",a)};this.fixNavigationButtons=function(){f.length||(e.find("a:first").tab("show"),f=e.find('li:has([data-toggle="tab"]):first'));c(b.previousSelector,d).toggleClass("disabled",a.firstIndex()>=a.currentIndex());c(b.nextSelector,d).toggleClass("disabled",a.currentIndex()>=a.navigationLength());c(b.nextSelector,d).toggleClass("hidden",
|
||||
a.currentIndex()>=a.navigationLength()&&0<c(b.finishSelector,d).length);c(b.lastSelector,d).toggleClass("hidden",a.currentIndex()>=a.navigationLength()&&0<c(b.finishSelector,d).length);c(b.finishSelector,d).toggleClass("hidden",a.currentIndex()<a.navigationLength());c(b.backSelector,d).toggleClass("disabled",0==h.length);c(b.backSelector,d).toggleClass("hidden",a.currentIndex()>=a.navigationLength()&&0<c(b.finishSelector,d).length);a.rebindClick(c(b.nextSelector,d),a.next);a.rebindClick(c(b.previousSelector,
|
||||
d),a.previous);a.rebindClick(c(b.lastSelector,d),a.last);a.rebindClick(c(b.firstSelector,d),a.first);a.rebindClick(c(b.finishSelector,d),a.finish);a.rebindClick(c(b.backSelector,d),a.back);if(b.onTabShow&&"function"===typeof b.onTabShow&&!1===b.onTabShow(f,e,a.currentIndex()))return!1};this.next=function(g){if(d.hasClass("last")||b.onNext&&"function"===typeof b.onNext&&!1===b.onNext(f,e,a.nextIndex()))return!1;g=a.currentIndex();var c=a.nextIndex();c>a.navigationLength()||(h.push(g),e.find('li:has([data-toggle="tab"])'+
|
||||
(b.withVisible?":visible":"")+":eq("+c+") a").tab("show"))};this.previous=function(g){if(d.hasClass("first")||b.onPrevious&&"function"===typeof b.onPrevious&&!1===b.onPrevious(f,e,a.previousIndex()))return!1;g=a.currentIndex();var c=a.previousIndex();0>c||(h.push(g),e.find('li:has([data-toggle="tab"])'+(b.withVisible?":visible":"")+":eq("+c+") a").tab("show"))};this.first=function(g){if(b.onFirst&&"function"===typeof b.onFirst&&!1===b.onFirst(f,e,a.firstIndex())||d.hasClass("disabled"))return!1;h.push(a.currentIndex());
|
||||
e.find('li:has([data-toggle="tab"]):eq(0) a').tab("show")};this.last=function(g){if(b.onLast&&"function"===typeof b.onLast&&!1===b.onLast(f,e,a.lastIndex())||d.hasClass("disabled"))return!1;h.push(a.currentIndex());e.find('li:has([data-toggle="tab"]):eq('+a.navigationLength()+") a").tab("show")};this.finish=function(g){if(b.onFinish&&"function"===typeof b.onFinish)b.onFinish(f,e,a.lastIndex())};this.back=function(){if(0==h.length)return null;var a=h.pop();if(b.onBack&&"function"===typeof b.onBack&&
|
||||
!1===b.onBack(f,e,a))return h.push(a),!1;d.find('li:has([data-toggle="tab"]):eq('+a+") a").tab("show")};this.currentIndex=function(){return e.find('li:has([data-toggle="tab"])'+(b.withVisible?":visible":"")).index(f)};this.firstIndex=function(){return 0};this.lastIndex=function(){return a.navigationLength()};this.getIndex=function(a){return e.find('li:has([data-toggle="tab"])'+(b.withVisible?":visible":"")).index(a)};this.nextIndex=function(){var a=this.currentIndex(),c;do a++,c=e.find('li:has([data-toggle="tab"])'+
|
||||
(b.withVisible?":visible":"")+":eq("+a+")");while(c&&c.hasClass("disabled"));return a};this.previousIndex=function(){var a=this.currentIndex(),c;do a--,c=e.find('li:has([data-toggle="tab"])'+(b.withVisible?":visible":"")+":eq("+a+")");while(c&&c.hasClass("disabled"));return a};this.navigationLength=function(){return e.find('li:has([data-toggle="tab"])'+(b.withVisible?":visible":"")).length-1};this.activeTab=function(){return f};this.nextTab=function(){return e.find('li:has([data-toggle="tab"]):eq('+
|
||||
(a.currentIndex()+1)+")").length?e.find('li:has([data-toggle="tab"]):eq('+(a.currentIndex()+1)+")"):null};this.previousTab=function(){return 0>=a.currentIndex()?null:e.find('li:has([data-toggle="tab"]):eq('+parseInt(a.currentIndex()-1)+")")};this.show=function(b){b=isNaN(b)?d.find('li:has([data-toggle="tab"]) a[href="#'+b+'"]'):d.find('li:has([data-toggle="tab"]):eq('+b+") a");0<b.length&&(h.push(a.currentIndex()),b.tab("show"))};this.disable=function(a){e.find('li:has([data-toggle="tab"]):eq('+a+
|
||||
")").addClass("disabled")};this.enable=function(a){e.find('li:has([data-toggle="tab"]):eq('+a+")").removeClass("disabled")};this.hide=function(a){e.find('li:has([data-toggle="tab"]):eq('+a+")").hide()};this.display=function(a){e.find('li:has([data-toggle="tab"]):eq('+a+")").show()};this.remove=function(a){var b="undefined"!=typeof a[1]?a[1]:!1;a=e.find('li:has([data-toggle="tab"]):eq('+a[0]+")");b&&(b=a.find("a").attr("href"),c(b).remove());a.remove()};var l=function(d){var g=e.find('li:has([data-toggle="tab"])');
|
||||
d=g.index(c(d.currentTarget).parent('li:has([data-toggle="tab"])'));g=c(g[d]);if(b.onTabClick&&"function"===typeof b.onTabClick&&!1===b.onTabClick(f,e,a.currentIndex(),d,g))return!1},m=function(d){d=c(d.target).parent();var g=e.find('li:has([data-toggle="tab"])').index(d);if(d.hasClass("disabled")||b.onTabChange&&"function"===typeof b.onTabChange&&!1===b.onTabChange(f,e,a.currentIndex(),g))return!1;f=d;a.fixNavigationButtons()};this.resetWizard=function(){c('a[data-toggle="tab"]',e).off("click",l);
|
||||
c('a[data-toggle="tab"]',e).off("show show.bs.tab",m);e=d.find("ul:first",d);f=e.find('li:has([data-toggle="tab"]).active',d);c('a[data-toggle="tab"]',e).on("click",l);c('a[data-toggle="tab"]',e).on("show show.bs.tab",m);a.fixNavigationButtons()};e=d.find("ul:first",d);f=e.find('li:has([data-toggle="tab"]).active',d);e.hasClass(b.tabClass)||e.addClass(b.tabClass);if(b.onInit&&"function"===typeof b.onInit)b.onInit(f,e,0);if(b.onShow&&"function"===typeof b.onShow)b.onShow(f,e,a.nextIndex());c('a[data-toggle="tab"]',
|
||||
e).on("click",l);c('a[data-toggle="tab"]',e).on("show show.bs.tab",m)};c.fn.bootstrapWizard=function(d){if("string"==typeof d){var k=Array.prototype.slice.call(arguments,1);1===k.length&&k.toString();return this.data("bootstrapWizard")[d](k)}return this.each(function(a){a=c(this);if(!a.data("bootstrapWizard")){var h=new n(a,d);a.data("bootstrapWizard",h);h.fixNavigationButtons()}})};c.fn.bootstrapWizard.defaults={withVisible:!0,tabClass:"nav nav-pills",nextSelector:".wizard li.next",previousSelector:".wizard li.previous",
|
||||
firstSelector:".wizard li.first",lastSelector:".wizard li.last",finishSelector:".wizard li.finish",backSelector:".wizard li.back",onShow:null,onInit:null,onNext:null,onPrevious:null,onLast:null,onFirst:null,onFinish:null,onBack:null,onTabChange:null,onTabClick:null,onTabShow:null}})(jQuery);
|
||||
8
assets/js/libraries/jquery.inputmask.min.js
vendored
Normal file
6
assets/js/libraries/jquery.repeater.min.js
vendored
Normal file
4
assets/js/libraries/jquery.validate.min.js
vendored
Normal file
276
assets/js/societes-credit-manager.js
Normal file
@ -0,0 +1,276 @@
|
||||
jQuery(document).ready(function($) {
|
||||
'use strict';
|
||||
|
||||
let currentSocieteId = null;
|
||||
let societesTable = null;
|
||||
|
||||
// Initialiser Select2 sur les éléments appropriés
|
||||
function initSelect2() {
|
||||
if (typeof $.fn.select2 === 'function') {
|
||||
// Select2 est disponible mais nous ne l'utilisons pas pour societe-type-credit
|
||||
// Le select reste un select HTML standard
|
||||
} else {
|
||||
// Si Select2 n'est pas encore disponible, réessayer dans 100ms
|
||||
setTimeout(initSelect2, 100);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialiser Select2 au chargement du document
|
||||
$(document).ready(function() {
|
||||
/* initSelect2(); */
|
||||
});
|
||||
|
||||
// Initialiser DataTables
|
||||
if ($('#societes-table').length) {
|
||||
societesTable = $('#societes-table').DataTable({
|
||||
ajax: {
|
||||
url: societesCreditAjax.ajaxurl,
|
||||
type: 'POST',
|
||||
data: function(d) {
|
||||
return {
|
||||
action: 'societes_credit_list',
|
||||
nonce: societesCreditAjax.nonce
|
||||
};
|
||||
},
|
||||
dataSrc: function(json) {
|
||||
if (json.success) {
|
||||
return json.data.societes;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{ data: 'id' },
|
||||
{ data: 'nom' },
|
||||
{
|
||||
data: 'status',
|
||||
render: function(data, type, row) {
|
||||
if (data == 1) {
|
||||
return '<span class="badge-active">Active</span>';
|
||||
} else {
|
||||
return '<span class="badge-inactive">Inactive</span>';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
data: null,
|
||||
orderable: false,
|
||||
render: function(data, type, row) {
|
||||
return `
|
||||
<button class="button button-small" onclick="openSocieteModal(${row.id})" title="Modifier">
|
||||
<span class="dashicons dashicons-edit"></span> Modifier
|
||||
</button>
|
||||
<button class="button button-small button-link-delete" onclick="deleteSociete(${row.id})" title="Supprimer">
|
||||
<span class="dashicons dashicons-trash"></span> Supprimer
|
||||
</button>
|
||||
`;
|
||||
}
|
||||
}
|
||||
],
|
||||
language: {
|
||||
url: '//cdn.datatables.net/plug-ins/1.13.4/i18n/fr-FR.json'
|
||||
},
|
||||
order: [[1, 'asc']],
|
||||
pageLength: 25,
|
||||
responsive: true,
|
||||
dom: '<"top"f>rt<"bottom"lip><"clear">'
|
||||
});
|
||||
}
|
||||
|
||||
// Afficher un message
|
||||
function showMessage(message, type) {
|
||||
// Supprimer les anciens messages
|
||||
$('.societe-message').remove();
|
||||
|
||||
let noticeClass = 'notice-' + type;
|
||||
if (type === 'info') {
|
||||
noticeClass = 'notice-info';
|
||||
}
|
||||
|
||||
const messageDiv = $('<div class="notice ' + noticeClass + ' is-dismissible societe-message"><p>' + message + '</p></div>');
|
||||
$('.wrap h1').after(messageDiv);
|
||||
|
||||
// Auto-suppression après 5 secondes (sauf pour les erreurs)
|
||||
if (type !== 'error') {
|
||||
setTimeout(function() {
|
||||
messageDiv.fadeOut(function() {
|
||||
messageDiv.remove();
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
// Ouvrir le modal
|
||||
window.openSocieteModal = function(societeId = null) {
|
||||
currentSocieteId = societeId;
|
||||
|
||||
if (societeId) {
|
||||
loadSocieteData(societeId);
|
||||
} else {
|
||||
$('#societe-form')[0].reset();
|
||||
$('#societe-status').prop('checked', true);
|
||||
$('.credit-modal-header h2').text('Nouvelle société');
|
||||
// Réinitialiser le select multiple
|
||||
$('#societe-type-credit').val([]);
|
||||
}
|
||||
|
||||
$('.societe-modal').addClass('show').show();
|
||||
// Pas de Select2 à réinitialiser pour ce select
|
||||
// Le select reste un select HTML standard
|
||||
};
|
||||
|
||||
// Fermer le modal
|
||||
window.closeSocieteModal = function() {
|
||||
$('.societe-modal').addClass('closing');
|
||||
|
||||
setTimeout(function() {
|
||||
$('.societe-modal').removeClass('show closing').hide();
|
||||
currentSocieteId = null;
|
||||
}, 300);
|
||||
};
|
||||
|
||||
// Charger les données d'une société
|
||||
function loadSocieteData(societeId) {
|
||||
$.ajax({
|
||||
url: societesCreditAjax.ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'societes_credit_get',
|
||||
nonce: societesCreditAjax.nonce,
|
||||
societe_id: societeId
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
const societe = response.data.societe;
|
||||
$('.credit-modal-header h2').text('Modifier la société');
|
||||
|
||||
// Remplir le formulaire
|
||||
$('#societe-nom').val(societe.nom || '');
|
||||
$('#societe-status').prop('checked', societe.status == 1);
|
||||
|
||||
// Remplir le select multiple des types de crédit
|
||||
if (societe.type_credit) {
|
||||
const typeCreditArray = typeof societe.type_credit === 'string'
|
||||
? societe.type_credit.split(',')
|
||||
: societe.type_credit;
|
||||
$('#societe-type-credit').val(typeCreditArray);
|
||||
} else {
|
||||
$('#societe-type-credit').val([]);
|
||||
}
|
||||
} else {
|
||||
showMessage('Erreur: ' + response.data, 'error');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
showMessage('Erreur de communication avec le serveur', 'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Sauvegarder la société
|
||||
window.saveSociete = function() {
|
||||
const typeCreditVal = $('#societe-type-credit').val() || [];
|
||||
console.log('Type credit values:', typeCreditVal);
|
||||
|
||||
// Créer FormData pour gérer correctement les arrays
|
||||
const formData = new FormData();
|
||||
formData.append('action', currentSocieteId ? 'societes_credit_update' : 'societes_credit_create');
|
||||
formData.append('nonce', societesCreditAjax.nonce);
|
||||
formData.append('nom', $('#societe-nom').val());
|
||||
formData.append('status', $('#societe-status').is(':checked') ? 'true' : 'false');
|
||||
|
||||
// Ajouter chaque valeur de type_credit individuellement
|
||||
if (typeCreditVal && typeCreditVal.length > 0) {
|
||||
typeCreditVal.forEach(function(value) {
|
||||
formData.append('type_credit[]', value);
|
||||
});
|
||||
} else {
|
||||
formData.append('type_credit[]', '');
|
||||
}
|
||||
|
||||
// Validation côté client
|
||||
const nomValue = $('#societe-nom').val();
|
||||
if (!nomValue) {
|
||||
showMessage('Le nom est obligatoire', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Ajouter l'ID si on modifie
|
||||
if (currentSocieteId) {
|
||||
formData.append('societe_id', currentSocieteId);
|
||||
}
|
||||
|
||||
// Envoyer la requête AJAX
|
||||
$.ajax({
|
||||
url: societesCreditAjax.ajaxurl,
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showMessage(response.data.message, 'success');
|
||||
closeSocieteModal();
|
||||
|
||||
// Recharger la table
|
||||
if (societesTable) {
|
||||
societesTable.ajax.reload(null, false);
|
||||
}
|
||||
} else {
|
||||
showMessage('Erreur: ' + response.data, 'error');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
showMessage('Erreur de communication avec le serveur', 'error');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Supprimer une société
|
||||
window.deleteSociete = function(societeId) {
|
||||
if (!confirm('Êtes-vous sûr de vouloir supprimer cette société de crédit ?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: societesCreditAjax.ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'societes_credit_delete',
|
||||
nonce: societesCreditAjax.nonce,
|
||||
societe_id: societeId
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showMessage(response.data.message, 'success');
|
||||
|
||||
// Recharger la table
|
||||
if (societesTable) {
|
||||
societesTable.ajax.reload(null, false);
|
||||
}
|
||||
} else {
|
||||
showMessage('Erreur: ' + response.data, 'error');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
showMessage('Erreur de communication avec le serveur', 'error');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Fermer le modal avec Escape
|
||||
$(document).on('keydown', function(e) {
|
||||
if (e.key === 'Escape' && $('.societe-modal').hasClass('show')) {
|
||||
closeSocieteModal();
|
||||
}
|
||||
});
|
||||
|
||||
// Soumettre le formulaire avec Enter
|
||||
$('#societe-form').on('keypress', function(e) {
|
||||
if (e.key === 'Enter' && e.target.tagName !== 'TEXTAREA') {
|
||||
e.preventDefault();
|
||||
saveSociete();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
17
composer.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "esi/credit-direct",
|
||||
"description": "Plugin WordPress pour la gestion des crédits",
|
||||
"type": "wordpress-plugin",
|
||||
"require": {
|
||||
"php": ">=7.4",
|
||||
"nesbot/carbon": "^2.0",
|
||||
"symfony/translation": "^5.0|^6.0",
|
||||
"mailchimp/marketing": "^3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"ESI\\CreditDirect\\": "app/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1242
composer.lock
generated
Normal file
122
cred_init.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
defined('_CREDEXEC_') or die();
|
||||
|
||||
// Inclure l'autoloader de Composer
|
||||
require_once _CRED_ABSPATH_ . 'vendor/autoload.php';
|
||||
|
||||
// Inclure le fichier de configuration
|
||||
require_once _CRED_ABSPATH_ . 'app/config.php';
|
||||
|
||||
class CRED {
|
||||
|
||||
private static $instance = NULL;
|
||||
|
||||
protected function __construct() {
|
||||
self::import('app.libraries.base');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Getting instance. This Class is a singleton class
|
||||
* @return \static
|
||||
*/
|
||||
public static function instance() {
|
||||
// Get an instance of Class
|
||||
if(!self::$instance) self::$instance = new self();
|
||||
|
||||
// Return the instance
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si le mode debug est activé
|
||||
* @return bool
|
||||
*/
|
||||
public static function isDebugMode() {
|
||||
return defined('_CRED_DEBUG_MODE_') && _CRED_DEBUG_MODE_ === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Détermine le chemin du template à utiliser en fonction du mode debug
|
||||
* @param string $template_path Chemin du template standard
|
||||
* @return string Chemin du template à utiliser
|
||||
*/
|
||||
public static function getTemplatePath($template_path) {
|
||||
if (self::isDebugMode()) {
|
||||
// Remplacer le chemin standard par le chemin newSteps
|
||||
$new_path = str_replace(_CRED_TEMPLATES_PATH_, _CRED_NEW_TEMPLATES_PATH_, $template_path);
|
||||
|
||||
// Vérifier si le fichier existe dans newSteps
|
||||
if (file_exists(_CRED_ABSPATH_ . $new_path)) {
|
||||
return $new_path;
|
||||
}
|
||||
}
|
||||
|
||||
return $template_path;
|
||||
}
|
||||
|
||||
public static function getInstance($file, $namespace="", $class_name = NULL) {
|
||||
/** Import the file using import method **/
|
||||
$override = self::import($file);
|
||||
|
||||
/** Generate class name if not provided **/
|
||||
if($class_name === null || !trim($class_name))
|
||||
{
|
||||
$ex = explode('.', $file);
|
||||
$file_name = end($ex);
|
||||
if(!empty($namespace))
|
||||
$class_name = '\\'.$namespace.'\CRED_'.$file_name;
|
||||
else
|
||||
$class_name = 'CRED_'.$file_name;
|
||||
}
|
||||
|
||||
// If overrode class exists then return the it instead of original class
|
||||
if($override) $class_name .= '_override';
|
||||
|
||||
/** Generate the object **/
|
||||
if(class_exists($class_name)) {
|
||||
|
||||
return new $class_name();
|
||||
|
||||
/* if($class_name::$instance === null) {
|
||||
echo $class_name;
|
||||
return new $class_name();
|
||||
} else {
|
||||
return self::$instance;
|
||||
} */
|
||||
} else {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function import($file, $return_path = false) {
|
||||
|
||||
$original_exploded = explode('.', $file);
|
||||
$file = implode(DS, $original_exploded) . '.php';
|
||||
|
||||
$path = _CRED_ABSPATH_ . $file;
|
||||
|
||||
// Return the file path without importing it
|
||||
if($return_path) return $path;
|
||||
|
||||
if(file_exists($path)) require_once $path;
|
||||
}
|
||||
|
||||
public function init() {
|
||||
$factory = self::getInstance('app.libraries.factory');
|
||||
$factory->load_actions();
|
||||
$factory->load_filters();
|
||||
|
||||
// Charger le système de rappel de crédit
|
||||
self::import('app.models.credit');
|
||||
/* self::import('app.libraries.credit-reminder'); */
|
||||
|
||||
// Charger les shortcodes
|
||||
self::import('app.controllers.shortcodes');
|
||||
|
||||
// Charger le gestionnaire de crédits
|
||||
self::import('app.controllers.credit_manager');
|
||||
}
|
||||
}
|
||||
12
crons/crons_autoloader.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
define('WP_USE_THEMES', false);
|
||||
require_once('../../../../wp-load.php');
|
||||
|
||||
if(!class_exists('CRED')) require_once(_CRED_ABSPATH_ . 'cred_init.php');
|
||||
|
||||
$cred = CRED::instance();
|
||||
|
||||
$cred->init();
|
||||
|
||||
|
||||
11
crons/crons_reminder.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
if(isset($_GET['sess']) && $_GET['sess'] == 'Pm43A43kUN5GOv'){
|
||||
|
||||
require 'crons_autoloader.php';
|
||||
|
||||
$reminder = new CRED_Credit_Reminder();
|
||||
|
||||
$reminder->send_reminder_email();
|
||||
|
||||
}
|
||||
37
package-lock.json
generated
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "ESI_creditDirect",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"datatables.net-dt": "^2.3.4"
|
||||
}
|
||||
},
|
||||
"node_modules/datatables.net": {
|
||||
"version": "2.3.4",
|
||||
"resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-2.3.4.tgz",
|
||||
"integrity": "sha512-fKuRlrBIdpAl2uIFgl9enKecHB41QmFd/2nN9LBbOvItV/JalAxLcyqdZXex7wX4ZXjnJQEnv6xeS9veOpKzSw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jquery": ">=1.7"
|
||||
}
|
||||
},
|
||||
"node_modules/datatables.net-dt": {
|
||||
"version": "2.3.4",
|
||||
"resolved": "https://registry.npmjs.org/datatables.net-dt/-/datatables.net-dt-2.3.4.tgz",
|
||||
"integrity": "sha512-qOCnnUuFTiju4AOMM4xy4Lx87UfyHdIHIMYdbBXD4pAtvoWTH9wMzVTN/2gFNT4GlbrLkmGf5ZkU6uLRTTymMA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"datatables.net": "2.3.4",
|
||||
"jquery": ">=1.7"
|
||||
}
|
||||
},
|
||||
"node_modules/jquery": {
|
||||
"version": "3.7.1",
|
||||
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz",
|
||||
"integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
}
|
||||
5
package.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"datatables.net-dt": "^2.3.4"
|
||||
}
|
||||
}
|
||||
70
templates/admin/credit_import.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1>Import de crédits</h1>
|
||||
|
||||
<p>Importez un fichier CSV conforme au modèle <code>modèle mailing.csv</code>. Séparateur attendu: point-virgule (;).</p>
|
||||
|
||||
<?php if (!empty($import_errors)): ?>
|
||||
<div class="notice notice-error">
|
||||
<p><strong>Erreurs d'import:</strong></p>
|
||||
<ul>
|
||||
<?php foreach ($import_errors as $err): ?>
|
||||
<li><?php echo esc_html($err); ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($import_summary)): ?>
|
||||
<div class="notice notice-success">
|
||||
<p><strong>Import terminé.</strong></p>
|
||||
<p>Enregistrements insérés: <strong><?php echo intval($import_summary['inserted']); ?></strong> | Ignorés/Erreurs: <strong><?php echo intval($import_summary['skipped']); ?></strong></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<?php wp_nonce_field('credit_import_action', 'credit_import_nonce'); ?>
|
||||
|
||||
<table class="form-table" role="presentation">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="csv_file">Fichier CSV</label></th>
|
||||
<td>
|
||||
<input type="file" id="csv_file" name="csv_file" accept=".csv" required>
|
||||
<p class="description">Utilisez le fichier modèle pour l'ordre des colonnes: TITRE;NOM - Prénom;ADRESSE;LOCALITE;Adresse E-Mail;Tel. Client;GSM Client;Sté de Crédit;Montant €;Date signature;N° de dossier / compte remb.;Code;Remarques</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Statut à appliquer</th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<label><input type="radio" name="status" value="1" checked> Validé non signé</label><br>
|
||||
<label><input type="radio" name="status" value="2"> Validé signé</label><br>
|
||||
<label><input type="radio" name="status" value="-1"> Refusé</label>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Statut du client</th>
|
||||
<th>
|
||||
<fieldset>
|
||||
<label><input type="radio" name="client_status" value="habitation_locataire"> Locataire</label><br>
|
||||
<label><input type="radio" name="client_status" value="habitation_proprietaire"> Propriétaire</label>
|
||||
</fieldset>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p class="submit">
|
||||
<button type="submit" name="credit_import_submit" class="button button-primary">Importer</button>
|
||||
<a href="<?php echo esc_url(admin_url('admin.php?page=credit-manager')); ?>" class="button">Retour à la liste</a>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
?>
|
||||
|
||||
355
templates/admin/credit_manager_table.php
Normal file
@ -0,0 +1,355 @@
|
||||
<?php
|
||||
|
||||
print_r($status_counts);
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1>Gestion des crédits</h1>
|
||||
|
||||
<!-- Bouton pour créer un nouveau crédit -->
|
||||
<div class="credit-actions-header">
|
||||
<button type="button" class="button button-primary" onclick="openCreditModal()">
|
||||
<span class="dashicons dashicons-plus-alt"></span> Nouveau crédit
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Formulaire de filtres -->
|
||||
<div class="credit-filters-panel">
|
||||
<h3>
|
||||
<span class="dashicons dashicons-filter"></span> Filtres
|
||||
<button type="button" class="button button-small" id="toggle-filters" style="float: right;">
|
||||
<span class="dashicons dashicons-arrow-down-alt2"></span> Afficher/Masquer
|
||||
</button>
|
||||
</h3>
|
||||
<form id="credit-filters-form" style="display: none;">
|
||||
<div class="filters-grid">
|
||||
<div class="filter-group">
|
||||
<label for="filter-societe">Société de crédit</label>
|
||||
<select id="filter-societe" name="societe_credit">
|
||||
<option value="">-- Toutes --</option>
|
||||
<?php if (!empty($societes_credit)): ?>
|
||||
<?php foreach ($societes_credit as $societe): ?>
|
||||
<option value="<?php echo esc_attr($societe->nom); ?>">
|
||||
<?php echo esc_html($societe->nom); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="filter-group">
|
||||
<label for="filter-code-postal">Code postal</label>
|
||||
<input type="text" id="filter-code-postal" name="code_postal" placeholder="Ex: 1000">
|
||||
</div>
|
||||
|
||||
<div class="filter-group">
|
||||
<label for="filter-status">Status</label>
|
||||
<select id="filter-status" name="status">
|
||||
<option value="">-- Tous --</option>
|
||||
<option value="0">En attente</option>
|
||||
<option value="1">Accepté non signé</option>
|
||||
<option value="2">Accepté signé</option>
|
||||
<option value="-1">Refusé</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="filter-group">
|
||||
<label for="filter-type">Groupe de crédit</label>
|
||||
<select id="filter-type" name="type_credit">
|
||||
<option value="">-- Tous --</option>
|
||||
<option value="PAT">PAT - Prêt à tempérament</option>
|
||||
<option value="CH">PH - Crédit hypothécaire</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="filter-group">
|
||||
<label for="filter-credit-code">Type de crédit</label>
|
||||
<select id="filter-credit-code" name="credit_code_select">
|
||||
<option value="">-- Tous --</option>
|
||||
|
||||
<optgroup label="Prêt à tempérament (PAT)">
|
||||
<?php foreach ($creditTypes as $code => $label): ?>
|
||||
<option value="<?php echo esc_attr($code); ?>">
|
||||
<?php echo esc_html($label); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="Crédit hypothécaire (PH)">
|
||||
<?php foreach ($houseCreditTypes as $code => $label): ?>
|
||||
<option value="<?php echo esc_attr($code); ?>">
|
||||
<?php echo esc_html($label); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="filter-group filter-range">
|
||||
<label>Montant (€)</label>
|
||||
<div class="range-inputs">
|
||||
<input type="number" id="filter-montant-min" name="montant_min" placeholder="Min" step="100">
|
||||
<span>-</span>
|
||||
<input type="number" id="filter-montant-max" name="montant_max" placeholder="Max" step="100">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="filter-group filter-range">
|
||||
<label>Date de signature</label>
|
||||
<div class="range-inputs">
|
||||
<input type="date" id="filter-date-debut" name="date_signature_debut" placeholder="Début">
|
||||
<span>-</span>
|
||||
<input type="date" id="filter-date-fin" name="date_signature_fin" placeholder="Fin">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="filter-group">
|
||||
<label>Situation habitation</label>
|
||||
<div class="habitation-filter">
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" id="filter-locataire" name="habitation_locataire" value="1">
|
||||
Locataire
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" id="filter-proprietaire" name="habitation_proprietaire" value="1">
|
||||
Propriétaire
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="filter-actions">
|
||||
<button type="submit" class="button button-primary">
|
||||
<span class="dashicons dashicons-search"></span> Filtrer
|
||||
</button>
|
||||
<button type="button" class="button" id="reset-filters">
|
||||
<span class="dashicons dashicons-image-rotate"></span> Réinitialiser
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Filtres rapides par statut -->
|
||||
<div class="status-quick-filters">
|
||||
<h3>Filtres rapides par statut</h3>
|
||||
<div class="status-filters-buttons">
|
||||
<button type="button" class="status-filter-btn status-pending" data-status="0" title="Filtrer les crédits à valider">
|
||||
<span class="status-icon"><i class="fa-solid fa-clock"></i></span>
|
||||
<span class="status-label">À valider</span>
|
||||
<span class="status-count" data-count-status="0">(<?php echo isset($status_counts['0']) ? $status_counts['0'] : 0; ?>)</span>
|
||||
</button>
|
||||
|
||||
<button type="button" class="status-filter-btn status-accepted-unsigned" data-status="1" title="Filtrer les crédits validés non signés">
|
||||
<span class="status-icon"><i class="fa-solid fa-check"></i></span>
|
||||
<span class="status-label">Validé non signé</span>
|
||||
<span class="status-count" data-count-status="1">(<?php echo isset($status_counts['1']) ? $status_counts['1'] : 0; ?>)</span>
|
||||
</button>
|
||||
|
||||
<button type="button" class="status-filter-btn status-accepted-filed" data-status="2" title="Filtrer les crédits validés classés">
|
||||
<span class="status-icon"><i class="fa-solid fa-box-archive"></i></span>
|
||||
<span class="status-label">Validé classé</span>
|
||||
<span class="status-count" data-count-status="2">(<?php echo isset($status_counts['2']) ? $status_counts['2'] : 0; ?>)</span>
|
||||
</button>
|
||||
|
||||
<button type="button" class="status-filter-btn status-refused" data-status="-1" title="Filtrer les crédits refusés">
|
||||
<span class="status-icon"><i class="fa-solid fa-xmark"></i></span>
|
||||
<span class="status-label">Refusé</span>
|
||||
<span class="status-count" data-count-status="-1">(<?php echo isset($status_counts['-1']) ? $status_counts['-1'] : 0; ?>)</span>
|
||||
</button>
|
||||
|
||||
<button type="button" class="status-filter-btn status-filter-all active" data-status="" title="Afficher tous les crédits">
|
||||
<span class="status-icon"><i class="fa-solid fa-list"></i></span>
|
||||
<span class="status-label">Tous</span>
|
||||
<span class="status-count" id="total-count">(<?php echo isset($total_credits) ? $total_credits : 0; ?>)</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table simple -->
|
||||
<table id="credits-table" class="wp-list-table widefat striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Type</th>
|
||||
<th>Nom</th>
|
||||
<th>Prénom</th>
|
||||
<th>Adresse</th>
|
||||
<th>Localité</th>
|
||||
<th>Email</th>
|
||||
<th>Téléphone/GSM</th>
|
||||
<th>Société de crédit</th>
|
||||
<th>Montant</th>
|
||||
<th>Date</th>
|
||||
<th>Signature</th>
|
||||
<th>N° de dossier</th>
|
||||
<th>Code</th>
|
||||
<th>Statut</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Les données seront chargées via AJAX par DataTables -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- Modal pour créer/modifier un crédit -->
|
||||
<div class="credit-modal" style="display: none;">
|
||||
<div class="credit-modal-content">
|
||||
<div class="credit-modal-header">
|
||||
<h2>Nouveau crédit</h2>
|
||||
<span class="credit-modal-close" onclick="closeCreditModal()">×</span>
|
||||
</div>
|
||||
|
||||
<form id="credit-form" class="credit-form">
|
||||
<div class="form-columns">
|
||||
<!-- Colonne gauche -->
|
||||
<div class="form-column">
|
||||
<div class="form-group">
|
||||
<label for="credit-type">Type de crédit <span class="required">*</span></label>
|
||||
<select id="credit-type" name="type_credit" required>
|
||||
<option value="">-- Sélectionner --</option>
|
||||
<option value="PAT">PAT - Prêt à tempérament</option>
|
||||
<option value="CH">CH - Crédit hypothécaire</option>
|
||||
<option value="CA">CA - Crédit auto</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-nom">Nom <span class="required">*</span></label>
|
||||
<input type="text" id="credit-nom" name="nom" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-prenom">Prénom <span class="required">*</span></label>
|
||||
<input type="text" id="credit-prenom" name="prenom" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-email">Email <span class="required">*</span></label>
|
||||
<input type="email" id="credit-email" name="email" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-telephone">Téléphone</label>
|
||||
<input type="tel" id="credit-telephone" name="telephone">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-gsm">GSM</label>
|
||||
<input type="tel" id="credit-gsm" name="gsm">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-type-habitation">Type d'habitation</label>
|
||||
<select id="credit-type-habitation" name="type_habitation">
|
||||
<option value="">-- Sélectionner --</option>
|
||||
<option value="locataire">Locataire</option>
|
||||
<option value="proprietaire">Propriétaire</option>
|
||||
<option value="proprietaire_sans_pret">Propriétaire sans prêt</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-societe">Société de crédit</label>
|
||||
<select id="credit-societe" name="societe_credit">
|
||||
<option value="">-- Sélectionner une société --</option>
|
||||
<?php if (!empty($societes_credit)): ?>
|
||||
<?php foreach ($societes_credit as $societe): ?>
|
||||
<option value="<?php echo esc_attr($societe->nom); ?>">
|
||||
<?php echo esc_html($societe->nom); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-montant">Montant (€)</label>
|
||||
<input type="number" id="credit-montant" name="montant" step="0.01" min="0">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Colonne droite -->
|
||||
<div class="form-column">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-code">But du crédit <span class="required">*</span></label>
|
||||
<select id="credit-code" name="code" required>
|
||||
<option value="">-- Sélectionner --</option>
|
||||
|
||||
<optgroup label="Prêt à tempérament (PAT)">
|
||||
<?php foreach ($creditTypes as $code => $label): ?>
|
||||
<option value="<?php echo esc_attr($code); ?>">
|
||||
<?php echo esc_html($label); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="Crédit hypothécaire (PH)">
|
||||
<?php foreach ($houseCreditTypes as $code => $label): ?>
|
||||
<option value="<?php echo esc_attr($code); ?>">
|
||||
<?php echo esc_html($label); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-localite">Localité</label>
|
||||
<input type="text" id="credit-localite" name="localite">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-date">Date</label>
|
||||
<input type="date" id="credit-date" name="date">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-signature">Signature</label>
|
||||
<input type="text" id="credit-signature" name="signature">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-numero-dossier">N° de dossier</label>
|
||||
<input type="text" id="credit-numero-dossier" name="numero_dossier">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-code">Code</label>
|
||||
<input type="text" id="credit-code" name="code">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="credit-adresse">Adresse</label>
|
||||
<input type="text" id="credit-adresse" name="adresse">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Remarques en une seule colonne -->
|
||||
<div class="form-group-full">
|
||||
<label for="credit-remarques">Remarques</label>
|
||||
<textarea id="credit-remarques" name="remarques" rows="4"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="button" class="button button-primary" onclick="saveCredit()">
|
||||
<span class="dashicons dashicons-yes"></span> Sauvegarder
|
||||
</button>
|
||||
<button type="button" class="button" onclick="closeCreditModal()">
|
||||
<span class="dashicons dashicons-no"></span> Annuler
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Les assets sont gérés par le factory dans enqueue_credit_manager_assets()
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
?>
|
||||
46
templates/admin/mailchimp_settings.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
// Sécurité
|
||||
if (!current_user_can('manage_options')) {
|
||||
wp_die(__('Vous n\'avez pas les permissions suffisantes pour accéder à cette page.', 'esi-creditdirect'));
|
||||
}
|
||||
|
||||
// Les options sont injectées par le contrôleur via $options
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1><?php echo esc_html__('Réglages Mailchimp', 'esi-creditdirect'); ?></h1>
|
||||
|
||||
<form method="post" action="options.php">
|
||||
<?php
|
||||
settings_fields('cred_mailchimp_options_group');
|
||||
do_settings_sections('credit-mailchimp');
|
||||
wp_nonce_field('cred_mailchimp_save', 'cred_mailchimp_nonce');
|
||||
submit_button(__('Enregistrer les modifications', 'esi-creditdirect'));
|
||||
?>
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
|
||||
<h2><?php echo esc_html__('Aide', 'esi-creditdirect'); ?></h2>
|
||||
<p>
|
||||
<?php echo esc_html__('Installez la librairie officielle Mailchimp Marketing pour PHP via Composer :', 'esi-creditdirect'); ?>
|
||||
</p>
|
||||
<pre><code>composer require mailchimp/marketing</code></pre>
|
||||
<p>
|
||||
<?php echo wp_kses_post(sprintf(
|
||||
/* translators: %s: URL */
|
||||
__('Voir la documentation: <a href="%s" target="_blank" rel="noopener noreferrer">mailchimp/mailchimp-marketing-php</a>', 'esi-creditdirect'),
|
||||
esc_url('https://github.com/mailchimp/mailchimp-marketing-php')
|
||||
)); ?>
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<h2><?php echo esc_html__('Test de connexion', 'esi-creditdirect'); ?></h2>
|
||||
<p><?php echo esc_html__('Cliquez pour vérifier la validité de vos identifiants.', 'esi-creditdirect'); ?></p>
|
||||
<button id="cred-mailchimp-test" class="button button-secondary"><?php echo esc_html__('Tester la connexion', 'esi-creditdirect'); ?></button>
|
||||
<span id="cred-mailchimp-test-result" style="margin-left:8px;"></span>
|
||||
</div>
|
||||
|
||||
<?php // JS déporté dans assets/js/credit-manager.js (réutilisé en admin) ?>
|
||||
|
||||
|
||||
48
templates/admin/sendy_settings.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
// Sécurité
|
||||
if (!current_user_can('manage_options')) {
|
||||
wp_die(__('Vous n\'avez pas les permissions suffisantes pour accéder à cette page.', 'esi-creditdirect'));
|
||||
}
|
||||
|
||||
// Les options sont injectées par le contrôleur via $options
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1><?php echo esc_html__('Réglages Sendy', 'esi-creditdirect'); ?></h1>
|
||||
|
||||
<form method="post" action="options.php">
|
||||
<?php
|
||||
settings_fields('cred_sendy_options_group');
|
||||
do_settings_sections('credit-sendy');
|
||||
wp_nonce_field('cred_sendy_save', 'cred_sendy_nonce');
|
||||
submit_button(__('Enregistrer les modifications', 'esi-creditdirect'));
|
||||
?>
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
|
||||
<h2><?php echo esc_html__('Aide', 'esi-creditdirect'); ?></h2>
|
||||
<p>
|
||||
<?php echo esc_html__('Sendy est une application d\'envoi d\'emails auto-hébergée. Pour utiliser cette intégration :', 'esi-creditdirect'); ?>
|
||||
</p>
|
||||
<ul>
|
||||
<li><?php echo esc_html__('Assurez-vous que votre installation Sendy est accessible et fonctionnelle', 'esi-creditdirect'); ?></li>
|
||||
<li><?php echo esc_html__('Récupérez votre clé API dans Sendy : Settings > API', 'esi-creditdirect'); ?></li>
|
||||
<li><?php echo esc_html__('L\'URL doit être l\'URL complète de votre installation Sendy (ex: https://sendy.example.com)', 'esi-creditdirect'); ?></li>
|
||||
</ul>
|
||||
<p>
|
||||
<?php echo wp_kses_post(sprintf(
|
||||
/* translators: %s: URL */
|
||||
__('Voir la documentation Sendy: <a href="%s" target="_blank" rel="noopener noreferrer">sendy.co</a>', 'esi-creditdirect'),
|
||||
esc_url('https://sendy.co')
|
||||
)); ?>
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<h2><?php echo esc_html__('Test de connexion', 'esi-creditdirect'); ?></h2>
|
||||
<p><?php echo esc_html__('Cliquez pour vérifier la validité de vos identifiants.', 'esi-creditdirect'); ?></p>
|
||||
<button id="cred-sendy-test" class="button button-secondary"><?php echo esc_html__('Tester la connexion', 'esi-creditdirect'); ?></button>
|
||||
<span id="cred-sendy-test-result" style="margin-left:8px;"></span>
|
||||
</div>
|
||||
|
||||
<?php // JS déporté dans assets/js/credit-manager.js (réutilisé en admin) ?>
|
||||
161
templates/admin/societes_credit_table.php
Normal file
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1>Gestion des Sociétés de Crédit</h1>
|
||||
|
||||
<!-- Bouton pour créer une nouvelle société -->
|
||||
<div class="credit-actions-header">
|
||||
<button type="button" class="button button-primary" onclick="openSocieteModal()">
|
||||
<span class="dashicons dashicons-plus-alt"></span> Nouvelle société
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Table simple -->
|
||||
<table id="societes-table" class="wp-list-table widefat striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 80px;">ID</th>
|
||||
<th>Nom de la société</th>
|
||||
<th style="width: 120px;">Status</th>
|
||||
<th style="width: 200px;">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Les données seront chargées via AJAX par DataTables -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- Modal pour créer/modifier une société -->
|
||||
<div class="societe-modal" style="display: none;">
|
||||
<div class="credit-modal-overlay" onclick="closeSocieteModal()"></div>
|
||||
<div class="credit-modal-content">
|
||||
<div class="credit-modal-header">
|
||||
<h2>Nouvelle société</h2>
|
||||
<span class="credit-modal-close" onclick="closeSocieteModal()">×</span>
|
||||
</div>
|
||||
|
||||
<form id="societe-form" class="credit-form">
|
||||
<div class="form-group-full">
|
||||
<label for="societe-nom">Nom de la société <span class="required">*</span></label>
|
||||
<input type="text" id="societe-nom" name="nom" required placeholder="Ex: Banque Exemple">
|
||||
</div>
|
||||
|
||||
<div class="form-group-full">
|
||||
<label for="societe-status">
|
||||
<input type="checkbox" id="societe-status" name="status" value="1" checked>
|
||||
Société active
|
||||
</label>
|
||||
<p class="description">Cochez cette case pour que la société apparaisse dans les formulaires de crédit.</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group-full">
|
||||
<label for="societe-type-credit">Type de crédit</label>
|
||||
<select id="societe-type-credit" name="type_credit[]" multiple style="min-height: 100px; width: 100%;">
|
||||
<option value="PAT">PAT - Prêt à tempérament</option>
|
||||
<option value="PH">PH - Crédit hypothécaire</option>
|
||||
</select>
|
||||
<p class="description">Sélectionnez les types de crédit que cette société propose. Maintenez Ctrl (ou Cmd sur Mac) pour sélectionner plusieurs types.</p>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="button" class="button button-primary" onclick="saveSociete()">
|
||||
<span class="dashicons dashicons-yes"></span> Sauvegarder
|
||||
</button>
|
||||
<button type="button" class="button" onclick="closeSocieteModal()">
|
||||
<span class="dashicons dashicons-no"></span> Annuler
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* Styles spécifiques pour la modal des sociétés */
|
||||
.societe-modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 999999;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Correction du z-index pour Select2 dans la modal */
|
||||
.societe-modal .select2-container--open .select2-dropdown {
|
||||
z-index: 1000000;
|
||||
}
|
||||
|
||||
.societe-modal .select2-container {
|
||||
z-index: 999999;
|
||||
}
|
||||
|
||||
.societe-modal.show {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
animation: fadeIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
.form-group-full label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
color: #23282d;
|
||||
}
|
||||
|
||||
.form-group-full input[type="text"] {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.form-group-full input[type="checkbox"] {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.description {
|
||||
margin-top: 5px;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.badge-active {
|
||||
display: inline-block;
|
||||
padding: 4px 10px;
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
background-color: #46b450;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.badge-inactive {
|
||||
display: inline-block;
|
||||
padding: 4px 10px;
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
background-color: #dc3232;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
// Les assets sont gérés par le factory
|
||||
?>
|
||||
|
||||