1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace WC_POS\Admin;
13
14 use WC_POS\Template;
15
16 class Status extends Page {
17
18
19 public $wc_pos_adminpage = 'admin_system_status';
20
21 22 23
24 static public $handlers = array(
25 'tools' => '\WC_POS\Admin\Settings\Tools',
26 'status' => '\WC_POS\Admin\Settings\Status'
27 );
28
29 30 31
32 public function admin_menu() {
33 $this->screen_id = add_submenu_page(
34 \WC_POS\PLUGIN_NAME,
35
36 __( 'System Status', 'woocommerce' ),
37
38 __( 'System Status', 'woocommerce' ),
39 'manage_woocommerce_pos',
40 'wc_pos_system_status',
41 array( $this, 'display_system_status_page' )
42 );
43
44 parent::admin_menu();
45 }
46
47 48 49
50 public function display_system_status_page() {
51 include 'views/settings.php';
52 }
53
54 55 56 57
58 static public function handlers(){
59 return apply_filters( 'woocommerce_pos_admin_system_status_handlers', self::$handlers);
60 }
61
62 63 64
65 public function enqueue_admin_scripts() {
66 global $wp_scripts;
67 $wp_scripts->queue = array();
68
69
70 wp_deregister_script( 'jquery' );
71 wp_deregister_script( 'underscore' );
72 wp_deregister_script( 'select2' );
73 wp_deregister_script( 'backbone' );
74
75
76 $external_libs = Template::get_external_js_libraries();
77 wp_register_script( 'jquery', $external_libs[ 'jquery' ], false, null, true );
78 wp_register_script( 'lodash', $external_libs[ 'lodash' ], array( 'jquery' ), null, true );
79 wp_register_script( 'backbone', $external_libs[ 'backbone' ], array( 'jquery', 'lodash' ), null, true );
80 wp_register_script( 'backbone.radio', $external_libs[ 'radio' ], array( 'jquery', 'backbone', 'lodash' ), null, true );
81 wp_register_script( 'marionette', $external_libs[ 'marionette' ], array( 'jquery', 'backbone', 'lodash' ), null, true );
82 wp_register_script( 'handlebars', $external_libs[ 'handlebars' ], false, null, true );
83 wp_register_script( 'moment', $external_libs[ 'moment' ], false, null, true );
84 wp_register_script( 'accounting', $external_libs[ 'accounting' ], false, null, true );
85
86
87 $build = defined( '\SCRIPT_DEBUG' ) && \SCRIPT_DEBUG ? 'build' : 'min';
88
89 wp_enqueue_script(
90 'eventsource-polyfill',
91 \WC_POS\PLUGIN_URL . 'assets/js/vendor/eventsource.min.js',
92 array(),
93 null,
94 true
95 );
96
97 wp_enqueue_script(
98 \WC_POS\PLUGIN_NAME . '-admin-system-status-app',
99 \WC_POS\PLUGIN_URL . 'assets/js/admin-system-status.' . $build . '.js',
100 array( 'backbone', 'backbone.radio', 'marionette', 'handlebars', 'accounting', 'moment' ),
101 \WC_POS\VERSION,
102 true
103 );
104
105 $scripts = apply_filters( 'woocommerce_pos_admin_enqueue_scripts', array() );
106 if ( isset( $scripts[ 'locale' ] ) ) {
107 wp_enqueue_script(
108 \WC_POS\PLUGIN_NAME . '-js-locale',
109 $scripts[ 'locale' ],
110 array( \WC_POS\PLUGIN_NAME . '-admin-system-status-app' ),
111 \WC_POS\VERSION,
112 true
113 );
114 }
115 }
116
117 }