diff --git a/odoo_calculator_tool/README.rst b/odoo_calculator_tool/README.rst new file mode 100755 index 000000000..d5e2ba848 --- /dev/null +++ b/odoo_calculator_tool/README.rst @@ -0,0 +1,49 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + + +Odoo Calculator +=============== +This module helps you to perform basic arithmetic calculations seamlessly within the Odoo interface. + +Configuration +============= +* Nothing to configure. + +License +------- +Lesser General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developers: (V16) Gion Dany, + (V15) Aysha Shalin + 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/odoo_calculator_tool/__init__.py b/odoo_calculator_tool/__init__.py new file mode 100644 index 000000000..626d140e7 --- /dev/null +++ b/odoo_calculator_tool/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################## diff --git a/odoo_calculator_tool/__manifest__.py b/odoo_calculator_tool/__manifest__.py new file mode 100644 index 000000000..e587bfbd8 --- /dev/null +++ b/odoo_calculator_tool/__manifest__.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': "Odoo Calculator", + 'version': '15.0.1.0.0', + 'category': 'Extra Tools', + 'summary': """Perform basic math calculations effortlessly within Odoo.""", + 'description': """This module makes it easy for you to carry out simple + mathematical operations via the Odoo user interface.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['base'], + 'assets': { + 'web.assets_backend': { + 'odoo_calculator_tool/static/src/css/calculator.css', + 'odoo_calculator_tool/static/src/js/calculator.js', + }, + 'web.assets_frontend': { + 'odoo_calculator_tool/static/src/xml/calculator.xml', + }, + }, + 'images': ['static/description/banner.png'], + 'license': "LGPL-3", + 'installable': True, + 'auto_install': False, + 'application': False +} diff --git a/odoo_calculator_tool/doc/RELEASE_NOTES.md b/odoo_calculator_tool/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..a0a6f357a --- /dev/null +++ b/odoo_calculator_tool/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 04.06.2024 +#### Version 15.0.1.0.0 +##### ADD +- Initial commit for Odoo Calculator diff --git a/odoo_calculator_tool/static/description/assets/icons/check.png b/odoo_calculator_tool/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/check.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/chevron.png b/odoo_calculator_tool/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/chevron.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/cogs.png b/odoo_calculator_tool/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/cogs.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/consultation.png b/odoo_calculator_tool/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/consultation.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/ecom-black.png b/odoo_calculator_tool/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/ecom-black.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/education-black.png b/odoo_calculator_tool/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/education-black.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/hotel-black.png b/odoo_calculator_tool/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/hotel-black.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/license.png b/odoo_calculator_tool/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/license.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/lifebuoy.png b/odoo_calculator_tool/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/lifebuoy.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/manufacturing-black.png b/odoo_calculator_tool/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/manufacturing-black.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/pos-black.png b/odoo_calculator_tool/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/pos-black.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/puzzle.png b/odoo_calculator_tool/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/puzzle.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/restaurant-black.png b/odoo_calculator_tool/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/restaurant-black.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/service-black.png b/odoo_calculator_tool/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/service-black.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/trading-black.png b/odoo_calculator_tool/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/trading-black.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/training.png b/odoo_calculator_tool/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/training.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/update.png b/odoo_calculator_tool/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/update.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/user.png b/odoo_calculator_tool/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/user.png differ diff --git a/odoo_calculator_tool/static/description/assets/icons/wrench.png b/odoo_calculator_tool/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/icons/wrench.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/categories.png b/odoo_calculator_tool/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/categories.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/check-box.png b/odoo_calculator_tool/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/check-box.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/compass.png b/odoo_calculator_tool/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/compass.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/corporate.png b/odoo_calculator_tool/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/corporate.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/customer-support.png b/odoo_calculator_tool/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/customer-support.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/cybrosys-logo.png b/odoo_calculator_tool/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/cybrosys-logo.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/features.png b/odoo_calculator_tool/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/features.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/logo.png b/odoo_calculator_tool/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/logo.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/pictures.png b/odoo_calculator_tool/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/pictures.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/pie-chart.png b/odoo_calculator_tool/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/pie-chart.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/right-arrow.png b/odoo_calculator_tool/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/right-arrow.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/star.png b/odoo_calculator_tool/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/star.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/support.png b/odoo_calculator_tool/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/support.png differ diff --git a/odoo_calculator_tool/static/description/assets/misc/whatsapp.png b/odoo_calculator_tool/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/misc/whatsapp.png differ diff --git a/odoo_calculator_tool/static/description/assets/modules/customer_product_qrcode.png b/odoo_calculator_tool/static/description/assets/modules/customer_product_qrcode.png new file mode 100644 index 000000000..71e2150bb Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/modules/customer_product_qrcode.png differ diff --git a/odoo_calculator_tool/static/description/assets/modules/customized_barcode_generator.png b/odoo_calculator_tool/static/description/assets/modules/customized_barcode_generator.png new file mode 100644 index 000000000..e678cb13b Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/modules/customized_barcode_generator.png differ diff --git a/odoo_calculator_tool/static/description/assets/modules/employee_dynamic_fields.png b/odoo_calculator_tool/static/description/assets/modules/employee_dynamic_fields.png new file mode 100644 index 000000000..036bc94b5 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/modules/employee_dynamic_fields.png differ diff --git a/odoo_calculator_tool/static/description/assets/modules/list_view_sticky_header.png b/odoo_calculator_tool/static/description/assets/modules/list_view_sticky_header.png new file mode 100644 index 000000000..8c155b2ee Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/modules/list_view_sticky_header.png differ diff --git a/odoo_calculator_tool/static/description/assets/modules/odoo_website_helpdesk.png b/odoo_calculator_tool/static/description/assets/modules/odoo_website_helpdesk.png new file mode 100644 index 000000000..d4a493e9c Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/modules/odoo_website_helpdesk.png differ diff --git a/odoo_calculator_tool/static/description/assets/modules/todo_list.png b/odoo_calculator_tool/static/description/assets/modules/todo_list.png new file mode 100644 index 000000000..e4d1f254a Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/modules/todo_list.png differ diff --git a/odoo_calculator_tool/static/description/assets/screenshots/1.png b/odoo_calculator_tool/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..d28e29b7b Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/screenshots/1.png differ diff --git a/odoo_calculator_tool/static/description/assets/screenshots/2.png b/odoo_calculator_tool/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..c4ac961e7 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/screenshots/2.png differ diff --git a/odoo_calculator_tool/static/description/assets/screenshots/3.png b/odoo_calculator_tool/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..957aea09b Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/screenshots/3.png differ diff --git a/odoo_calculator_tool/static/description/assets/screenshots/hero.gif b/odoo_calculator_tool/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..4e4061c88 Binary files /dev/null and b/odoo_calculator_tool/static/description/assets/screenshots/hero.gif differ diff --git a/odoo_calculator_tool/static/description/banner.png b/odoo_calculator_tool/static/description/banner.png new file mode 100644 index 000000000..f9e1bb485 Binary files /dev/null and b/odoo_calculator_tool/static/description/banner.png differ diff --git a/odoo_calculator_tool/static/description/icon.png b/odoo_calculator_tool/static/description/icon.png new file mode 100644 index 000000000..150e3106a Binary files /dev/null and b/odoo_calculator_tool/static/description/icon.png differ diff --git a/odoo_calculator_tool/static/description/index.html b/odoo_calculator_tool/static/description/index.html new file mode 100644 index 000000000..5da1370c7 --- /dev/null +++ b/odoo_calculator_tool/static/description/index.html @@ -0,0 +1,638 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ Odoo Calculator

+

+ Perform basic math calculations effortlessly within Odoo.

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

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ This module makes it easy for you to carry out simple + mathematical operations via the Odoo user interface. +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ + User-Friendly Interface. +
+
+
+
+ + Drag-and-Drop Capability. +
+
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+
+

+ Display Calculator +

+

+ Click the calculator icon to show the calculator, and click it + again to hide it. +

+ +
+ +
+

+ Odoo Calculator +

+

+ Allows users to perform basic arithmetic operations.

+ +
+
+

+ Drag-and-Drop +

+

+ Users can click and hold on the calculator's header or any + draggable area to move it to a different location on the Odoo + interface.

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

+ 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/odoo_calculator_tool/static/src/css/calculator.css b/odoo_calculator_tool/static/src/css/calculator.css new file mode 100644 index 000000000..2160d8bb7 --- /dev/null +++ b/odoo_calculator_tool/static/src/css/calculator.css @@ -0,0 +1,110 @@ +.calc-pad-tool { + position: relative; + top: 360px; + left: -524px; +} +.calc_dropdown { + display: inline-block; + position: relative; + background: transparent; + color: rgba(255, 255, 255, 0.9); +} +.calc_dropdown-toggle { + background: none; + border: none; + padding: 0; + cursor: pointer; + padding: 0 0.75rem; + color: whitesmoke; +} +.calc_dropdown-menu { + position: absolute; + top: calc(100% + 5px); + left: 0; + z-index: 1000; + display: none; + padding: 5px 0; + margin: 2px 0 0; + font-size: 14px; + text-align: left; + list-style: none; + min-width: auto; + top: auto; + left: auto; + transform: none; +} +.calculator-app { + width: 320px; + margin: auto; + background-color: #f0f0f7; + padding: 15px; + border-radius: 10px; + box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2); +} +.calculator-app #display { + width: 100%; + height: 60px; + margin-bottom: 10px; + font-size: 32px; + text-align: right; + padding: 10px; + border: none; + background-color: #ececec; + border-radius: 5px; + box-shadow: inset 0px 4px 8px rgba(0, 0, 0, 0.1); +} +.calculator-app .buttons { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 10px; +} +.calculator-app button { + width: 100%; + height: 60px; + font-size: 28px; + border: none; + border-radius: 5px; + background-color: #e4e4e4; + cursor: pointer; + transition: background-color 0.3s, transform 0.2s; +} +.calculator-app .number { + background-color: #fff; +} +.calculator-app .number:hover { + background-color: #d0d0d0; +} +.calculator-app .operator { + background-color: #f0f0f0; + color: #ff9500; +} +.calculator-app .operator:hover { + background-color: #e0e0e0; +} +.calculator-app .equals { + background-color: #ff9500; + grid-column: span 2; + color: #fff; +} +.calculator-app .equals:hover { + background-color: #ff7400; +} +.calculator-app .clear { + background-color: #acacac; + color: #fff; +} +.calculator-app .clear:hover { + background-color: #9a9a9a; +} +.calculator-app .decimal { + background-color: #f0f0f0; +} +.calculator-app .decimal:hover { + background-color: #e0e0e0; +} +#close_btn{ + color: black; + position: relative; + left: 267px; + top: -6px; +} diff --git a/odoo_calculator_tool/static/src/js/calculator.js b/odoo_calculator_tool/static/src/js/calculator.js new file mode 100644 index 000000000..9f10093c0 --- /dev/null +++ b/odoo_calculator_tool/static/src/js/calculator.js @@ -0,0 +1,122 @@ +/** @odoo-module **/ +import SystrayMenu from 'web.SystrayMenu'; +import Widget from 'web.Widget'; + +var CalculatorTool = Widget.extend({ + template: 'CalculatorTool', + xmlDependencies: ['/odoo_calculator_tool/static/src/xml/calculator.xml'], + events: { + // Add your calculator specific events + 'click .number': 'onNumberClick', + 'click .operator': 'onOperatorClick', + 'click .equals': 'onEqualsClick', + 'click .clear': 'onClearClick', + 'click .toggle-sign': 'onToggleSignClick', + 'click .decimal': 'onDecimalClick', + 'click .calc_dropdown': '_onDropdownToggleClick', + 'click #close_btn': 'onCloseBtnClick', + }, + init: function (parent) { + this._super(parent); + this.currentInput = ''; + this.currentOperator = ''; + this.result = 0; + }, + start: function () { + this.$('.calc_dropdown-toggle').click(this._onDropdownToggleClick.bind(this)); + this.$('.draggable-tool').draggable(); + return this._super.apply(this, arguments); + }, + onNumberClick: function (ev) { + // Handles the click event for number buttons. + var number = ev.currentTarget.getAttribute('data-key'); + if (number === '.') { + this.onDecimalClick(ev); + } + else { + this.currentInput += number; + this.$('.display').val(this.currentInput); + } + }, + onOperatorClick: function (ev) { + // Handles the click event for operator buttons. + var operator = ev.currentTarget.getAttribute('data-key'); + if (this.currentInput !== '') { + if (this.currentOperator !== '') { + this.result = this.calculate(this.result, parseFloat(this.currentInput), this.currentOperator); + this.$('.display').val(this.result); + } + else { + this.result = parseFloat(this.currentInput); + } + this.currentInput = ''; + this.currentOperator = operator; + } + }, + onEqualsClick: function () { + // Handles the click event for the equals button. + if (this.currentInput !== '') { + this.result = this.calculate(this.result, parseFloat(this.currentInput), this.currentOperator); + this.$('.display').val(this.result); + this.currentInput = this.result.toString(); + this.currentOperator = ''; + } + }, + onClearClick: function () { + // Handles the click event for the Clear button. + this.result = 0; + this.currentInput = ''; + this.currentOperator = ''; + this.$('.display').val(''); + }, + calculate: function (num1, num2, operator) { + // Performs arithmetic calculations based on the provided operator. + switch (operator) { + case '+': + return num1 + num2; + case '-': + return num1 - num2; + case '*': + return num1 * num2; + case '/': + return num1 / num2; + case '%': + return (num1 / 100) * num2; + default: + return num2; + } + }, + onDecimalClick: function (ev) { + // Handles the click event for the decimal point toggle button + var decimal = ev.currentTarget.getAttribute('data-key'); + if (this.currentInput.indexOf('.') === -1) { + this.currentInput += decimal; + this.$('.display').val(this.currentInput); + } + }, + onToggleSignClick: function () { + if (this.currentInput !== '') { + // Check if the current input is a negative number + if (this.currentInput[0] === '-') { + // Remove the negative sign to make it positive + this.currentInput = this.currentInput.substring(1); + } else { + // Add a negative sign to make it negative + this.currentInput = '-' + this.currentInput; + } + this.$('.display').val(this.currentInput); + } + }, + _onDropdownToggleClick: function () { + // Handles the click event for the dropdown toggle button. + var $dropdownMenu = this.$el.find('.calc_dropdown-menu'); + $dropdownMenu.fadeToggle(); + }, + onCloseBtnClick: function () { + // Handles the click event for the calculator close button. + var $dropdownMenu = this.$el.find('.calc_dropdown-menu'); + $dropdownMenu.hide(); + }, +}); +SystrayMenu.Items.push(CalculatorTool); +export default CalculatorTool; diff --git a/odoo_calculator_tool/static/src/xml/calculator.xml b/odoo_calculator_tool/static/src/xml/calculator.xml new file mode 100644 index 000000000..d82bab25d --- /dev/null +++ b/odoo_calculator_tool/static/src/xml/calculator.xml @@ -0,0 +1,64 @@ + + + + +
+ +
    +
  • +
    +
    +
    + X +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    +
    +
  • +
+
+
+