Commit ef1e808a by Kunto Bregananta Adi

test custom layout/styles for the dashboard

1 parent f608f07b
from odoo import models, api
from datetime import datetime
class PadDashboard(models.Model):
_inherit = ''
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
var radialoptions = {
series: [72],
chart: {
type: 'radialBar',
width: 72,
height: 72,
sparkline: {
enabled: true
}
},
dataLabels: {
enabled: false
},
colors: ['#0ab39c'],
stroke: {
lineCap: 'round'
},
plotOptions: {
radialBar: {
hollow: {
margin: 0,
size: '70%'
},
track: {
margin: 0,
},
dataLabels: {
name: {
show: false
},
value: {
offsetY: 5,
show: true
}
}
}
}
};
var radialchart = new ApexCharts(document.querySelector("#radialchart-1"), radialoptions);
radialchart.render();
// Radialchart 2
var radialoptions = {
series: [45],
chart: {
type: 'radialBar',
width: 72,
height: 72,
sparkline: {
enabled: true
}
},
dataLabels: {
enabled: false
},
colors: ['#0ab39c'],
stroke: {
lineCap: 'round'
},
plotOptions: {
radialBar: {
hollow: {
margin: 0,
size: '70%'
},
track: {
margin: 0,
},
dataLabels: {
name: {
show: false
},
value: {
offsetY: 5,
show: true
}
}
}
}
};
var radialchart = new ApexCharts(document.querySelector("#radialchart-2"), radialoptions);
radialchart.render();
// Radialchart 3
var radialoptions = {
series: [54],
chart: {
type: 'radialBar',
width: 72,
height: 72,
sparkline: {
enabled: true
}
},
dataLabels: {
enabled: false
},
colors: ['#0ab39c'],
stroke: {
lineCap: 'round'
},
plotOptions: {
radialBar: {
hollow: {
margin: 0,
size: '70%'
},
track: {
margin: 0,
},
dataLabels: {
name: {
show: false
},
value: {
offsetY: 5,
show: true
}
}
}
}
};
var radialchart = new ApexCharts(document.querySelector("#radialchart-3"), radialoptions);
radialchart.render();
\ No newline at end of file
odoo.define('idg_dashboard.pad_dashboard', function (require) {
"use strict";
var AbstractAction = require('web.AbstractAction');
var core = require('web.core');
var QWeb = core.qweb;
var PadDashboard = AbstractAction.extend({
template: 'Dashboard',
init: function(parent, context) {
this._super(parent, context);
this.dashboard_templates = [
'DashboardTop',
];
this.pad_total_nasional = [];
},
start: function() {
var self = this;
this.set("title", "Dashboard");
return this._super().then(function() {
self.render_dashboards();
});
},
render_dashboards: function() {
var self = this;
_.each(this.dashboard_templates, function(template) {
self.$('.o_pad_dashboard').append(QWeb.render(template, {widget: self}));
});
},
fetch_data: function() {
// to do : fetching the data
},
});
core.action_registry.add('pad_dashboard_tag', PadDashboard);
return PadDashboard;
});
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">
<t t-name="Dashboard">
<div class="oh_dashboards">
<div class="container-fluid o_pad_dashboard">
</div>
</div>
</t>
<t t-name="DashboardTop">
<div class="row">
<div class="col-xl-3 col-sm-6">
<div class="card">
<div class="card-body">
<div class="d-flex text-muted">
<div class="flex-shrink-0 me-3 align-self-center">
<div id="radialchart-1" class="apex-charts" dir="ltr"></div>
</div>
<div class="flex-grow-1 overflow-hidden">
<p class="mb-1">Users</p>
<h5 class="mb-3">2.2k</h5>
<p class="text-truncate mb-0"><span class="text-success me-2"> 0.02% <i class="ri-arrow-right-up-line align-bottom ms-1"></i></span> From previous</p>
</div>
</div>
</div>
<!-- end card-body -->
</div>
<!-- end card -->
</div>
<!-- end col -->
<div class="col-xl-3 col-sm-6">
<div class="card">
<div class="card-body">
<div class="d-flex">
<div class="flex-shrink-0 me-3 align-self-center">
<div id="radialchart-2" class="apex-charts" dir="ltr"></div>
</div>
<div class="flex-grow-1 overflow-hidden">
<p class="mb-1">Views per minute</p>
<h5 class="mb-3">50</h5>
<p class="text-truncate mb-0"><span class="text-success me-2"> 1.7% <i class="ri-arrow-right-up-line align-bottom ms-1"></i></span> From previous</p>
</div>
</div>
</div>
<!-- end card-body -->
</div>
<!-- end card -->
</div>
<!-- end col -->
<div class="col-xl-3 col-sm-6">
<div class="card">
<div class="card-body">
<div class="d-flex text-muted">
<div class="flex-shrink-0 me-3 align-self-center">
<div id="radialchart-3" class="apex-charts" dir="ltr"></div>
</div>
<div class="flex-grow-1 overflow-hidden">
<p class="mb-1">Bounce Rate</p>
<h5 class="mb-3">24.03 %</h5>
<p class="text-truncate mb-0"><span class="text-danger me-2"> 0.01% <i class="ri-arrow-right-down-line align-bottom ms-1"></i></span> From previous</p>
</div>
</div>
</div>
<!-- end card-body -->
</div>
<!-- end card -->
</div>
<!-- end col -->
<div class="col-xl-3 col-sm-6">
<div class="card">
<div class="card-body">
<div class="d-flex text-muted">
<div class="flex-shrink-0 me-3 align-self-center">
<div class="avatar-sm">
<div class="avatar-title bg-light rounded-circle text-primary font-size-20">
<i class="ri-group-line"></i>
</div>
</div>
</div>
<div class="flex-grow-1 overflow-hidden">
<p class="mb-1">New Visitors</p>
<h5 class="mb-3">435</h5>
<p class="text-truncate mb-0"><span class="text-success me-2"> 0.01% <i class="ri-arrow-right-up-line align-bottom ms-1"></i></span> From previous</p>
</div>
</div>
</div>
<!-- end card-body -->
</div>
<!-- end card -->
</div>
<!-- end col -->
</div>
</t>
</templates>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="pad_dashboard_action" model="ir.actions.client">
<field name="name">Dashboard</field>
<field name="tag">pad_dashboard_tag</field>
</record>
<menuitem name="Dashboard" id="pad_dashboard_menu" action="pad_dashboard_action"/>
<!-- <template id="dashboard_assets" name="Dashboard Assets" inherit_id="web.assets_backend">-->
<!-- <xpath expr="." position="inside">-->
<!-- <link href="/idg_board/static/src/css/pad_dashboard.css" rel="stylesheet" type="text/css" />-->
<!-- </xpath>-->
<!-- </template>-->
<template id="dashboard_assets_2" name="Dashboard Assets 2" inherit_id="web.assets_backend">
<xpath expr="." position="after">
<script type="text/javascript" src="/idg_board/static/src/js/pad_dashboard.js"/>
<script type="text/javascript" src="/idg_board/static/src/js/apexcharts.min.js"/>
<script type="text/javascript" src="/idg_board/static/src/js/dashboard.js"/>
</xpath>
</template>
</odoo>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!