Rebase with latest master (#293, #472)

Enable email button in customers, suppliers only if selected row has
email filled in
Disable sale/receiving edit in reports (TBC)
This commit is contained in:
jekkos
2016-05-03 08:58:11 +02:00
parent 2adc096eeb
commit c2f895c1d4
11 changed files with 43 additions and 42 deletions

View File

@@ -43,7 +43,7 @@ class Reports extends Secure_area
$report_data = $model->getDataBySaleId($sale_id);
$summary_data = array(anchor('sales/edit/'.$report_data['sale_id'],
$summary_data = array(anchor('#',
'POS '.$report_data['sale_id'],
array('class'=>'modal-dlg modal-btn-submit')),
$report_data['sale_date'],
@@ -68,9 +68,7 @@ class Reports extends Secure_area
$report_data = $model->getDataByReceivingId($receiving_id);
$summary_data = array(anchor('receivings/edit/'.$report_data['receiving_id'],
'RECV '.$report_data['receiving_id'],
array('class'=>'modal-dlg modal-btn-submit')),
$summary_data = array('RECV '.$report_data['receiving_id'],
$report_data['receiving_date'],
to_quantity_decimals($report_data['items_purchased']),
$report_data['employee_name'],
@@ -912,7 +910,7 @@ class Reports extends Secure_area
foreach($report_data['summary'] as $key=>$row)
{
$summary_data[] = array(anchor('sales/edit/'.$row['sale_id'], 'POS '.$row['sale_id'], array('class'=>'modal-dlg modal-btn-delete modal-btn-submit')), $row['sale_date'], to_quantity_decimals($row['items_purchased']), $row['employee_name'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit']), $row['payment_type'], $row['comment']);
$summary_data[] = array('POS '.$row['sale_id'], $row['sale_date'], to_quantity_decimals($row['items_purchased']), $row['employee_name'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit']), $row['payment_type'], $row['comment']);
foreach($report_data['details'][$key] as $drow)
{
@@ -958,9 +956,7 @@ class Reports extends Secure_area
if($this->config->item('invoice_enable') == TRUE)
{
$summary_data[] = array(
anchor('receivings/edit/'.$row['receiving_id'],
'RECV '.$row['receiving_id'],
array('class'=>'modal-dlg modal-btn-delete modal-btn-submit')),
$row['receiving_date'],
to_quantity_decimals($row['items_purchased']),
$row['employee_name'], $row['supplier_name'],
@@ -973,9 +969,7 @@ class Reports extends Secure_area
else
{
$summary_data[] = array(
anchor('receivings/edit/'.$row['receiving_id'],
'RECV '.$row['receiving_id'],
array('class'=>'modal-dlg modal-btn-delete modal-btn-submit')),
$row['receiving_date'],
to_quantity_decimals($row['items_purchased']),
$row['employee_name'], $row['supplier_name'],

View File

@@ -73,7 +73,7 @@ function get_sale_data_row($sale, $controller)
)
);
if($CI->config->item('invoice_enable') == TRUE)
if ($CI->config->item('invoice_enable'))
{
$row['invoice'] = anchor($controller_name."/invoice/$sale->sale_id", '<span class="glyphicon glyphicon-list-alt"></span>',
array('title'=>$CI->lang->line('sales_show_invoice'))
@@ -111,10 +111,6 @@ function get_sales_manage_payments_summary($payments, $sales, $controller)
}
function transform_headers($array)
if($CI->Employee->has_grant('messages', $CI->session->userdata('person_id')))
{
$headers[] = '&nbsp';
}
{
return json_encode(array_map(function($v) {
return array('field' => key($v), 'title' => current($v), 'checkbox' => (key($v) == 'checkbox'));
@@ -132,6 +128,11 @@ function get_people_manage_table_headers()
array('email' => $CI->lang->line('common_email')),
array('phone_number' => $CI->lang->line('common_phone_number'))
);
if($CI->Employee->has_grant('messages', $CI->session->userdata('person_id')))
{
$headers[] = array('messages' => '');
}
return transform_headers($headers);
}
@@ -140,7 +141,7 @@ function get_person_data_row($person, $controller) {
$CI =& get_instance();
$controller_name=strtolower(get_class($CI));
$row = array (
return array (
'id' => $person->person_id,
'last_name' => character_limiter($person->last_name,13),
'first_name' => character_limiter($person->first_name,13),
@@ -169,10 +170,6 @@ function get_detailed_data_row($row, $controller)
}
function get_suppliers_manage_table_headers()
if($CI->Employee->has_grant('messages', $CI->session->userdata('person_id')))
{
$headers[] = '&nbsp';
}
{
$CI =& get_instance();
@@ -186,6 +183,11 @@ function get_suppliers_manage_table_headers()
array('phone_number' => $CI->lang->line('common_phone_number'))
);
if($CI->Employee->has_grant('messages', $CI->session->userdata('person_id')))
{
$headers[] = array('messages' => '');
}
return transform_headers($headers);
}

View File

@@ -44,7 +44,7 @@ $(document).ready(function()
success:function(response)
{
dialog_support.hide();
post_person_form_submit(response);
table_support.handle_submit('<?php echo site_url('messages'); ?>', response);
},
dataType:'json'
});

View File

@@ -64,7 +64,7 @@
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=52c16a3504"/>
<!-- end mincss template tags -->
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=539c3f5252" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=cc99edb756" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>

View File

@@ -9,8 +9,10 @@ $(document).ready(function()
resource: '<?php echo site_url($controller_name);?>',
headers: <?php echo $table_headers; ?>,
confirmDeleteMessage : '<?php echo $this->lang->line($controller_name."_confirm_delete")?>',
enableActions: function() {
// should only enable if email filed in
enableActions: function()
{
var email_disabled = $("tr.selected a[href^='mailto:']").length == 0;
$("#email").attr('disabled', email_disabled);
}
});

View File

@@ -125,7 +125,8 @@ else
if (isset($editable))
{
?>
function post_form_submit(response, row_id)
table_support.handle_submit = function(resource, response)
{
if(!response.success)
{
@@ -142,7 +143,7 @@ else
row.replaceWith(response);
row = get_table_row(row_id).parent().parent();
update_sortable_table();
animate_row(row);
highligh(row);
row.find("a.expand").click(expand_handler).text(sign);
dialog_support.init(row.find("a.modal"));
});

View File

@@ -659,7 +659,6 @@ $(document).ready(function()
table_support.handle_submit = function(resource, response, stay_open)
{
debugger;;
if(response.success) {
if (resource.match(/customers$/))
{

16
dist/opensourcepos.js vendored
View File

@@ -49384,9 +49384,11 @@ $.tablesorter.addWidget({
(function(table_support, $) {
var enable_actions = function(callback) {
var selection_empty = selected_rows().length == 0;
$("#toolbar button:not(.dropdown-toggle)").attr('disabled', selection_empty);
typeof callback == 'function' && callback();
return function() {
var selection_empty = selected_rows().length == 0;
$("#toolbar button:not(.dropdown-toggle)").attr('disabled', selection_empty);
typeof callback == 'function' && callback();
}
};
var table = function() {
@@ -49417,7 +49419,7 @@ $.tablesorter.addWidget({
};
var highlight_row = function (id, color) {
var original = $(row_selector(id,true)).css('backgroundColor');
var original = $(row_selector(id)).css('backgroundColor');
$(row_selector(id)).find("td").animate({backgroundColor: color || '#e1ffdd'}, "slow", "linear")
.animate({backgroundColor: color || '#e1ffdd'}, 5000)
.animate({backgroundColor: original}, "slow", "linear");
@@ -49435,7 +49437,6 @@ $.tablesorter.addWidget({
field: 'id',
values: selected_ids()
});
//refresh();
enable_actions();
});
});
@@ -49462,6 +49463,7 @@ $.tablesorter.addWidget({
var init = function (_options) {
options = _options;
enable_actions = enable_actions(options.enableActions);
$('#table').bootstrapTable($.extend(options, {
columns: options.headers,
url: options.resource + '/search',
@@ -49480,7 +49482,8 @@ $.tablesorter.addWidget({
onLoadSuccess: load_success(options.onLoadSuccess),
queryParamsType: 'limit',
iconSize: 'sm',
silentSort: true
silentSort: true,
paginationVAlign: 'bottom'
}));
enable_actions();
init_delete();
@@ -49511,7 +49514,6 @@ $.tablesorter.addWidget({
url: resource + '/get_row/' + id,
success: function (response) {
table().updateByUniqueId({id: id, row: response});
dialog_support.init("a.modal-dlg");
enable_actions();
highlight_row(id);

View File

File diff suppressed because one or more lines are too long

View File

@@ -105,9 +105,11 @@
(function(table_support, $) {
var enable_actions = function(callback) {
var selection_empty = selected_rows().length == 0;
$("#toolbar button:not(.dropdown-toggle)").attr('disabled', selection_empty);
typeof callback == 'function' && callback();
return function() {
var selection_empty = selected_rows().length == 0;
$("#toolbar button:not(.dropdown-toggle)").attr('disabled', selection_empty);
typeof callback == 'function' && callback();
}
};
var table = function() {
@@ -138,7 +140,7 @@
};
var highlight_row = function (id, color) {
var original = $(row_selector(id,true)).css('backgroundColor');
var original = $(row_selector(id)).css('backgroundColor');
$(row_selector(id)).find("td").animate({backgroundColor: color || '#e1ffdd'}, "slow", "linear")
.animate({backgroundColor: color || '#e1ffdd'}, 5000)
.animate({backgroundColor: original}, "slow", "linear");
@@ -156,7 +158,6 @@
field: 'id',
values: selected_ids()
});
//refresh();
enable_actions();
});
});
@@ -183,6 +184,7 @@
var init = function (_options) {
options = _options;
enable_actions = enable_actions(options.enableActions);
$('#table').bootstrapTable($.extend(options, {
columns: options.headers,
url: options.resource + '/search',
@@ -233,7 +235,6 @@
url: resource + '/get_row/' + id,
success: function (response) {
table().updateByUniqueId({id: id, row: response});
dialog_support.init("a.modal-dlg");
enable_actions();
highlight_row(id);

View File

@@ -65,7 +65,7 @@
<!-- 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=539c3f5252" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=cc99edb756" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>