diff --git a/hrms_dashboard/README.rst b/hrms_dashboard/README.rst new file mode 100644 index 000000000..507ba458f --- /dev/null +++ b/hrms_dashboard/README.rst @@ -0,0 +1,41 @@ +Open HRMS Dashboard v10 +======================= + +Keep your eyes on your whole Human resource analysis. + +Depends +======= +[hr] addon Odoo + +Tech +==== +* [Python] - Models +* [XML] - Odoo views + +Installation +============ +- www.odoo.com/documentation/10.0/setup/install.html +- Install our custom addon + + + +Bug Tracker +=========== +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Credits +======= +* Cybrosys Techno Solutions + +Author +------ + +Developer: Saritha Sahadevan, saritha@cybrosys.in + +Maintainer +---------- + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.openhrms.com + diff --git a/hrms_dashboard/RELEASE_NOTES.md b/hrms_dashboard/RELEASE_NOTES.md new file mode 100644 index 000000000..6311e3f00 --- /dev/null +++ b/hrms_dashboard/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module hrms_dashboard + +#### 30.03.2018 +#### Version 10.0.1.0.0 +##### ADD +- Initial commit for Open HRMS Project diff --git a/hrms_dashboard/__init__.py b/hrms_dashboard/__init__.py new file mode 100644 index 000000000..ed8e46e29 --- /dev/null +++ b/hrms_dashboard/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################### +# A part of Open HRMS Project +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies (). +# Author: Aswani PC , Saritha Sahadevan () +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### +from . import models diff --git a/hrms_dashboard/__manifest__.py b/hrms_dashboard/__manifest__.py new file mode 100644 index 000000000..9e6d4cd2d --- /dev/null +++ b/hrms_dashboard/__manifest__.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +################################################################################### +# A part of Open HRMS Project +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies (). +# Author: Aswani PC , Saritha Sahadevan () +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### +{ + 'name': "Open HRMS Dashboard", + 'version': '10.0.1.0.0', + 'summary': """Open HRMS Dashboard""", + 'description': """Open HRMS Dashboard""", + 'category': 'Human Resource', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.openhrms.com", + 'depends': ['hr', 'hr_holidays', 'hr_timesheet_sheet', 'hr_recruitment'], + 'data': ['views/dashboard_views.xml'], + 'qweb': ["static/src/xml/hrms_dashboard.xml"], + 'images': ["static/description/banner.gif"], + 'license': "AGPL-3", + 'installable': True, + 'application': True, +} diff --git a/hrms_dashboard/models/__init__.py b/hrms_dashboard/models/__init__.py new file mode 100644 index 000000000..be8386cdf --- /dev/null +++ b/hrms_dashboard/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################### +# A part of Open HRMS Project +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies (). +# Author: Aswani PC , Saritha Sahadevan () +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### +from . import hrms_dashboard diff --git a/hrms_dashboard/models/hrms_dashboard.py b/hrms_dashboard/models/hrms_dashboard.py new file mode 100644 index 000000000..04a3357ae --- /dev/null +++ b/hrms_dashboard/models/hrms_dashboard.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +################################################################################### +# A part of Open HRMS Project +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies (). +# Author: Aswani PC, Saritha Sahadevan () +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### +from odoo import models, api, _ +from odoo.http import request + + +class Employee(models.Model): + _inherit = 'hr.employee' + + @api.model + def get_user_employee_details(self): + uid = request.session.uid + employee = self.env['hr.employee'].sudo().search_read([('user_id', '=', uid)], limit=1) + leaves_to_approve = self.env['hr.holidays'].sudo().search_count([('state', 'in', ['confirm', 'validate1']), + ('type', '=', 'remove')]) + leaves_alloc_req = self.env['hr.holidays'].sudo().search_count([('state', 'in', ['confirm', 'validate1']) + , ('type', '=', 'add')]) + timesheets_to_approve = self.env['hr_timesheet_sheet.sheet'].sudo().search_count( + [('state', 'in', ['confirm'])]) + job_applications = self.env['hr.applicant'].sudo().search_count([]) + if employee: + data = { + 'leaves_to_approve': leaves_to_approve, + 'leaves_alloc_req': leaves_alloc_req, + 'timesheets_to_approve': timesheets_to_approve, + 'job_applications': job_applications, + } + employee[0].update(data) + return employee diff --git a/hrms_dashboard/static/description/HRMS-BUTTON.png b/hrms_dashboard/static/description/HRMS-BUTTON.png new file mode 100644 index 000000000..0f1b65bea Binary files /dev/null and b/hrms_dashboard/static/description/HRMS-BUTTON.png differ diff --git a/hrms_dashboard/static/description/banner.jpg b/hrms_dashboard/static/description/banner.jpg new file mode 100644 index 000000000..3652da349 Binary files /dev/null and b/hrms_dashboard/static/description/banner.jpg differ diff --git a/hrms_dashboard/static/description/cybro-service.png b/hrms_dashboard/static/description/cybro-service.png new file mode 100644 index 000000000..252929a86 Binary files /dev/null and b/hrms_dashboard/static/description/cybro-service.png differ diff --git a/hrms_dashboard/static/description/cybro_logo.png b/hrms_dashboard/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/hrms_dashboard/static/description/cybro_logo.png differ diff --git a/hrms_dashboard/static/description/dashboard.png b/hrms_dashboard/static/description/dashboard.png new file mode 100644 index 000000000..64ce246c3 Binary files /dev/null and b/hrms_dashboard/static/description/dashboard.png differ diff --git a/hrms_dashboard/static/description/icon.png b/hrms_dashboard/static/description/icon.png new file mode 100644 index 000000000..91ef06c51 Binary files /dev/null and b/hrms_dashboard/static/description/icon.png differ diff --git a/hrms_dashboard/static/description/index.html b/hrms_dashboard/static/description/index.html new file mode 100644 index 000000000..77871d53e --- /dev/null +++ b/hrms_dashboard/static/description/index.html @@ -0,0 +1,68 @@ +
+
+
+

Open HRMS

+

Most advanced open source HR management software

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

Open HRMS Dashboard

+

Keep your eyes on your whole Human resource analysis

+

Cybrosys Technologies

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

Our Odoo Services

+
+
+ +
+ + +
+

Need Any Help?

+ +
diff --git a/hrms_dashboard/static/src/css/hrms_dashboard.css b/hrms_dashboard/static/src/css/hrms_dashboard.css new file mode 100644 index 000000000..2cbceda5a --- /dev/null +++ b/hrms_dashboard/static/src/css/hrms_dashboard.css @@ -0,0 +1,575 @@ +.o_dashboards{ + padding-top :15px; + background-color: #f8faff !important; +} +.social-box { + min-height: 160px; + margin-bottom: 1.5rem; + text-align: center; + background: #fff; } + .social-box i { + display: block; + margin: -1px -1px 0; + font-size: 40px; + line-height: 90px; + background: #e9ecef; } + .social-box .chart-wrapper { + height: 90px; + margin: -90px 0 0; } + .social-box .chart-wrapper canvas { + width: 100% !important; + height: 90px !important; } + .social-box ul { + padding: 10px 0; + list-style: none; } + .social-box ul li { + display: block; + float: left; + width: 50%; + padding-top: 10px; + font-size: 18px; } + .social-box ul li:first-child { + border-right: 1px solid #c2cfd6; } + .social-box ul li strong { + display: block; + font-size: 20px; } + .social-box ul li span { + font-size: 18px; + font-weight: 500; + color: #949CA0; + text-transform: uppercase; } + .social-box.facebook i { + color: #fff; + background: #3b5998; } + .social-box.twitter i { + color: #fff; + background: #00aced; } + .social-box.linkedin i { + color: #fff; + background: #4875b4; } + .social-box.google-plus i { + color: #fff; + background: #d34836; } + + +.content { + float: left; + padding: 0 20px; + width: 100%; } + +.card { + padding-top: 0px; + padding: 14px; + margin-bottom: 1.5rem; + border-radius: 10px; + box-shadow: 2px 14px 32px 5px rgba(0, 0, 0, 0.02), 0 3px 13px 0px rgba(0, 0, 0, 0.16); + background-color: #fff; + transition: transform 0.2s ease, box-shadow 0.2s ease; + will-change: transform, box-shadow; +} +.card:hover{ + transform: translateY(-5px) translateZ(0); + box-shadow: 0 16px 32px 0 rgba(62,57,107,0.28), 0 0 0 transparent; +} + .card h4 { + font-size: 1.1rem; } + .card .user-header .media img { + border: 5px solid rgba(255, 255, 255, 0.3); + border-radius: 50%; + -webkit-border-radius: 50%; } + .card .card-header .card-actions button { + display: block; + float: left; + width: 50px; + padding: .75rem 0; + margin: 0 !important; + color: #fff; + outline: 0; + text-align: center; + background: transparent; + border: 0; + border-left: 1px solid rgba(120, 130, 140, 0.4); } + .card .card-footer { + padding: 0.65rem 1.25rem; + background-color: #f0f3f5; + border-top: 1px solid #c2cfd6; } + .card .card-footer ul li { + display: table-cell; + padding: 0 1rem; + text-align: center; } + +.breadcrumbs { + margin-top: 0; } + +/* Tabs */ +.nav-tabs a.active { + color: #555; + cursor: default; + background-color: #fff; + border: 1px solid #ddd; + border-bottom-color: transparent; } +.nav-tabs .dropdown .dropdown-menu { + top: 100% !important; } + +.custom-tab .nav-tabs > a.active, .custom-tab .nav-tabs > .active > a:focus, .custom-tab .nav-tabs > li.active > a:hover { + border-color: transparent transparent; + color: #ff2e44; + position: relative; } + +.custom-tab .nav-tabs > a.active > a:after, .custom-tab .nav-tabs > li.active > a:focus:after, .custom-tab .nav-tabs > li.active > a:hover:after { + background: #ff2e44; + bottom: -1px; + content: ""; + height: 2px; + left: 0; + position: absolute; + right: 0; + width: 100%; + z-index: 999; } + +.card .card-header .card-actions { + float: right; } + .card .card-header .card-actions [class*="btn"] { + border-left: 1px solid rgba(120, 130, 140, 0.4); + color: #878787; + display: inline-block; + font-size: 16px; + float: left; + padding: 0 7px; + width: inherit; + text-align: center; } +.left-top-card-body { + display: block; + float: left; + position: relative; +} +.left-bottom-card-body{ + display: block; + float: left; + position: relative; +} +.social-buttons .card-body p button { + padding-top: 0; + padding-left: 0; + padding-bottom: 0; } +.social-buttons .only-icon .card-body p button { + padding: 0; } +.social-buttons .social i { + padding: 0 10px; + width: inherit !important; } +.social-buttons .only-text p button { + padding: 0 .5rem; } + +.buttons button { + margin: 2px 0; } + +/* Ribons */ +.corner-ribon { + text-align: center; + width: 71px; + height: 71px; + position: absolute; + right: 0; + top: 0; + font-size: 20px; } + +.corner-ribon i { + padding: 10px 0 0 35px; + color: #fff; } + +/*.black-ribon {*/ + /*background: url("../../images/twitter_corner_black.png") no-repeat; }*/ + +/*.blue-ribon {*/ + /*background: url("../../images/twitter_corner_blue.png") no-repeat; }*/ + +.twt-feed .wtt-mark { + color: rgba(255, 255, 255, 0.15); + font-size: 160px; + position: absolute; + top: 10px; + left: 40%; } + +.twt-feed { + -webkit-border-radius: 4px 4px 0 0; + color: #FFFFFF; + padding: 40px 10px 10px; + position: relative; + min-height: 170px; } + +.weather-category { + padding: 15px 0; + color: #74829C; } + .weather-category ul li { + width: 32%; + text-align: center; + border-right: 1px solid #e6e6e6; + display: inline-block; } + +.twt-feed.blue-bg { + background: #58C9F3; } + +.twt-category { + display: inline-block; + margin-bottom: 11px; + margin-top: 10px; + width: 100%; } + .twt-category ul li { + color: #bdbdbd; + font-size: 13px; } + +.twt-footer { + padding: 12px 15px; } + +.twt-footer, .twt-footer a { + color: #d2d2d2; } + +/* Button Reset */ +.btn, .button { + display: inline-block; + font-weight: 400; + text-align: center; + white-space: nowrap; + vertical-align: middle; + transition: all .15s ease-in-out; + border-radius: 0; + cursor: pointer; } + +/* Icons */ +.icon-section { + margin: 0 0 3em; + clear: both; + overflow: hidden; } + +.icon-container { + width: 240px; + padding: .7em 0; + float: left; + position: relative; + text-align: left; } + +.icon-container [class^="ti-"], +.icon-container [class*=" ti-"] { + color: #000; + position: absolute; + margin-top: 3px; + transition: .3s; } + +.icon-container:hover [class^="ti-"], +.icon-container:hover [class*=" ti-"] { + font-size: 2.2em; + margin-top: -5px; } + +.icon-container:hover .icon-name { + color: #000; } + +.icon-name { + color: #aaa; + margin-left: 35px; + font-size: 14px; + transition: .3s; } + +.icon-container:hover .icon-name { + margin-left: 45px; } + +.fontawesome-icon-list .page-header { + border-bottom: 1px solid #C9CDD7; + padding-bottom: 9px; + margin: 30px 0px 27px 0px; } +.fontawesome-icon-list h2 { + margin-top: 0; + font-size: 20px; + font-weight: 300; } +.fontawesome-icon-list i { + font-style: italic; + padding-right: 10px; } + +.social-box i { + line-height: 110px; } +.social-box ul { + display: inline-block; + margin: 7px 0 0; + padding: 10px; + width: 100%; } + .social-box ul li { + color: #949CA0; + font-size: 14px; + font-weight: 700; + padding: 0 10px 0 0; + text-align: right; } + .social-box ul li:last-child { + padding-left: 10px; + padding-right: 0; + text-align: left; } + .social-box ul li span { + font-size: 14px; } + +.login-logo { + text-align: center; + margin-bottom: 15px; } + .login-logo span { + color: #ffffff; + font-size: 24px; } + +.login-content { + max-width: 540px; + margin: 8vh auto; } + +.login-form { + background: #ffffff; + padding: 30px 30px 20px; + border-radius: 2px; } + +.login-form h4 { + color: #878787; + text-align: center; + margin-bottom: 50px; } + +.login-form .checkbox { + color: #878787; } + +.login-form .checkbox label { + text-transform: none; } + +.login-form .btn { + width: 100%; + text-transform: uppercase; + font-size: 14px; + padding: 15px; + border: 0px; } + +.login-form label { + color: #878787; + text-transform: uppercase; } + +.login-form label a { + color: #ff2e44; } + +.social-login-content { + margin: 0px -30px; + border-top: 1px solid #e7e7e7; + border-bottom: 1px solid #e7e7e7; + padding: 30px 0px; + background: #fcfcfc; } + +.social-button { + padding: 0 30px; } + .social-button .facebook { + background: #3b5998; + color: #fff; } + .social-button .facebook:hover { + background: #344e86; } + .social-button .twitter { + background: #00aced; + color: #fff; } + .social-button .twitter:hover { + background: #0099d4; } + +.social-button i { + padding: 19px; } + +.register-link a { + color: #ff2e44; } + +.cpu-load { + width: 100%; + height: 272px; + font-size: 14px; + line-height: 1.2em; } + +.cpu-load-data-content { + font-size: 18px; + font-weight: 400; + line-height: 40px; } + +.cpu-load-data { + margin-bottom: 30px; } + +.cpu-load-data li { + display: inline-block; + width: 32.5%; + text-align: center; + border-right: 1px solid #e7e7e7; } + +.cpu-load-data li:last-child { + border-right: 0px; } + +.nestable-cart { + overflow: hidden; } + +/* Forms */ +.input-group-addon { + background-color: transparent; + border-left: 0; } + +.input-group-addon, .input-group-btn { + white-space: nowrap; + vertical-align: middle; } + +.input-group-addon { + padding: .5rem .75rem; + margin-bottom: 0; + font-size: 1rem; + font-weight: 400; + line-height: 1.25; + color: #495057; + text-align: center; + background-color: #e9ecef; + border: 1px solid rgba(0, 0, 0, 0.15); + border-radius: .25rem; } + +.flotTip { + background: #252525; + border: 1px solid #252525; + padding: 5px 15px; + color: #ffffff; } + +.flot-container { + box-sizing: border-box; + width: 100%; + height: 275px; + padding: 20px 15px 15px; + margin: 15px auto 30px; + background: transparent; } + +.flot-pie-container { + height: 275px; } + +.flotBar-container { + height: 275px; } + +.flot-line { + width: 100%; + height: 100%; + font-size: 14px; + line-height: 1.2em; } + +.legend table { + border-spacing: 5px; } + +#chart1, +#flotBar, +#flotCurve { + width: 100%; + height: 275px; } + +.morris-hover { + position: absolute; + z-index: 1; } + +.morris-hover.morris-default-style .morris-hover-row-label { + font-weight: bold; + margin: 0.25em 0; } + +.morris-hover.morris-default-style .morris-hover-point { + white-space: nowrap; + margin: 0.1em 0; } + +.morris-hover.morris-default-style { + border-radius: 2px; + padding: 10px 12px; + color: #666; + background: rgba(0, 0, 0, 0.7); + border: none; + color: #fff !important; } + +.morris-hover-point { + color: rgba(255, 255, 255, 0.8) !important; } + +#morris-bar-chart { + height: 285px; } + +.map, .vmap { + width: 100%; + height: 400px; } + +.btn-toolbar { + float: left !important; } + .btn-toolbar .btn-outline-secondary:not([disabled]):not(.disabled):active, + .btn-toolbar .btn-outline-secondary:not([disabled]):not(.disabled).active, + .btn-toolbar .show > .btn-outline-secondary.dropdown-toggle { + background-color: #212529; + border-color: #212529; + -webkit-box-shadow: none; + box-shadow: none; + color: #fff; } + .btn-toolbar .btn-outline-secondary:hover { + background-color: #212529; + border-color: #212529; + color: #fff; } + +/* Widget One +---------------------------*/ +.dib { + display: inline-block; } + +.stat-widget-one .stat-icon { + vertical-align: top; + margin: auto; + width: 100%; + color: #01c490; +} +.stat-widget-one { + background-color: white; + text-align: center; +} + +.stat-widget-one .stat-icon i { + font-size: 30px; + font-weight: 900; + display: inline-block; + color: #01c490;} + +.stat-widget-one .stat-text { + font-size: 14px; + color: #868e96; } + +.stat-widget-one .stat-digit { + font-size: 24px; + color: #02448b; } + +.stat-count { + font-size: 20px; + text-align: center; + color: #00438b;} + +.stat-title { + font-size: 17px; + text-align: center; + color: #00438b; } + +.bg-flat-color-1 { + background: #20a8d8; } + +.bg-flat-color-2 { + background: #63c2de; } + +.bg-flat-color-3 { + background: #ffc107; } + +.bg-flat-color-4 { + background: #f86c6b; } + +.bg-flat-color-5 { + background: #4dbd74; } + +.mb-0{ + font-size: 20px; + position: relative; + text-align: center; +} +.mb-0 .dash-title { + font-size: 20px; + text-align: center; + color: rgba(255, 255, 255, 0.81); +} +.hr_birthday { + font-size: 28px; + text-align: center; + padding: 20px 0; + color: #00438b; + font-weight: 600; +} +body .text-color { + color: #00438b; +} \ No newline at end of file diff --git a/hrms_dashboard/static/src/js/hrms_dashboard.js b/hrms_dashboard/static/src/js/hrms_dashboard.js new file mode 100644 index 000000000..af73f656f --- /dev/null +++ b/hrms_dashboard/static/src/js/hrms_dashboard.js @@ -0,0 +1,223 @@ +odoo.define('hrms_dashboard.Dashboard', function (require) { +"use strict"; + +var ajax = require('web.ajax'); +var ControlPanelMixin = require('web.ControlPanelMixin'); +var core = require('web.core'); +var Dialog = require('web.Dialog'); +var Model = require('web.Model'); +var session = require('web.session'); +var utils = require('web.utils'); +var web_client = require('web.web_client'); +var Widget = require('web.Widget'); +var session = require('web.session'); +var _t = core._t; +var QWeb = core.qweb; + +var HrDashboard = Widget.extend(ControlPanelMixin, { + template: "hrms_dashboard.HrDashboardMain", + events: { + 'click .hr_leave_request_approve': 'leaves_to_approve', + 'click .hr_leave_allocations_approve': 'leave_allocations_to_approve', + 'click .hr_timesheet_approve': 'timesheets_to_approve', + 'click .hr_job_application_approve': 'job_applications_to_approve', + 'click .hr_payslip':'hr_payslip', + 'click .hr_contract':'hr_contract', + 'click .hr_employee':'hr_employee', + 'click .leaves_request_month':'leaves_request_month', + 'click .leaves_request':'leaves_request' + }, + + init: function(parent, context) { + this._super(parent, context); + this.login_employee = true; + this.employee_birthday = []; + this._super(parent,context); + + }, + + start: function() { + var self = this; + for(var i in self.breadcrumbs){ + self.breadcrumbs[i].title = "Dashboard"; + } + self.update_control_panel({breadcrumbs: self.breadcrumbs}, {clear: true}); + var hr_emp = new Model('hr.employee'); + var model = new Model('hr.employee').call('get_user_employee_details').then(function(result){ + + this.login_employee = result[0]; + $('.o_hr_dashboard').html(QWeb.render('ManagerDashboard', {widget: this})); + $('.o_hr_dashboard').prepend(QWeb.render('LoginEmployeeDetails', {widget: this})); + /*need to check user access levels*/ + session.user_has_group('hr.group_hr_manager').then(function(has_group){ + if(has_group == false){ + $('.employee_dashboard_main').css("display", "none"); + } + }); + }); + var today = new Date().toJSON().slice(0,10).replace(/-/g,'/'); + var employee = new Model('hr.employee').query(['name', 'birthday','image']).filter([['birthday', '!=', false]]) + .order_by('birthday').all().then(function(res){ + for (var i = 0; i < res.length; i++) { + var bday_dt = new Date(res[i]['birthday']); + var bday_month = bday_dt.getMonth(); + var bday_day = bday_dt.getDate(); + var today_dt = new Date( today); + var today_month = today_dt.getMonth(); + var today_day = today_dt.getDate(); + var day = new Date(); + var next_day = new Date(day.setDate(day.getDate() + 7)); + var next_week = next_day.toJSON().slice(0,10).replace(/-/g,'/'); + var bday_date = bday_dt.toJSON().slice(0,10).replace(/-/g,'/');; + if (bday_month == today_month && bday_day >= today_day && next_week >= bday_date){ + self.employee_birthday.push(res[i]); + var flag = 1; + } + } + if (flag !=1){ + self.employee_birthday = false; + } + $('.o_hr_birthday_reminder').html(QWeb.render('BirthdayEventDashboard', {widget: self})); + }); + return this._super().then(function() { + self.$el.parent().addClass('oe_background_grey'); + }); + }, + + hr_payslip: function(e){ + var self = this; + e.stopPropagation(); + e.preventDefault(); + this.do_action({ + name: _t("Employee Payslips"), + type: 'ir.actions.act_window', + res_model: 'hr.payslip', + view_mode: 'tree,form,calendar', + view_type: 'form', + views: [[false, 'list'],[false, 'form']], + target: 'current' + }) + }, + + hr_contract: function(e){ + var self = this; + e.stopPropagation(); + e.preventDefault(); + this.do_action({ + name: _t("Contracts"), + type: 'ir.actions.act_window', + res_model: 'hr.contract', + view_mode: 'tree,form,calendar', + view_type: 'form', + views: [[false, 'list'],[false, 'form']], + target: 'current' + }) + }, + + leaves_request_month: function(e) { + var self = this; + e.stopPropagation(); + e.preventDefault(); + var date = new Date(); + var firstDay = new Date(date.getFullYear(), date.getMonth(), 1); + var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0); + var fday = firstDay.toJSON().slice(0,10).replace(/-/g,'-'); + var lday = lastDay.toJSON().slice(0,10).replace(/-/g,'-'); + this.do_action({ + name: _t("Leave Request"), + type: 'ir.actions.act_window', + res_model: 'hr.holidays', + view_mode: 'tree,form,calendar', + view_type: 'form', + views: [[false, 'list'],[false, 'form']], + domain: [['date_from','>', fday],['state','=','confirm'],['date_from','<', lday]], + target: 'current' + }) + }, + + leaves_request: function(e) { + var self = this; + e.stopPropagation(); + e.preventDefault(); + this.do_action({ + name: _t("Leave Request"), + type: 'ir.actions.act_window', + res_model: 'hr.holidays', + view_mode: 'tree,form,calendar', + view_type: 'form', + views: [[false, 'list'],[false, 'form']], + domain: [['type','=','add']], + target: 'current' + }) + }, + leaves_to_approve: function(e) { + var self = this; + e.stopPropagation(); + e.preventDefault(); + this.do_action({ + name: _t("Leave Request"), + type: 'ir.actions.act_window', + res_model: 'hr.holidays', + view_mode: 'tree,form,calendar', + view_type: 'form', + views: [[false, 'list'],[false, 'form']], + context: {'search_default_approve': true}, + domain: [['type','=','remove'],], + target: 'current' + }) + }, + leave_allocations_to_approve: function(e) { + var self = this; + e.stopPropagation(); + e.preventDefault(); + this.do_action({ + name: _t("Leave Allocation Request"), + type: 'ir.actions.act_window', + res_model: 'hr.holidays', + view_mode: 'tree,form,calendar', + view_type: 'form', + views: [[false, 'list'],[false, 'form']], + context: {'search_default_approve': true}, + domain: [['type','=','add'],], + target: 'current' + }) + }, + + timesheets_to_approve: function(e) { + var self = this; + e.stopPropagation(); + e.preventDefault(); + this.do_action({ + name: _t("Timesheets"), + type: 'ir.actions.act_window', + res_model: 'hr_timesheet_sheet.sheet', + view_mode: 'tree,form', + view_type: 'form', + views: [[false, 'list'],[false, 'form']], + context: {'search_default_to_approve': true}, + target: 'current' + }) + }, + job_applications_to_approve: function(event){ + var self = this; + event.stopPropagation(); + event.preventDefault(); + this.do_action({ + name: _t("Applications"), + type: 'ir.actions.act_window', + res_model: 'hr.applicant', + view_mode: 'tree,kanban,form,pivot,graph,calendar', + view_type: 'form', + views: [[false, 'list'],[false, 'kanban'],[false, 'form'], + [false, 'pivot'],[false, 'graph'],[false, 'calendar']], + context: {}, + target: 'current' + }) + }, +}); + +core.action_registry.add('hr_dashboard', HrDashboard); + +return HrDashboard; + +}); diff --git a/hrms_dashboard/static/src/xml/hrms_dashboard.xml b/hrms_dashboard/static/src/xml/hrms_dashboard.xml new file mode 100644 index 000000000..e55b29680 --- /dev/null +++ b/hrms_dashboard/static/src/xml/hrms_dashboard.xml @@ -0,0 +1,155 @@ + + + +
+
+
+
+
+
+ + +
+
+
+
+
+

+

+ +

+

Leave Request

+
+
+
+
+
+
+

+

+

+

This Month

+
+
+
+
+
+
+

+

+

+

To Approve

+
+
+
+
+
+
+
+

+

+

+

Leave Allocations

+
+
+
+
+
+
+

+

+

+

Job Applications

+
+
+
+
+
+ + + +
+
+ Upcoming Birthdays +
+
+
+ +
+
+
+
+ + + +
+

+

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

+

+
+
+ +
+
+
+
+
+
+
Payslips
+
+
+
+
+
+
+ +
+
+
+
+
+
+
Timesheets
+
+
+
+
+
+
+ +
+
+
+
+
+
+
Contracts
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/hrms_dashboard/views/dashboard_views.xml b/hrms_dashboard/views/dashboard_views.xml new file mode 100644 index 000000000..783945130 --- /dev/null +++ b/hrms_dashboard/views/dashboard_views.xml @@ -0,0 +1,24 @@ + + + + Dashboard + hr_dashboard + + + + + +