forked from DGNum/gestioCOF
Merge branch 'qwann/k-fet/home' into qwann/k-fet/kfet_open
This commit is contained in:
commit
a828ecbcf0
60 changed files with 35400 additions and 108 deletions
54
kfet/static/kfet/css/home.css
Normal file
54
kfet/static/kfet/css/home.css
Normal file
|
@ -0,0 +1,54 @@
|
|||
ul.carte {
|
||||
width: 100%;
|
||||
list-style-type: none;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
display: inline-block;
|
||||
*display: inline;
|
||||
zoom: 1;
|
||||
position: relative;
|
||||
clip: auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
/*
|
||||
ul.carte > li {
|
||||
border-style: none none solid none;
|
||||
border-width: 1px;
|
||||
border-color: #DDD;
|
||||
}
|
||||
*/
|
||||
li.carte-line {
|
||||
position: relative;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.filler {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border-bottom: 3px dotted #333;
|
||||
height: 70%;
|
||||
}
|
||||
.carte-label {
|
||||
background: white;
|
||||
float: left;
|
||||
padding-right: 4px;
|
||||
position: relative;
|
||||
max-width: calc(100% - 40px);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.carte-ukf {
|
||||
background: white;
|
||||
padding-left: 4px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
.unbreakable.carte-inverted .carte-ukf,
|
||||
.unbreakable.carte-inverted .carte-label,
|
||||
.unbreakable.carte-inverted {
|
||||
background: #FFDBC7;
|
||||
}
|
|
@ -99,6 +99,25 @@ textarea {
|
|||
font-weight:bold;
|
||||
}
|
||||
|
||||
.nopadding {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.panel-md-margin{
|
||||
background-color: white;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
padding-bottom: 15px;
|
||||
padding-top: 1px;
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.panel-md-margin{
|
||||
margin:8px;
|
||||
background-color: white;
|
||||
}
|
||||
}
|
||||
|
||||
.col-content-left, .col-content-right {
|
||||
padding:0;
|
||||
}
|
||||
|
@ -165,6 +184,10 @@ textarea {
|
|||
background:#fff;
|
||||
}
|
||||
|
||||
.content-right-block-transparent > div:not(.buttons-title) {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.content-right-block .buttons-title {
|
||||
position:absolute;
|
||||
top:8px;
|
||||
|
@ -341,3 +364,161 @@ textarea {
|
|||
.help h4 {
|
||||
margin:15px 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Statistiques
|
||||
*/
|
||||
|
||||
.stat-graph {
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
/*
|
||||
* Responsive Columns
|
||||
*/
|
||||
|
||||
.unbreakable {
|
||||
display:inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.column-row {
|
||||
padding: 15px 20px;
|
||||
}
|
||||
|
||||
.column-xs-1,
|
||||
.column-sm-1,
|
||||
.column-md-1,
|
||||
.column-lg-1,
|
||||
.column-xs-2,
|
||||
.column-sm-2,
|
||||
.column-md-2,
|
||||
.column-lg-2,
|
||||
.column-xs-3,
|
||||
.column-sm-3,
|
||||
.column-md-3,
|
||||
.column-lg-3,
|
||||
.column-xs-4,
|
||||
.column-sm-4,
|
||||
.column-md-4,
|
||||
.column-lg-4,
|
||||
.column-xs-5,
|
||||
.column-sm-5,
|
||||
.column-md-5,
|
||||
.column-lg-5 {
|
||||
-webkit-column-count: 1; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 1; /* Firefox */
|
||||
column-count: 1;
|
||||
}
|
||||
|
||||
|
||||
.column-xs-1 {
|
||||
-webkit-column-count: 1; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 1; /* Firefox */
|
||||
column-count: 1;
|
||||
}
|
||||
.column-xs-2 {
|
||||
-webkit-column-count: 2; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 2; /* Firefox */
|
||||
column-count: 2;
|
||||
}
|
||||
.column-xs-3 {
|
||||
-webkit-column-count: 3; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 3; /* Firefox */
|
||||
column-count: 3;
|
||||
}
|
||||
.column-xs-4 {
|
||||
-webkit-column-count: 4; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 4; /* Firefox */
|
||||
column-count: 4;
|
||||
}
|
||||
.column-xs-5 {
|
||||
-webkit-column-count: 5; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 5; /* Firefox */
|
||||
column-count: 5;
|
||||
}
|
||||
|
||||
@media (min-width: 576px) {
|
||||
.column-sm-1 {
|
||||
-webkit-column-count: 1; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 1; /* Firefox */
|
||||
column-count: 1;
|
||||
}
|
||||
.column-sm-2 {
|
||||
-webkit-column-count: 2; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 2; /* Firefox */
|
||||
column-count: 2;
|
||||
}
|
||||
.column-sm-3 {
|
||||
-webkit-column-count: 3; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 3; /* Firefox */
|
||||
column-count: 3;
|
||||
}
|
||||
.column-sm-4 {
|
||||
-webkit-column-count: 4; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 4; /* Firefox */
|
||||
column-count: 4;
|
||||
}
|
||||
.column-sm-5 {
|
||||
-webkit-column-count: 5; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 5; /* Firefox */
|
||||
column-count: 5;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.column-md-1 {
|
||||
-webkit-column-count: 1; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 1; /* Firefox */
|
||||
column-count: 1;
|
||||
}
|
||||
.column-md-2 {
|
||||
-webkit-column-count: 2; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 2; /* Firefox */
|
||||
column-count: 2;
|
||||
}
|
||||
.column-md-3 {
|
||||
-webkit-column-count: 3; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 3; /* Firefox */
|
||||
column-count: 3;
|
||||
}
|
||||
.column-md-4 {
|
||||
-webkit-column-count: 4; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 4; /* Firefox */
|
||||
column-count: 4;
|
||||
}
|
||||
.column-md-5 {
|
||||
-webkit-column-count: 5; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 5; /* Firefox */
|
||||
column-count: 5;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.column-lg-1 {
|
||||
-webkit-column-count: 1; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 1; /* Firefox */
|
||||
column-count: 1;
|
||||
}
|
||||
.column-lg-2 {
|
||||
-webkit-column-count: 2; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 2; /* Firefox */
|
||||
column-count: 2;
|
||||
}
|
||||
.column-lg-3 {
|
||||
-webkit-column-count: 3; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 3; /* Firefox */
|
||||
column-count: 3;
|
||||
}
|
||||
.column-lg-4 {
|
||||
-webkit-column-count: 4; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 4; /* Firefox */
|
||||
column-count: 4;
|
||||
}
|
||||
.column-lg-5 {
|
||||
-webkit-column-count: 5; /* Chrome, Safari, Opera */
|
||||
-moz-column-count: 5; /* Firefox */
|
||||
column-count: 5;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ input[type=number]::-webkit-outer-spin-button {
|
|||
margin: 0;
|
||||
}
|
||||
|
||||
#account, #checkout, input, #history, #basket, #basket_rel, #previous_op, #articles_data {
|
||||
#account, #checkout, #article_selection, #history, #basket, #basket_rel, #previous_op, #articles_data {
|
||||
background:#fff;
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ input[type=number]::-webkit-outer-spin-button {
|
|||
width:100%;
|
||||
}
|
||||
|
||||
#article_selection input {
|
||||
#article_selection input, #article_selection span {
|
||||
height:100%;
|
||||
float:left;
|
||||
border:0;
|
||||
|
@ -263,12 +263,12 @@ input[type=number]::-webkit-outer-spin-button {
|
|||
font-weight:bold;
|
||||
}
|
||||
|
||||
#article_selection input+input {
|
||||
#article_selection input+input #article_selection input+span {
|
||||
border-right:0;
|
||||
}
|
||||
|
||||
#article_autocomplete {
|
||||
width:90%;
|
||||
width:80%;
|
||||
padding-left:10px;
|
||||
}
|
||||
|
||||
|
@ -277,14 +277,24 @@ input[type=number]::-webkit-outer-spin-button {
|
|||
text-align:center;
|
||||
}
|
||||
|
||||
#article_stock {
|
||||
width:10%;
|
||||
line-height:38px;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
@media (min-width:1200px) {
|
||||
#article_autocomplete {
|
||||
width:92%
|
||||
width:84%
|
||||
}
|
||||
|
||||
#article_number {
|
||||
width:8%;
|
||||
}
|
||||
|
||||
#article_stock {
|
||||
width:8%;
|
||||
}
|
||||
}
|
||||
|
||||
/* Article data */
|
||||
|
@ -319,6 +329,10 @@ input[type=number]::-webkit-outer-spin-button {
|
|||
padding-left:20px;
|
||||
}
|
||||
|
||||
#articles_data .article.low-stock {
|
||||
background:rgba(236,100,0,0.3);
|
||||
}
|
||||
|
||||
#articles_data .article:hover {
|
||||
background:rgba(200,16,46,0.3);
|
||||
cursor:pointer;
|
||||
|
@ -384,6 +398,11 @@ input[type=number]::-webkit-outer-spin-button {
|
|||
text-align:right;
|
||||
}
|
||||
|
||||
#basket tr .lowstock {
|
||||
display:none;
|
||||
padding-right:15px;
|
||||
}
|
||||
|
||||
#basket tr.ui-selected, #basket tr.ui-selecting {
|
||||
background-color:rgba(200,16,46,0.6);
|
||||
color:#FFF;
|
||||
|
|
15855
kfet/static/kfet/js/Chart.bundle.js
Normal file
15855
kfet/static/kfet/js/Chart.bundle.js
Normal file
File diff suppressed because it is too large
Load diff
16
kfet/static/kfet/js/Chart.bundle.min.js
vendored
Normal file
16
kfet/static/kfet/js/Chart.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
11557
kfet/static/kfet/js/Chart.js
vendored
Normal file
11557
kfet/static/kfet/js/Chart.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
|
@ -37,9 +37,10 @@ function amountDisplay(amount, is_cof=false, tri='') {
|
|||
return amountToUKF(amount, is_cof);
|
||||
}
|
||||
|
||||
function amountToUKF(amount, is_cof=false) {
|
||||
function amountToUKF(amount, is_cof=false, account=false) {
|
||||
var rounding = account ? Math.floor : Math.round ;
|
||||
var coef_cof = is_cof ? 1 + settings['subvention_cof'] / 100 : 1;
|
||||
return Math.floor(amount * coef_cof * 10);
|
||||
return rounding(amount * coef_cof * 10);
|
||||
}
|
||||
|
||||
function isValidTrigramme(trigramme) {
|
||||
|
|
197
kfet/static/kfet/js/statistic.js
Normal file
197
kfet/static/kfet/js/statistic.js
Normal file
|
@ -0,0 +1,197 @@
|
|||
(function($){
|
||||
window.StatsGroup = function (url, target) {
|
||||
// a class to properly display statictics
|
||||
|
||||
// url : points to an ObjectResumeStat that lists the options through JSON
|
||||
// target : element of the DOM where to put the stats
|
||||
|
||||
var self = this;
|
||||
var element = $(target);
|
||||
var content = $("<div>");
|
||||
var buttons;
|
||||
|
||||
function dictToArray (dict, start) {
|
||||
// converts the dicts returned by JSONResponse to Arrays
|
||||
// necessary because for..in does not guarantee the order
|
||||
if (start === undefined) start = 0;
|
||||
var array = new Array();
|
||||
for (var k in dict) {
|
||||
array[k] = dict[k];
|
||||
}
|
||||
array.splice(0, start);
|
||||
return array;
|
||||
}
|
||||
|
||||
function handleTimeChart (dict) {
|
||||
// reads the balance data and put it into chartjs formatting
|
||||
var data = dictToArray(dict, 0);
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var source = data[i];
|
||||
data[i] = { x: new Date(source.at),
|
||||
y: source.balance,
|
||||
label: source.label }
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function showStats () {
|
||||
// CALLBACK : called when a button is selected
|
||||
|
||||
// shows the focus on the correct button
|
||||
buttons.find(".focus").removeClass("focus");
|
||||
$(this).addClass("focus");
|
||||
|
||||
// loads data and shows it
|
||||
$.getJSON(this.stats_target_url + "?format=json",
|
||||
displayStats);
|
||||
}
|
||||
|
||||
function displayStats (data) {
|
||||
// reads the json data and updates the chart display
|
||||
|
||||
var chart_datasets = [];
|
||||
var charts = dictToArray(data.charts);
|
||||
|
||||
// are the points indexed by timestamps?
|
||||
var is_time_chart = data.is_time_chart || false;
|
||||
|
||||
// reads the charts data
|
||||
for (var i = 0; i < charts.length; i++) {
|
||||
var chart = charts[i];
|
||||
|
||||
// format the data
|
||||
var chart_data = is_time_chart ? handleTimeChart(chart.values) : dictToArray(chart.values, 1);
|
||||
|
||||
chart_datasets.push(
|
||||
{
|
||||
label: chart.label,
|
||||
borderColor: chart.color,
|
||||
backgroundColor: chart.color,
|
||||
fill: is_time_chart,
|
||||
lineTension: 0,
|
||||
data: chart_data,
|
||||
steppedLine: is_time_chart,
|
||||
});
|
||||
}
|
||||
|
||||
// options for chartjs
|
||||
var chart_options =
|
||||
{
|
||||
responsive: true,
|
||||
tooltips: {
|
||||
mode: 'index',
|
||||
intersect: false,
|
||||
},
|
||||
hover: {
|
||||
mode: 'nearest',
|
||||
intersect: false,
|
||||
}
|
||||
};
|
||||
|
||||
// additionnal options for time-indexed charts
|
||||
if (is_time_chart) {
|
||||
chart_options['scales'] = {
|
||||
xAxes: [{
|
||||
type: "time",
|
||||
display: true,
|
||||
scaleLabel: {
|
||||
display: false,
|
||||
labelString: 'Date'
|
||||
},
|
||||
time: {
|
||||
tooltipFormat: 'll HH:mm',
|
||||
displayFormats: {
|
||||
'millisecond': 'SSS [ms]',
|
||||
'second': 'mm:ss a',
|
||||
'minute': 'DD MMM',
|
||||
'hour': 'ddd h[h]',
|
||||
'day': 'DD MMM',
|
||||
'week': 'DD MMM',
|
||||
'month': 'MMM',
|
||||
'quarter': 'MMM',
|
||||
'year': 'YYYY',
|
||||
}
|
||||
}
|
||||
|
||||
}],
|
||||
yAxes: [{
|
||||
display: true,
|
||||
scaleLabel: {
|
||||
display: false,
|
||||
labelString: 'value'
|
||||
}
|
||||
}]
|
||||
};
|
||||
}
|
||||
|
||||
// global object for the options
|
||||
var chart_model =
|
||||
{
|
||||
type: 'line',
|
||||
options: chart_options,
|
||||
data: {
|
||||
labels: dictToArray(data.labels, 1),
|
||||
datasets: chart_datasets,
|
||||
}
|
||||
};
|
||||
|
||||
// saves the previous charts to be destroyed
|
||||
var prev_chart = content.children();
|
||||
|
||||
// creates a blank canvas element and attach it to the DOM
|
||||
var canvas = $("<canvas>");
|
||||
content.append(canvas);
|
||||
|
||||
// create the chart
|
||||
var chart = new Chart(canvas, chart_model);
|
||||
|
||||
// clean
|
||||
prev_chart.remove();
|
||||
}
|
||||
|
||||
// initialize the interface
|
||||
function initialize (data) {
|
||||
// creates the bar with the buttons
|
||||
buttons = $("<div>",
|
||||
{class: "btn-group btn-group-justified",
|
||||
role: "group",
|
||||
"aria-label": "select-period"});
|
||||
|
||||
var to_click;
|
||||
var context = dictToArray(data.stats);
|
||||
|
||||
for (var i = 0; i < context.length; i++) {
|
||||
// creates the button
|
||||
var btn_wrapper = $("<div>",
|
||||
{class: "btn-group",
|
||||
role:"group"});
|
||||
var btn = $("<button>",
|
||||
{class: "btn btn-primary",
|
||||
type: "button"})
|
||||
.text(context[i].label)
|
||||
.prop("stats_target_url", context[i].url)
|
||||
.on("click", showStats);
|
||||
|
||||
// saves the default option to select
|
||||
if (i == data.default_stat || i == 0)
|
||||
to_click = btn;
|
||||
|
||||
// append the elements to the parent
|
||||
btn_wrapper.append(btn);
|
||||
buttons.append(btn_wrapper);
|
||||
}
|
||||
|
||||
// appends the contents to the DOM
|
||||
element.append(buttons);
|
||||
element.append(content);
|
||||
|
||||
// shows the default chart
|
||||
to_click.click();
|
||||
};
|
||||
|
||||
// constructor
|
||||
(function () {
|
||||
$.getJSON(url + "?format=json", initialize);
|
||||
})();
|
||||
};
|
||||
})(jQuery);
|
Loading…
Add table
Add a link
Reference in a new issue