diff --git a/systray_world_clock/README.rst b/systray_world_clock/README.rst new file mode 100644 index 000000000..c02356e17 --- /dev/null +++ b/systray_world_clock/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 + +Systray World Clock +=================== +Module enables user to add world clocks of selected timezones in +the systray dropdown. + +Configuration +============= +The desired timezone and title for the clocks can be configured in +the settings page. + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) +(http://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +* Developer: (V16) subina, 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 +`Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/systray_world_clock/__init__.py b/systray_world_clock/__init__.py new file mode 100644 index 000000000..8c65c9089 --- /dev/null +++ b/systray_world_clock/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Subina P (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 diff --git a/systray_world_clock/__manifest__.py b/systray_world_clock/__manifest__.py new file mode 100644 index 000000000..b74d48090 --- /dev/null +++ b/systray_world_clock/__manifest__.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Subina P (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': "Systray World Clock", + 'version': '16.0.1.0.0', + 'category': 'Productivity', + 'summary': """Keep track of the time in different countries around the world.""", + 'description': """This module adds a world clock in the systray which + displays the time in different countries around the world. The time zone + can be customized in the settings""", + 'author': "Cybrosys Techno Solutions", + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['base', 'web'], + 'data': [ + 'security/ir.model.access.csv', + 'views/systray_world_clock_config_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'systray_world_clock/static/src/js/SystrayWorldClock.js', + 'systray_world_clock/static/src/xml/systray_world_clock.xml', + 'systray_world_clock/static/src/scss/systray_world_clock.scss' + ], + }, + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/systray_world_clock/doc/RELEASE_NOTES.md b/systray_world_clock/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..f19ad4512 --- /dev/null +++ b/systray_world_clock/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 28.05.2024 +#### Version 16.0.1.0.0 +##### ADD +- Initial commit for Systray World Clock diff --git a/systray_world_clock/models/__init__.py b/systray_world_clock/models/__init__.py new file mode 100644 index 000000000..667a4c27c --- /dev/null +++ b/systray_world_clock/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Subina P (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 systray_world_clock_config diff --git a/systray_world_clock/models/systray_world_clock_config.py b/systray_world_clock/models/systray_world_clock_config.py new file mode 100644 index 000000000..f3e7ea867 --- /dev/null +++ b/systray_world_clock/models/systray_world_clock_config.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Subina P (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 . +# +############################################################################# +import pytz +from datetime import datetime +from odoo import api, fields, models +from odoo.addons.base.models.res_partner import _tz_get + + +class SystrayWorldClockConfig(models.Model): + """A model representing the configuration of a world clock in the systray. + """ + _name = 'systray.world.clock.config' + _description = 'Systray World Clock Configuration' + + name = fields.Char(string='Location', required=True, + help='Location associated with this clock.') + tz = fields.Selection(_tz_get, required=True, string='Timezone', + help='Timezone of the clock.') + offset = fields.Float(string="Offset", + help='The time difference between the timezone and ' + 'UTC, in hours.') + + @api.onchange('tz') + def _onchange_tz(self): + """Calculate the time offset between the selected timezone and UTC. + This method is called automatically whenever the timezone field is + changed. + """ + if self.tz: + utc_dt = pytz.utc.localize(datetime.utcnow()) + tz = pytz.timezone(self.tz) + local_dt = utc_dt.astimezone(tz) + self.offset = local_dt.utcoffset().total_seconds() / 3600 diff --git a/systray_world_clock/security/ir.model.access.csv b/systray_world_clock/security/ir.model.access.csv new file mode 100644 index 000000000..d7e3a33a0 --- /dev/null +++ b/systray_world_clock/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_systray_world_clock_config_user,access.systray.world.clock.config.user,model_systray_world_clock_config,base.group_user,1,1,1,1 diff --git a/systray_world_clock/static/description/assets/icons/check.png b/systray_world_clock/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/check.png differ diff --git a/systray_world_clock/static/description/assets/icons/chevron.png b/systray_world_clock/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/chevron.png differ diff --git a/systray_world_clock/static/description/assets/icons/cogs.png b/systray_world_clock/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/cogs.png differ diff --git a/systray_world_clock/static/description/assets/icons/consultation.png b/systray_world_clock/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/consultation.png differ diff --git a/systray_world_clock/static/description/assets/icons/ecom-black.png b/systray_world_clock/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/ecom-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/education-black.png b/systray_world_clock/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/education-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/hotel-black.png b/systray_world_clock/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/hotel-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/license.png b/systray_world_clock/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/license.png differ diff --git a/systray_world_clock/static/description/assets/icons/lifebuoy.png b/systray_world_clock/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/lifebuoy.png differ diff --git a/systray_world_clock/static/description/assets/icons/manufacturing-black.png b/systray_world_clock/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/manufacturing-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/pos-black.png b/systray_world_clock/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/pos-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/puzzle.png b/systray_world_clock/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/puzzle.png differ diff --git a/systray_world_clock/static/description/assets/icons/restaurant-black.png b/systray_world_clock/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/restaurant-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/service-black.png b/systray_world_clock/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/service-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/trading-black.png b/systray_world_clock/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/trading-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/training.png b/systray_world_clock/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/training.png differ diff --git a/systray_world_clock/static/description/assets/icons/update.png b/systray_world_clock/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/update.png differ diff --git a/systray_world_clock/static/description/assets/icons/user.png b/systray_world_clock/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/user.png differ diff --git a/systray_world_clock/static/description/assets/icons/wrench.png b/systray_world_clock/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/wrench.png differ diff --git a/systray_world_clock/static/description/assets/misc/categories.png b/systray_world_clock/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/categories.png differ diff --git a/systray_world_clock/static/description/assets/misc/check-box.png b/systray_world_clock/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/check-box.png differ diff --git a/systray_world_clock/static/description/assets/misc/compass.png b/systray_world_clock/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/compass.png differ diff --git a/systray_world_clock/static/description/assets/misc/corporate.png b/systray_world_clock/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/corporate.png differ diff --git a/systray_world_clock/static/description/assets/misc/customer-support.png b/systray_world_clock/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/customer-support.png differ diff --git a/systray_world_clock/static/description/assets/misc/cybrosys-logo.png b/systray_world_clock/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/cybrosys-logo.png differ diff --git a/systray_world_clock/static/description/assets/misc/features.png b/systray_world_clock/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/features.png differ diff --git a/systray_world_clock/static/description/assets/misc/logo.png b/systray_world_clock/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/logo.png differ diff --git a/systray_world_clock/static/description/assets/misc/pictures.png b/systray_world_clock/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/pictures.png differ diff --git a/systray_world_clock/static/description/assets/misc/pie-chart.png b/systray_world_clock/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/pie-chart.png differ diff --git a/systray_world_clock/static/description/assets/misc/right-arrow.png b/systray_world_clock/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/right-arrow.png differ diff --git a/systray_world_clock/static/description/assets/misc/star.png b/systray_world_clock/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/star.png differ diff --git a/systray_world_clock/static/description/assets/misc/support.png b/systray_world_clock/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/support.png differ diff --git a/systray_world_clock/static/description/assets/misc/whatsapp.png b/systray_world_clock/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/systray_world_clock/static/description/assets/misc/whatsapp.png differ diff --git a/systray_world_clock/static/description/assets/modules/5.gif b/systray_world_clock/static/description/assets/modules/5.gif new file mode 100644 index 000000000..8f40aab85 Binary files /dev/null and b/systray_world_clock/static/description/assets/modules/5.gif differ diff --git a/systray_world_clock/static/description/assets/modules/barcode.png b/systray_world_clock/static/description/assets/modules/barcode.png new file mode 100644 index 000000000..618e3e6c4 Binary files /dev/null and b/systray_world_clock/static/description/assets/modules/barcode.png differ diff --git a/systray_world_clock/static/description/assets/modules/fatoorah.png b/systray_world_clock/static/description/assets/modules/fatoorah.png new file mode 100644 index 000000000..991fc77ec Binary files /dev/null and b/systray_world_clock/static/description/assets/modules/fatoorah.png differ diff --git a/systray_world_clock/static/description/assets/modules/integration_biometric.png b/systray_world_clock/static/description/assets/modules/integration_biometric.png new file mode 100644 index 000000000..ed11bd818 Binary files /dev/null and b/systray_world_clock/static/description/assets/modules/integration_biometric.png differ diff --git a/systray_world_clock/static/description/assets/modules/product_brand.png b/systray_world_clock/static/description/assets/modules/product_brand.png new file mode 100644 index 000000000..1d2238b80 Binary files /dev/null and b/systray_world_clock/static/description/assets/modules/product_brand.png differ diff --git a/systray_world_clock/static/description/assets/modules/website_cart.png b/systray_world_clock/static/description/assets/modules/website_cart.png new file mode 100644 index 000000000..163485cfd Binary files /dev/null and b/systray_world_clock/static/description/assets/modules/website_cart.png differ diff --git a/systray_world_clock/static/description/assets/screenshots/clock1.png b/systray_world_clock/static/description/assets/screenshots/clock1.png new file mode 100644 index 000000000..7974e608b Binary files /dev/null and b/systray_world_clock/static/description/assets/screenshots/clock1.png differ diff --git a/systray_world_clock/static/description/assets/screenshots/clock2.png b/systray_world_clock/static/description/assets/screenshots/clock2.png new file mode 100644 index 000000000..c6e60606d Binary files /dev/null and b/systray_world_clock/static/description/assets/screenshots/clock2.png differ diff --git a/systray_world_clock/static/description/assets/screenshots/clock3.png b/systray_world_clock/static/description/assets/screenshots/clock3.png new file mode 100644 index 000000000..3339ce2ab Binary files /dev/null and b/systray_world_clock/static/description/assets/screenshots/clock3.png differ diff --git a/systray_world_clock/static/description/assets/screenshots/clock4.png b/systray_world_clock/static/description/assets/screenshots/clock4.png new file mode 100644 index 000000000..ef121150f Binary files /dev/null and b/systray_world_clock/static/description/assets/screenshots/clock4.png differ diff --git a/systray_world_clock/static/description/assets/screenshots/hero.gif b/systray_world_clock/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..295ce8f17 Binary files /dev/null and b/systray_world_clock/static/description/assets/screenshots/hero.gif differ diff --git a/systray_world_clock/static/description/banner.png b/systray_world_clock/static/description/banner.png new file mode 100644 index 000000000..b03db03a7 Binary files /dev/null and b/systray_world_clock/static/description/banner.png differ diff --git a/systray_world_clock/static/description/icon.png b/systray_world_clock/static/description/icon.png new file mode 100644 index 000000000..03b038cfc Binary files /dev/null and b/systray_world_clock/static/description/icon.png differ diff --git a/systray_world_clock/static/description/index.html b/systray_world_clock/static/description/index.html new file mode 100644 index 000000000..58681db07 --- /dev/null +++ b/systray_world_clock/static/description/index.html @@ -0,0 +1,635 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+
+ + + +
+
+
+ +

+ Systray World Clock

+

+ The World Clock in the Systray.

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

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ This module adds a world clock in the systray which + displays the time in different countries around the world. +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ + + Different timezones. +
+
+ + Digital and Analogue time. +
+
+ + Shows black theme at night. +
+
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+ +
+

+ Configure the Location and Timezone here.

+ +
+
+

+

+ +
+ +
+

+

+ +
+ +
+

+ The globe icon in systray opens the interface with all the clocks + configured in the settings. The settings button opens the + configuration page. +

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

+ Related + Products +

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

+ Our Services +

+
+ +
+
+
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ 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 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/systray_world_clock/static/src/js/SystrayWorldClock.js b/systray_world_clock/static/src/js/SystrayWorldClock.js new file mode 100644 index 000000000..4929868ac --- /dev/null +++ b/systray_world_clock/static/src/js/SystrayWorldClock.js @@ -0,0 +1,135 @@ +/** @odoo-module **/ + +import { Component, useState, onMounted} from "@odoo/owl"; +import { useService } from "@web/core/utils/hooks"; +import { Dropdown } from "@web/core/dropdown/dropdown"; +import { registry } from "@web/core/registry"; + +export class Analogue extends Component { + static template = "systray_world_clock.AnalogueInterface"; + async setup() { + super.setup(...arguments); + onMounted(() => { + this.renderClock(); + this.intrvl = setInterval(() => { + this.renderClock(); + }, 1000); + }); + } + + calcTime(offset) { + // Calculating time based on the offset + const d = new Date(), + utc = d.getTime() + (d.getTimezoneOffset() * 60000); + const nd = new Date(utc + (3600000 * offset)); + const options = { + year: 'numeric', + month: 'numeric', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + hour12: true + }; + return [nd, nd.toLocaleString('en-US', options)]; + } + + renderClock(){ + //Update the analogue clock time + let [nd, localestring] = this.calcTime(this.props.offset); + let currentClockClass = this.props.currentClockClass; + let h = (nd.getHours() % 12) + nd.getMinutes() / 59; + let m = nd.getMinutes(); + let s = nd.getSeconds(); + h *= 30; + m *= 6; + s *= 6; + const $hoursArr = document.querySelector('.' + currentClockClass + ' .hours'); + const $minutesArr = document.querySelector('.' + currentClockClass + ' .minutes'); + const $secondsArr = document.querySelector('.' + currentClockClass + ' .seconds'); + if($hoursArr){ + $hoursArr.style.transform = `rotate(${h}deg)` + $minutesArr.style.transform = `rotate(${m}deg)` + $secondsArr.style.transform = `rotate(${s}deg)` + } + if (18 <= nd.getHours() || nd.getHours() < 6) { + $('#clocks_container .clock.' + currentClockClass).addClass('night-clock'); + } + else { + $('#clocks_container .' + currentClockClass).removeClass('night-clock'); + } + } +} + +export class WorldClock extends Component { + static components = { Dropdown, Analogue } + static template = "systray_world_clock.Systray_clock"; + async setup() { + // Initialize and fetch the data from the time zone + super.setup(...arguments); + this.orm = useService("orm"); + this.action = useService("action"); + this.state = useState({ + isOpen: false, + notes: [], + + }) + const fields = ['name', 'tz', 'offset']; + const domain = []; + const result = await this.orm.call("systray.world.clock.config", "search_read", [], { + fields: ["name", "tz", "offset"], + domain: [], + }); + this.ClockConfigIds = result; + if (result.length != 0){ + this.state.isOpen = true + } + const data = [] + for (let clock of result) { + let offsetStr = clock.offset.toString().replace('.', '_'); + let currentClockClass = 'clock' + offsetStr; + this.offset = clock.offset + let [nd, localestring] = this.calcTime(clock.offset); + data.push({ + 'id': clock.id, + 'name': clock.name, + 'offset': clock.offset, + 'tz': clock.tz, + 'currentClockClass': currentClockClass + clock.id, + 'nd': nd, + 'localestring': localestring + }); + } + this.state.notes = data; + } + // Calculating time based on the offset + calcTime(offset) { + const d = new Date(), + utc = d.getTime() + (d.getTimezoneOffset() * 60000); + const nd = new Date(utc + (3600000 * offset)); + const options = { + year: 'numeric', + month: 'numeric', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + hour12: true + }; + return [nd, nd.toLocaleString('en-US', options)]; + } + //Settings view for adding the different timezone + onClickSettings(ev) { + ev.stopPropagation(); + this.action.doAction({ + type: 'ir.actions.act_window', + name: 'Clock Settings', + res_model: 'systray.world.clock.config', + view_mode: 'list, form', + views: [[false, 'list'], [false, 'form']] + }); + } +} + +export const systrayItem = { + Component: WorldClock, +}; +registry.category("systray").add("WorldClock", systrayItem, { sequence: 0 }); diff --git a/systray_world_clock/static/src/scss/systray_world_clock.scss b/systray_world_clock/static/src/scss/systray_world_clock.scss new file mode 100644 index 000000000..f15f57325 --- /dev/null +++ b/systray_world_clock/static/src/scss/systray_world_clock.scss @@ -0,0 +1,132 @@ +.systray_clock_dropdown { + padding: 2em; + width: 1100px; +} +.settings_tz { + position: relative; + top: 0.5rem; + color: blueviolet; + background: lavender; + border: aliceblue; + } + + +#clocks_container { + display: flex; + justify-content: space-evenly; + flex-wrap: wrap; + .time-info { + padding: 10px 30px; + margin: 2em 0; + min-height: 50px; + border: 1px solid #dddddd; + border-radius: 10px; + background-color: transparent; + } +} +.clocks_container:not(:last-child) { + padding: 10px; + min-height: 50px; + border-bottom: 1px solid #9DA1AA; + background-color: transparent; +} +.clocks_container > p { + font-size: 20px; +} + +//button +:root { + --primary-light: #8abdff; + --primary: #6d5dfc; + --primary-dark: #5b0eeb; + --white: #FFFFFF; + --greyLight-1: #E4EBF5; + --greyLight-2: #c8d0e7; + --greyLight-3: #bec8e4; + --greyDark: #9baacf; +} +$shadow: .3rem .3rem .6rem var(--greyLight-2), +-.2rem -.2rem .5rem var(--white); +$inner-shadow: inset .2rem .2rem .5rem var(--greyLight-2), +inset -.2rem -.2rem .5rem var(--white); + +/* CLOCK */ +.clock { + grid-column: 2 / 3; + grid-row: 1 / 3; + width: 12rem; + height: 12rem; + justify-self: center; + box-shadow: $shadow; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + position: relative; + .hand { + position: absolute; + transform-origin: bottom; + bottom: 6rem; + border-radius: .2rem; + z-index: 200; + } + .hours { + width: .4rem; + height: 3.2rem; + background: var(--greyLight-3); + + } + .minutes { + width: .4rem; + height: 4.6rem; + background: var(--greyDark); + } + .seconds { + width: .2rem; + height: 5.2rem; + background: var(--primary); + } + .point { + position: absolute; + width: .8rem; + height: .8rem; + border-radius: 50%; + background: var(--primary); + z-index: 300; + } + .in-border { + width: 95%; + height: 95%; + border-radius: 50%; + display: flex; + position: relative; + box-shadow: $inner-shadow; + .center { + width: 60%; + height: 60%; + position: absolute; + box-shadow: inset 1px 1px 1px var(--greyLight-2), + inset -1px -1px 1px var(--white); + border-radius: 50%; + top: 20%; + left: 20%; + filter: blur(1px); + } + div.digit { + position: absolute; + inset: 1px; + text-align: center; + transform: rotate(calc(var(--i) * (360deg / 12))); + span { + display: inline-block; + font-size: 80%; + font-weight: 600; + transform: rotate(calc(var(--i) * (-360deg / 12))); + } + } + } +} +.night-clock { + background-color: black; + color: white; +} diff --git a/systray_world_clock/static/src/xml/systray_world_clock.xml b/systray_world_clock/static/src/xml/systray_world_clock.xml new file mode 100644 index 000000000..f842e83b6 --- /dev/null +++ b/systray_world_clock/static/src/xml/systray_world_clock.xml @@ -0,0 +1,103 @@ + + + + + + + + + + +
+ + + + + + +
+ No clocks configured. Please add a clock + in the + settings. + +
+
+
+
+
+
+ + +
+
+ +

+ + +
+
+ +

+ +
+
+ + + + +
+
+ 1 +
+
+ 2 +
+
+ 3 +
+
+ 4 +
+
+ 5 +
+
+ 6 +
+
+ 7 +
+
+ 8 +
+
+ 9 +
+
+ 10 +
+
+ 11 +
+
+ 12 +
+
+
+
+
+
+ + diff --git a/systray_world_clock/views/systray_world_clock_config_views.xml b/systray_world_clock/views/systray_world_clock_config_views.xml new file mode 100644 index 000000000..e6b7f3b0a --- /dev/null +++ b/systray_world_clock/views/systray_world_clock_config_views.xml @@ -0,0 +1,15 @@ + + + + + systray.world.clock.config.view.tree + systray.world.clock.config + + + + + + + + +