diff --git a/web_events_calendar_view/README.rst b/web_events_calendar_view/README.rst new file mode 100755 index 000000000..65cdb09bc --- /dev/null +++ b/web_events_calendar_view/README.rst @@ -0,0 +1,50 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Website Event Calendar View +=========================== +This module allow to view the events in calendar and user can easily +navigate to event from calendar. + +Installation +============ +- www.odoo.com/documentation/17.0/setup/install.html +- Install our custom addon + +License +------- +GNU AFFERO GENERAL PUBLIC LICENSE v3.0 (AGPL-3) +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developers : (V16) Renu M, + (V17) Busthana Shirin, +* Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ diff --git a/web_events_calendar_view/__init__.py b/web_events_calendar_view/__init__.py new file mode 100644 index 000000000..40d3a6212 --- /dev/null +++ b/web_events_calendar_view/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +from . import models +from . import controllers diff --git a/web_events_calendar_view/__manifest__.py b/web_events_calendar_view/__manifest__.py new file mode 100644 index 000000000..e82b57edd --- /dev/null +++ b/web_events_calendar_view/__manifest__.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +{ + 'name': 'Website Event Calendar View', + 'version': '17.0.1.0.0', + 'category': 'Website', + 'summary': 'Website Calendar View for Event in Odoo 17', + 'description': 'This module helps you make calender view of events in ' + 'website.Hence we can easily navigate to the event ' + 'through the calendar', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['web','website_event'], + 'data': [ + 'views/event_templates.xml', + ], + 'assets': { + 'web.assets_frontend': [ + 'web_events_calendar_view/static/src/css/calender.css', + 'web_events_calendar_view/static/src/js/CalendarView.js', + 'web_events_calendar_view/static/src/xml/templates.xml', + ], + }, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/web_events_calendar_view/controllers/__init__.py b/web_events_calendar_view/controllers/__init__.py new file mode 100644 index 000000000..8daacfbc6 --- /dev/null +++ b/web_events_calendar_view/controllers/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +from . import web_events_calendar_view diff --git a/web_events_calendar_view/controllers/web_events_calendar_view.py b/web_events_calendar_view/controllers/web_events_calendar_view.py new file mode 100644 index 000000000..65ef26db9 --- /dev/null +++ b/web_events_calendar_view/controllers/web_events_calendar_view.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +from datetime import date, timedelta +from odoo import http +from odoo.fields import Date +from odoo.http import request + + +class EventCalendar(http.Controller): + @http.route("/web_events_calendar_view/days_with_events", + auth="public", type="json", website=True) + def days_with_events(self, start, end): + """Day with any events. + + start: + Search events from that date. + + end: + Search events until that date. + """ + events = request.env["event.event"].search([ + "|", + ("date_begin", "<=", end), + ("date_end", ">=", start), + ]) + days = set() + one_day = timedelta(days=1) + start = Date.from_string(start) + end = Date.from_string(end) + for event in events: + now = max(Date.from_string(event.date_begin), start) + event_end = min(Date.from_string(event.date_end), end) + while now <= event_end: + days.add(now) + now += one_day + return [Date.to_string(day) for day in days] + + @http.route("/web_events_calendar_view/events_for_day", + auth="public", type="json", website=True) + def events_for_day(self, day=None, limit=None): + """Day wise list of events. + + day: + Date in a string. If ``None``, we'll search for upcoming events + from today up to specified limit. + + limit: + How many results to return. + """ + ref = day or Date.to_string(date.today()) + domain = [ + ("date_end", ">=", ref), + ] + if day: + domain.append(("date_begin", "<=", ref)) + return request.env["event.event"].search_read( + domain=domain, + limit=limit, + fields=[ + "date_begin_pred_located", + "name", + "event_type_id", + "website_published", + "website_url", + ], + ) + + @http.route('/web_events_calendar_view/events', auth='public', type='json', website=True) + def get_events(self): + # Fetch events from the calendar.event model + ref = Date.to_string(date.today()) + events = request.env['event.event'].sudo().search([("date_begin", ">=", ref)]) + + # Create a list of event dictionaries + event_data = [] + for event in events: + event_dict = { + 'title': event.name, + 'start': event.date_begin.strftime('%Y-%m-%d'), + 'display': 'background' + + } + if event.date_end: # Check if the event has an end date + event_dict['end'] = event.date_end.strftime( + '%Y-%m-%d') # Format the end datetime as 'YYYY-MM-DD' + event_data.append(event_dict) + return event_data + + @http.route(['/calendar_events'], type='http', auth="public", + website=True) + def calendar_events(self): + return request.render( + "web_events_calendar_view.global_events_calendar") diff --git a/web_events_calendar_view/doc/RELEASE_NOTES.md b/web_events_calendar_view/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..d6b81c40c --- /dev/null +++ b/web_events_calendar_view/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 13.12.2024 +#### Version 17.0.1.0.0 +#### ADD + +- Initial commit for Website Event Calendar View diff --git a/web_events_calendar_view/models/__init__.py b/web_events_calendar_view/models/__init__.py new file mode 100644 index 000000000..ad2148d3e --- /dev/null +++ b/web_events_calendar_view/models/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +from . import event diff --git a/web_events_calendar_view/models/event.py b/web_events_calendar_view/models/event.py new file mode 100644 index 000000000..8b0b38776 --- /dev/null +++ b/web_events_calendar_view/models/event.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +from odoo import api, fields, models +from odoo.tools import format_datetime + + +class EventEvent(models.Model): + _inherit = 'event.event' + + date_begin_pred_located = fields.Char( + compute='_compute_date_begin_pred_located', + store=True, + ) + + @api.depends('date_begin', 'date_tz') + def _compute_date_begin_pred_located(self): + for record in self: + record.date_begin_pred_located = format_datetime( + self.env, + record.date_begin, + tz=record.date_tz, + dt_format='medium') diff --git a/web_events_calendar_view/static/description/assets/icons/capture (1).png b/web_events_calendar_view/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/capture (1).png differ diff --git a/web_events_calendar_view/static/description/assets/icons/check.png b/web_events_calendar_view/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/check.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/chevron.png b/web_events_calendar_view/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/chevron.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/cogs.png b/web_events_calendar_view/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/cogs.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/consultation.png b/web_events_calendar_view/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/consultation.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/ecom-black.png b/web_events_calendar_view/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/ecom-black.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/education-black.png b/web_events_calendar_view/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/education-black.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/hotel-black.png b/web_events_calendar_view/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/hotel-black.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/img.png b/web_events_calendar_view/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/img.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/license.png b/web_events_calendar_view/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/license.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/lifebuoy.png b/web_events_calendar_view/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/lifebuoy.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/manufacturing-black.png b/web_events_calendar_view/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/manufacturing-black.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/photo-capture.png b/web_events_calendar_view/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/photo-capture.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/pos-black.png b/web_events_calendar_view/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/pos-black.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/puzzle.png b/web_events_calendar_view/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/puzzle.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/restaurant-black.png b/web_events_calendar_view/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/restaurant-black.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/service-black.png b/web_events_calendar_view/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/service-black.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/trading-black.png b/web_events_calendar_view/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/trading-black.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/training.png b/web_events_calendar_view/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/training.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/update.png b/web_events_calendar_view/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/update.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/user.png b/web_events_calendar_view/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/user.png differ diff --git a/web_events_calendar_view/static/description/assets/icons/wrench.png b/web_events_calendar_view/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/web_events_calendar_view/static/description/assets/icons/wrench.png differ diff --git a/web_events_calendar_view/static/description/assets/misc/Cybrosys R.png b/web_events_calendar_view/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/misc/Cybrosys R.png differ diff --git a/web_events_calendar_view/static/description/assets/misc/email.svg b/web_events_calendar_view/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/web_events_calendar_view/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web_events_calendar_view/static/description/assets/misc/phone.svg b/web_events_calendar_view/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/web_events_calendar_view/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/web_events_calendar_view/static/description/assets/misc/star (1) 2.svg b/web_events_calendar_view/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/web_events_calendar_view/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/web_events_calendar_view/static/description/assets/misc/support (1) 1.svg b/web_events_calendar_view/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/web_events_calendar_view/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/web_events_calendar_view/static/description/assets/misc/support-email.svg b/web_events_calendar_view/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/web_events_calendar_view/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/web_events_calendar_view/static/description/assets/misc/tick-mark.svg b/web_events_calendar_view/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/web_events_calendar_view/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/web_events_calendar_view/static/description/assets/misc/whatsapp 1.svg b/web_events_calendar_view/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/web_events_calendar_view/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/web_events_calendar_view/static/description/assets/misc/whatsapp.svg b/web_events_calendar_view/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/web_events_calendar_view/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web_events_calendar_view/static/description/assets/modules/1.jpg b/web_events_calendar_view/static/description/assets/modules/1.jpg new file mode 100644 index 000000000..67c7f7062 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/modules/1.jpg differ diff --git a/web_events_calendar_view/static/description/assets/modules/2.png b/web_events_calendar_view/static/description/assets/modules/2.png new file mode 100644 index 000000000..3bedf7981 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/modules/2.png differ diff --git a/web_events_calendar_view/static/description/assets/modules/3.png b/web_events_calendar_view/static/description/assets/modules/3.png new file mode 100644 index 000000000..164eb62c7 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/modules/3.png differ diff --git a/web_events_calendar_view/static/description/assets/modules/4.png b/web_events_calendar_view/static/description/assets/modules/4.png new file mode 100644 index 000000000..d246d83ac Binary files /dev/null and b/web_events_calendar_view/static/description/assets/modules/4.png differ diff --git a/web_events_calendar_view/static/description/assets/modules/5.jpg b/web_events_calendar_view/static/description/assets/modules/5.jpg new file mode 100644 index 000000000..655cf38f5 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/modules/5.jpg differ diff --git a/web_events_calendar_view/static/description/assets/modules/6.jpg b/web_events_calendar_view/static/description/assets/modules/6.jpg new file mode 100644 index 000000000..1f3f2e27f Binary files /dev/null and b/web_events_calendar_view/static/description/assets/modules/6.jpg differ diff --git a/web_events_calendar_view/static/description/assets/screenshots/1.png b/web_events_calendar_view/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..c1cf67907 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/screenshots/1.png differ diff --git a/web_events_calendar_view/static/description/assets/screenshots/2.png b/web_events_calendar_view/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..d9234dfeb Binary files /dev/null and b/web_events_calendar_view/static/description/assets/screenshots/2.png differ diff --git a/web_events_calendar_view/static/description/assets/screenshots/3.png b/web_events_calendar_view/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..a81400db8 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/screenshots/3.png differ diff --git a/web_events_calendar_view/static/description/assets/screenshots/4.png b/web_events_calendar_view/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..9b4a29854 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/screenshots/4.png differ diff --git a/web_events_calendar_view/static/description/assets/screenshots/hero.gif b/web_events_calendar_view/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..9200d1b99 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/screenshots/hero.gif differ diff --git a/web_events_calendar_view/static/description/assets/screenshots/web1.png b/web_events_calendar_view/static/description/assets/screenshots/web1.png new file mode 100644 index 000000000..d78233eb3 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/screenshots/web1.png differ diff --git a/web_events_calendar_view/static/description/assets/screenshots/web2.png b/web_events_calendar_view/static/description/assets/screenshots/web2.png new file mode 100644 index 000000000..8d379eeec Binary files /dev/null and b/web_events_calendar_view/static/description/assets/screenshots/web2.png differ diff --git a/web_events_calendar_view/static/description/assets/screenshots/web3.png b/web_events_calendar_view/static/description/assets/screenshots/web3.png new file mode 100644 index 000000000..a0d830196 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/screenshots/web3.png differ diff --git a/web_events_calendar_view/static/description/assets/screenshots/web4.png b/web_events_calendar_view/static/description/assets/screenshots/web4.png new file mode 100644 index 000000000..80d4dcf30 Binary files /dev/null and b/web_events_calendar_view/static/description/assets/screenshots/web4.png differ diff --git a/web_events_calendar_view/static/description/banner.jpg b/web_events_calendar_view/static/description/banner.jpg new file mode 100644 index 000000000..6c3df8eea Binary files /dev/null and b/web_events_calendar_view/static/description/banner.jpg differ diff --git a/web_events_calendar_view/static/description/icon.png b/web_events_calendar_view/static/description/icon.png new file mode 100644 index 000000000..3e1fb4d41 Binary files /dev/null and b/web_events_calendar_view/static/description/icon.png differ diff --git a/web_events_calendar_view/static/description/index.html b/web_events_calendar_view/static/description/index.html new file mode 100644 index 000000000..ee7c53610 --- /dev/null +++ b/web_events_calendar_view/static/description/index.html @@ -0,0 +1,747 @@ + + + + + + + Website Event Calendar View + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ Website Event Calendar View

+

+ Navigate Events through Website Calendar. +

+
+ +
+
+
+
+
+

+ Key Highlights +

+
+
+
+
+
+ +
+
+

+ Enterprise and Community compatible.

+
+
+
+
+
+
+ +
+
+

+ Able to recognise the event between a certain + date on the calendar.

+
+
+
+
+
+
+ +
+
+

+ Easily discern the events which are + unpublished.

+
+
+
+
+
+
+ +
+
+

+ Can easily navigate to the event through + calendar list.

+
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+

+ Event Calendar menu in Website +

+

+ User can view all events from this menu + Events Calendar.

+
+
+
+
+
+
+ +
+
+

+ Date wise Events. +

+

+ User can easily track events by date + wise.

+
+
+
+
+
+
+ +
+
+

+ User can easily navigate to the event from + the calendar on + one click. +

+
+
+
+
+
+
+ +
+
+

+ Unpublished Events. +

+

+ User can easily identify the unpublished + events.

+
+
+
+
+
+
+
    +
  • + Enterprise and Community compatible. +
  • +
  • + Able to recognise the event between a certain date on the calendar. +
  • +
  • + Easily discern the events which are unpublished. +
  • +
  • + Can easily navigate to the event through calendar list. +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:13 Dec 2024 +
+

+ + Initial commit for Website Event Calendar View.

+
+
+
+
+
+
+
+

+ Related Products

+
+
+ +
+
+

+ Our Services

+ +
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire + Odoo Developer

+
+
+
+
+ +
+
+ service-icon +
+
+

Odoo + Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Licensing Consultancy

+
+
+
+
+
+
+

+ Our Industries

+ +
+
+
+
+
+
+ +

Trading

+

Easily procure and sell your products

+
+
+
+
+ +

POS

+

Easy configuration and convivial experience

+
+
+
+
+ +

+ Education

+

A platform for educational management

+
+
+
+
+ +

+ Manufacturing

+

Plan, track and schedule your operations

+
+
+
+
+ +

E-commerce & + Website

+

Mobile friendly, awe-inspiring product pages

+
+
+
+
+ +

Service + Management

+

Keep track of services and invoice

+
+
+
+
+ +

+ Restaurant

+

Run your bar or restaurant methodically

+
+
+
+
+ +

Hotel + Management

+

An all-inclusive hotel management application

+
+
+
+
+
+
+

+ Support

+
+
+
+
+
+
+
+ +
+ Need + Help? +

Got + questions or need help? Get in touch.

+
odoo@cybrosys.com +
+
+
+
+
+
+
+
+ +
+ WhatsApp +

Say hi to + us on WhatsApp!

+
+91 + 99456767686 +
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/web_events_calendar_view/static/src/css/calender.css b/web_events_calendar_view/static/src/css/calender.css new file mode 100644 index 000000000..7f46d9e94 --- /dev/null +++ b/web_events_calendar_view/static/src/css/calender.css @@ -0,0 +1,63 @@ +h3{ + font-size:3rem; + font-weight:bold; + color:#c68307; +} + +.s_event_calendar { + width: 100%; /* You can also set a fixed width like '1000px' if you prefer */ + max-width: 100%; /* Ensure it doesn't overflow the screen */ +} + +.fc-day.fc-day-today { + background-color: #f0f8ff; /* Light blue for today's column */ +} + +.fc-event { + background-color: #ff6347; /* Custom event background color */ + color: white; /* Text color */ +} + +/* If you want to apply specific styles to events in a specific range or with specific classes */ +.fc-event.start-to-end { + background-color: #8a2be2; +} + +.s_event_calendar { + margin-right: initial; +} + +.s_event_calendar_list .row { + display: flex; + justify-content: center; /* Align items horizontally in the center */ + align-items: center; /* Align items vertically in the center */ +} + +/* Ensure the calendar itself is centered */ +.s_event_calendar_list .col-md-6, +.s_event_calendar_list .col-lg-5 { + display: flex; + justify-content: center; + align-items: center; +} +.fc .fc-daygrid-day.fc-day-today{ + background-color: #efc085 !important; +} + +.s_event_calendar_list { + overflow: hidden; + max-width: 100%; + max-height: 100%; +} + +.fc-scroller { + overflow: hidden !important; +} + +.fc-daygrid-body { + overflow: hidden !important; +} + +.s_event_calendar { + height: 31rem; +} diff --git a/web_events_calendar_view/static/src/js/CalendarView.js b/web_events_calendar_view/static/src/js/CalendarView.js new file mode 100644 index 000000000..34f4c6c80 --- /dev/null +++ b/web_events_calendar_view/static/src/js/CalendarView.js @@ -0,0 +1,203 @@ +/** @odoo-module **/ +import { patch } from "@web/core/utils/patch"; +import { Component, useState , useRef, useEffect } from "@odoo/owl"; +import { animations } from "@website/js/content/snippets.animation"; +const { DateTime } = luxon; +import publicWidget from "@web/legacy/js/public/public_widget"; +import { renderToFragment } from "@web/core/utils/render"; +import { useService } from "@web/core/utils/hooks"; +import { jsonrpc } from "@web/core/network/rpc_service"; +import { DateTimePicker } from "@web/core/datetime/datetime_picker"; + + +const DATE_FORMAT = "yyyy-MM-dd"; +const DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; + +publicWidget.registry.CustomCalendar = publicWidget.Widget.extend({ + selector: '.s_event_calendar_list', + + setup() { + const rpc = useService("rpc"); + }, + + init: function () { + const referenceMoment = DateTime.local().setLocale("en"); + this.selected_date = null + + this.datepickerOptions = { + inline: true, + minDate: referenceMoment.minus({ years: 100 }), + maxDate: referenceMoment.plus({ years: 100 }), + icons: { + previous: "fa fa-chevron-left", + next: "fa fa-chevron-right", + }, + format: DATE_FORMAT, + useCurrent: false, + locale: referenceMoment.loc.locale, + }; + + return this._super.apply(this, arguments); + }, + + start: function (editableMode) { + this._super.apply(this, arguments); + + if (editableMode) { + return; + } + this.selectedDates = { + min: null, + max: null, + matches: [], + }; + + this.defaultAmount = Number(this.$(".js_amount").html()) || 4; + // Get initial events to render the list + this.loadEvents(null, this.defaultAmount) + .then($.proxy(this, "renderList")); + // Preload dates and render the calendar + const referenceMoment = DateTime.local().setLocale("en"); + this.preloadDates(referenceMoment) + .then($.proxy(this, "renderCalendar")); + }, + + preloadDates: function (when) { + const referenceMoment = DateTime.local().setLocale("en"); + const margin = { months: 4 }; + + // Don't preload if we have up to 4 months of margin + if ( + this.selectedDates.min && this.selectedDates.max && + this.selectedDates.min <= when - margin && + this.selectedDates.max >= when + margin + ) { + return $.Deferred().resolve(); + } + // Default values + margin.months += 2; + const start = referenceMoment.minus(margin); + const end = referenceMoment.plus(margin); + // If we already preloaded, preload 6 more months + if (this.selectedDates.min) { + start.subtract(6, "months"); + } + if (this.selectedDates.max) { + end.add(6, "months"); + } + // Do the preloading + return this.loadDates(start, end); + }, + + loadDates: function (start, end) { + const startdate = start.toISO(); + + return jsonrpc( + "/web_events_calendar_view/days_with_events", + { + start: start.toISO(), + end: end.toISO(), + } + ).then($.proxy(this, "updateDatesCache", start, end)); + }, + + updateDatesCache: function (start, end, dates) { + if (!this.selectedDates.min || this.selectedDates.min > start) { + this.selectedDates.min = start; + } + if (!this.selectedDates.max || this.selectedDates.max < end) { + this.selectedDates.max = end; + } + this.selectedDates.matches = [...new Set([...this.selectedDates.matches, ...dates])]; + + }, + + renderCalendar: function () { + const enabledDates = this.selectedDates.matches.map((ndate) => { + return new Date(ndate); // Convert string date to JavaScript Date object + }); + this._load_fullcalendar(); + }, + + _load_fullcalendar: function () { + // Dynamically load FullCalendar CSS + var link = document.createElement('link'); + link.rel = 'stylesheet'; + link.type = 'text/css'; + link.href = 'https://cdn.jsdelivr.net/npm/fullcalendar@5.10.0/main.min.css'; + document.head.appendChild(link); + + // Dynamically load FullCalendar JS + var script = document.createElement('script'); + script.type = 'text/javascript'; + script.src = 'https://cdn.jsdelivr.net/npm/fullcalendar@5.10.0/main.min.js'; + script.onload = this._initialize_calendar.bind(this); // Initialize the calendar once the script is loaded + document.body.appendChild(script); + }, + + async _initialize_calendar() { + var calendarElement = document.querySelector('.s_event_calendar') + if (!calendarElement) { + return; + } + + var events = await jsonrpc( + "/web_events_calendar_view/events", + {} + ); + + // Initialize FullCalendar + new FullCalendar.Calendar(calendarElement, { + initialView: 'dayGridMonth', + events: events, + + // This will trigger when a date is clicked + dateClick: (info) => { + this.handleDateClick(info); // 'this' now refers to the CalendarHandler instance + } + }).render(); + }, + + // Handle date click event + handleDateClick(info) { + let clickedDate = info.dateStr; // Date in 'YYYY-MM-DD' format + this.selected_date = clickedDate; + + let previousSelectedDate = document.querySelector('.fc-selected'); + if (previousSelectedDate) { + previousSelectedDate.classList.remove('fc-selected'); + previousSelectedDate.style.backgroundColor = ''; // Reset background color + } + + // Add background color to the clicked date + let clickedDateElement = info.dayEl; // Get the actual DOM element of the clicked day + clickedDateElement.classList.add('fc-selected'); + clickedDateElement.style.backgroundColor = '#1b918b'; + + // Get the default amount + this.defaultAmount = Number(document.querySelector(".js_amount").innerHTML) || 4; + + // Call loadEvents and then render the list + this.loadEvents(this.selected_date, this.defaultAmount) + .then(this.renderList); + }, + + renderList: function (events) { + document.querySelector('.s_event_list').innerHTML = ''; + + document.querySelector('.s_event_list').append(renderToFragment( + 'web_events_calendar_view.list', + { + events: events + } + )); + }, + + loadEvents: function (day, limit) { + return jsonrpc( + "/web_events_calendar_view/events_for_day", + {day: day, limit: limit} + ); + }, + +}); diff --git a/web_events_calendar_view/static/src/xml/templates.xml b/web_events_calendar_view/static/src/xml/templates.xml new file mode 100644 index 000000000..3ea529edc --- /dev/null +++ b/web_events_calendar_view/static/src/xml/templates.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/web_events_calendar_view/views/event_templates.xml b/web_events_calendar_view/views/event_templates.xml new file mode 100644 index 000000000..51eb6c4b7 --- /dev/null +++ b/web_events_calendar_view/views/event_templates.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + Events Calendar + /calendar_events + + 20 + +