Compare commits
8 Commits
9bd6cbdfa6
...
8eb61a4b61
| Author | SHA1 | Date | |
|---|---|---|---|
| 8eb61a4b61 | |||
| e7629a41d4 | |||
| 86066613cb | |||
| 9863cb65d5 | |||
| 6d360a66f3 | |||
| e7544a9908 | |||
| 67c16a6f24 | |||
| 2f6d823564 |
|
|
@ -192,8 +192,10 @@ function render_custom_chantier_box_content($post)
|
||||||
echo '<ul>';
|
echo '<ul>';
|
||||||
while ($chantiers->have_posts()) {
|
while ($chantiers->have_posts()) {
|
||||||
$chantiers->the_post();
|
$chantiers->the_post();
|
||||||
|
$date = get_field('date');
|
||||||
|
$city = get_field('city')['city'] ?? null;
|
||||||
$chantier_name = get_field('chantier_name');
|
$chantier_name = get_field('chantier_name');
|
||||||
echo '<li><a href="' . get_edit_post_link() . '"> <img src=' . get_stylesheet_directory_uri() . '/resources/img/icons/document-inspect.svg' . ' /> ' . $chantier_name . '</a></li>';
|
echo '<li><a href="' . get_edit_post_link() . '"> <img src=' . get_stylesheet_directory_uri() . '/resources/img/icons/document-inspect.svg' . ' /> ' . $chantier_name . ' | ' . $city . ' | ' . $date . '</a></li>';
|
||||||
}
|
}
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
echo '<a href="' . admin_url('post-new.php?post_type=chantiers&return_to=' . urlencode($return_to)) . '" class="new-chantier">Ajouter un chantier</a>';
|
echo '<a href="' . admin_url('post-new.php?post_type=chantiers&return_to=' . urlencode($return_to)) . '" class="new-chantier">Ajouter un chantier</a>';
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ function generate_artisans_datas_to_csv()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ajouter les en-têtes du CSV
|
// Ajouter les en-têtes du CSV
|
||||||
fputcsv($file, ['Artisan', 'N° Téléphone', 'Mail', 'Adresse', 'Site web', 'TVA', 'Conseiller', 'Action requise', 'Précision pour contact', 'ID de l\'artisan', 'Date de création',]);
|
fputcsv($file, ['Artisan', 'N° Téléphone', 'Mail', 'Adresse', 'Site web', 'TVA', 'Statut de travail', 'Conseiller', 'Dernière Action', 'Commentaire', 'ID de l\'artisan', 'Date de création',]);
|
||||||
|
|
||||||
// Boucler sur chaque post et écrire les données dans le CSV
|
// Boucler sur chaque post et écrire les données dans le CSV
|
||||||
foreach ($artisans->posts as $artisan) {
|
foreach ($artisans->posts as $artisan) {
|
||||||
|
|
@ -112,8 +112,17 @@ function generate_artisans_datas_to_csv()
|
||||||
|
|
||||||
$conseiller = getArtisanConseillerName($postID) ?? '';
|
$conseiller = getArtisanConseillerName($postID) ?? '';
|
||||||
$requiredAction = get_field('required_action', $postID);
|
$requiredAction = get_field('required_action', $postID);
|
||||||
$requiredAction = $requiredAction ? 'Oui' : '';
|
$lastAction = get_field('last_action', $postID);
|
||||||
$contactComments = get_field('contact_comments', $postID);
|
$lastActionComment = $lastAction['comments'] ?? '';
|
||||||
|
$lastActionDate = $lastAction['last_contact_date'] ?? '';
|
||||||
|
$mdp_status = get_field('mdp_status', $postID)['label'] ?? '';
|
||||||
|
// Formater la date pour la rendre plus lisible
|
||||||
|
if (!empty($lastActionDate)) {
|
||||||
|
$lastActionDate = date('d/m/Y', strtotime($lastActionDate));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
write_log($mdp_status);
|
||||||
|
|
||||||
fputcsv($file, [
|
fputcsv($file, [
|
||||||
$artisan->post_title,
|
$artisan->post_title,
|
||||||
|
|
@ -122,9 +131,10 @@ function generate_artisans_datas_to_csv()
|
||||||
$adresse,
|
$adresse,
|
||||||
$website,
|
$website,
|
||||||
$tva,
|
$tva,
|
||||||
|
$mdp_status,
|
||||||
$conseiller,
|
$conseiller,
|
||||||
$requiredAction,
|
$lastActionDate,
|
||||||
$contactComments,
|
$lastActionComment,
|
||||||
$artisan->ID,
|
$artisan->ID,
|
||||||
$artisan->post_date,
|
$artisan->post_date,
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,16 @@ function metiers_patrimoine_enqueue_back_scripts()
|
||||||
wp_enqueue_style('metiers-theme-main-css', get_stylesheet_directory_uri() . '/css/app.css', array('homegrade-main-css'), $theme->get('Version'));
|
wp_enqueue_style('metiers-theme-main-css', get_stylesheet_directory_uri() . '/css/app.css', array('homegrade-main-css'), $theme->get('Version'));
|
||||||
wp_enqueue_script('metiers-theme-main-js', get_stylesheet_directory_uri() . '/js/app.js', array(), $theme->get('Version'));
|
wp_enqueue_script('metiers-theme-main-js', get_stylesheet_directory_uri() . '/js/app.js', array(), $theme->get('Version'));
|
||||||
wp_enqueue_script('metiers-theme-editor-js', get_stylesheet_directory_uri() . '/js/editor.js', array(), $theme->get('Version'));
|
wp_enqueue_script('metiers-theme-editor-js', get_stylesheet_directory_uri() . '/js/editor.js', array(), $theme->get('Version'));
|
||||||
|
wp_enqueue_script('metiers-theme-artisans-js', get_stylesheet_directory_uri() . '/js/artisans.js', array(), $theme->get('Version'));
|
||||||
}
|
}
|
||||||
add_action('wp_enqueue_scripts', 'metiers_patrimoine_enqueue_scripts');
|
add_action('admin_enqueue_scripts', 'metiers_patrimoine_enqueue_back_scripts');
|
||||||
|
|
||||||
add_action('enqueue_block_editor_assets', 'metiers_patrimoine_enqueue_back_scripts');
|
add_action('enqueue_block_editor_assets', 'metiers_patrimoine_enqueue_back_scripts');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function wpacg_mtier_patrimoine_admin_color_scheme()
|
function wpacg_mtier_patrimoine_admin_color_scheme()
|
||||||
{
|
{
|
||||||
//Get the theme directory
|
//Get the theme directory
|
||||||
|
|
|
||||||
|
|
@ -17,20 +17,23 @@
|
||||||
"production:css-admin": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/admin-style.css -o ./css/admin-style.css --postcss --minify",
|
"production:css-admin": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/admin-style.css -o ./css/admin-style.css --postcss --minify",
|
||||||
"production:css-login": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/login-style.css -o ./css/login-style.css --postcss --minify",
|
"production:css-login": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/login-style.css -o ./css/login-style.css --postcss --minify",
|
||||||
"production:js": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/app.js --bundle --outfile=./js/app.js --minify",
|
"production:js": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/app.js --bundle --outfile=./js/app.js --minify",
|
||||||
|
"production:js-artisans": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/artisans.js --bundle --outfile=./js/artisans.js --minify",
|
||||||
"dev:css-app": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/app.css -o ./css/app.css --postcss",
|
"dev:css-app": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/app.css -o ./css/app.css --postcss",
|
||||||
"dev:css-editor": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/editor-style.css -o ./css/editor-style.css --postcss",
|
"dev:css-editor": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/editor-style.css -o ./css/editor-style.css --postcss",
|
||||||
"dev:css-admin": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/admin-style.css -o ./css/admin-style.css --postcss",
|
"dev:css-admin": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/admin-style.css -o ./css/admin-style.css --postcss",
|
||||||
"dev:css-login": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/login-style.css -o ./css/login-style.css --postcss",
|
"dev:css-login": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/login-style.css -o ./css/login-style.css --postcss",
|
||||||
"dev:js": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/app.js --bundle --outfile=./js/app.js",
|
"dev:js": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/app.js --bundle --outfile=./js/app.js",
|
||||||
|
"dev:js-artisans": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/artisans.js --bundle --outfile=./js/artisans.js",
|
||||||
"watch:css-app": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/app.css -o ./css/app.css --postcss --watch",
|
"watch:css-app": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/app.css -o ./css/app.css --postcss --watch",
|
||||||
"watch:css-editor": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/editor-style.css -o ./css/editor-style.css --postcss --watch",
|
"watch:css-editor": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/editor-style.css -o ./css/editor-style.css --postcss --watch",
|
||||||
"watch:css-admin": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/admin-style.css -o ./css/admin-style.css --postcss --watch",
|
"watch:css-admin": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/admin-style.css -o ./css/admin-style.css --postcss --watch",
|
||||||
"watch:css-login": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/login-style.css -o ./css/login-style.css --postcss --watch",
|
"watch:css-login": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/login-style.css -o ./css/login-style.css --postcss --watch",
|
||||||
"watch:js-editor": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/editor.js --bundle --outfile=./js/editor.js --watch --loader:.js=jsx",
|
"watch:js-editor": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/editor.js --bundle --outfile=./js/editor.js --watch --loader:.js=jsx",
|
||||||
"watch:js": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/app.js --bundle --outfile=./js/app.js --watch",
|
"watch:js": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/app.js --bundle --outfile=./js/app.js --watch",
|
||||||
"production": "cross-env NODE_ENV=production concurrently \"npm run production:css-app\" \"npm run production:css-editor\" \"npm run production:css-admin\" \"npm run production:css-login\" \"npm run production:js\"",
|
"watch:js-artisans": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/artisans.js --bundle --outfile=./js/artisans.js --watch",
|
||||||
"dev": "cross-env NODE_ENV=development concurrently \"npm run dev:css-app\" \"npm run dev:css-admin\" \"npm run dev:css-editor\" \"npm run dev:css-login\" \"npm run dev:js\"",
|
"production": "cross-env NODE_ENV=production concurrently \"npm run production:css-app\" \"npm run production:css-editor\" \"npm run production:css-admin\" \"npm run production:css-login\" \"npm run production:js\" \"npm run production:js-artisans\"",
|
||||||
"watch": "cross-env NODE_ENV=development concurrently \"npm run watch:css-app\" \"npm run watch:css-editor\" \"npm run watch:css-admin\" \"npm run watch:css-login\" \"npm run watch:js\" \"npm run watch:js-editor\"",
|
"dev": "cross-env NODE_ENV=development concurrently \"npm run dev:css-app\" \"npm run dev:css-admin\" \"npm run dev:css-editor\" \"npm run dev:css-login\" \"npm run dev:js\" \"npm run dev:js-artisans\"",
|
||||||
|
"watch": "cross-env NODE_ENV=development concurrently \"npm run watch:css-app\" \"npm run watch:css-editor\" \"npm run watch:css-admin\" \"npm run watch:css-login\" \"npm run watch:js\" \"npm run watch:js-editor\" \"npm run watch:js-artisans\"",
|
||||||
"browser-sync": "cross-env NODE_ENV=development browser-sync start --proxy \"tailpress.test\" --host=\"tailpress.test\" --no-inject-changes --files=\"./\"",
|
"browser-sync": "cross-env NODE_ENV=development browser-sync start --proxy \"tailpress.test\" --host=\"tailpress.test\" --no-inject-changes --files=\"./\"",
|
||||||
"watch-sync": "cross-env NODE_ENV=development concurrently \"npm run browser-sync\" \"npm run watch\""
|
"watch-sync": "cross-env NODE_ENV=development concurrently \"npm run browser-sync\" \"npm run watch\""
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -379,11 +379,17 @@ body.post-type-artisans {
|
||||||
@apply !hidden;
|
@apply !hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul a {
|
ul {
|
||||||
@apply text-patrimoine-sante-securite text-base flex items-center gap-2;
|
li {
|
||||||
filter: brightness(80%);
|
@apply mb-3;
|
||||||
img {
|
}
|
||||||
@apply w-6 h-6 object-contain filter-patrimoine-sante-securite;
|
a {
|
||||||
|
@apply text-patrimoine-sante-securite text-base flex items-center gap-2;
|
||||||
|
text-underline-offset: 4px !important;
|
||||||
|
filter: brightness(80%);
|
||||||
|
img {
|
||||||
|
@apply w-6 h-6 object-contain filter-patrimoine-sante-securite;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -392,7 +398,11 @@ body.post-type-artisans {
|
||||||
}
|
}
|
||||||
|
|
||||||
.new-chantier {
|
.new-chantier {
|
||||||
@apply bg-patrimoine-sante-securite text-white py-2 px-4 no-underline rounded-full mb-4 block w-fit;
|
/* @apply bg-patrimoine-sante-securite text-white py-2 px-4 rounded-xl mb-4 block w-fit mt-5; */
|
||||||
|
@apply !bg-patrimoine-sante-securite !text-white !border-none no-underline !rounded-xl !px-3 !py-1 my-8 flex items-center justify-center gap-2 w-fit;
|
||||||
|
&:before {
|
||||||
|
@apply content-['+'] !text-2xl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -698,6 +708,33 @@ select[data-enpassusermodified='yes'] {
|
||||||
@apply border-none;
|
@apply border-none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* FIELD DES MEMBRES DE L'ÉQUIPE DE L'ARTISAN */
|
||||||
|
.acf-field-670d268f2b324 {
|
||||||
|
label[for='acf-field_670d268f2b324'] {
|
||||||
|
@apply !hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
div[data-layout='membre'] {
|
||||||
|
&.-collapsed {
|
||||||
|
@apply !border-none;
|
||||||
|
}
|
||||||
|
.acf-fc-layout-handle {
|
||||||
|
@apply !flex !gap-4 !text-base !items-center !bg-violet-50 !text-violet-950 !border-none !font-semibold;
|
||||||
|
}
|
||||||
|
span.acf-fc-layout-order {
|
||||||
|
@apply !bg-patrimoine-sante-securite !rounded-full mr-4 !block !text-white !border-none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.acf-actions a[data-name='add-layout'] {
|
||||||
|
@apply !bg-patrimoine-sante-securite !text-white !border-none !rounded-xl !px-3 !py-1 my-8 flex items-center justify-center gap-2 w-fit !mx-auto;
|
||||||
|
&:before {
|
||||||
|
@apply content-['+'] !text-2xl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIELD DE GESTION */
|
||||||
|
|
||||||
#acf-group_67581cdaf3262 {
|
#acf-group_67581cdaf3262 {
|
||||||
@apply border border-patrimoine-sante-securite border-solid rounded-t-xl p-0;
|
@apply border border-patrimoine-sante-securite border-solid rounded-t-xl p-0;
|
||||||
@apply bg-white;
|
@apply bg-white;
|
||||||
|
|
|
||||||
44
resources/js/artisans.ts
Normal file
44
resources/js/artisans.ts
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
interface MemberElement extends Element {
|
||||||
|
querySelector(selectors: string): Element | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('DOMContentLoaded', (): void => {
|
||||||
|
const artisansMembers: NodeListOf<MemberElement> = document.querySelectorAll('.acf-field-670d268f2b324 div[data-layout="membre"]');
|
||||||
|
|
||||||
|
artisansMembers.forEach((member: MemberElement): void => {
|
||||||
|
setMemberName(member);
|
||||||
|
|
||||||
|
// Créer un MutationObserver pour surveiller les changements de classe
|
||||||
|
const observer: MutationObserver = new MutationObserver((mutations: MutationRecord[]): void => {
|
||||||
|
mutations.forEach((mutation: MutationRecord): void => {
|
||||||
|
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
|
||||||
|
setTimeout((): void => {
|
||||||
|
setMemberName(member);
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Configuration de l'observateur pour surveiller les changements de classe
|
||||||
|
observer.observe(member, {
|
||||||
|
attributes: true,
|
||||||
|
attributeFilter: ['class'],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function setMemberName(member: MemberElement): void {
|
||||||
|
const memberFirstName: string | undefined = (member.querySelector('div[data-name="first_name"] input') as HTMLInputElement)?.value;
|
||||||
|
const memberLastName: string | undefined = (member.querySelector('div[data-name="last_name"] input') as HTMLInputElement)?.value;
|
||||||
|
const memberName: string = `${memberFirstName} ${memberLastName}`;
|
||||||
|
|
||||||
|
const spanOrder: Element | null = member.querySelector('.acf-fc-layout-handle span');
|
||||||
|
const panelTitleDiv: Element | null = member.querySelector('.acf-fc-layout-handle');
|
||||||
|
|
||||||
|
if (memberName && memberName !== '' && panelTitleDiv) {
|
||||||
|
panelTitleDiv.textContent = memberName;
|
||||||
|
if (spanOrder) {
|
||||||
|
panelTitleDiv.prepend(spanOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -155,15 +155,13 @@ $pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
|
||||||
<?php
|
<?php
|
||||||
$chantier_description = get_field('description', $chantier->ID);
|
$chantier_description = get_field('description', $chantier->ID);
|
||||||
$date = get_field('date', $chantier->ID);
|
$date = get_field('date', $chantier->ID);
|
||||||
// $city = get_field('city', $chantier->ID);
|
|
||||||
$city = get_field('city', $chantier->ID)['city'] ?? null;
|
$city = get_field('city', $chantier->ID)['city'] ?? null;
|
||||||
|
|
||||||
// write_log($city);
|
|
||||||
$pictures = get_field('pictures', $chantier->ID);
|
$pictures = get_field('pictures', $chantier->ID);
|
||||||
|
$chantier_name = get_field('chantier_name', $chantier->ID);
|
||||||
?>
|
?>
|
||||||
<div class="chantier">
|
<div class="chantier">
|
||||||
|
|
||||||
<h4 class="chantier__title"><?php echo $chantier->post_title ?></h4>
|
<h4 class="chantier__title"><?php echo $chantier_name ?></h4>
|
||||||
<div class="chantier__infos">
|
<div class="chantier__infos">
|
||||||
<?php if ($city): ?>
|
<?php if ($city): ?>
|
||||||
<p class="chantier__city"><?php echo $city ?></p>
|
<p class="chantier__city"><?php echo $city ?></p>
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,8 @@ $company_members = get_field('company_members', $postID);
|
||||||
$phoneNumber = get_field('phone_number', $postID);
|
$phoneNumber = get_field('phone_number', $postID);
|
||||||
$gsmNumber = get_field('gsm_number', $postID);
|
$gsmNumber = get_field('gsm_number', $postID);
|
||||||
$faxNumber = get_field('fax_number', $postID);
|
$faxNumber = get_field('fax_number', $postID);
|
||||||
$formattedPhoneNumber = preg_replace('/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/', '+$1 $2 $3 $4 $5', $phoneNumber);
|
$formattedPhoneNumber = preg_replace('/(\d{2})(\d{3})(\d{2})(\d{2})(\d{2})/', '+$1 $2 $3 $4 $5', $phoneNumber);
|
||||||
$formattedGsmNumber = preg_replace('/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/', '+$1 $2 $3 $4 $5', $gsmNumber);
|
$formattedGsmNumber = preg_replace('/(\d{2})(\d{3})(\d{2})(\d{2})(\d{2})/', '+$1 $2 $3 $4 $5', $gsmNumber);
|
||||||
$formattedFaxNumber = preg_replace('/^(\+\d{2})(\d{3})(\d{2})(\d{2})(\d{2})/', '$1 $2 $3 $4 $5', $faxNumber);
|
|
||||||
$email = get_field('email', $postID);
|
$email = get_field('email', $postID);
|
||||||
$website = get_field('website', $postID);
|
$website = get_field('website', $postID);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user