New look for the Reports listing page, code tidy up, dist regen (#695)

This commit is contained in:
FrancescoUK
2016-06-24 17:55:10 +01:00
parent 6d012144db
commit d378cfdb5f
12 changed files with 110 additions and 186 deletions

View File

@@ -1,33 +1,11 @@
<?php
function get_random_colors($how_many)
{
$colors = array();
for($k=0;$k<$how_many;$k++)
{
$colors[] = '#'.random_color();
}
return $colors;
}
function random_color()
{
mt_srand((double)microtime()*1000000);
$c = '';
while(strlen($c)<6){
$c .= sprintf("%02X", mt_rand(0, 255));
}
return $c;
}
function show_report_if_allowed($report_prefix, $report_name, $person_id, $permission_id='')
function show_report_if_allowed($report_prefix, $report_name, $person_id, $permission_id = '')
{
$CI =& get_instance();
$permission_id = empty($permission_id) ? 'reports_' . $report_name : $permission_id;
if ($CI->Employee->has_grant($permission_id, $person_id))
if($CI->Employee->has_grant($permission_id, $person_id))
{
show_report($report_prefix, $report_name, $permission_id);
}
@@ -36,14 +14,15 @@ function show_report_if_allowed($report_prefix, $report_name, $person_id, $permi
function show_report($report_prefix, $report_name, $lang_key='')
{
$CI =& get_instance();
$lang_key = empty($lang_key) ? $report_name : $lang_key;
$report_label = $CI->lang->line($lang_key);
$report_prefix = empty($report_prefix) ? '' : $report_prefix . '_';
// no summary nor detailed reports for receivings
if (!empty($report_label) && $report_label != $lang_key . ' (TBD)')
if(!empty($report_label) && $report_label != $lang_key . ' (TBD)')
{
?>
<li><a href="<?php echo site_url('reports/' . $report_prefix . preg_replace('/reports_(.*)/', '$1', $report_name));?>"><?php echo $report_label; ?></a></li>
<a class="list-group-item" href="<?php echo site_url('reports/' . $report_prefix . preg_replace('/reports_(.*)/', '$1', $report_name));?>"><?php echo $report_label; ?></a>
<?php
}
}

View File

@@ -6,7 +6,7 @@
<title>Open Source Point Of Sale <?php echo $this->lang->line('login_login'); ?></title>
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
<!-- start css template tags -->
<link rel="stylesheet" type="text/css" href="dist/bootstrap.min.css?rel=9ed20b1ee8"/>
<link rel="stylesheet" type="text/css" href="dist/bootstrap.min.css?rel=50ab19585f"/>
<link rel="stylesheet" type="text/css" href="css/login.css"/>
<!-- end css template tags -->

View File

@@ -67,12 +67,12 @@
<link rel="stylesheet" media="print" href="css/print.css" type="text/css" />
<![endif]-->
<!-- start mincss template tags -->
<link rel="stylesheet" type="text/css" href="dist/bootstrap.min.css?rel=9ed20b1ee8"/>
<link rel="stylesheet" type="text/css" href="dist/bootstrap.min.css?rel=50ab19585f"/>
<link rel="stylesheet" type="text/css" href="dist/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=725a0444ad"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=6565b523f9"/>
<!-- end mincss template tags -->
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=057f34d35e" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=d18a7b4a1b" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>

View File

@@ -7,62 +7,81 @@ if(isset($error))
}
?>
<ul id="report_list">
<li><h4><?php echo $this->lang->line('reports_graphical_reports'); ?></h4>
<ul>
<?php
foreach($grants as $grant)
{
if (!preg_match('/reports_(inventory|receivings)/', $grant['permission_id']))
<div class="row">
<div class="col-md-4">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title"><span class="glyphicon glyphicon-stats">&nbsp</span><?php echo $this->lang->line('reports_graphical_reports'); ?></h3>
</div>
<div class="list-group">
<?php
foreach($grants as $grant)
{
show_report('graphical_summary',$grant['permission_id']);
if (!preg_match('/reports_(inventory|receivings)/', $grant['permission_id']))
{
show_report('graphical_summary', $grant['permission_id']);
}
}
}
?>
</ul>
</li>
<li><h4><?php echo $this->lang->line('reports_summary_reports'); ?></h4>
<ul>
<?php
foreach($grants as $grant)
{
if (!preg_match('/reports_(inventory|receivings)/', $grant['permission_id']))
?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title"><span class="glyphicon glyphicon-list">&nbsp</span><?php echo $this->lang->line('reports_summary_reports'); ?></h3>
</div>
<div class="list-group">
<?php
foreach($grants as $grant)
{
show_report('summary',$grant['permission_id']);
if (!preg_match('/reports_(inventory|receivings)/', $grant['permission_id']))
{
show_report('summary', $grant['permission_id']);
}
}
}
?>
</ul>
</li>
<li><h4><?php echo $this->lang->line('reports_detailed_reports'); ?></h4>
<ul>
<?php
$person_id = $this->session->userdata('person_id');
show_report_if_allowed('detailed', 'sales', $person_id);
show_report_if_allowed('detailed', 'receivings', $person_id);
show_report_if_allowed('specific', 'customer', $person_id, 'reports_customers');
show_report_if_allowed('specific', 'discount', $person_id, 'reports_discounts');
show_report_if_allowed('specific', 'employee', $person_id, 'reports_employees');
?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title"><span class="glyphicon glyphicon-list-alt">&nbsp</span><?php echo $this->lang->line('reports_detailed_reports'); ?></h3>
</div>
<div class="list-group">
<?php
$person_id = $this->session->userdata('person_id');
show_report_if_allowed('detailed', 'sales', $person_id);
show_report_if_allowed('detailed', 'receivings', $person_id);
show_report_if_allowed('specific', 'customer', $person_id, 'reports_customers');
show_report_if_allowed('specific', 'discount', $person_id, 'reports_discounts');
show_report_if_allowed('specific', 'employee', $person_id, 'reports_employees');
?>
</div>
</div>
<?php
if ($this->Employee->has_grant('reports_inventory', $this->session->userdata('person_id')))
{
?>
</ul>
</li>
<?php
if ($this->Employee->has_grant('reports_inventory', $this->session->userdata('person_id')))
{
?>
<li><h4><?php echo $this->lang->line('reports_inventory_reports'); ?></h4>
<ul>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title"><span class="glyphicon glyphicon-book">&nbsp</span><?php echo $this->lang->line('reports_inventory_reports'); ?></h3>
</div>
<div class="list-group">
<?php
show_report('', 'reports_inventory_low');
show_report('', 'reports_inventory_summary');
?>
</div>
</div>
<?php
show_report('', 'reports_inventory_low');
show_report('', 'reports_inventory_summary');
}
?>
</ul>
</li>
<?php
}
?>
</ul>
</div>
</div>
<?php $this->load->view("partial/footer"); ?>

View File

@@ -28,7 +28,7 @@
"jquery-validate": "~1.13.1",
"jquery": "~1.12.4",
"jquery-ui": "1.11.4",
"bootstrap3-dialog": "bootstrap-dialog#^1.35.1",
"bootstrap3-dialog": "bootstrap-dialog#^1.35.2",
"jasny-bootstrap": "^3.1.3",
"bootswatch-dist": "3.3.6-flatly",
"smalot-bootstrap-datetimepicker": "^2.3.11",
@@ -36,7 +36,7 @@
"bootstrap-table": "^1.10.1",
"bootstrap-daterangepicker": "^2.1.22",
"tableExport.jquery.plugin": "1.5.1",
"chartist": "^0.9.7",
"chartist": "^0.9.8",
"chartist-plugin-axistitle": "^0.1.0",
"chartist-plugin-pointlabels": "^0.0.4",
"chartist-plugin-tooltip": "https://github.com/Globegitter/chartist-plugin-tooltip/archive/master.zip",

View File

@@ -1,13 +1,3 @@
#report_list li ul li
{
margin-left: 35px;
}
#report_date_range_simple, #report_date_range_complex
{
margin-bottom: 10px;
}
.report
{
font-size: .85em;

View File

File diff suppressed because one or more lines are too long

72
dist/opensourcepos.js vendored
View File

File diff suppressed because one or more lines are too long

View File

File diff suppressed because one or more lines are too long

View File

File diff suppressed because one or more lines are too long

View File

@@ -6,7 +6,7 @@
<title>Open Source Point Of Sale <?php echo $this->lang->line('login_login'); ?></title>
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
<!-- start css template tags -->
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/bootstrap.min.css?rel=9ed20b1ee8"/>
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/bootstrap.min.css?rel=50ab19585f"/>
<link rel="stylesheet" type="text/css" href="css/login.css"/>
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/style.css"/>
<!-- end css template tags -->

View File

@@ -66,14 +66,14 @@
<!--[if lte IE 8]>
<link rel="stylesheet" media="print" href="css/print.css" type="text/css" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/bootstrap.min.css?rel=9ed20b1ee8"/>
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/bootstrap.min.css?rel=50ab19585f"/>
<!-- start mincss template tags -->
<link rel="stylesheet" type="text/css" href="dist/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=725a0444ad"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=6565b523f9"/>
<!-- end mincss template tags -->
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/style.css"/>
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=057f34d35e" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=d18a7b4a1b" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>