Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • baa3d6ad6a88540538d94cfe345b3c8992bd0a9d
  • 12.0 par défaut protégée
  • 17.0
  • 18.0
  • 16.0
  • 14.0
  • 15.0
  • 13.0
  • 10.0
  • 9.0
10 résultats

dashboard_year.js

Blame
  • dashboard_year.js 6,12 Kio
    odoo.define('lefilament_tdb.dashboard_year', function (require) {
    
    	var core = require('web.core');
    	var formats = require('web.formats');
    	var Model = require('web.Model');
    	var session = require('web.session');
    	var Widget = require('web.Widget');
    
    	var QWeb = core.qweb;
    
    	var _t = core._t;
    	var _lt = core._lt;
    
    	var YearDashboardView = Widget.extend({
    	    template: 'YearDashboard',
    
    	    events: {
    	        'click .card': function() { this.mychart.reflow(); },
    	    },
    
    	    init: function() {
    	      var result = this._super.apply(this, arguments);
    	      return result;
    	    },
    
    	    willStart: function() {
    	        var deferred = new jQuery.Deferred();
    	        var self = this;
    	        this.values = {};
    	        this.progess = 0
    	        new Model('lefilament.dashboard')
    	            .call('retrieve_datas_dashboard', [])
                    .then(function(results) {
                        self.values = results;
                        self.progress = results.facture / results.target;
                        deferred.resolve();
                    });
    	          return jQuery.when(this._super.apply(this, arguments),deferred);
    	    },
    
    	    start: function() {
    	    	this.render_chart();
    	    },
    
    	    render_chart: function(chart) {
    	    	self = this;
    
    	    	var pfact = (this.values.facture / this.values.target * 100).toFixed(0);
    			var pcomm = (this.values.commandes / this.values.target * 100).toFixed(0);
    			var ppipe = (this.values.pipe / this.values.target * 100).toFixed(0);
    			var ptarg = 100-pfact-pcomm-ppipe;
    			var pfact2 = (this.values.facture);
    			var pcomm2 = (this.values.commandes);
    			var ppipe2 = (this.values.pipe);
    			var ptarg2 = this.values.target -pfact2-pcomm2-ppipe2;
    	    	
    	    	// ctx = this.$el.find('#progressbar')[0];
    	    	// this.chart = this.$el.find('#myChart')[0].getContext('2d');
    
    	  //   	var bar = new ProgressBar.Circle(ctx, {
    	  //   		color: '#43B160',
    	  //   		easing: 'easeInOut',
    	  //   		strokeWidth: 5,
    	  //   		trailWidth: 1,
    	  //   		step: function(state, circle) {
    			// 	    value = self.progress*100
    			// 	    circle.setText(
    			// 	    	'<span class="ca_target">'+
    			// 	    	self.values.target.toLocaleString('fr', { maximumFractionDigits: 0 }) + ' € </span><br />'
    			// 	    	+'facturé '+ pfact + ' %<br />'