From 2c3989b9c786b3dfddd3d1af612fb7ba483c5286 Mon Sep 17 00:00:00 2001 From: Rafael Pivato Date: Sat, 1 Jun 2024 14:21:17 -0300 Subject: [PATCH] Added scheduling plugin --- README.md | 17 +++++ mahoee-scheduling/admin/site-settings.php | 83 +++++++++++++++++++++++ mahoee-scheduling/composer.json | 1 + mahoee-scheduling/composer.lock | 18 +++++ mahoee-scheduling/mahoee-scheduling.php | 38 +++++++++++ 5 files changed, 157 insertions(+) create mode 100644 mahoee-scheduling/admin/site-settings.php create mode 100644 mahoee-scheduling/composer.json create mode 100644 mahoee-scheduling/composer.lock create mode 100644 mahoee-scheduling/mahoee-scheduling.php diff --git a/README.md b/README.md index 5b6723c..bcd0ccf 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ For more information about Mahoee, visit our [website](https://mahoee.com). - [Plugins](#plugins) - [mahoee-tracking](#mahoee-tracking) - [mahoee-acme](#mahoee-acme) + - [mahoee-scheduling](#mahoee-scheduling) - [Installation](#installation) - [Usage](#usage) - [Contributing](#contributing) @@ -34,6 +35,15 @@ For more information about Mahoee, visit our [website](https://mahoee.com). - Easy integration with your WordPress site - Enhances site security with SSL/TLS encryption +### mahoee-scheduling + +**mahoee-scheduling** will let you define scheduling for your business and let you add scheduling controls in your web site using shortcodes and custom HTML classes. + +#### Features: +- Lets you configure business operating schedule +- Provides shortcode to actiate scheduling on a page +- Uses CSS selectors to toggle elements required for scheduling + ## Installation To install any of the plugins, follow these steps: @@ -57,6 +67,13 @@ To install any of the plugins, follow these steps: 2. Follow the instructions to configure your Let's Encrypt account. 3. Request a new certificate for your site and the plugin will handle the rest. +### mahoee-scheduling + +1. After activating the plugin, go to the plugin settings page in your WordPress admin dashboard. +2. Go do scheduling admin page and set working weekdays and shifts. +3. Add shortcode to your page where you want scheduling to starts. +4. Add CSS elements to the HTML blocks that need to be activated. + ## Contributing We welcome contributions from the community! If you have any suggestions, bug reports, or feature requests, please open an issue on the [GitHub repository](https://github.com/mahoee-labs/wordpress-plugins/issues). diff --git a/mahoee-scheduling/admin/site-settings.php b/mahoee-scheduling/admin/site-settings.php new file mode 100644 index 0000000..85bae0a --- /dev/null +++ b/mahoee-scheduling/admin/site-settings.php @@ -0,0 +1,83 @@ +'; + settings_fields('mahoee_scheduling'); + do_settings_sections('mahoee-scheduling'); + submit_button(); + echo ''; + +} + +function mahoee_scheduling_register_settings() +{ + register_setting('mahoee_scheduling', 'mahoee_scheduling_recurring', ['type' => 'object']); + + add_settings_section( + 'recurring', + 'Agenda Recorrente', + 'mahoee_scheduling_recurring_section_callback', + 'mahoee-scheduling', + ); + + add_settings_field( + 'weekdays', + 'Dias da Semana', + 'mahoee_scheduling_recurring_weekdays_callback', + 'mahoee-scheduling', + 'recurring' + ); + + add_settings_field( + 'shifts', + 'Turnos nesses Dias', + 'mahoee_scheduling_recurring_shifts_callback', + 'mahoee-scheduling', + 'recurring' + ); +} +add_action('admin_init', 'mahoee_scheduling_register_settings'); + +function mahoee_scheduling_recurring_section_callback() +{ + echo 'Informe quais dias da semana você opera consistentemente com os turnos selecionado.'; +} + +function mahoee_scheduling_recurring_weekdays_callback() +{ + $options = get_option('mahoee_scheduling_recurring'); + $weekdays = isset($options['weekdays']) ? $options['weekdays'] : []; + $days = [ + 0 => 'Domingo', + 1 => 'Segunda-feira', + 2 => 'Terça-feira', + 3 => 'Quarta-feira', + 4 => 'Quinta-feira', + 5 => 'Sexta-feira', + 6 => 'Sábado', + ]; + + foreach ($days as $value => $day) { + echo '
'; + } +} + +function mahoee_scheduling_recurring_shifts_callback() +{ + $options = get_option('mahoee_scheduling_recurring'); + $shifts = isset($options['shifts']) ? $options['shifts'] : []; + $days = [ + 0 => 'Manhã', + 1 => 'Tarde', + 2 => 'Noite', + ]; + + foreach ($days as $value => $shift) { + echo '
'; + } +} \ No newline at end of file diff --git a/mahoee-scheduling/composer.json b/mahoee-scheduling/composer.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/mahoee-scheduling/composer.json @@ -0,0 +1 @@ +{} diff --git a/mahoee-scheduling/composer.lock b/mahoee-scheduling/composer.lock new file mode 100644 index 0000000..ba6fe47 --- /dev/null +++ b/mahoee-scheduling/composer.lock @@ -0,0 +1,18 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "d751713988987e9331980363e24189ce", + "packages": [], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.6.0" +} diff --git a/mahoee-scheduling/mahoee-scheduling.php b/mahoee-scheduling/mahoee-scheduling.php new file mode 100644 index 0000000..9022010 --- /dev/null +++ b/mahoee-scheduling/mahoee-scheduling.php @@ -0,0 +1,38 @@ +