Skip to content

Commit 30fa490

Browse files
author
Shaun Kutch
committed
More bootstrap theming
Updated some model logic to return json
1 parent 981a8f8 commit 30fa490

File tree

17 files changed

+953
-751
lines changed

17 files changed

+953
-751
lines changed

application/controllers/sales.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,31 @@ function index()
1515

1616
function item_search()
1717
{
18-
$suggestions = $this->Item->get_item_search_suggestions($this->input->post('q'),$this->input->post('limit'));
19-
$suggestions = array_merge($suggestions, $this->Item_kit->get_item_kit_search_suggestions($this->input->post('q'),$this->input->post('limit')));
20-
echo implode("\n",$suggestions);
18+
$items = $this->Item->get_item_search_suggestions($this->input->post('term'),$this->input->post('limit'));
19+
$suggestions = array();
20+
foreach($items as $item)
21+
{
22+
$renderItem = array();
23+
$renderItem["label"] = $item->name . " | " . $item->item_number;
24+
$renderItem["value"] = $item->item_number;
25+
$suggestions[] = $renderItem;
26+
}
27+
//$suggestions = array_merge($suggestions, $this->Item_kit->get_item_kit_search_suggestions($this->input->post('q'),$this->input->post('limit')));
28+
echo json_encode($suggestions);
2129
}
2230

2331
function customer_search()
2432
{
25-
$suggestions = $this->Customer->get_customer_search_suggestions($this->input->post('q'),$this->input->post('limit'));
26-
echo implode("\n",$suggestions);
33+
$customers = $this->Customer->get_customer_search_suggestions($this->input->post('term'), $this->input->post('limit'));
34+
$suggestions = array();
35+
foreach($customers as $customer)
36+
{
37+
$renderItem = array();
38+
$renderItem["label"] = $customer->last_name . " " . $customer->first_name . " | " . $customer->account_number;
39+
$renderItem["value"] = $customer->account_number ;
40+
$suggestions[] = $renderItem;
41+
}
42+
echo json_encode($suggestions);
2743
}
2844

2945
function select_customer()

application/helpers/table_helper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ function get_supplier_data_row($supplier,$controller)
170170
$table_data_row.='<td width="20%">'.mailto($supplier->email,character_limiter($supplier->email,22)).'</td>';
171171
$table_data_row.='<td width="13%" class="email-lists">'.$CI->MailChimp->tableListing($supplier->email).'</td>';
172172
$table_data_row.='<td width="15%">'.character_limiter($supplier->phone_number,13).'</td>';
173-
$table_data_row.='<td width="5%">'.anchor($controller_name."/view/$supplier->person_id/", $CI->lang->line('common_edit'),array('class'=>'thickbox','title'=>$CI->lang->line($controller_name.'_update'))).'</td>';
173+
$table_data_row.='<td width="5%">'.anchor($controller_name."/view/$supplier->person_id/", $CI->lang->line('common_edit'),array('class'=>'btn btn-default','title'=>$CI->lang->line($controller_name.'_update'))).'</td>';
174174
} else {
175175
$table_data_row.="<td width='5%'><input type='checkbox' id='person_$supplier->person_id' value='".$supplier->person_id."'/></td>";
176176
$table_data_row.='<td width="17%">'.character_limiter($supplier->company_name,13).'</td>';
177177
$table_data_row.='<td width="17%">'.character_limiter($supplier->last_name,13).'</td>';
178178
$table_data_row.='<td width="17%">'.character_limiter($supplier->first_name,13).'</td>';
179179
$table_data_row.='<td width="22%">'.mailto($supplier->email,character_limiter($supplier->email,22)).'</td>';
180180
$table_data_row.='<td width="17%">'.character_limiter($supplier->phone_number,13).'</td>';
181-
$table_data_row.='<td width="5%">'.anchor($controller_name."/view/$supplier->person_id/", $CI->lang->line('common_edit'),array('class'=>'thickbox','title'=>$CI->lang->line($controller_name.'_update'))).'</td>';
181+
$table_data_row.='<td width="5%">'.anchor($controller_name."/view/$supplier->person_id/", $CI->lang->line('common_edit'),array('class'=>'btn btn-default','title'=>$CI->lang->line($controller_name.'_update'))).'</td>';
182182
}
183183

184184
$table_data_row.='</tr>';
@@ -327,7 +327,7 @@ function get_giftcard_data_row($giftcard,$controller)
327327
$table_data_row.="<td width='3%'><input type='checkbox' id='giftcard_$giftcard->giftcard_id' value='".$giftcard->giftcard_id."'/></td>";
328328
$table_data_row.='<td width="15%">'.$giftcard->giftcard_number.'</td>';
329329
$table_data_row.='<td width="20%">'.to_currency($giftcard->value).'</td>';
330-
$table_data_row.='<td width="5%">'.anchor($controller_name."/view/$giftcard->giftcard_id/", $CI->lang->line('common_edit'),array('title'=>$CI->lang->line($controller_name.'_update'))).'</td>';
330+
$table_data_row.='<td width="5%">'.anchor($controller_name."/view/$giftcard->giftcard_id/", $CI->lang->line('common_edit'),array('class'=>'btn btn-default float_right', 'title'=>$CI->lang->line($controller_name.'_update'))).'</td>';
331331

332332
$table_data_row.='</tr>';
333333
return $table_data_row;

application/language/english/sales_lang.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
$lang['sales_new_item'] = 'New Item';
77
$lang['sales_item_name'] = 'Item Name';
88
$lang['sales_item_number'] = 'Item #';
9-
$lang['sales_new_customer'] = 'New Customer';
9+
$lang['sales_new_customer'] = 'Add New Customer';
1010
$lang['sales_customer'] = 'Customer';
1111
$lang['sales_no_items_in_cart']='There are no items in the cart';
1212
$lang['sales_total']='Total';
@@ -21,17 +21,17 @@
2121
$lang['sales_find_or_scan_item_or_receipt']='Find/Scan Item OR Receipt';
2222
$lang['sales_select_customer']='Select Customer (Optional)';
2323
$lang['sales_start_typing_item_name']='Start Typing item\'s name or scan barcode...';
24-
$lang['sales_start_typing_customer_name']='Start Typing customer\'s name...';
24+
$lang['sales_start_typing_customer_name']='Select Customer (Optional)';
2525
$lang['sales_sub_total']='Sub Total';
2626
$lang['sales_tax']='Tax';
2727
$lang['sales_comment']='Comment';
2828
$lang['sales_unable_to_add_item']='Unable to add item to sale';
2929
$lang['sales_sale_for_customer']='Customer:';
3030
$lang['sales_remove_customer']='Remove Customer';
3131
$lang['sales_error_editing_item']='Error editing item';
32-
$lang['sales_complete_sale']='Complete Sale';
33-
$lang['sales_cancel_sale']='Cancel Sale';
34-
$lang['sales_add_payment']='Add Payment';
32+
$lang['sales_complete_sale']='Complete';
33+
$lang['sales_cancel_sale']='Cancel';
34+
$lang['sales_add_payment']='Add';
3535
$lang['sales_receipt']='Sales Receipt';
3636
$lang['sales_id']='Sale ID';
3737
$lang['sales_sale']='Sale';
@@ -65,7 +65,7 @@
6565
$lang['sales_date'] = 'Sale Date';
6666
$lang['sales_delete_successful'] = 'You have successfully deleted a sale';
6767
$lang['sales_delete_unsuccessful'] = 'You have unsuccessfully deleted a sale';
68-
$lang['sales_suspend_sale'] = 'Suspend Sale';
68+
$lang['sales_suspend_sale'] = 'Suspend';
6969
$lang['sales_confirm_suspend_sale'] = 'Are you sure you want to suspend this sale?';
7070
$lang['sales_suspended_sales'] = 'Suspended Sales';
7171
$lang['sales_suspended_sale_id'] = 'Suspended Sale ID';

application/libraries/report_service.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,9 @@ function graphical_summary_sales($start_date, $end_date, $sale_type)
266266
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type'=>$sale_type))
267267
);
268268

269-
$this->_display($this->CI->load->view("reports/graphical",$data,true));
269+
//$this->_display($this->CI->load->view("reports/graphical",$data,true));
270+
$this->renderData = array('view'=>'reports/graphical', 'data'=>$data);
271+
return $this;
270272
}
271273

272274
function graphical_summary_sales_graph($start_date, $end_date, $sale_type)

application/models/customer.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ function count_all()
3838
/*
3939
Gets information about a particular customer
4040
*/
41-
function get_info($customer_id)
41+
function get_info($id)
4242
{
4343
$this->db->from('customers');
4444
$this->db->join('people', 'people.person_id = customers.person_id');
45-
$this->db->where('customers.person_id',$customer_id);
45+
$this->db->where('customers.person_id',$id);
46+
$this->db->or_where('customers.account_number',$id);
4647
$query = $this->db->get();
4748

4849
if($query->num_rows()==1)
@@ -197,7 +198,8 @@ function get_customer_search_suggestions($term, $limit=25)
197198
$this->db->join('people','customers.person_id=people.person_id');
198199
$this->db->where("(first_name LIKE '%".$this->db->escape_like_str($term)."%' or
199200
last_name LIKE '%".$this->db->escape_like_str($term)."%' or
200-
CONCAT(`first_name`,' ',`last_name`) LIKE '%".$this->db->escape_like_str($term)."%') and deleted = 0");
201+
CONCAT(`first_name`,' ',`last_name`) LIKE '%".$this->db->escape_like_str($term)."%' or account_number
202+
LIKE '%".$this->db->escape_like_str($term)."%') and deleted = 0");
201203
$this->db->order_by("last_name", "asc");
202204
$this->db->limit($limit);
203205
$by_name = $this->db->get();

application/models/item.php

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -213,29 +213,14 @@ function get_item_search_suggestions($search,$limit=25)
213213
$suggestions = array();
214214

215215
$this->db->from('items');
216-
$this->db->where('deleted',0);
217-
$this->db->like('name', $search);
216+
$this->db->where("(name LIKE '%".$this->db->escape_like_str($search)."%' or
217+
item_number LIKE '%".$this->db->escape_like_str($search)."%') and deleted=0");
218218
$this->db->order_by("name", "asc");
219219
$by_name = $this->db->get();
220+
$this->db->limit($limit);
220221
foreach($by_name->result() as $row)
221222
{
222-
$suggestions[]=$row->item_id.'|'.$row->name;
223-
}
224-
225-
$this->db->from('items');
226-
$this->db->where('deleted',0);
227-
$this->db->like('item_number', $search);
228-
$this->db->order_by("item_number", "asc");
229-
$by_item_number = $this->db->get();
230-
foreach($by_item_number->result() as $row)
231-
{
232-
$suggestions[]=$row->item_id.'|'.$row->item_number;
233-
}
234-
235-
//only return $limit suggestions
236-
if(count($suggestions > $limit))
237-
{
238-
$suggestions = array_slice($suggestions, 0,$limit);
223+
$suggestions[]=$row;
239224
}
240225
return $suggestions;
241226

application/views/giftcards/form.php

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,39 @@
1-
<div id="required_fields_message"><?php echo $this->lang->line('common_fields_required_message'); ?></div>
1+
<?php $this->load->view("partial/header"); ?>
2+
<h1><?php echo $this->lang->line("giftcards_basic_information"); ?></h1>
3+
<hr>
24
<ul id="error_message_box"></ul>
35
<?php
46
echo form_open('giftcards/save/'.$giftcard_info->giftcard_id,array('id'=>'giftcard_form'));
57
?>
68
<fieldset id="giftcard_basic_info">
7-
<legend><?php echo $this->lang->line("giftcards_basic_information"); ?></legend>
8-
9-
<div class="field_row clearfix">
10-
<?php echo form_label($this->lang->line('giftcards_giftcard_number').':', 'name',array('class'=>'required wide')); ?>
11-
<div class='form_field'>
9+
<div class="form-group">
10+
<?php echo form_label($this->lang->line('giftcards_giftcard_number'), 'name',array('class'=>'required wide')); ?>
1211
<?php echo form_input(array(
12+
'class'=>'form-control',
1313
'name'=>'giftcard_number',
1414
'size'=>'8',
1515
'id'=>'giftcard_number',
1616
'value'=>$giftcard_info->giftcard_number)
1717
);?>
18-
</div>
1918
</div>
2019

21-
<div class="field_row clearfix">
22-
<?php echo form_label($this->lang->line('giftcards_card_value').':', 'name',array('class'=>'required wide')); ?>
23-
<div class='form_field'>
20+
<div class="form-group">
21+
<?php echo form_label($this->lang->line('giftcards_card_value') , 'name',array('class'=>'required wide')); ?>
2422
<?php echo form_input(array(
23+
'class'=>'form-control',
2524
'name'=>'value',
2625
'size'=>'8',
2726
'id'=>'value',
2827
'value'=>$giftcard_info->value)
2928
);?>
30-
</div>
3129
</div>
3230

3331
<?php
3432
echo form_submit(array(
3533
'name'=>'submit',
3634
'id'=>'submit',
3735
'value'=>$this->lang->line('common_submit'),
38-
'class'=>'submit_button float_right')
36+
'class'=>'btn btn-primary float_right')
3937
);
4038
?>
4139
</fieldset>
@@ -53,7 +51,6 @@
5351
$(form).ajaxSubmit({
5452
success:function(response)
5553
{
56-
tb_remove();
5754
post_giftcard_form_submit(response);
5855
},
5956
dataType:'json'
@@ -89,5 +86,21 @@
8986
}
9087
}
9188
});
89+
90+
function post_giftcard_form_submit(response)
91+
{
92+
if(!response.success)
93+
{
94+
set_feedback(response.message,'error',true);
95+
}
96+
else
97+
{
98+
var message = {'text': response.message, 'type': 'success'};
99+
window.localStorage.setItem("message", JSON.stringify(message));
100+
window.location.href = '<?php echo site_url("giftcards")?>';
101+
}
102+
}
92103
});
93-
</script>
104+
</script>
105+
<div id="feedback_bar"></div>
106+
<?php $this->load->view("partial/footer"); ?>

application/views/giftcards/manage.php

Lines changed: 15 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -27,60 +27,30 @@ function init_table_sorting()
2727
});
2828
}
2929
}
30-
31-
function post_giftcard_form_submit(response)
32-
{
33-
if(!response.success)
34-
{
35-
set_feedback(response.message,'error_message',true);
36-
}
37-
else
38-
{
39-
//This is an update, just update one row
40-
if(jQuery.inArray(response.giftcard_id,get_visible_checkbox_ids()) != -1)
41-
{
42-
update_row(response.giftcard_id,'<?php echo site_url("$controller_name/get_row")?>');
43-
set_feedback(response.message,'success_message',false);
44-
45-
}
46-
else //refresh entire table
47-
{
48-
do_search(true,function()
49-
{
50-
//highlight new row
51-
hightlight_row(response.giftcard_id);
52-
set_feedback(response.message,'success_message',false);
53-
});
54-
}
55-
}
56-
}
57-
5830
</script>
5931

60-
<div id="title_bar">
61-
<div id="title" class="float_left"><?php echo $this->lang->line('common_list_of').' '.$this->lang->line('module_'.$controller_name); ?></div>
62-
<div id="new_button">
63-
<?php echo anchor("$controller_name/view/-1/width:$form_width",
64-
"<div class='big_button' style='float: left;'><span>".$this->lang->line($controller_name.'_new')."</span></div>",
65-
array('class'=>'thickbox none','title'=>$this->lang->line($controller_name.'_new')));
66-
?>
67-
</div>
68-
</div>
69-
<?php echo $this->pagination->create_links();?>
70-
<div id="table_action_header">
71-
<ul>
72-
<li class="float_left"><span><?php echo anchor("$controller_name/delete",$this->lang->line("common_delete"),array('id'=>'delete')); ?></span></li>
73-
<li class="float_right">
32+
<h1 id="title"><?php echo $this->lang->line('common_list_of').' '.$this->lang->line('module_'.$controller_name); ?></h1>
33+
<hr>
34+
<div class="actions">
35+
<div class="search-box">
7436
<img src='<?php echo base_url()?>images/spinner_small.gif' alt='spinner' id='spinner' />
7537
<?php echo form_open("$controller_name/search",array('id'=>'search_form')); ?>
7638
<input type="text" name ='search' id='search'/>
7739
</form>
78-
</li>
79-
</ul>
40+
</div>
41+
<div id="new_button" class="btn-group">
42+
<?php echo anchor("$controller_name/view/-1", $this->lang->line($controller_name.'_new'), array('class'=>'btn btn-success','title'=>$this->lang->line($controller_name.'_new')));?>
43+
<?php if ($controller_name =='customers') {?>
44+
<?php echo anchor("$controller_name/excel_import", "Excel Import", array('class'=>'btn btn-default','title'=>'Import Items from Excel'));?>
45+
<?php } ?>
46+
<?php echo anchor("$controller_name/delete",$this->lang->line("common_delete"),array('class'=>'btn btn-danger','id'=>'delete')); ?>
47+
</div>
48+
<br style="clear:both" />
8049
</div>
8150

8251
<div id="table_holder">
83-
<?php echo $manage_table; ?>
52+
<?php echo $manage_table; ?>
8453
</div>
54+
<?php echo $this->pagination->create_links();?>
8555
<div id="feedback_bar"></div>
8656
<?php $this->load->view("partial/footer"); ?>

application/views/partial/header.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<head>
55
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
66
<base href="<?php echo base_url();?>" />
7-
<title><?php echo $this->config->item('company').' -- '.$this->lang->line('common_powered_by').' PHP Point Of Sale' ?></title>
7+
<title><?php echo $this->config->item('company') ?></title>
8+
<link rel="stylesheet" rev="stylesheet" href="<?php echo base_url();?>css/phppos.css" />
89
<link rel="stylesheet" rev="stylesheet" href="<?php echo base_url();?>css/bootstrap.css" />
910
<link rel="stylesheet" rev="stylesheet" href="<?php echo base_url();?>css/bootstrap-select.css" />
1011
<link rel="stylesheet" rev="stylesheet" href="<?php echo base_url();?>css/bootstrap-theme.css" />
11-
<link rel="stylesheet" rev="stylesheet" href="<?php echo base_url();?>css/phppos.css" />
1212
<link rel="stylesheet" rev="stylesheet" href="<?php echo base_url();?>css/css3buttons.css" />
1313
<link rel="stylesheet" rev="stylesheet" href="<?php echo base_url();?>css/phppos_print.css" media="print"/>
1414
<link rel="stylesheet" rev="stylesheet" href="<?php echo base_url();?>css/toastr.css" />

application/views/people/manage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ function init_table_sorting()
3838
</form>
3939
</div>
4040
<div id="new_button" class="btn-group">
41-
<?php echo anchor("$controller_name/view/-1", $this->lang->line($controller_name.'_new'), array('class'=>'btn btn-default','title'=>$this->lang->line($controller_name.'_new')));?>
41+
<?php echo anchor("$controller_name/view/-1", $this->lang->line($controller_name.'_new'), array('class'=>'btn btn-success','title'=>$this->lang->line($controller_name.'_new')));?>
4242
<?php if ($controller_name =='customers') {?>
4343
<?php echo anchor("$controller_name/excel_import", "Excel Import", array('class'=>'btn btn-default','title'=>'Import Items from Excel'));?>
4444
<?php } ?>
45-
<?php echo anchor("$controller_name/delete",$this->lang->line("common_delete"),array('class'=>'btn btn-default','id'=>'delete')); ?>
45+
<?php echo anchor("$controller_name/delete",$this->lang->line("common_delete"),array('class'=>'btn btn-danger','id'=>'delete')); ?>
4646
</div>
4747
<br style="clear:both" />
4848
</div>

0 commit comments

Comments
 (0)