Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
New: option to automatically print receipt after checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
kilbot committed Jul 29, 2015
1 parent 83351bc commit 16fba05
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 9 deletions.
4 changes: 4 additions & 0 deletions assets/js/src/apps/pos/receipt/route.js
Expand Up @@ -17,6 +17,7 @@ var ReceiptRoute = Route.extend({
options = options || {};
this.container = options.container;
this.collection = options.collection;
this.autoPrint = options.autoPrint;
this.setTabLabel({
tab : 'right',
label : polyglot.t('titles.receipt')
Expand Down Expand Up @@ -61,6 +62,9 @@ var ReceiptRoute = Route.extend({
this.showItems();
this.showTotals();
this.showActions();
if(this.autoPrint){
this.print();
}
});

this.container.show( this.layout );
Expand Down
8 changes: 7 additions & 1 deletion assets/js/src/apps/pos/router.js
Expand Up @@ -83,9 +83,15 @@ var POSRouter = Router.extend({
},

showReceipt: function() {
var autoPrint = Radio.request('entities', 'get', {
type: 'option',
name: 'auto_print'
});

return new ReceiptRoute({
container : this.layout.getRegion('right'),
collection: this.orders
collection: this.orders,
autoPrint : autoPrint
});
},

Expand Down
14 changes: 12 additions & 2 deletions includes/admin/settings/views/checkout.php
Expand Up @@ -29,10 +29,20 @@
</th>
<td>
<input type="checkbox" name="admin_emails" id="admin_emails" />
<label for="order_emails">Enable admin emails</label>
<label for="order_emails"><?php _e( 'Enable admin emails', 'woocommerce-pos' ); ?></label>
<br>
<input type="checkbox" name="customer_emails" id="customer_emails" />
<label for="order_emails">Enable customer emails</label>
<label for="order_emails"><?php _e( 'Enable customer emails', 'woocommerce-pos' ); ?></label>
</td>
</tr>

<tr class="receipt_printing">
<th scope="row">
<?php _e( 'Receipt Printing', 'woocommerce-pos' ); ?>
</th>
<td>
<input type="checkbox" name="auto_print_receipt" id="auto_print_receipt" />
<label for="auto_print_receipt"><?php _e( 'Automatically print receipt after checkout', 'woocommerce-pos' ); ?></label>
</td>
</tr>

Expand Down
7 changes: 6 additions & 1 deletion includes/class-wc-pos-params.php
Expand Up @@ -26,6 +26,7 @@ public function __construct() {
public function frontend_params( array $params ) {
$params['accounting'] = $this->accounting();
$params['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
$params['auto_print'] = $this->auto_print();
$params['customers'] = $this->customers();
$params['discount_keys'] = $this->discount_keys();
$params['hotkeys'] = $this->hotkeys();
Expand All @@ -36,7 +37,6 @@ public function frontend_params( array $params ) {
$params['tax_labels'] = $this->tax_labels();
$params['tax_rates'] = $this->tax_rates();
$params['user'] = $this->user();
$params['version'] = WC_POS_VERSION;
$params['wc_api'] = get_woocommerce_api_url( '' );
$params['emulateHTTP'] = get_option( 'woocommerce_pos_emulateHTTP' ) === '1';
return $params;
Expand Down Expand Up @@ -270,4 +270,9 @@ private function discount_keys(){
return $settings->get_data('discount_quick_keys');
}

private function auto_print(){
$settings = new WC_POS_Admin_Settings_Checkout();
return $settings->get_data('auto_print_receipt');
}

}
2 changes: 1 addition & 1 deletion includes/class-wc-pos-template.php
Expand Up @@ -97,7 +97,7 @@ protected function footer() {
// now using customised idb-wrapper
// 'idb-wrapper' => 'https://cdnjs.cloudflare.com/ajax/libs/idbwrapper/1.5.0/idbstore.min.js',
'select2' => 'https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js',
'moment' => 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js',
'moment' => 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js',
'accounting' => 'https://cdnjs.cloudflare.com/ajax/libs/accounting.js/0.4.1/accounting.min.js',
'jquery.color' => 'https://cdnjs.cloudflare.com/ajax/libs/jquery-color/2.1.2/jquery.color.min.js',
'app' => WC_POS_PLUGIN_URL .'assets/js/app.'. $build .'.js?ver='. WC_POS_VERSION
Expand Down
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -41,12 +41,12 @@
"jquery": "^2.1.4",
"jquery-color": "^1.0.0",
"lodash": "^3.10.0",
"moment": "^2.10.3",
"moment": "^2.10.6",
"node-polyglot": "^0.4.3",
"select2": "^3.5.2-browserify"
},
"devDependencies": {
"chai": "^3.1.0",
"chai": "^3.2.0",
"chai-as-promised": "^5.1.0",
"chai-backbone": "^0.9.2",
"chai-jquery": "^2.0.0",
Expand All @@ -57,7 +57,7 @@
"grunt-contrib-compass": "^1.0.3",
"grunt-contrib-compress": "^0.13.0",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-cssmin": "^0.12.2",
"grunt-contrib-cssmin": "^0.13.0",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-symlink": "^0.3.0",
"grunt-contrib-uglify": "^0.9.1",
Expand All @@ -81,7 +81,7 @@
"sinon": "^1.15.4",
"sinon-as-promised": "^4.0.0",
"sinon-chai": "^2.8.0",
"webpack": "^1.10.1",
"webpack": "^1.10.5",
"webpack-dev-server": "^1.10.1"
}
}
2 changes: 2 additions & 0 deletions readme.txt
Expand Up @@ -79,8 +79,10 @@ Bugs can be reported on the [WooCommerce POS GitHub repository](https://github.c

= 0.4.2 =
* New: local storage will now clear on version change - commit [85ec411](https://github.com/kilbot/WooCommerce-POS/commit/85ec411a58600988b811272be6d151cb11161f4f)
* New: option to automatically print receipt after checkout - commit
* Fix: variation display and select issues - commit [91c7ec1](https://github.com/kilbot/WooCommerce-POS/commit/91c7ec13e737f820d84feb7890d7b6d027a79792)
* Fix: variation barcode search for products in queue - commit [3fda531](https://github.com/kilbot/WooCommerce-POS/commit/3fda5317ef580f6b6d70e24ba235d2b7e69c5ee4)
* Fix: populate order addresses from customer id - commit [b86bc56](https://github.com/kilbot/WooCommerce-POS/commit/b86bc5650a2bf41d7744bf07cda34407e8fa3dd5)
* Tweak: WP Admin CSS - commit [c5a38c7](https://github.com/kilbot/WooCommerce-POS/commit/c5a38c7f889a7788e3eaa633c28620d2e80ac2ee)

= 0.4.1 =
Expand Down

0 comments on commit 16fba05

Please sign in to comment.