diff --git a/fleet_advanced_dashboard/README.rst b/fleet_advanced_dashboard/README.rst new file mode 100755 index 000000000..dc34ad7a5 --- /dev/null +++ b/fleet_advanced_dashboard/README.rst @@ -0,0 +1,47 @@ +.. 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 + +Fleet Dashboard +=============== +In this dashboard you can get all the details about fleet module + +Configuration +============= +* No additional configurations needed + +License +------- +Affero General Public License, Version 3 +`(AGPL v3). +`__ + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developer : (V17) Ajith V, + (V16) Yadhukrishnan, 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/fleet_advanced_dashboard/__init__.py b/fleet_advanced_dashboard/__init__.py new file mode 100644 index 000000000..c702209c8 --- /dev/null +++ b/fleet_advanced_dashboard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Ajith V (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 controllers +from . import models diff --git a/fleet_advanced_dashboard/__manifest__.py b/fleet_advanced_dashboard/__manifest__.py new file mode 100644 index 000000000..95cc26275 --- /dev/null +++ b/fleet_advanced_dashboard/__manifest__.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Ajith V (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": "Fleet Dashboard", + "version": "17.0.1.0.0", + "category": "Industries,Productivity", + "summary": """User can analyse the fleet module in easy ways """, + "description": """In this module can see all tha data related to the fleet + module. Flee dashboard contain the graphical representation of the odometer + values, service cost, vehicle status and service types""", + "author": "Cybrosys Techno Solutions", + "company": "Cybrosys Techno Solutions", + "maintainer": "Cybrosys Techno Solutions", + "website": "https://www.cybrosys.com", + "depends": ["base", "hr", "fleet"], + "data": ["views/fleet_advanced_dashboard_menus.xml"], + "assets": { + "web.assets_backend": [ + "fleet_advanced_dashboard/static/src/xml/fleet_dashboard_templates.xml", + "fleet_advanced_dashboard/static/src/js/fleet_dashboard.js", + "https://www.gstatic.com/charts/loader.js", + "fleet_advanced_dashboard/static/src/css/fleet_dashboard.css" + ], + }, + "images": ["static/description/banner.jpg"], + "license": "AGPL-3", + "installable": True, + "auto_install": False, + "application": False, +} diff --git a/fleet_advanced_dashboard/controllers/__init__.py b/fleet_advanced_dashboard/controllers/__init__.py new file mode 100644 index 000000000..538e169fe --- /dev/null +++ b/fleet_advanced_dashboard/controllers/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Ajith V (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 fleet_advanced_dashboard diff --git a/fleet_advanced_dashboard/controllers/fleet_advanced_dashboard.py b/fleet_advanced_dashboard/controllers/fleet_advanced_dashboard.py new file mode 100644 index 000000000..73b019780 --- /dev/null +++ b/fleet_advanced_dashboard/controllers/fleet_advanced_dashboard.py @@ -0,0 +1,138 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Ajith V (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.http import request + + +class FleetFilter(http.Controller): + """ + The FleetFilter class provides the filter option to the js. + When applying the filter return the corresponding data. + Methods: + fleet_filter(self): + when the page is loaded adding filter options to the selection + field. + return a list variable. + fleet_filter_data(self,**kw): + after applying the filter receiving the values and return the + filtered data. + """ + + @http.route('/fleet/filter', auth='public', type='json') + def fleet_filter(self): + """ + Summary: + transferring data to the selection field that works as a filter + Returns: + type:list of lists , it contains the data for the corresponding + filter. + """ + fleet_vehicle_ids = request.env['fleet.vehicle'].search([]) + driver_list = request.env['res.partner'].search_read([], ['name']) + # Getting vehicles model data + vehicle_list = [{'id': fleet_vehicle_id.model_id.id, + 'name': fleet_vehicle_id.model_id.name} + for fleet_vehicle_id in fleet_vehicle_ids] + vehicle_list = [vehicle for n, vehicle in + enumerate(vehicle_list) if + vehicle not in vehicle_list[:n]] + # Getting vehicles brand data + manufacturers_list = [{'id': fleet_vehicle_id.model_id.brand_id.id, + 'name': fleet_vehicle_id.model_id.brand_id.name} + for fleet_vehicle_id in fleet_vehicle_ids] + manufacturers_list = [manufacturer for n, manufacturer in + enumerate(manufacturers_list) if + manufacturer not in manufacturers_list[:n]] + return {'drivers': driver_list, 'vehicles': vehicle_list, 'manufactures': manufacturers_list} + + @http.route('/fleet_advanced_dashboard/filter_data', auth='public', + type='json') + def fleet_filter_data(self, **kw): + data = kw.get('data') + driver = [partner.id for partner in + request.env['res.partner'].search([])] \ + if data['driver'] == 'null' else [int(data['driver'])] + + vehicle = [fleet_vehicle_id.id for fleet_vehicle_id in + request.env['fleet.vehicle.model'].search([])] \ + if data['vehicle'] == 'null' else [int(data['vehicle'])] + + fleet_vehicle_list = request.env['fleet.vehicle'].search( + [("model_id", 'in', vehicle)]) + + manufacturer = [fleet_vehicle_id.model_id.brand_id.id for + fleet_vehicle_id in fleet_vehicle_list] \ + if data['manufacturer'] == 'null' else [int(data['manufacturer'])] + + if data['date'] == 'null': + fleet_vehicle_odometer_ids = request.env[ + 'fleet.vehicle.odometer'].search( + [("vehicle_id", 'in', fleet_vehicle_list.ids), + ("vehicle_id.brand_id", "in", manufacturer), + ("driver_id", "in", driver)]) + fleet_vehicle_log_contract_ids = request.env[ + 'fleet.vehicle.log.contract'].search( + [("vehicle_id.model_id", 'in', vehicle), + ("vehicle_id.model_id.brand_id", 'in', manufacturer), + ("state", "not in", ['expired', 'closed']), + ("purchaser_id", "in", driver)]) + fleet_vehicle_log_services_ids = request.env[ + 'fleet.vehicle.log.services'].search( + [("vehicle_id.model_id", 'in', vehicle), + ("vehicle_id.model_id.brand_id", 'in', manufacturer), + ("purchaser_id", "in", driver)]) + else: + range_date = date.today() - timedelta(days=int(data['date'])) + fleet_vehicle_odometer_ids = request.env[ + 'fleet.vehicle.odometer'].search( + [("vehicle_id", 'in', fleet_vehicle_list.ids), + ("vehicle_id.brand_id", "in", manufacturer), + ("driver_id", "in", driver), + ("date", ">", range_date)]) + fleet_vehicle_log_contract_ids = request.env[ + 'fleet.vehicle.log.contract'].search( + [("vehicle_id.model_id", 'in', vehicle), + ("vehicle_id.model_id.brand_id", 'in', manufacturer), + ("state", "not in", ['expired', 'closed']), + ("purchaser_id", "in", driver), + ("expiration_date", ">", range_date)]) + fleet_vehicle_log_services_ids = request.env[ + 'fleet.vehicle.log.services'].search( + [("vehicle_id.model_id", 'in', vehicle), + ("vehicle_id.model_id.brand_id", 'in', manufacturer), + ("purchaser_id", "in", driver), + ("date", ">", range_date)]) + + total_odometer = sum(fleet_vehicle_odometer_ids.mapped('value')) + admin_odometer_list = fleet_vehicle_odometer_ids.ids + + service_cost = sum(fleet_vehicle_log_services_ids.mapped('amount')) + admin_fleet_cost_list = fleet_vehicle_log_services_ids.ids + + recurring_cost = sum( + fleet_vehicle_log_contract_ids.mapped('cost_generated')) + admin_recurring_list = fleet_vehicle_log_contract_ids.ids + + return [total_odometer, service_cost, recurring_cost, + admin_odometer_list, admin_fleet_cost_list, + admin_recurring_list, fleet_vehicle_list.ids, vehicle, + manufacturer, len(fleet_vehicle_list.ids)] diff --git a/fleet_advanced_dashboard/doc/RELEASE_NOTES.md b/fleet_advanced_dashboard/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..0a15ec89a --- /dev/null +++ b/fleet_advanced_dashboard/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 16.09.2024 +#### Version 17.0.1.0.0 +##### ADD +- Initial Commit for Fleet Dashboard diff --git a/fleet_advanced_dashboard/models/__init__.py b/fleet_advanced_dashboard/models/__init__.py new file mode 100755 index 000000000..886d43b77 --- /dev/null +++ b/fleet_advanced_dashboard/models/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Yadhukrishnan K (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 fleet_vehicle diff --git a/fleet_advanced_dashboard/models/fleet_vehicle.py b/fleet_advanced_dashboard/models/fleet_vehicle.py new file mode 100755 index 000000000..dd823884c --- /dev/null +++ b/fleet_advanced_dashboard/models/fleet_vehicle.py @@ -0,0 +1,255 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Ajith V (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 api, models + + +class FleetVehicle(models.Model): + """ + The FleetVehicle class provides the data to the js when the dashboard is + loaded. + Methods: + get_tiles_data(self): + when the page is loaded get the data from different models and + transfer to the js file. + return a dictionary variable. + get_graph_data(self, month, flag, model_ids): + month and flag are Integer variables and model_ids is object. + In this methode getting data to the corresponding month from the + model_ids and return + it to the get_tiles_data methode. return a list variable. + """ + _inherit = 'fleet.vehicle' + + @api.model + def get_tiles_data(self): + """ + Summary: + when the page is loaded get the data from different models and + transfer to the js file. + return a dictionary variable. + return: + type:It is a dictionary variable. This dictionary contain data that + affecting the dashboard view. + """ + # Checking login user is manager or not. + if self.env.user.user_has_groups('fleet.fleet_group_manager'): + flag = 1 + fleet_vehicle_odometer_ids = self.env[ + 'fleet.vehicle.odometer'].search([]) + fleet_vehicle_log_services_ids = self.env[ + 'fleet.vehicle.log.services'].search([]) + service_type_list = [['Service Type', 'Total Repair']] + # Getting service type and it's total services. + for fleet_service_type_id in self.env['fleet.service.type'].search( + []): + service_types_list = [fleet_service_type_id.name, + self.env['fleet.vehicle.log.services'] + .search_count([('service_type_id', '=', + fleet_service_type_id.id)])] + if service_types_list not in service_type_list: + service_type_list.append(service_types_list) + fleet_vehicle_log_contract_ids = self.env[ + 'fleet.vehicle.log.contract'].search([]) + filtered_fleet_vehicle_log_contract_ids = \ + fleet_vehicle_log_contract_ids.filtered( + lambda fleet_vehicle_log_contract_id: + fleet_vehicle_log_contract_id.state not in [ + 'expired', + 'closed']) + fleet_model_list = [fleet_vehicle_id.model_id.id for + fleet_vehicle_id in self.env + ['fleet.vehicle'].search([])] + fleet_model_list = [fleet_model for n, fleet_model in + enumerate(fleet_model_list) if + fleet_model not in fleet_model_list[:n]] + fleet_manufacture_list = [fleet_vehicle_id.model_id.brand_id.id for + fleet_vehicle_id in + self.env['fleet.vehicle'].search([])] + fleet_manufacture_list = [fleet_manufacture for n, fleet_manufacture + in enumerate(fleet_manufacture_list) if + fleet_manufacture not in + fleet_manufacture_list[:n]] + return { + 'total_odometer': sum( + fleet_vehicle_odometer_ids.mapped('value')), + 'service_cost': sum( + fleet_vehicle_log_services_ids.mapped('amount')), + 'recurring_cost': sum( + filtered_fleet_vehicle_log_contract_ids.mapped( + 'cost_generated')), + 'all_vehicles': self.env['fleet.vehicle'].search_count([]), + 'service_type': service_type_list, + 'service_cost_list': self.get_graph_data(6, 1, self.env[ + 'fleet.vehicle.log.services'].search([])), + 'odometer_value_list': self.get_graph_data(13, 0, + fleet_vehicle_odometer_ids), + 'fleet_state': [{'id': fleet_vehicle_state_id.id, + 'state': fleet_vehicle_state_id.name, + 'number': self.env[ + 'fleet.vehicle'].search_count( + [('state_id', '=', + fleet_vehicle_state_id.id)])} + for fleet_vehicle_state_id in + self.env['fleet.vehicle.state'].search( + [])], + 'admin_odometer_list': [fleet_vehicle_odometer_id.id + for fleet_vehicle_odometer_id in + fleet_vehicle_odometer_ids], + 'admin_fleet_cost_list': [fleet_vehicle_log_services_id.id for + fleet_vehicle_log_services_id in + fleet_vehicle_log_services_ids], + 'admin_recurring_list': [fleet_vehicle_log_contract_id.id for + fleet_vehicle_log_contract_id in + fleet_vehicle_log_contract_ids if + fleet_vehicle_log_contract_id.state not in [ + 'expired', + 'closed']], + 'fleet_vehicle_list': [fleet_vehicle_id.id for fleet_vehicle_id + in + self.env['fleet.vehicle'].search([])], + 'fleet_model_list': fleet_model_list, + 'fleet_manufacture_list': fleet_manufacture_list, + 'flag': flag, + } + else: + flag = 0 + fleet_vehicle_odometer_ids = self.env[ + 'fleet.vehicle.odometer'].search( + [('vehicle_id.manager_id.id', '=', self.env.uid)]) + # Getting total odometer value. + fleet_vehicle_log_services_ids = self.env[ + 'fleet.vehicle.log.services'].search( + [('vehicle_id.manager_id.id', '=', self.env.uid)]) + # Getting total service cost. + service_type_list = [['Service Type', 'Total Repair']] + # Getting service type and it's total services. + for fleet_service_type_id in self.env['fleet.service.type'].search( + []): + service_types_list = [fleet_service_type_id.name, + self.env['fleet.vehicle.log.services']. + search_count( + [('service_type_id', '=', + fleet_service_type_id.id), + ('vehicle_id.manager_id.id', '=', + self.env.uid)])] + if service_types_list not in service_type_list: + service_type_list.append(service_types_list) + fleet_vehicle_log_contract_ids = self.env[ + 'fleet.vehicle.log.contract'].search([]) + filtered_fleet_vehicle_log_contract_ids = \ + fleet_vehicle_log_contract_ids.filtered( + lambda fleet_vehicle_log_contract_id: + fleet_vehicle_log_contract_id.state not in [ + 'expired', + 'closed']) + fleet_vehicle_ids = self.env['fleet.vehicle'].search([]) + # Getting vehicle status and total number vehicles for the + # Corresponding state. + model_list = [fleet_vehicle_id.model_id.id for fleet_vehicle_id in + fleet_vehicle_ids] + model_list = [model for n, model in enumerate(model_list) if + model not in model_list[:n]] + manufacture_list = [fleet_vehicle_id.model_id.brand_id.id for + fleet_vehicle_id in fleet_vehicle_ids] + manufacture_list = [manufacture for n, manufacture in + enumerate(manufacture_list) if + manufacture not in manufacture_list[:n]] + return { + 'total_odometer': sum( + fleet_vehicle_odometer_ids.mapped('value')), + 'service_cost': sum( + fleet_vehicle_log_services_ids.mapped('amount')), + 'recurring_cost': sum( + filtered_fleet_vehicle_log_contract_ids.mapped( + 'cost_generated')), + 'all_vehicles': self.env['fleet.vehicle'].search_count([]), + 'service_type': service_type_list, + 'service_cost_list': self.get_graph_data(6, 1, self.env[ + 'fleet.vehicle.log.services'].search( + [('vehicle_id.manager_id.id', '=', self.env.uid)])), + 'odometer_value_list': self.get_graph_data(13, 0, + fleet_vehicle_odometer_ids), + 'fleet_state': [{'state': fleet_vehicle_state_id.name, + 'number': self.env[ + 'fleet.vehicle'].search_count( + [('state_id', '=', + fleet_vehicle_state_id.id)])} + for fleet_vehicle_state_id in + self.env['fleet.vehicle.state'].search( + [])], + 'flag': flag, + 'model_list': model_list, + 'manufacture_list': manufacture_list + } + + def get_graph_data(self, month, flag, model_ids): + """ + summary: + In this meth ode getting data to the corresponding month from the + model_ids and return + it to the get_tiles_data methode. + Args: + month(int): This parameter used to calculate the month range. + flag(int): This parameter used to differentiate the need and + performing different functions. + model_ids(obj): This parameter used to identify the model to + performs the function. + Returns: + type:list of lists , it contains the data for the corresponding + month. + """ + data_list = [['Month', '']] + # Getting last "month" range + for i in range(0, month): + previous_month = date.today().replace(day=5) - timedelta( + days=i * 30) + first_day_of_previous_month = previous_month.replace(day=1) + last_day_of_previous_month = previous_month.replace( + day=1) + timedelta(days=32) + last_day_of_previous_month = last_day_of_previous_month.replace( + day=1) - timedelta(days=1) + monthly_service_cost = 0 + if flag == 1: + # Getting data to the corresponding month and append to + # The data_list + for fleet_vehicle_log_services_id in model_ids: + if first_day_of_previous_month < \ + fleet_vehicle_log_services_id.date < \ + last_day_of_previous_month: + monthly_service_cost += \ + fleet_vehicle_log_services_id.amount + data_list.append([ + previous_month.strftime("%b"), monthly_service_cost + ]) + else: + # Getting data to the corresponding month and append to the + # data_list + monthly_odometer_value = 0 + for fleet_vehicle_odometer_id in model_ids: + if first_day_of_previous_month < \ + fleet_vehicle_odometer_id.date < \ + last_day_of_previous_month: + monthly_odometer_value += \ + fleet_vehicle_odometer_id.value + data_list.append( + [previous_month.strftime("%b-%y"), monthly_odometer_value]) + return data_list diff --git a/fleet_advanced_dashboard/static/description/assets/icons/capture (1).png b/fleet_advanced_dashboard/static/description/assets/icons/capture (1).png new file mode 100755 index 000000000..8824deafc Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/capture (1).png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/check.png b/fleet_advanced_dashboard/static/description/assets/icons/check.png new file mode 100755 index 000000000..c8e85f51d Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/check.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/chevron.png b/fleet_advanced_dashboard/static/description/assets/icons/chevron.png new file mode 100755 index 000000000..2089293d6 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/chevron.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/cogs.png b/fleet_advanced_dashboard/static/description/assets/icons/cogs.png new file mode 100755 index 000000000..95d0bad62 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/cogs.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/consultation.png b/fleet_advanced_dashboard/static/description/assets/icons/consultation.png new file mode 100755 index 000000000..8319d4baa Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/consultation.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/ecom-black.png b/fleet_advanced_dashboard/static/description/assets/icons/ecom-black.png new file mode 100755 index 000000000..a9385ff13 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/ecom-black.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/education-black.png b/fleet_advanced_dashboard/static/description/assets/icons/education-black.png new file mode 100755 index 000000000..3eb09b27b Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/education-black.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/hotel-black.png b/fleet_advanced_dashboard/static/description/assets/icons/hotel-black.png new file mode 100755 index 000000000..130f613be Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/hotel-black.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/img.png b/fleet_advanced_dashboard/static/description/assets/icons/img.png new file mode 100755 index 000000000..70197f477 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/img.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/license.png b/fleet_advanced_dashboard/static/description/assets/icons/license.png new file mode 100755 index 000000000..a5869797e Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/license.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/lifebuoy.png b/fleet_advanced_dashboard/static/description/assets/icons/lifebuoy.png new file mode 100755 index 000000000..658d56ccc Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/lifebuoy.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/manufacturing-black.png b/fleet_advanced_dashboard/static/description/assets/icons/manufacturing-black.png new file mode 100755 index 000000000..697eb0e9f Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/manufacturing-black.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/photo-capture.png b/fleet_advanced_dashboard/static/description/assets/icons/photo-capture.png new file mode 100755 index 000000000..06c111758 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/photo-capture.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/pos-black.png b/fleet_advanced_dashboard/static/description/assets/icons/pos-black.png new file mode 100755 index 000000000..97c0f90c1 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/pos-black.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/puzzle.png b/fleet_advanced_dashboard/static/description/assets/icons/puzzle.png new file mode 100755 index 000000000..65cf854e7 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/puzzle.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/restaurant-black.png b/fleet_advanced_dashboard/static/description/assets/icons/restaurant-black.png new file mode 100755 index 000000000..4a35eb939 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/restaurant-black.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/service-black.png b/fleet_advanced_dashboard/static/description/assets/icons/service-black.png new file mode 100755 index 000000000..301ab51cb Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/service-black.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/trading-black.png b/fleet_advanced_dashboard/static/description/assets/icons/trading-black.png new file mode 100755 index 000000000..9398ba2f1 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/trading-black.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/training.png b/fleet_advanced_dashboard/static/description/assets/icons/training.png new file mode 100755 index 000000000..884ca024d Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/training.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/update.png b/fleet_advanced_dashboard/static/description/assets/icons/update.png new file mode 100755 index 000000000..ecbc5a01a Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/update.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/user.png b/fleet_advanced_dashboard/static/description/assets/icons/user.png new file mode 100755 index 000000000..6ffb23d9f Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/user.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/icons/wrench.png b/fleet_advanced_dashboard/static/description/assets/icons/wrench.png new file mode 100755 index 000000000..6c04dea0f Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/icons/wrench.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/misc/Cybrosys R.png b/fleet_advanced_dashboard/static/description/assets/misc/Cybrosys R.png new file mode 100755 index 000000000..da4058087 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/misc/Cybrosys R.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/misc/email.svg b/fleet_advanced_dashboard/static/description/assets/misc/email.svg new file mode 100755 index 000000000..15291cdc3 --- /dev/null +++ b/fleet_advanced_dashboard/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fleet_advanced_dashboard/static/description/assets/misc/phone.svg b/fleet_advanced_dashboard/static/description/assets/misc/phone.svg new file mode 100755 index 000000000..b7bd7f251 --- /dev/null +++ b/fleet_advanced_dashboard/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/fleet_advanced_dashboard/static/description/assets/misc/star (1) 2.svg b/fleet_advanced_dashboard/static/description/assets/misc/star (1) 2.svg new file mode 100755 index 000000000..5ae9f507a --- /dev/null +++ b/fleet_advanced_dashboard/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/fleet_advanced_dashboard/static/description/assets/misc/support (1) 1.svg b/fleet_advanced_dashboard/static/description/assets/misc/support (1) 1.svg new file mode 100755 index 000000000..7d37a8f30 --- /dev/null +++ b/fleet_advanced_dashboard/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/fleet_advanced_dashboard/static/description/assets/misc/support-email.svg b/fleet_advanced_dashboard/static/description/assets/misc/support-email.svg new file mode 100755 index 000000000..eb70370d6 --- /dev/null +++ b/fleet_advanced_dashboard/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/fleet_advanced_dashboard/static/description/assets/misc/tick-mark.svg b/fleet_advanced_dashboard/static/description/assets/misc/tick-mark.svg new file mode 100755 index 000000000..2dbb40187 --- /dev/null +++ b/fleet_advanced_dashboard/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/fleet_advanced_dashboard/static/description/assets/misc/whatsapp 1.svg b/fleet_advanced_dashboard/static/description/assets/misc/whatsapp 1.svg new file mode 100755 index 000000000..0bfaf8fc6 --- /dev/null +++ b/fleet_advanced_dashboard/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/fleet_advanced_dashboard/static/description/assets/misc/whatsapp.svg b/fleet_advanced_dashboard/static/description/assets/misc/whatsapp.svg new file mode 100755 index 000000000..b618aea1d --- /dev/null +++ b/fleet_advanced_dashboard/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fleet_advanced_dashboard/static/description/assets/modules/l1.png b/fleet_advanced_dashboard/static/description/assets/modules/l1.png new file mode 100755 index 000000000..50c7e6849 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/modules/l1.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/modules/l2.png b/fleet_advanced_dashboard/static/description/assets/modules/l2.png new file mode 100755 index 000000000..5197aa78f Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/modules/l2.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/modules/l3.png b/fleet_advanced_dashboard/static/description/assets/modules/l3.png new file mode 100755 index 000000000..f89729d87 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/modules/l3.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/modules/l4.png b/fleet_advanced_dashboard/static/description/assets/modules/l4.png new file mode 100755 index 000000000..b7fbcc744 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/modules/l4.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/modules/l5.png b/fleet_advanced_dashboard/static/description/assets/modules/l5.png new file mode 100755 index 000000000..f147b824f Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/modules/l5.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/modules/l6.png b/fleet_advanced_dashboard/static/description/assets/modules/l6.png new file mode 100755 index 000000000..1ab575f00 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/modules/l6.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/screenshots/1.png b/fleet_advanced_dashboard/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..c0c86cb18 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/screenshots/1.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/screenshots/2.png b/fleet_advanced_dashboard/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..b1b0010e3 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/screenshots/2.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/screenshots/3.png b/fleet_advanced_dashboard/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..5c9a292ef Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/screenshots/3.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/screenshots/4.png b/fleet_advanced_dashboard/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..a732e581a Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/screenshots/4.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/screenshots/5.png b/fleet_advanced_dashboard/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..890efb721 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/screenshots/5.png differ diff --git a/fleet_advanced_dashboard/static/description/assets/screenshots/hero-v17.gif b/fleet_advanced_dashboard/static/description/assets/screenshots/hero-v17.gif new file mode 100644 index 000000000..d7f83baa1 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/assets/screenshots/hero-v17.gif differ diff --git a/fleet_advanced_dashboard/static/description/banner.jpg b/fleet_advanced_dashboard/static/description/banner.jpg new file mode 100644 index 000000000..08c6ee249 Binary files /dev/null and b/fleet_advanced_dashboard/static/description/banner.jpg differ diff --git a/fleet_advanced_dashboard/static/description/icon.png b/fleet_advanced_dashboard/static/description/icon.png new file mode 100644 index 000000000..f0f00597c Binary files /dev/null and b/fleet_advanced_dashboard/static/description/icon.png differ diff --git a/fleet_advanced_dashboard/static/description/index.html b/fleet_advanced_dashboard/static/description/index.html new file mode 100755 index 000000000..98b8b82a1 --- /dev/null +++ b/fleet_advanced_dashboard/static/description/index.html @@ -0,0 +1,752 @@ + + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ Fleet Dashboard

+

+ In this dashboard you can get all the details about fleet + module. +

+
+ +
+
+
+
+
+

+ Key Highlights +

+
+
+
+
+
+ +
+
+

+ This module provides the detailed graph view of + Odoometer

+
+
+
+
+
+
+ +
+
+

+ The module provides the view of the service cost + in last six months.

+
+
+
+
+
+
+ +
+
+

+ Can see Drivers and Contracts information.

+
+
+
+
+
+
+ +
+
+

+ User can get details about Vehicles, + Manufacturers, Models and Vehicle Status

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

+ Dynamic And Clickable Dashboard Tiles +

+

+ Users can click the tiles, which display a + detailed view of the corresponding tiles. +

+
+
+
+
+
+
+ +
+
+

+ Dynamic Filters +

+

Users can apply the filters based on their + requirements. +

+
+
+
+
+
+
+ +
+
+

+ Different Types of Graphs +

+

The Fleet Dashboard has different types of graphs that will give you a complete analysis of the Fleet Module. +

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

+ Vehicle Table +

+

User can see all vehicles and its current status. +

+
+
+
+
+
+
+
    +
  • + Community & + Enterprise Support +
  • +
  • + Additional + Configuration +
  • +
  • + Delivery Status +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:16th September 2024 +
+

+ Initial Commit for Delivery Status on Sale + Order

+
+
+
+
+
+
+
+

+ 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/fleet_advanced_dashboard/static/src/css/fleet_dashboard.css b/fleet_advanced_dashboard/static/src/css/fleet_dashboard.css new file mode 100644 index 000000000..7123ac33a --- /dev/null +++ b/fleet_advanced_dashboard/static/src/css/fleet_dashboard.css @@ -0,0 +1,222 @@ +.fleet_select{ + width:200px; + margin-right:10px; + margin-left:10px; + background-color:#827c93; !important; + color: #fff; + padding-left:7px; +} +.content_fleet_external{ + transition: 0.5s; + box-shadow: 5px 5px 30px; +} +.card-body{ + margin-bottom:10px; +} +.content_fleet_external:hover{ + transform: translateY(-5px); + box-shadow: 10px 10px 10px; + cursor:pointer; +} +.fleet_content{ + height:auto; +} +.fleet_main{ + margin-top: 40px; + margin-left: 2%; + width:96%; +} +.fleet_content_main{ + margin-left:10px; + height:24vh; +} +.fleet_content_graph{ + margin-left:10px; + height:24vh; +} +.fleet_content_graph_inner{ + height:20vh; +} +.fleet_img_content{ + width=170px; + height:170px; + margin-left:30px; + margin-top:10px; +} +.fleet_other_info{ + height:14vh; + margin-left:10px; + margin-bottom:10px; +} +.o_action_manager { + overflow: auto !important; +} +.oh_dashboards{ + overflow-y: scroll; + -moz-overflow-y: scroll; + -webkit-overflow-y: scroll; + -ms-overflow-y: scroll; + -o-overflow-y: scroll; + vertical-align: middle; + overflow-x: clip; + max-height: -webkit-fill-available; + background-color:#FFF; +} +#table_status { + width: 80%; + margin-left: 49px; + margin-top: 30px; + font-family: Arial, Helvetica, sans-serif; +} +#table_status tr:nth-child(even){background-color: #f2f2f2;} +#table_status tr:hover {background-color: #ddd;} +.fleet-pill { + align-items: center; + font-family: "Open Sans", Arial, Verdana, sans-serif; + font-weight: bold; + font-size: 11px; + display: inline-block; + height: 100%; + white-space: nowrap; + width: auto; + position: relative; + border-radius: 100px; + line-height: 1; + overflow: hidden; + padding: 0px 8px 0px 7px; + text-overflow: ellipsis; + line-height: 1.25rem; + color: #fff; + word-break: break-word; + background: #0253e8; +} +.fleet_content_titles { + text-align: center; + margin-top: 74px; + margin-left: -18px; +} +.align_center{ + text-align:center; +} +.fleet_container { + padding: 50px 0; + text-align: center; +} +.chart { + position: relative; + display: inline-block; + color: #999; + font-size: 20px; + text-align: center; + margin-top: -43px; + margin-left:-4px; + } +.chart figcaption { + padding: 50px 25px; + width: 190px; + height: 190px; + border: 20px solid #f0e4eb; + border-radius: 100px; + line-height: 50px; +} +.chart img { + position: absolute; + max-width: 100px; + max-height: 100px; + background: white; +} +.img_ext { + top: 50px; + left: 45px; +} +.chart svg { + position: absolute; + top: 0; + left: 0; +} +.outer { + fill: transparent; + stroke: #333; + stroke-width: 20; + stroke-dasharray: 534; + transition: stroke-dashoffset 2s; + -webkit-animation-play-state: running; + /* firefox bug fix - won't rotate at 90deg angles */ + -moz-transform: rotate(-89deg) translateX(-190px); +} +.chart:hover .outer { + stroke-dashoffset: 534 !important; + -webkit-animation-play-state: paused; +} +/* END Circle colors and graphic positions */ +.chart[data-percent='75'] .outer { + stroke-dashoffset: 133; + -webkit-animation: show75 3s; + animation: show75 3s; +} +.fleet_icon-div{ + font-size:25px; + color:#fff; + background-color:#ffac00; + height:14vh; +} +.fleet_icon-content{ + height:24vh; + font-size:40px; + } +.fleet_icon-content i{ + margin-top:9vh; + color:#fff; +} +.fleet_border-content{ + background-color: #fff; + border: solid; + border-width: 1px; +} +@-webkit-keyframes show75 { + from { + stroke-dashoffset: 537; + } + to { + stroke-dashoffset: 134; + } +} +@keyframes show75 { + from { + stroke-dashoffset: 537; + } + to { + stroke-dashoffset: 124; + } +} +@media (min-width: 1374px) and (max-width: 1873px){ + .fleet_content_graph{ + width:64% !important; + } + .fleet_content_main{ + width:31.5% !important; + } + .fleet_img_content{ + margin-left:0px; + } +} +@media (min-width: 1024px) and (max-width: 1374px){ + .fleet_content_graph{ + width:64% !important; + } + .fleet_content_main{ + width:31.5% !important; + } + .fleet_img_content{ + width:96%; + margin-left:0px; + height:auto !important; + } + .card-body:first-child{ + + display:flex; + align-items:center; + max-width:110px; + + } + } diff --git a/fleet_advanced_dashboard/static/src/js/fleet_dashboard.js b/fleet_advanced_dashboard/static/src/js/fleet_dashboard.js new file mode 100644 index 000000000..4187f8a42 --- /dev/null +++ b/fleet_advanced_dashboard/static/src/js/fleet_dashboard.js @@ -0,0 +1,269 @@ +/** @odoo-module **/ +import {Component,useState,useRef,onWillStart,onMounted} from "@odoo/owl"; +import {registry} from "@web/core/registry"; +import { jsonrpc } from "@web/core/network/rpc_service"; +import { useService } from "@web/core/utils/hooks"; +/** + * DashboardAction component handles the display and interaction + * of the fleet management dashboard. It manages data fetching, + * filtering, and displaying charts and lists. + */ +export class DashboardAction extends Component { + /** + * Initializes component state and fetches initial data. + */ + async setup(){ + this.state = useState({ + flag:null, + admin_odometer_list:[], + admin_fleet_cost_list:[], + admin_recurring_list:[], + fleet_vehicle_list:[], + fleet_model_list:[], + fleet_manufacture_list:[], + odometer_value:null, + service_value:null, + recurring_value:null, + all_vehicles:null, + fleet_state:[], + manufacture_list:[], + model_list:[], + data: { + "drivers": [], + "vehicles": [], + "manufactures": [] + } + }) + this.filter = useRef("filters") + this.fleet_main = useRef("fleet_main") + this.action = useService("action"); + this.fetch_data(); + this.state.data = await this.render_filter(); + } + /** + * Handles filter change events and updates the dashboard data. + */ + _onchangeFilter(){ + var self = this; + jsonrpc('/fleet_advanced_dashboard/filter_data', { + 'data':{ + "date": this.filter.el.querySelector('#date_filter').value, + 'vehicle':this.filter.el.querySelector('#vehicle_selection').value, + 'driver':this.filter.el.querySelector('#driver_selection').value, + 'manufacturer':this.filter.el.querySelector('#manufacturers_selection').value + } + }).then(function(result){ + self.state.admin_odometer_list = result[3], + self.state.admin_fleet_cost_list = result[4], + self.state.admin_recurring_list = result[5], + self.state.fleet_vehicle_list = result[6], + self.state.fleet_model_list = result[7], + self.state.fleet_manufacture_list=result[8], + self.state.odometer_value=result[0], + self.state.service_value=result[1], + self.state.recurring_value=result[2] + }); + } + + /** + * Opens the Manufacturers view based on the current state. + */ + _onClickManufacturers(){ + if (this.state.flag == 1) { + this.OpenVehicleModelBrand(this.state.fleet_manufacture_list) + } + else{ + this.OpenVehicleModelBrand(this.state.fleet_manufacture_list) + } + } + + /** + * Opens the vehicle model brand view with a specific domain. + * @param {Array} domain - The domain to filter the records. + */ + OpenVehicleModelBrand(domain){ + this.action.doAction({ + type: 'ir.actions.act_window', + name: 'Manufacturers', + res_model: 'fleet.vehicle.model.brand', + domain: [["id", "in", domain]], + view_mode: 'kanban', + views: [[false, 'kanban'],[false, 'form']], + target: 'self' + }); + } + + /** + * Opens the Models view based on the current state. + */ + _onClickModels(){ + if (this.state.flag == 1){ + this.OpenVehicleModel(this.state.fleet_model_list) + } + else{ + this.OpenVehicleModel(this.state.fleet_model_list) + } + } + /** + * Opens the vehicle model view with a specific domain. + * @param {Array} domain - The domain to filter the records. + */ + OpenVehicleModel(domain){ + this.action.doAction({ + type: 'ir.actions.act_window', + name: 'Models', + res_model: 'fleet.vehicle.model', + domain: [["id", "in", domain]], + view_mode: 'kanban', + views: [[false, 'kanban'],[false, 'form']], + target: 'self' + }); + } + /** + * Opens the Vehicles view based on the current state. + */ + _onClickVehicles(){ + if (this.state.flag == 1) { + this.action.doAction({ + type: 'ir.actions.act_window', + name: 'Vehicles', + res_model: 'fleet.vehicle', + view_mode: 'kanban', + views: [[false, 'kanban'],[false, 'form']], + domain: [["id", "in", this.state.fleet_vehicle_list]], + target: 'self' + }); + } + } + /** + * Opens the Contracts view based on the current state. + */ + _onClickContracts() { + if (this.state.flag == 1) { + this.action.doAction({ + type: 'ir.actions.act_window', + name: 'Vehicles', + res_model: 'fleet.vehicle.log.contract', + domain: [["id", "in", this.state.admin_recurring_list]], + view_mode: 'kanban', + views: [[false, 'list'],[false, 'form']], + target: 'self' + }); + } + } + /** + * Opens the Services view based on the current state. + */ + _onClickServices(){ + if (this.state.flag == 1) { + this.action.doAction({ + type: 'ir.actions.act_window', + name: 'Services', + res_model: 'fleet.vehicle.log.services', + domain: [["id", "in", this.state.admin_fleet_cost_list]], + view_mode: 'list', + views: [[false, 'list'],[false, 'form']], + target: 'self' + }) + } + } + /** + * Opens the Odometers view based on the current state. + */ + _onClickOdoMeter(){ + if (this.state.flag == true) { + this.action.doAction({ + type: 'ir.actions.act_window', + name: 'Odometers', + res_model: 'fleet.vehicle.odometer', + domain: [["id", "in", this.state.admin_odometer_list]], + view_mode: 'list', + views: [[false, 'list'],[false, 'form']], + target: 'self' + }) + } + } + /** + * Fetches filter data for the dashboard. + * @returns {Object} The filter data including drivers, vehicles, and manufactures. + */ + async render_filter(){ + const { drivers, vehicles, manufactures } = await jsonrpc('/fleet/filter', {}) + return { drivers, vehicles, manufactures} + } + /** + * Fetches data for the dashboard and draws charts. + */ + fetch_data(){ + var self = this; + var def1 = jsonrpc('/web/dataset/call_kw', { + model: 'fleet.vehicle', + method: 'get_tiles_data', + args: [], + kwargs: {} + }).then(function(result) { + self.state.odometer_value = result['total_odometer'], + self.state.service_value = result['service_cost'], + self.state.recurring_value = result['recurring_cost'], + self.state.all_vehicles = result['all_vehicles'], + self.state.fleet_state = result['fleet_state'], + self.state.flag = result['flag'] + if (self.state.flag == 0) { + self.state.manufacture_list = result['manufacture_list'], + self.state.model_list = result['model_list'] + } + else{ + self.state.admin_odometer_list = result['admin_odometer_list'], + self.state.admin_fleet_cost_list = result['admin_fleet_cost_list'], + self.state.admin_recurring_list = result['admin_recurring_list'], + self.state.fleet_vehicle_list = result['fleet_vehicle_list'], + self.state.fleet_model_list = result['fleet_model_list'], + self.state.fleet_manufacture_list = result['fleet_manufacture_list'] + } + google.charts.load('current', { + 'packages': ['corechart'] + }); + google.charts.setOnLoadCallback(drawChart); + function drawChart() { + try{ + var data = google.visualization.arrayToDataTable(result['odometer_value_list']); + var options = { + title: 'Odometer Reading Monthly Wise', + hAxis: {title: 'Month'}, + vAxis: {title: 'Odometer Values'}, + legend: 'none', + pointsVisible: true, + } + var line_chart = new google.visualization.LineChart(self.fleet_main.el.querySelector('#lineChart')); + line_chart.draw(data, options); + var service_data = google.visualization.arrayToDataTable(result['service_type']); + var service_options = { + title: 'Service Types', + pieHole: 0.4 + }; + var service_chart = new google.visualization.PieChart(self.fleet_main.el.querySelector('#service_Chart')); + service_chart.draw(service_data, service_options); + var data = google.visualization.arrayToDataTable(result['service_cost_list']); + var options = { + title: ' Service Cost Last Six Months', + vAxis: { + gridlines: {color: 'transparent'}, + title: 'Service Cost' + }, + legend: 'none', + }; + var chart = new google.visualization.ColumnChart(self.fleet_main.el.querySelector('#barChart')); + chart.draw(data, options); + } + catch (e) { + self.fetch_data(); + } + } + }); + return $.when(def1); + } +} + +DashboardAction.template = "fleet_advanced_dashboard.FleetDashBoard" + +registry.category("actions").add("dashboard_action", DashboardAction); diff --git a/fleet_advanced_dashboard/static/src/xml/fleet_dashboard_templates.xml b/fleet_advanced_dashboard/static/src/xml/fleet_dashboard_templates.xml new file mode 100644 index 000000000..e035c58b1 --- /dev/null +++ b/fleet_advanced_dashboard/static/src/xml/fleet_dashboard_templates.xml @@ -0,0 +1,400 @@ + + + + +
+
+ +
+

Date Range :

+

+ +

+

Driver :

+

+ +

+

Vehicle Model :

+

+ +

+

Vehicle Manufacturers :

+

+ +

+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
VEHICLES +
+

Total + Vehicles + +

+
+
+
+
+
+
+
+ +
+
+
+
+ MANUFACTURERS +
+
+
+
+
+
+
+
+ +
+
+
+
MODELS +
+
+
+
+
+
+
+
+
+
+ +
+
+
+

Odometer +

+

+ Show All Odometer Value +

+
+
+
+
+
+
+
+ +
+
+

+ Total Odometer value +

+

+ +

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

Service + Cost +

+

+ Show All Service Cost +

+
+
+
+
+
+
+
+ +
+
+

+ Total Service Cost +

+

+ +

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

Recurring + Cost +

+

+ Show All Contracts +

+
+
+
+
+
+
+
+ +
+
+

+ Total Recurring Cost +

+

+ +

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

Vehicle + Status +

+
+ + + + + + + +
+

+

+

+

+
+
+
+
+
+
+
diff --git a/fleet_advanced_dashboard/views/fleet_advanced_dashboard_menus.xml b/fleet_advanced_dashboard/views/fleet_advanced_dashboard_menus.xml new file mode 100644 index 000000000..7bac2f78a --- /dev/null +++ b/fleet_advanced_dashboard/views/fleet_advanced_dashboard_menus.xml @@ -0,0 +1,15 @@ + + + + + Dashboard + dashboard_action + current + + + +